2

我一直在寻找一个模块,如果库存水平为 0,客户仍然可以购买商品。OpenCart 1.5.x 中是否提供此功能?

我已将产品设置为 2-3 天,但是在网站前端它仍然显示产品缺货。是否可以提醒客户延迟 2-3 天,并且仍然允许客户购买?

4

3 回答 3

2

首先,您需要更改防止缺货商品结账的功能。转到 catalog/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'));
}

我不记得它是否首先阻止您将其添加到购物车中,所以请告诉我。祝大卫好运!

更新

要更改产品页面上的“缺货”,我自己使用商店中的设置进行了更改,所以如果这对您不起作用,那么您可以进入 catalog/controller/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');
        }

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

于 2012-07-13T15:35:25.473 回答
0

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

于 2012-07-10T11:50:47.913 回答
-1

首先找到

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

并替换为

if (1==1 || !$option_value['subtract'] || ($option_value['quantity'] > 0)) {
于 2012-10-05T10:58:06.473 回答