as the structure of x-cart, orderid is created on the base of providers. there are 3 scenarios.:
I stuck on the 3rd scenario. there are 2 scopes of discount coupons, either you can give it as percentage
or as flat discount
.
Now the issue is there is a loop which is counting discount on products. so when there will be 2 providers discount will be counted on both products because there will be 2 orderids.
when I am trying to break a loop when there is a discount. the site is crashing. there is no way to stop the loop. because if we are stopping a loop, so the data which is needed to order array will be not there and the script will be crash. did anyone face same issue? or do anyone have any solution regarding this?
what I need is discount should be counted on cart subtotal, not on products. have tried too many things but haven't found any solution yet. if you guys have any idea about it, please tell me.
thank you.
One custom solution for the problem "what I need is discount should be counted on cart subtotal, not on products." may be auxiliary hidden coupons.
This is a piece of example code for func_calculate_discounts function
//$discount_coupon_data = func_query_first("SELECT * FROM $sql_tbl[discount_coupons] WHERE coupon='" . addslashes($discount_coupon) . "' $provider_condition");
//find related child coupons instead of main coupon
$discount_coupon_data = MultiCoupon::getChildCouponByMainCouponCode($discount_coupon, $provider_condition);
where MultiCoupon::getChildCouponByMainCouponCode is something like
class MultiCoupon {
public static function getChildCouponByMainCouponCode($main_coupon_code, $provider_condition) {
global $sql_tbl;
$child_discount_coupon_data = func_query_first("SELECT child_coupons.* FROM $sql_tbl[discount_coupons] as child_coupons INNER JOIN $sql_tbl[discount_coupons_links] as main_coupons ON child_coupons.main_code = main_coupons.code AND main_coupons.code='" . addslashes($main_coupon_code) . "' $provider_condition");
return $child_discount_coupon_data;
}
}
I.E. you should substitute coupon data based on one coupon code to multiple coupons based on providers.