Created
December 11, 2023 22:48
-
-
Save drbyte/d503661e2b91353e82f8790a2e982cfb to your computer and use it in GitHub Desktop.
Coupon/ReferralCode Tracking / auto-apply in Zen Cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$autoLoadConfig[100][] = array('autoType'=>'init_script', | |
'loadFile'=> 'init_referral_tracking.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* initialize referral-tracking-system variables | |
* | |
* Determines which referral code the customer came in on | |
* | |
*/ | |
if (!defined('IS_ADMIN_FLAG')) { | |
die('Illegal Access'); | |
} | |
// REFERRALS SYSTEM (c/f modules/checkout_process.php and tpl_checkout_success_default.php) | |
if (isset($_GET['ref']) && $_GET['ref'] != '') { | |
$_SESSION['referral_code'] = $_GET['ref']; | |
if ($_GET['ref'] == 'vt') { | |
$_SESSION['referral_code'] = 'vtarget'; | |
$_SESSION['cc_id']='vtarget'; | |
} | |
} | |
// TESTING - the following dumps the referral-code for this session into the page-headers as a comment, which is invisible to customers. It only shows up for administrators' PC's whose IP address is in the down-for-maint list. | |
if (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) { | |
if (isset($_SESSION['referral_code'])) $debug_message .= '<!-- ref=' . $_SESSION['referral_code'] . ' -->'; | |
// print_r($_COOKIE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment