Loving the update Lat9 :hug:
Printable View
Loving the update Lat9 :hug:
Just a thought to add to the 'wish'/update list;
Admin tracking of the banner images that are selected by affiliates, which banner is more popular/best return of sales.
Thanks :hug:
Having an issue with secure site and images. For some reason the tools page with banners on it is throwing up an non-secure warning. I couldnt find where to change it in the files, but shouldnt it be setup with a relative link so it automatically changes to secure when pple login.
Right now its throwing people the warning message that there are non-secure items on the page.(from the banners)
Any work around for this?
Latest version downloaded yesterday, also running ultimate seo. Tried it with seo on and off, same result.
Everything else works great. Pretty easy to install also, once you get past all the edits for a shop with lots of customized files.
Thanks in advance
Bill H.
www.bug-water.com
@BugWater, I believe that this will fix the issue (I don't currently have an HTTPS test site with the plugin installed). Make the following modifications to the get_referrer_image function in /includes/templates/YOUR_TEMPLATE/tpl_referrer_tools_default.php (starts on line 23):
Please let me know if this corrects the issue; I've got another correction in the queue ...Code:function get_referrer_image($width, $height, $filename) {
global $request_type; /*v2.5.1a*/
$image_html = '';
$alt = TEXT_IMAGE_ALT_TEXT;
$filename = (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . $filename; /*v2.3.0a,v2.5.1c*/
$image_html .= '<div class="imagewrap">';
$image_html .= '<div class="imagetitle">' . sprintf(TEXT_X_BY_Y_PIXELS, $width, $height) . '</div>';
$image_html .= "<img class=\"referrer_image\" src=\"$filename\" width=\"$width\" height=\"$height\" alt=\"$alt\" /><br />";
$image_html .= '<textarea rows="3" cols="1"><a href="' . get_referrer_link(FILENAME_DEFAULT) . "\"><img src=\"$filename\" width=\"$width\" height=\"$height\" alt=\"$alt\" /></a></textarea><br />";
$image_html .= '</div>';
return $image_html;
}
It most certainly did, that was awesomely fast support.
Thanks
Sweet, im off to email my freak out pple that sweat the little things in life.
(fricken browser popups created for those that dont know better create more work then they are worth)
No problem; thanks for the bug report (and letting me know that the fix worked)!
Now thats its all working smooth I got a few sites to add it too. So im just going to make both variations in the file and just comment out the one not needed.
Maybe i can just put it in an includes file, and add it into the folder structure. Then I can change it anytime needed. Hmmm.
Thanks Again
Here's the update I was alluding to for /includes/modules/pages/referrer_main/header_php.php. The issue was that if you have no orders-status exclusions that the referrers' activity details won't display:
Code:<?php
// +----------------------------------------------------------------------+
// |Snap Affiliates for Zen Cart |
// +----------------------------------------------------------------------+
// | Copyright (c) 2013, 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'));
$breadcrumb->add(NAVBAR_TITLE);
$today = getdate();
$referrer = null;
$submitted = false;
$approved = false;
$banned = false;
$is_referrer = false;
$is_logged_in = isset ($_SESSION['customer_id']);
$total_total = 0;
$total_commission = 0;
$unpaid_total = 0;
$unpaid_commission = 0;
$yearly_total = 0;
$yearly_commission = 0;
$last_payout = 0;
$next_payout = 0;
$activity_begin = mktime(0, 0, 0, $today['mon'], 1, $today['year']);
$activity_end = mktime(23, 59, 59, $activity_begin['mon'] + 1, 0, $today['year']);
$activity_total = 0;
$activity_commission = 0;
$activity = array();
if (isset($_GET['start'])) {
$activity_begin = intval ($_GET['start']);
}
if( $activity_begin > time() ) {
$activity_begin = time();
}
if (isset ($_GET['end'])) {
$activity_end = intval( $_GET['end'] );
}
if ($activity_begin > $activity_end) {
$tempDate = getdate ($activity_begin);
$activity_end = mktime (23, 59, 59, $tempDate['mon']+1, 0, $tempDate['year']);
}
if (!$is_logged_in) {
zen_redirect(zen_href_link(FILENAME_REFERRER_SIGNUP, '', "SSL"));
} else {
$query = "SELECT * FROM ". TABLE_REFERRERS ." WHERE referrer_customers_id = " . (int)$_SESSION['customer_id'];
$referrer = $db->Execute($query);
if (!is_object($referrer) || $referrer->EOF ) {
zen_redirect(zen_href_link(FILENAME_REFERRER_SIGNUP, '', "SSL"));
} else {
$submitted = true;
$approved = (bool)$referrer->fields['referrer_approved'];
$banned = (bool)$referrer->fields['referrer_banned'];
if ($approved) {
if (!defined('SNAP_ORDER_STATUS_EXCLUSIONS')) define('SNAP_ORDER_STATUS_EXCLUSIONS', ''); /*v2.1.0a*/
if (!defined('SNAP_ORDER_TOTALS_EXCLUSIONS')) define('SNAP_ORDER_TOTALS_EXCLUSIONS', 'ot_tax,ot_shipping');
//-bof-v2.1.0c (changed $exclude_array to $totals_exclude_array
$totals_exclude_array = explode(',', SNAP_ORDER_TOTALS_EXCLUSIONS);
for ($i = 0, $totals_exclude_clause = '', $n = count($totals_exclude_array); $i < $n; $i++) {
if ($i != 0) {
$totals_exclude_clause .= ' OR ';
}
$totals_exclude_clause .= ("t.class = '" . $totals_exclude_array[$i] . "'");
}
if ($totals_exclude_clause != '') {
$totals_exclude_clause = " AND ( $totals_exclude_clause ) ";
}
//-eof-v2.1.0c
$year_start = mktime(0,0,0, 1, 1, $today['year']);
//-bof-v2.1.0a: Don't show commission for orders status values in the "exclude list".
$status_exclude_array = explode(',', SNAP_ORDER_STATUS_EXCLUSIONS);
//-eof-v2.1.0a
$no_status_exclusions = (sizeof($status_exclude_array) == 1 && $status_exclude_array[0] == '') ? true : false; /*v2.5.1a*/
$query = "SELECT o.orders_id, o.date_purchased, o.order_total, c.commission_paid, c.commission_rate, o.orders_status
FROM ". TABLE_ORDERS ." o, " . TABLE_COMMISSION . " c
WHERE c.commission_referrer_key = '" . $referrer->fields['referrer_key'] . "'
AND o.orders_id = c.commission_orders_id"; /*v2.1.0c*/
$orders = $db->Execute($query);
while (!$orders->EOF) {
$commission = floatval($orders->fields['commission_rate']);
$purchase_date = strtotime($orders->fields['date_purchased']);
$current_date = $orders->fields['commission_paid'];
$query = "SELECT t.value
FROM " . TABLE_ORDERS ." o, ". TABLE_ORDERS_TOTAL ." t
WHERE o.orders_id = " . $orders->fields['orders_id'] . "
AND o.orders_id = t.orders_id" . $totals_exclude_clause; /*v2.1.0c*/
$totals = $db->Execute($query);
$current_exclusion = 0;
while (!$totals->EOF) {
$current_exclusion += floatval($totals->fields['value']);
$totals->MoveNext();
}
$current_amount = floatval($orders->fields['order_total']) - $current_exclusion;
if ($current_amount < 0) {
$current_amount = 0;
}
if ($current_date != "0000-00-00 00:00:00") {
$current_date = strtotime($current_date);
} else {
$current_date = 0;
}
if ( $no_status_exclusions || !($current_date == 0 && in_array($orders->fields['orders_status'], $status_exclude_array)) ) { /*v2.5.0a,v2.5.1c*/
$total_total += $current_amount;
$total_commission += $commission * $current_amount;
if( $purchase_date > $year_start ) {
$yearly_total += $current_amount;
$yearly_commission += $commission * $current_amount;
}
if ($current_date === 0) {
$unpaid_total += $current_amount;
$unpaid_commission += $commission * $current_amount;
}
if ($current_date > $last_payout) {
$last_payout = $current_date;
}
if ($activity_begin < $current_date && $current_date < $activity_end) { /*v2.5.0c*/
$activity_total += $current_amount;
$activity_commission += $commission * $current_amount;
array_push( $activity, array('amount' => $current_amount, 'date' => $purchase_date, 'paid' => $current_date, 'commission' => $commission) );
}
} /*v2.5.0a*/
$orders->MoveNext();
}
}
}
}
v2.5.1 has been submitted to the Plugins area:
- BUGFIX: Introduced in v2.5.0, no order details were displayed on referrers_main if the configuration contained no orders-status exclusions.
- Updated language file for referrers_main page to make it more obvious that the activity report is based on commission payments.
- BUGFIX: Banner images displayed using HTTP_SERVER on SSL pages, resulting in mixed-content warnings from the browser.
v2.5.1 is now available in the Plugins ...