diff --git a/classes/models/LengowCart.php b/classes/models/LengowCart.php index 6cc21849..0382e74f 100755 --- a/classes/models/LengowCart.php +++ b/classes/models/LengowCart.php @@ -139,7 +139,7 @@ public function updateQty( if (!empty($idProductAttribute)) { $version = defined('_PS_VERSION_') ? _PS_VERSION_ : ''; // for PrestaShop 8.0 and higher - if (version_compare($version, '8.0.0.0', '>=')) { + if (version_compare($version, '8.0.0.0', '>=') && !isset($skipAvailabilityCheckOutOfStock)) { $minimalQuantity = (int) ProductAttribute::getAttributeMinimalQty($idProductAttribute); } else { $minimalQuantity = (int) Attribute::getAttributeMinimalQty($idProductAttribute); @@ -156,9 +156,7 @@ public function updateQty( if (isset(self::$_totalWeight[$this->id])) { unset(self::$_totalWeight[$this->id]); } - if ((!$product->available_for_order && !$this->forceProduct) - || (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')) - ) { + if (!$product->available_for_order && !$this->forceProduct) { return false; } // check if the product is already in the cart @@ -185,7 +183,8 @@ public function updateQty( $qty = '+ ' . (int) $quantity; // force here if ($newQty > $productQty - && !Product::isAvailableWhenOutOfStock(!$this->forceProduct && (int) $result2['out_of_stock']) + && !$this->forceProduct + && !Product::isAvailableWhenOutOfStock((int) $result2['out_of_stock']) ) { return false; } @@ -322,4 +321,4 @@ public function validateFieldLengow($fieldName, $errorType) $this->{$fieldName} = Context::getContext()->language->id; } } -} +}