Jump to content

How to get product combination attribute IDs


Tachanka
 Share

Recommended Posts

Is there a way for me to get every single combination's attribute id from a product?

Say I have a product named MyProduct with an ID = 1, which has 3 attributes A, B, and C, each attribute with 3 options. So there will be around 27 possible combinations, all of them I can see on Catalog > products > MyProduct on the Combinations tab. However, what I cannot see is their respective id_product_attribute.

One way of getting it is adding MyProduct to the cart and hovering my mouse on the delete button, which gives me a link like this:  /cart?delete=1&id_product=1&id_product_attribute=1000 . But alas, I cannot do this for 800+ combinations.

I'm implementing an external product selector which sends the final built productID to prestashop (if that helps). For it to work, I need to get the id_product_attribute, any leads?

Share this post


Link to post
Share on other sites

in .tpl file

 

<script><script>

$(document).ready(function() {    

    $id_product = '{$product.id_product}';    
    $id_product_attribute = '{$product.id_product_attribute}';
    $productoref = '{$product.reference_to_display}';
    $urlok = '{$urlok}';

});
 

</script>

 

Share this post


Link to post
Share on other sites

19 minutes ago, gusman126 said:

in .tpl file

 

<script><script>

$(document).ready(function() {    

    $id_product = '{$product.id_product}';    
    $id_product_attribute = '{$product.id_product_attribute}';
    $productoref = '{$product.reference_to_display}';
    $urlok = '{$urlok}';

});
 

</script>

 

 

This could work. However I am using an external site which is not supporting prestashop. What I just found out though, is that I can get the product IDs and product attribute IDs by doing an SQL query. Now I only need to find out the correct one that includes the combination parameters for it to output said ID. Thanks anyway! :)

  • Confused 1

Share this post


Link to post
Share on other sites

  • 2 years later...

Hello,
I'm bringing this topic up again, because my request is related.

I am looking to change the value of the product_attribute_id so that :
 the value id_product_attribute = id_product- id_attribute


Example:
If my product has as id_product: 250
If the declination in Catalogue > Attributes & characteristics > Size (ID "1") > XL (ID "6") 
I want my product_attribute to be 250-6

Does anyone know how to make this change?

Thanks in advance and have a nice day

Share this post


Link to post
Share on other sites

On 3/18/2021 at 3:55 PM, limitedshop said:

Hello,
I'm bringing this topic up again, because my request is related.

I am looking to change the value of the product_attribute_id so that :
 the value id_product_attribute = id_product- id_attribute


Example:
If my product has as id_product: 250
If the declination in Catalogue > Attributes & characteristics > Size (ID "1") > XL (ID "6") 
I want my product_attribute to be 250-6

Does anyone know how to make this change?

Thanks in advance and have a nice day

Forget it. id_product_attribute is an auto-increase key. You would need to redefine it in all tables in which it is used as there are validation routines that check it being an integer.

Share this post


Link to post
Share on other sites

11 minutes ago, musicmaster said:

Forget it. id_product_attribute is an auto-increase key. You would need to redefine it in all tables in which it is used as there are validation routines that check it being an integer.

Hi,
Thank you for your feedback.
I would like to make this change because I cannot export the variations on my orders.

I have tried through Zapier and Integromat but there is only :
product_name
id_product
id_product_attribute

The id_product is perfectly usable but the product_attribute is unusable as there are 100,000 variations.

In conclusion, it is impossible to get the variations (sizes) on the products ordered by my customers.
My goal is simply to export the orders of my customers and to obtain in one of these columns the declination (size) bought by the customer.

Would you have an alternative solution?

Best regards,

Share this post


Link to post
Share on other sites

It is not hard to make a customized export that exports according to your specification.

On the other hand, when you change the id_product_attribute you make changes in the heart of Prestashop and nobody can foretell what side-effects that will have.

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