我想要的是根據選擇的配置更改庫存狀態。更新opencart上的產品選項庫存
如果產品選項有股票期權與數量0節目「缺貨」或數量是50顯示「可用」,並且當是數量-1節目「預購」
if ($product_option_value['quantity'] <= -1) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = $this->language->get('text_preorder');
if ($product_option_value['quantity'] <= 0) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = $this->language->get('text_outstock');
}
if ($product_option_value['quantity'] => 50) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = $this->language->get('text_instock');
}
那麼需要解決什麼問題? –
它不起作用 – user3063382
它不會作爲'$ this-> data ['stock'] = $ this-> language-> get('text_instock');' - 這段代碼'else'將始終呈現。 –