Jump to content

Product.tpl : Use the quantities by product attribute?


Recommended Posts

Hi, 

 

As part of my studies, i have to make a module on Prestashop 1.5.4 :

-Override Product.tpl (check !)

-Implement a personnal hook (check !)

-Retrieve the quantity of each variations of product (in the demo, it's for example "iPod Nano Green, iPod Nano Pink, etc...) and i don't know how to do that.

 

 

I have identified the display block, it starts at line 351

{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
	<span id="quantityAvailable">{$product->quantity|intval}</span>
	<span {if $product->quantity > 1} style="display: none;"{/if} 
id="quantityAvailableTxt">{l s='Item in stock'}</span>
	<span {if $product->quantity == 1} style="display: none;"{/if} 
id="quantityAvailableTxtMultiple">{l s='Items in stock'}</span>
</p>
{/if}

But when i use the {product->quantity}, it displays the whole quantity of the family product, in my example it'll be "Ipod Nano" despite of the color.

 

How can i retrieve the real quantity for each product?

Thank you in advance (and sorry for my english, i'm not fluent at all :/ )

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...