Jump to content

How to get all id_product_attribute in product.tpl?


santiagonra
 Share

Recommended Posts

Hi! I need to have the id_product_attribute (aka Product Combination ID) for each combination in my Product page. So far I have been able to get the id_product_attribute for the selected current combination. But what I really need is to have all the ids.

 

This is what I have in my product.tpl

            <div id="mobileProductViewer" class="col-md-6">
                <input type="hidden" id="combinationId" value="{$product.id_product_attribute}">
            </div>

 That generates a hidden input with just one combination id. I would need all the ids for the combinations. 

And is it possible to get also what that ID represents? I mean something like this:

167 - Red - XL

 

I hope I coud explain myself.

 

Thanks in advance!!!

prestashopCombinationId.png

Share this post


Link to post
Share on other sites

Why put it in product.tpl?
You would have to add a variable to Product.php.
A better way is to paste the code into product-variants.tpl

obrazek.thumb.png.d02cbe257184cb21ffc8e3c1161b4cbd.png

Share this post


Link to post
Share on other sites

Thanks so much for you answer! I tried your code, it works, but it's not exactly what I need. What I need is each combination number. You can see it on the url on the image that I attached. 

Every combination has this id, for example:

RED-S : 286

RED-M: 134

WHITE-L: 122

 

So what I need is to have all the combinations ids on my product page.

 

 

combination.png

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More