Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Small issue with shopping cart


Recommended Posts

Hi there...


I've just been mucking around with my cart and have noticed a small problem on the shopping cart page. I have the 'add weight to product attributes' contribution installed...


I have a product A that comes in 3 sizes: SMALL, MEDIUM and LARGE. Small weighs 1kg, medium weighs 2kg and large weighs 3kg.


If I add a size small to my cart, weight is shown as 1kg. fine.

If I take that out and instead add a size medium to my cart, weight is shown as 2kg. fine.

Same thing again for size large (3kg).


Now if I mix things in the cart, e.g. 1 x small plus 1 x medium, weight shows as 4kg (which obviously isn't fine!). I've narrowed it down to the small size being the problem, and only if other things are in the cart.


In my product info area, I have defined the weight as 2kg, in the attributes area I have split it up into small (1kg), medium (2kg) and large (3kg). I think the 'default' weight is over-riding the attribute weight ONLY when there is a mix of different weights in the cart.


Has anyone encountered this? I hope I've explained it well enough, kinda hard to put it to paper. If I change the default weight to the lowest possible weight for the product (eg 1kg), it seems to be ok, but I don't particularily want to go and change all the products I've entered (about 300 products would need changing).


So, if anyone has had this happen or has any ideas, I'd love to hear them :)





Edited by bobsi18
Link to comment
Share on other sites

Please help me out here... I'm going round and round in circles... I've narrowed it down to the includes/classes/shopping_cart.php page (i think)...particularily to this bit of code:

if(!empty($attribute_price['options_values_weight'])) {
           	// [email protected]
           	// add-weight-to-product-attributes mod:
           	if ($attribute_price['options_values_weight'] > '0') {
           	$this->weight += (($qty * $attribute_price['options_values_weight'])-($qty * $products_weight));
           	} else {
           	$this->weight += ($qty * $products_weight);
           } // END if(!empty($attribute_price['options_values_weight


Basically, the weight if it's only one of a product in the cart, it's fine. It's when I add two different sizes of the same product that the problem occurs - the weight defaults back to 'default' weight, not the one I set for the attributes.


Has anyone heard of this happening?




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...