Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Show Quantity For Particular Products Or Categories Only Rate Topic   - - - - -

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 19 October 2017 - 03:08 PM #21

Hi, 

 

Thanks for your reply. 

 

I do not fully understand what I need to do. Please can you clarify which files I need to edit and what I need to do in each file?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 20 October 2017 - 06:40 AM #22

Hi, 

 

Thanks for your reply. 

 

I do not fully understand what I need to do. Please can you clarify which files I need to edit and what I need to do in each file?

 

Product information for each product is displayed through the design/themes/THEME/templates/common/product_data.tpl template. When it is called, you can specify different parameters, like show_product_amount, show_price etc.

 

In your case the system checks show_product_amount parameter and value of the Settings -> Appearance -> Show number of available products setting. So you should change setting value before calling this template


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 20 October 2017 - 10:38 AM #23

Thanks! I've got it working:

 

I created a new

design/themes/THEME/templates/common/product_data.tpl ( called product_data_show_quantity.tpl )

which I then called from 

design/themes/THEME/templates/blocks/product_template.tpl ( I actually duplicated this one and named product_template_show_quantity.tpl )

And set this template in category settings.

 

 

In the new product_data_show_quantity.tpl I added {$product_amount} to show the remaining product quantity. 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 20 October 2017 - 01:23 PM #24

There is no need to create copy of product_data.tpl file. In the product_template_show_quantity.tpl (as far as I understand it is a copy fo the default_template.tpl file )one you can replace

{include file="common/product_data.tpl" product=$product but_role="big" but_text=__("add_to_cart")}

with

{$settings.Appearance.in_stock_field = 'Y'}
{include file="common/product_data.tpl" product=$product but_role="big" but_text=__("add_to_cart") show_product_amount=true}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 20 October 2017 - 02:34 PM #25

Ok, I will give that a go thanks. 

 

 

I am trying to add the product quantity on the category page now.

 

I've set show_product_amount=true

 

Then in the list_templates I've tried the below, but none seem to work

 

{$product_amount}

 

{assign var="product_amount" value="product_amount_`$obj_id`"}
                            {$smarty.capture.$product_amount nofilter}
 
{assign var="qty" value="qty_`$obj_id`"}
                                {$smarty.capture.$qty nofilter}

 

{hook name="products:product_amount"}



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 23 October 2017 - 06:17 AM #26

Ok, I will give that a go thanks. 

 

 

I am trying to add the product quantity on the category page now.

 

I've set show_product_amount=true

 

Then in the list_templates I've tried the below, but none seem to work

 

 

I am afraid, it is required to examine the code you use.


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 23 October 2017 - 08:24 AM #27

Hi, 

 

Thanks for your reply. Please find attached the files I'm using.

Attached Files



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 23 October 2017 - 01:53 PM #28

As far as I can see, you did not add the following line of code

{$settings.Appearance.in_stock_field = 'Y'}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 24 October 2017 - 07:46 AM #29

Hi, 

 

Please see attached amended file. 

 

What do I add to display the product remaining quantity?

Attached Files



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 24 October 2017 - 01:31 PM #30

Hi, 

 

Please see attached amended file. 

 

What do I add to display the product remaining quantity?

 

Did you see my previous post?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 24 October 2017 - 02:46 PM #31

Yes, I have put that in. Its on line 75



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 16,441 posts

Posted 25 October 2017 - 06:32 AM #32

Yes, I have put that in. Its on line 75

 

PM me temporary FTP access, we will check


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration

Certified CS-Cart RU Developer | Сертифицированный разработчик на CS-Cart Русская Версия

 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 25 October 2017 - 08:36 AM #33

PM sent.

 

Thanks



 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 26 October 2017 - 09:00 AM #34

Hi, 

 

So I've added this to the blocks/products_list_templates/template_name.tpl

show_product_amount=true

 

then added this to the blocks/list_templates/template_name.tpl

{$settings.Appearance.in_stock_field = 'Y'}
{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}
 
 
and that has displayed the remaining quantity for each product on the category page :)
However, for products which are out of stock, 'out of stock' does not display. There is just an empty space. Any ideas?

Attached Files



 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 26 October 2017 - 09:49 AM #35

This is what I have on the product page, and that shows 'out of stock' or the quantity number if in stock. But this does not work on the category page ( blocks/list_templates/template_name.tpl ) 

 

{$settings.Appearance.in_stock_field = 'Y'}
{hook name="products:product_amount"}
 
{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}
 
{/hook}


 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 26 October 2017 - 10:08 AM #36

Ignore previous post. That is incorrect. 

 

How do I delete my post??



 
  • charlotted
  • Member
  • Trial users
  • Join Date: 03-Jul 17
  • 38 posts

Posted 26 October 2017 - 11:16 AM #37

Ok, so I've managed to do it!

 

In design/themes/theme_name/templates/blocks/list_templates/template_name.tpl

Below the <div class="ty-grid-list__price ....">

I've added 

{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}
 
then in design/themes/theme_name/templates/common/product_data.tpl (I actually duplicated this and updated the list template to show this new .tpl)
on line 360
I added {*{$product_amount}&nbsp;*}
before the
{__("in_stock")}