Re: Snap Affiliates v2.0 for v1.5.0 and later
Quote:
Originally Posted by
lat9
There's not a method (yet), but what if any file matching the "template" /images/referrers/ref*.120.600.jpg was detected as being a banner image?
I don't have my SNAP test site available, but here's (as yet untested) what I propose using as a replacement for /includes/modules/pages/referrer_tools/header_php.php:
Code:
<?php
// +---------------------------------------------------------------------------+
// |Snap Affiliates for Zen Cart |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2013-2014, Vinos de Frutas Tropicales (lat9) for ZC 1.5.0+ |
// | |
// | Original: Copyright (c) 2009 Michael Burke |
// | http://www.filterswept.com |
// | |
// +---------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license. |
// +---------------------------------------------------------------------------+
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
define('DIR_WS_IMAGES_REFERRERS', DIR_WS_IMAGES . 'referrers/');
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
$messageStack->add_session('login', CAUTION_NEED_LOGIN, 'caution');
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
$is_logged_in = true;
$query = "SELECT * FROM " . TABLE_REFERRERS ." WHERE referrer_customers_id = " . (int)$_SESSION['customer_id'];
$referrer = $db->Execute($query);
if ($referrer->EOF) {
zen_redirect(zen_href_link(FILENAME_REFERRER_SIGNUP, '', 'SSL'));
}
if (((int)$referrer->fields['referrer_approved']) == 0) {
zen_redirect(zen_href_link(FILENAME_REFERRER_MAIN, '', 'SSL'));
}
$snap_banners = array();
if (SNAP_AFFILIATE_IMAGES != '') {
$snap_banner_files = explode('/', SNAP_AFFILIATE_IMAGES);
foreach ($snap_banner_files as $current_file ) {
if (zen_not_null($current_file)) {
$fileinfo = explode(',', $current_file);
$width = $fileinfo[0];
$height = $fileinfo[1];
$extension = $fileinfo[2];
$filenames = glob (DIR_WS_IMAGES_REFERRERS . "ref*.$width.$height.$extension");
if ($filenames !== false {
foreach ($filenames as $filename) {
$snap_banners[] = array ( 'name' => $filename, 'width' => $width, 'height' => $height );
}
}
}
}
}
// include template specific file name defines
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_REFERRAL_TOOLS, 'false');
$breadcrumb->add(NAVBAR_TITLE);
Re: Snap Affiliates v2.0 for v1.5.0 and later
This isn't a dynamic method but for now it's going to have to work for me, since I need to get my store up and this is the only thing hold me back, since i've got a ton affiliates already from using older version of zen cart..
I just wanted to pass this along if someone else needed to add multiple banners of the same size. I updated the tpl_referrer_tools_default.php file. Instead of having the banners generated dynamically, i'm just adding them in manually with the below code repeating and adding in the image page, sizing and banner sizing info.
<div class="imagewrap"><div class="imagetitle">Banner Size Goes Here</div>
<img class="referrer_image" src="banner image path here" width="banner width here" height="banner height here" alt="Your image alt-text here" />
<br />
<textarea rows="3" cols="1"><a href="http://your store url&referrer=<?php echo $referrer->fields['referrer_key']; ?>"><img src="banner image path here" width="banner width here" height="banner height here" alt="Your image alt-text here" /></a>
</textarea>
<br />
</div>
for anyone interested, the above code is replacing
<p><?php echo TEXT_BANNERS; ?></p>
<?php
foreach ($snap_banners as $current_banner) {
echo get_referrer_image($current_banner['width'], $current_banner['height'], $current_banner['name']);
}
}
?>
you also must delete lines 54-56:
<?php
if (is_array($snap_banners) && count($snap_banners) != 0) {
?>
Sorry for the hack up job but, time is important right now. When I have more time, i'm going to look into a dynamic fix if one hasn't been worked out by the time I get around to it :o)
Re: Snap Affiliates v2.0 for v1.5.0 and later
Hi lat9,
What a truly fantastic mod, thank you so much for all your hard work.
I have installed this along with many other modifications including Ty Packager Tracker. With the files you provided for this integration, all seems to be working quite well with one small exception. When adding the tracking number to customer's order the comments generated to include a link to the shippers tracking info gives the following:
Quote:
Your USPS Tracking ID is ***************
https://tools.usps.com/go/TrackConfirmAction!input.action?tLabels=****************>Click here</a> to track your package.
If the above link does not work, copy the following URL address and paste it into your Web browser.
https://tools.usps.com/go/TrackConfi...**************
It may take up to 24 hours for the tracking information to appear on the website.
It seems to me this is generated in admin/includes/classes/observers/class.ty_package_tracker but not being a coder, I have no idea how to correct it. Everything I try 'breaks' the page.
Thanks in advance for your response, and many,many thanks for this great contribution!
Duffy
Re: Snap Affiliates v2.0 for v1.5.0 and later
Duffy, you're correct about which module inserts that tracking information. I'll need to review that integration code-merge to see what's up. Where does that "funky" display show up? On the display? In HTML emails? In text emails?
Re: Snap Affiliates v2.0 for v1.5.0 and later
It shows up in all three plus. On the admin order screen in the comments section, in emails and in the customer's account history when reviewing orders.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Hmm, it looks like your language definition is missing an anchor start. Do lines 32-45 of the identified file look like this?
Code:
case 'ZEN_UPDATE_ORDERS_HISTORY_PRE_EMAIL': {
$track_id = $this->get_track_ids();
if (is_array($track_id)) {
foreach ($track_id as $id => $track) {
if (zen_not_null($track) && constant('CARRIER_STATUS_' . $id) == 'True') {
if (zen_not_null($osh_additional_comments)) {
$osh_additional_comments .= "\n";
}
$osh_additional_comments .= "Your " . constant('CARRIER_NAME_' . $id) . " Tracking ID is " . $track . " \n\t\t<a href=" . constant('CARRIER_LINK_' . $id) . $track . ">Click here</a> to track your package. \n\t\tIf the above link does not work, copy the following URL address and paste it into your Web browser. \n\t\t" . constant('CARRIER_LINK_' . $id) . $track . "\n\nIt may take up to 24 hours for the tracking information to appear on the website.";
}
}
}
break;
}
Re: Snap Affiliates v2.0 for v1.5.0 and later
Yes. It looks exactly like that.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Change that code fragment to
Code:
case 'ZEN_UPDATE_ORDERS_HISTORY_PRE_EMAIL': {
$track_id = $this->get_track_ids();
if (is_array($track_id)) {
foreach ($track_id as $id => $track) {
if (zen_not_null($track) && constant('CARRIER_STATUS_' . $id) == 'True') {
if (zen_not_null($osh_additional_comments)) {
$osh_additional_comments .= "\n";
}
$osh_additional_comments .= "Your " . constant('CARRIER_NAME_' . $id) . " Tracking ID is " . $track . "\n\nIt may take up to 24 hours for the tracking information to appear on the website.\n\n";
}
}
}
break;
}
The additional information is extraneous.
Re: Snap Affiliates v2.0 for v1.5.0 and later
Perfect!! Works great. THANK YOU SO VERY MUCH!!:clap:
Re: Snap Affiliates v2.0 for v1.5.0 and later
You're welcome. I'll include that update as an optional installation element in the next release of the SNAP Affiliates plugin. Thanks for the heads-up that the changes caused "funkiness" in the display