2017-09-26 203 views
0

我目前正在使用xcart 4.7鉑金開發一個電子商務網站。我啓用了優惠券模塊。在當前的實施中,特定優惠券僅適用於單個產品或單個類別及其子類別。如何改變接受像開放式購物車中的多種產品和類別?或者一次在購物車中添加多個優惠券?多個產品的多張優惠券或同一張優惠券

+0

的步驟創建一張表**優惠券**通過它的參考產品 –

回答

0

1)創建像

xcart_discount_coupons_products (
    id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, 
    productid int(11) NOT NULL DEFAULT '0', 
    ... keys 
) 

2的新表)的新字段添加到xcart_discount_coupons表

ALTER TABLE xcart_discount_coupons add pid_link mediumint(8) unsigned NOT NULL DEFAULT 0 COMMENT 'Link to xcart_discount_coupons_products.id'; 
Add a mysql key for xcart_discount_coupons.pid_link if needed 

3)調整func_is_valid_coupon功能
從 模塊/ Discount_Coupons/func.php文件
接受新的多個產品條件。

} elseif ($my_coupon['pid_link'] > 0) { 
...... 
      Your new code will slightly different from the "if ($my_coupon['productid'] > 0)" handler 
...... 

4)調整從
功能func_calculate_discounts包括/ FUNC/func.cart.php
您應該添加一個新的條件爲你的新$ discount_coupon_data [ 'pid_link']字段這裏

  if ($discount_coupon_data['productid'] > 0) { 
...... 
       if ($product['productid'] != $discount_coupon_data['productid']) 
        continue; 

5)改變後端文件接受多個產品
你應該改變 文件 皮膚/ common_files /模塊/ Discount_Coupons/coupons.tpl
提供商/ coupons.php

順便說一句,您可以鍵入以逗號
SKU17482,SKU17511,從X車版本4.7.4
https://www.x-cart.com/blog/4-7-4-released.html#search-faster

你應該分開多個SKU調整這部分代碼以接受多個SKU
provider/coupons.php

$newproduct_ids = !empty($productid_new) ? array(intval($productid_new)) : XCAjaxSearchProducts::extractIdsFromStr($productname); 
$productid_new = $newproduct_ids[0]; 

6)重複類別