Global Coupons for X-Cart Pro - Simple Mod
Frustraded with the lack of support for a global coupon that works with all providers I wrote my own.
My hack requires you create a provider which I called "globalcoupon". You make the coupons using this provider and a user can use it with any providers products. You can rename this account to something else if you like, but be sure to update the code below. I am currently on 3.5.2 - I'm not sure if this will work for the pre 3.5s tho it probably should. ** UPDATED Minor Bug Fix 6/6/04 ** File #1 include/func.php -- Line: 900 Original Code Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon= Replace With: Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon='$discount_coupon' AND ( " . ($single_mode ? "1" : "provider='$provider'") . ($single_mode ? "" : " OR provider='globalcoupon'") .")" ); File #2 modules/Discount_Coupons/discount_coupons.php Line: 52 Original Code Code:
if (!$single_mode) { Replace With: Code:
if (!$single_mode and $my_coupon["provider"] != "globalcoupon" ) { Line: 64 Original Code Code:
if ((!$single_mode) and ($my_coupon["provider"] != $value["provider"])) Replace With: Code:
if ((!$single_mode) and ($my_coupon["provider"] != "globalcoupon") Line: ~87 Original Code Code:
if (!$single_mode and $my_coupon["provider"] != $value["provider"]) Replace With: Code:
if ((!$single_mode) and ($my_coupon["provider"] != "globalcoupon") Line: ~103 Original Code Code:
if (($single_mode) or ((!$single_mode) and ($my_coupon["provider"] == $value["provider"]))) Replace With: Code:
if (($single_mode) or |
Cool... thanks, Krazik! :) I'm going to give this a try in the next day or two.
|
Thank you very much! This should come standard.
|
you're both very welcome.
I assume it works for both of you? It's still working great for me. -Ry |
I actually haven't installed it yet, but will. ;) thanks again.
|
Updated the code above to fix a bug.
** NEW CODE ** File #1 include/func.php -- Line: 900 Original Code Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon= Replace With: Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon='$discount_coupon' AND ( " . ($single_mode ? "1" : "provider='$provider'") . ($single_mode ? "" : " OR provider='globalcoupon'") .")" ); [quote] *** OLD CODE - Don't Use *** File #1 include/func.php -- Line: 900 Original Code Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon= Replace With: Code:
$discount_coupon_data = func_query_first("select * from $sql_tbl[discount_coupons] where coupon='$discount_coupon' $provider_condition" . ($single_mode ? "" : " OR provider='globalcoupon'")); |
Does this act as a gobal discount?
Does this mod create a coupon that acts as a global discount, rather than a coupon? In otherwords, can it create a coupon that can then be applied to any product with the global discounts checked? If so, that is exactly what I am looking for. Please let me know
Thanks!! |
Does this work on Pro 4.0.11? And does the customer have to use a coupon code to get the discount?
Thanks! |
Re: Does this act as a gobal discount?
Quote:
No it doesn't do that, just makes coupons that can be used w/ any provider. |
Quote:
Yes it works on 4.x, we use 4.x now. the line numbers and code is a little different in 4 but pretty much everything else is the same. I didn't bother to document this when I hacked it back into v4. |
All times are GMT -8. The time now is 10:18 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.