Jump to content
koolmind

Products attributes are wrong

Recommended Posts

Good evening,

a client of mine asked me billions of modification on the template (and also on some controllers) and I believe that something has gone wrong now!

 

I have 3 product attributes, Type, Size, Sex, for my product (a t-shirt) but when I save one product into the cart I always get the custom combinations (Type1, Size1, Sex1).

 

I need to know what function and file are responsible of the cart updating operation.

 

I tryed to trace the POST data using Chrome Code Inspector, and the page /cart receive the correct combination of attributes. But somehow, when the product is saved, a default combination is picked up.

Really bad problem!!
HELP

 

Prestashop v1.4.8.2

Share this post


Link to post
Share on other sites

The function that adds/removes a product from a cart would be this one in classes/Cart.php

 

/**
* Update product quantity
*
* @param integer $quantity Quantity to add (or substract)
* @param integer $id_product Product ID
* @param integer $id_product_attribute Attribute ID if needed
* @param string $operator Indicate if quantity must be increased or decreased
*/
public function updateQty($quantity, $id_product, $id_product_attribute = NULL, $id_customization = false, $operator = 'up')
 
 
Maybe you forget to add the id_product_attribute here, so that maybe the default one is chosen?
 
My 2 cents,
pascal

Share this post


Link to post
Share on other sites

Thank you Pascal. I never made modification to that function, so I guess that I have to look for the code that call it and see if the correct parameter is sent.

I cannot understand what happened. I just modified a couple of controllers to include a Gift Message to ship with my object.

Share this post


Link to post
Share on other sites

I just discovered a strange behaviour!

When I click on "Add To Cart" button, Prestashop shows ad url like /order?ipa=<number>

As far as I know, ipa stands for Id Product Attribute and it should represent the attribute conbination I'm trying to by... for example Tshirt, sex Male, Size Large

 

In my case, IPA is equal to the Product ID!! That's the problem! I need to find out where the ipa parameter is wrongly generated before passing it to the update function of my cart.

 

Any hint?

 

Thank you

Share this post


Link to post
Share on other sites

My problem was a silly one...
Due to the modification asked by the client I removed this part of code onchange="findCombination();getProductAttribute();" from my attribute's drop-down input.

 

Now it works

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

×

Important Information

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