Show Quantity For Particular Products Or Categories Only

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?

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

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.

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}

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"}

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.

Hi,

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

products_multicolumns_show_quantity.tpl

grid_list_show_quantity.tpl

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

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

Hi,

Please see attached amended file.

What do I add to display the product remaining quantity?

grid_list_show_quantity.tpl

Hi,

Please see attached amended file.

What do I add to display the product remaining quantity?

Did you see my previous post?

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

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

PM me temporary FTP access, we will check

PM sent.

Thanks

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?

Untitled-2.jpg

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}

Ignore previous post. That is incorrect.

How do I delete my post??

Ok, so I've managed to do it!

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

Below the

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} *}
before the
{__("in_stock")}