Jump to content
thirty bees forum

Recommended Posts

Posted

Hi All

 

My website is giving an error 500, when add to cart on some items.  But the items is in stock.

 

Here is the Debug Report:

What could this be?

102:		if (is_array($cart_products))
103:			foreach ($cart_products as $cart_product)
104:			{
105:				if ((!isset($this->id_product_attribute) || $cart_product['id_product_attribute'] == $this->id_product_attribute) &&
106:					(isset($this->id_product) && $cart_product['id_product'] == $this->id_product))
107:				{
108:					$qty_to_check = $cart_product['cart_quantity'];
109:
110:					if (Tools::getValue('op', 'up') == 'down')
111:						$qty_to_check -= $this->qty;
112:					else
113:						$qty_to_check += $this->qty;
114:
115:					break;
116:				}
117:			}
118:
119:		if ($this->id_product_attribute)
120:		{
121:			if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
122:				$this->errors[] = Tools::displayError('There isn\'t enough product in stock.', !Tools::getValue('ajax'));
123:		}
124:		elseif ($product->hasAttributes())
125:		{
126:			$minimumQuantity = ($product->out_of_stock == 2) ? !Configuration::get('PS_ORDER_OUT_OF_STOCK') : !$product->out_of_stock;
127:			$this->id_product_attribute = Product::getDefaultAttribute($product->id, $minimumQuantity);
128:			if (!$this->id_product_attribute)
129:				Tools::redirectAdmin($this->context->link->getProductLink($product));
130:			elseif (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
131:				$this->errors[] = Tools::displayError('There isn\'t enough product in stock.', !Tools::getValue('ajax'));
Posted
2 minutes ago, the.rampage.rado said:

Did you recently update your TB?

Not too recently, the update module did mention there was some changes that it needs to fix about 2 days ago, which I did.

Posted

Make a DB backup before you apply all of those. Most are non-critical (ignore the red label) but few of them might be part of this rework I mentioned.

Each file update to most recent bleeding edge version should be followed by check and update on any available fixes here because otherwise the shop might end up broken.

Posted
8 minutes ago, the.rampage.rado said:

Make a DB backup before you apply all of those. Most are non-critical (ignore the red label) but few of them might be part of this rework I mentioned.

Thank you, I just applied them all, but it seams like the Error is still there when I add that product.  What I find off is that the older products add to cart 100%, but not this new product.

 

Posted

Its as if it doesnt see the stock,  when I change it to Allow Orders when out of stock, then add to cart is working.  But when I set it to Deny, then it gives the erorr.  And there is stock.. 

Posted (edited)
1 minute ago, the.rampage.rado said:

Open this file:
image.png.897adcffc1233cc9cb43604543d2da58.png

and edit the highlighted 121 line to datakicks version and it will work as it used to before. 😉

Got it, thank you so much.  I changed it and now its adding.  Thank you so much.

Edited by HenriBierman

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...