Product stock status in other location

Hello,

I am trying to modify addon of additional products to show additional product stock status.

In addon tpl file I added fragment like in product:

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

but it shows only main product status on every additional product. I tried edit this code, to replace $obj_id with $_product.product_id, I can get additional product ID, butI can not transfer it to status.

I hope you can help me. Thank you.

When you call the product_data.tpl for the additional product, please make sure that it has the show_product_amount=true flag

Thank you for the answer, but if i did that right, nothing changes.

With this code I get main product ID on all additional products and it shows its status

{include file="common/product_data.tpl" show_product_amount=true}
{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}

With this code I get additional product ID in same format, but it does not show any of status just blank

{include file="common/product_data.tpl" show_product_amount=true}
{assign var="product_amount" value="product_amount_`$_product.product_id`"}
{$smarty.capture.$product_amount nofilter}

Also tried code from internet “{include file=“common/product_data.tpl” product=$product show_product_amount=true}” also not helped

Hello!

Make sure that $obj_id / $_product.product_id is from the proper one product.

So try

{include file="common/product_data.tpl" show_product_amount=true obj_id=$_product.product_id}

It helped but only that now it again shows status of main product again.

No matter if result is product_amount_6501 or orher ID result always as main product ID

{include file="common/product_data.tpl" show_product_amount=true obj_id=$_product.product_id}
{assign var="product_amount" value="product_amount_`$_product.product_id`"}
{$smarty.capture.$product_amount nofilter}
  • Maybe it is because I am making changes in slide_product.tpl file and not in other? But this files is responsive for that place where I want to put that additional product status

To be more clearly I am adding tpl file code where I work - https://pastebin.com/WJNQMPLF

Please try

{include file="common/product_data.tpl" show_product_amount=true obj_id=$_product.product_id product=$_product}
{assign var="product_amount" value="product_amount_`$_product.product_id`"}
{$smarty.capture.$product_amount nofilter}

Same. Status from main product.

Was the cache cleared after last changes?

Yes ofcourse.

Correct products ID, but status from main product