更新opencart上的产品选项库存

时间:2014-01-09 11:18:09

标签: php 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');
        }

1 个答案:

答案 0 :(得分:0)

if ($product_option_value['quantity'] <= 0) {
    $this->data['stock'] = $this->language->get('text_outstock');
} elseif ($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');
}

- 我认为这么多代码已足够,可根据您的要求更改分配给$this->data['stock']的值。