允许客户在OpenCart中购买缺货商品

时间:2012-07-10 08:22:20

标签: php module opencart

我一直在寻找一个模块,允许客户在库存水平为0时仍能购买物品。这个功能在OpenCart 1.5.x中可用吗?

我已将产品设置为2-3天,但在网站前端仍显示产品缺货。有没有提醒客户2-3天的延迟,仍然允许客户购买?

3 个答案:

答案 0 :(得分:2)

首先,您需要更改阻止缺货商品结帐的功能。转到目录/ controller / checkout / checkout.php并更改

public function index() {
    // 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'))) {
        $this->redirect($this->url->link('checkout/cart'));
}

public function index() {
    // Validate cart has products and has stock.
    if (!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) {
        $this->redirect($this->url->link('checkout/cart'));
}

我不记得是否阻止你首先将它添加到购物车中,所以让我知道。祝大卫好运!

更新

要更改产品页面上的“缺货”,我已自行更改了商店中的设置,如果这对您不起作用,那么您可以进入产品目录/控制器/product/product.php和你看到的地方

if ($product_info['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_instock');
        }

更改为:

if ($product_info['quantity'] <= 0) {
            $this->data['stock'] = "2-3 Days";
        } elseif ($this->config->get('config_stock_display')) {
            $this->data['stock'] = $product_info['quantity'];
        } else {
            $this->data['stock'] = $this->language->get('text_instock');
        }

将这些括号中的文字更改为适合您的短语。

答案 1 :(得分:0)

这是OpenCart内置的标准功能。该设置应位于设置页面的“选项”标签中

答案 2 :(得分:-1)

首先找到

if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {

并替换为

if (1==1 || !$option_value['subtract'] || ($option_value['quantity'] > 0)) {
相关问题