в библиотеке cart.php метод getProcucts
if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $cart['quantity'])) {
$stock = false;
}
// ......................
$product_data[] = array(
'cart_id' => $cart['cart_id'],
'product_id' => $product_query->row['product_id'],
'name' => $product_query->row['name'],
'model' => $product_query->row['model'],
'shipping' => $product_query->row['shipping'],
'image' => $product_query->row['image'],
'option' => $option_data,
'download' => $download_data,
'quantity' => $cart['quantity'],
'minimum' => $product_query->row['minimum'],
'subtract' => $product_query->row['subtract'],
'stock' => $stock,// тута наличие
'price' => ($price + $option_price),
'total' => ($price + $option_price) * $cart['quantity'],
'reward' => $reward * $cart['quantity'],
'points' => ($product_query->row['points'] ? ($product_query->row['points'] + $option_points) * $cart['quantity'] : 0),
'tax_class_id' => $product_query->row['tax_class_id'],
'weight' => ($product_query->row['weight'] + $option_weight) * $cart['quantity'],
'weight_class_id' => $product_query->row['weight_class_id'],
'length' => $product_query->row['length'],
'width' => $product_query->row['width'],
'height' => $product_query->row['height'],
'length_class_id' => $product_query->row['length_class_id'],
'recurring' => $recurring
);
метод проверяет есть ли в корзине товары которых нет на складе
public function hasStock() {
foreach ($this->getProducts() as $product) {
if (!$product['stock']) {
return false;
}
}
return true;
}
confirm.php
// Validate cart has products and has stock.
if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
$redirect = $this->url->link('checkout/cart');
}
контроллер корзины cart.php
if (!$this->cart->hasStock() && (!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning'))) {
$data['error_warning'] = $this->language->get('error_stock');
} elseif (isset($this->session->data['error'])) {
$data['error_warning'] = $this->session->data['error'];