多个产品的多张优惠券或同一张优惠券
问题描述:
我目前正在使用xcart 4.7铂金开发一个电子商务网站。我启用了优惠券模块。在当前的实施中,特定优惠券仅适用于单个产品或单个类别及其子类别。如何改变接受像开放式购物车中的多种产品和类别?或者一次在购物车中添加多个优惠券?多个产品的多张优惠券或同一张优惠券
答
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)重复类别
的步骤创建一张表**优惠券**通过它的参考产品 –