Re: Snap Affiliates v2.0 for v1.5.0 and later
Hey lat9, I tried to implement the code change and I'm getting "Parse error: syntax error, unexpected T_STRING in /[site_folders]/public_html/YOUR_admin/invoice.php on line 27" when I try to open the Invoice. This is what I have on line 27: "return ($sa_info->EOF) ? false : $sa_info->fields['referrer_key'];" (minus the quotes of course.) In case it makes a difference, but I don't think it will, I did make a change to the various referrer_ files changing the verbiage of "Website" to "Organization." I did not change the actual code portions that referenced "website", just the HTML verbiage displayed on the page.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Sorry (I should have tested before I posted), try this for the function:
Code:
function get_referrer_key($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key;
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_key'];
}
Re: Snap Affiliates v2.0 for v1.5.0 and later
Quote:
Originally Posted by
lat9
Sorry (I should have tested before I posted), try this for the function:
Code:
function get_referrer_key($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key;
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_key'];
}
That did succeed in moving the error from line 27 to 28!! As for testing your code, that's why you have me since I'm the one requesting custom mods! :)
Re: Snap Affiliates v2.0 for v1.5.0 and later
Thanks for your kind words, try this adding the stupid little quote at the end of the $sa_sql assignment (the global $db missing would have bit you later on!):
Code:
function get_referrer_key($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key';
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_key'];
}
Re: Snap Affiliates v2.0 for v1.5.0 and later
Quote:
Originally Posted by
lat9
Thanks for your kind words, try this adding the stupid little quote at the end of the $sa_sql assignment (the global $db missing would have bit you later on!):
Code:
function get_referrer_key($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key';
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_key'];
}
That did the trick!
Re: Snap Affiliates v2.0 for v1.5.0 and later
For anyone reading this and contemplating something similar I realized that referrer_key listed on the invoice wasn't nearly as useful as referrer_homepage. I modified the function as follows to make that happen:
Code:
function get_referrer_homepage($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key, r.referrer_homepage
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key';
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_homepage'];
Then later on when calling the function:
Code:
<?php
if (get_referrer_homepage($oID) !== false) {
?>
<tr>
<td class="main"><b>Affiliate Key:</b></td>
<td class="main"><?php echo get_referrer_homepage($oID); ?></td>
</tr>
<?php
}
?>
Re: Snap Affiliates v2.0 for v1.5.0 and later
Nice one! Thanks for sharing.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Quote:
Originally Posted by
lat9
Nice one! Thanks for sharing.
After I asked you about adding the key I realized that a string of numbers doesn't easily help me determine which label to put on the bag like homepage would. Especially in my case where I've modified the homepage verbiage to be organization name instead of website. Thank you for all your work on this module. It's giving us exactly what we wanted so the groups we're working with can see the progress of their fundraising efforts throughout the year. Any chance you would like to work on a recurring billing module? I'd happily be your guinea pig for testing it out! That's the last piece we need to make this our ideal site for $$$$$ less than we anticipated.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Quote:
Originally Posted by
jcbazemore
... Any chance you would like to work on a recurring billing module? I'd happily be your guinea pig for testing it out! That's the last piece we need to make this our ideal site for $$$$$ less than we anticipated.
It's on my list of things-to-do, based on a client's previous request.
Re: Snap Affiliates v2.0 for v1.5.0 and later
I have installed Snap Affiliates v 251 to a 1.5.1 Zen Cart. However, the sign up option is not appearing on the create account page. I assume that is where I should see it, based on what I saw in the files uploaded... Did I miss a step in the install process? I uploaded all the files, and I configured things under Configuration > Affiliate Program. I can also see / edit the two new pages in the Define Pages Editor. Help? ~anne