Jump to content

Undefined Index: Weight_Attribute In The Cart.


Recommended Posts

Hello.

I got an error any time I try to add product to cart.

Impossible to add the product to the cart.
textStatus: 'parsererror'
errorThrown: 'SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data'
responseText:

Notice: Undefined index: weight_attribute in /var/www/moja.domena.com/public_html/classes/Carrier.php on line 1389
{"products":[{"id":67,"link":"http:\/\/1cdeli.com.cn\/en\/sausages\/67-bratwurst-coarse-snail-230g-eco-pack-6957490109260.html","quantity":1,"image":"http:\/\/1cdeli.com.cn\/307-home_default\/bratwurst-coarse-snail-230g-eco-pack.jpg","image_cart":"http:\/\/1cdeli.com.cn\/307-cart_default\/bratwurst-coarse-snail-230g-eco-pack.jpg","priceByLine":"\u00a5 12.90","name":"BRATWURST COARSE SNAIL 230G ECO PACK","price":"\u00a5 12.90","price_float":12.9,"idCombination":0,"idAddressDelivery":0,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"\u00a5 0.00","shippingCostFloat":0,"wrappingCost":"\u00a5 0.00","nbTotalProducts":1,"total":"\u00a5 12.90","productTotal":"\u00a5 12.90","freeShipping":"\u00a5 0.00","freeShippingFloat":0,"hasError":false,"crossSelling":false}

Is anybody can help me to fix this issue?

Link to comment
Share on other sites

Hello.

I got an error any time I try to add product to cart.

Impossible to add the product to the cart.
textStatus: 'parsererror'
errorThrown: 'SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data'
responseText:

Notice: Undefined index: weight_attribute in /var/www/moja.domena.com/public_html/classes/Carrier.php on line 1389
{"products":[{"id":67,"link":"http:\/\/1cdeli.com.cn\/en\/sausages\/67-bratwurst-coarse-snail-230g-eco-pack-6957490109260.html","quantity":1,"image":"http:\/\/1cdeli.com.cn\/307-home_default\/bratwurst-coarse-snail-230g-eco-pack.jpg","image_cart":"http:\/\/1cdeli.com.cn\/307-cart_default\/bratwurst-coarse-snail-230g-eco-pack.jpg","priceByLine":"\u00a5 12.90","name":"BRATWURST COARSE SNAIL 230G ECO PACK","price":"\u00a5 12.90","price_float":12.9,"idCombination":0,"idAddressDelivery":0,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"\u00a5 0.00","shippingCostFloat":0,"wrappingCost":"\u00a5 0.00","nbTotalProducts":1,"total":"\u00a5 12.90","productTotal":"\u00a5 12.90","freeShipping":"\u00a5 0.00","freeShippingFloat":0,"hasError":false,"crossSelling":false}

Is anybody can help me to fix this issue?

You must enter in Advanced Parameters -> Performance and on "Combinations" item, check Yes and Save. You will se that now you can add to cart. Similar to this, I have manualy changed the value to "false" on "PS_COMBINATION_FEATURE_ACTIVE", direct from phpMyAdmin in "configuration" table .

Edited by bitwise (see edit history)
  • Like 2
Link to comment
Share on other sites

You must enter in Advanced Parameters -> Performance and on "Combinations" item, check Yes and Save. You will se that now you can add to cart. Similar to this, I have manualy changed the value to "false" on "PS_COMBINATION_FEATURE_ACTIVE", direct from phpMyAdmin in "configuration" table .

 

On my database that parameter was null, I updated it to false and the error report dissapeared. Thanks for the clue.

Link to comment
Share on other sites

  • 5 weeks later...
  • 2 months later...
  • 1 year later...

Hello,

 

better and the CORRECT way is to change the classes/Carrier.php on line 1389

 

from

            if ($cart_product['weight_attribute'] > 0) {
 

to

            if (isset($cart_product['weight_attribute']) && $cart_product['weight_attribute'] > 0) {
 

 

and like this you can disable Combinations for better performances

 

 

regards

  • Like 1
Link to comment
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
×
×
  • Create New...