网站开发 · 2025年4月24日

ecshop团购“库存不足”问题及解决方法

如果ecshop商品库存大于0,但没有设置任何属性,零购正常,团购就会被提示“商品库存不足”。

解决方法(任选一):
1.为团购商品设置任一属性、且为此属性分配好库存。
2.修改group_buy.php.

将以下代码

  1.     empty($product_info) ? $product_info = array(‘product_number’ => 0, ‘product_id’ => 0) : ”;
     
  2. /* 查询:判断指定规格的货品数量是否足够 */
     
  3.     if ($number > $product_info[‘product_number’])
     
  4.     {        show_message($_LANG[‘gb_error_goods_lacking’], ”, ”, ‘error’);
     
  5.     }

复制代码

改为
 

  1. //    empty($product_info) ? $product_info = array(‘product_number’ => 0, ‘product_id’ => 0) : ”;
     
  2. if($product_info){
     
  3.         /* 查询:判断指定规格的货品数量是否足够 */
     
  4.         if ($number > $product_info[‘product_number’])
     
  5.         {
     
  6.             show_message($_LANG[‘gb_error_goods_lacking’], ”, ”, ‘error’);
     
  7.         }
     
  8.     }

复制代码

3.推荐方法

group_buy.php
249行原先的
    if ($number > $product_info[‘product_number’])
修改为
    if ($specs && $number > $product_info[‘product_number’])