[*] BO : #PSFV-94 - added AdminReferrersController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10046 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+1
-1
@@ -87,7 +87,7 @@ if (Tools::isSubmit('ajaxProductManufacturers'))
|
||||
|
||||
if (Tools::isSubmit('ajaxReferrers'))
|
||||
{
|
||||
require('tabs/AdminReferrers.php');
|
||||
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxProductSuppliers'))
|
||||
|
||||
@@ -1,471 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..');
|
||||
|
||||
if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab::getIdFromClassName('AdminReferrers')).(int)(Tools::getValue('id_employee'))))
|
||||
{
|
||||
if (Tools::isSubmit('ajaxProductFilter'))
|
||||
Referrer::getAjaxProduct((int)(Tools::getValue('id_referrer')), (int)(Tools::getValue('id_product')), new Employee((int)(Tools::getValue('id_employee'))));
|
||||
else if (Tools::isSubmit('ajaxFillProducts'))
|
||||
{
|
||||
$jsonArray = array();
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT p.id_product, pl.name
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)(Tools::getValue('id_lang')).')
|
||||
'.(Tools::getValue('filter') != 'undefined' ? 'WHERE name LIKE "%'.pSQL(Tools::getValue('filter')).'%"' : ''));
|
||||
foreach ($result as $row)
|
||||
$jsonArray[] = '{id_product:'.(int)($row['id_product']).',name:\''.addslashes($row['name']).'\'}';
|
||||
die ('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
}
|
||||
|
||||
include_once(dirname(__FILE__).'/AdminStats.php');
|
||||
|
||||
class AdminReferrers extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'referrer';
|
||||
$this->className = 'Referrer';
|
||||
$this->view = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
|
||||
SUM(sa.cache_registrations) AS cache_registrations, SUM(sa.cache_orders) AS cache_orders, SUM(sa.cache_sales) AS cache_sales,
|
||||
IF(sa.cache_orders > 0, ROUND(sa.cache_sales/sa.cache_orders, 2), 0) as cart, (sa.cache_visits*click_fee) as fee0,
|
||||
(sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'referrer_shop` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).'))';
|
||||
$this->_group = 'GROUP BY sa.id_referrer';
|
||||
$this->fieldsDisplay = array(
|
||||
'id_referrer' => array('title' => $this->l('ID'), 'width' => 25, 'align' => 'center'),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 80),
|
||||
'cache_visitors' => array('title' => $this->l('Visitors'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_visits' => array('title' => $this->l('Visits'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_pages' => array('title' => $this->l('Pages'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_registrations' => array('title' => $this->l('Reg.'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_orders' => array('title' => $this->l('Ord.'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_sales' => array('title' => $this->l('Sales'), 'width' => 80, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'price' => true),
|
||||
'cart' => array('title' => $this->l('Avg. cart'), 'width' => 50, 'align' => 'right', 'price' => true),
|
||||
'cache_reg_rate' => array('title' => $this->l('Reg. rate'), 'width' => 30, 'align' => 'center'),
|
||||
'cache_order_rate' => array('title' => $this->l('Order rate'), 'width' => 30, 'align' => 'center'),
|
||||
'fee0' => array('title' => $this->l('Click'), 'width' => 30, 'align' => 'right', 'price' => true),
|
||||
'fee1' => array('title' => $this->l('Base'), 'width' => 30, 'align' => 'right', 'price' => true),
|
||||
'fee2' => array('title' => $this->l('Percent'), 'width' => 30, 'align' => 'right', 'price' => true));
|
||||
}
|
||||
|
||||
private function enableCalendar()
|
||||
{
|
||||
return (!Tools::isSubmit('add'.$this->table) AND !Tools::isSubmit('submitAdd'.$this->table) AND !Tools::isSubmit('update'.$this->table));
|
||||
}
|
||||
|
||||
public function displayJavascript()
|
||||
{
|
||||
$products = Product::getSimpleProducts($this->context->language->id);
|
||||
$productsArray = array();
|
||||
foreach ($products as $product)
|
||||
$productsArray[] = $product['id_product'];
|
||||
|
||||
return '
|
||||
<script type="text/javascript">
|
||||
var productIds = new Array(\''.implode('\',\'', $productsArray).'\');
|
||||
var referrerStatus = new Array();
|
||||
|
||||
function newProductLine(id_referrer, result)
|
||||
{
|
||||
return \'\'+
|
||||
\'<tr id="trprid_\'+id_referrer+\'_\'+result.id_product+\'" style="background-color: rgb(255, 255, 187);">\'+
|
||||
\' <td align="center">--</td>\'+
|
||||
\' <td align="center">\'+result.id_product+\'</td>\'+
|
||||
\' <td>\'+result.product_name+\'</td>\'+
|
||||
\' <td align="center">\'+result.uniqs+\'</td>\'+
|
||||
\' <td align="center">\'+result.visits+\'</td>\'+
|
||||
\' <td align="center">\'+result.pages+\'</td>\'+
|
||||
\' <td align="center">\'+result.registrations+\'</td>\'+
|
||||
\' <td align="center">\'+result.orders+\'</td>\'+
|
||||
\' <td align="right">\'+result.sales+\'</td>\'+
|
||||
\' <td align="right">\'+result.cart+\'</td>\'+
|
||||
\' <td align="center">\'+result.reg_rate+\'</td>\'+
|
||||
\' <td align="center">\'+result.order_rate+\'</td>\'+
|
||||
\' <td align="center">\'+result.click_fee+\'</td>\'+
|
||||
\' <td align="center">\'+result.base_fee+\'</td>\'+
|
||||
\' <td align="center">\'+result.percent_fee+\'</td>\'+
|
||||
\' <td align="center">--</td>\'+
|
||||
\'</tr>\';
|
||||
}
|
||||
|
||||
function showProductLines(id_referrer)
|
||||
{
|
||||
if (!referrerStatus[id_referrer])
|
||||
{
|
||||
referrerStatus[id_referrer] = true;
|
||||
for (var i = 0; i < productIds.length; ++i)
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$this->context->employee->id.',token:"'.Tools::getValue('token').'",id_referrer:id_referrer,id_product:productIds[i]},
|
||||
function(result) {
|
||||
var newLine = newProductLine(id_referrer, result[0]);
|
||||
$(newLine).hide().insertAfter(getE(\'trid_\'+id_referrer)).fadeIn();
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
referrerStatus[id_referrer] = false;
|
||||
for (var i = 0; i < productIds.length; ++i)
|
||||
$("#trprid_"+id_referrer+"_"+productIds[i]).fadeOut("fast", function(){$("#trprid_"+i).remove();});
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
if (!Tools::isSubmit('viewreferrer'))
|
||||
echo $this->displayJavascript();
|
||||
|
||||
if ($this->enableCalendar())
|
||||
{
|
||||
echo '
|
||||
<div style="float:left;margin-right:20px">
|
||||
'.AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Today'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year'))).'
|
||||
</div>';
|
||||
if (!Tools::isSubmit('viewreferrer'))
|
||||
echo '
|
||||
<div style="float: left; margin-right: 20px;">
|
||||
<fieldset style="width:630px"><legend><img src="../img/admin/tab-preferences.gif" /> '.$this->l('Settings').'</legend>
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post">
|
||||
<label>'.$this->l('Save direct traffic').'</label>
|
||||
<div class="float" style="margin-left: 200px;">
|
||||
<label class="t" for="tracking_dt_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="tracking_dt" id="tracking_dt_on" value="1" '.((int)(Tools::getValue('tracking_dt', Configuration::get('TRACKING_DIRECT_TRAFFIC'))) ? 'checked="checked"' : '').' />
|
||||
<label class="t" for="tracking_dt_on"> '.$this->l('Yes').'</label>
|
||||
<label class="t" for="tracking_dt_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" style="margin-left: 10px;" /></label>
|
||||
<input type="radio" name="tracking_dt" id="tracking_dt_off" value="0" '.(!(int)(Tools::getValue('tracking_dt', Configuration::get('TRACKING_DIRECT_TRAFFIC'))) ? 'checked="checked"' : '').'/>
|
||||
<label class="t" for="tracking_dt_off"> '.$this->l('No').'</label>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<p>'.$this->l('Direct traffic can be quite consuming. You should consider enabling it only if you have a strong database server and a strong need for it.').'</p>
|
||||
<input type="submit" class="button" value="'.$this->l(' Save ').'" name="submitSettings" />
|
||||
</form>
|
||||
<hr />
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post">
|
||||
<p class="bold">'.$this->l('Indexation').'</p>
|
||||
<p>'.$this->l('There is a huge quantity of data, so each connection corresponding to a referrer is indexed. You can refresh this index by clicking on the button below. Be aware that it may take a long time and it is only needed if you modified or added a referrer and if you want your changes to be retroactive.').'</p>
|
||||
<input type="submit" class="button" value="'.$this->l('Refresh index').'" name="submitRefreshIndex" />
|
||||
</form>
|
||||
<hr />
|
||||
<form action="'.self::$currentIndex.'&token='.Tools::getValue('token').'" method="post">
|
||||
<p class="bold">'.$this->l('Cache').'</p>
|
||||
<p>'.$this->l('For you to sort and filter your data, it is cached. You can refresh the cache by clicking on the button below.').'</p>
|
||||
<input type="submit" class="button" value="'.$this->l('Refresh cache').'" name="submitRefreshCache" />
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>';
|
||||
}
|
||||
echo '<div class="clear space"> </div>';
|
||||
parent::display();
|
||||
echo '<div class="clear space"> </div>';
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->enableCalendar())
|
||||
{
|
||||
$calendarTab = new AdminStats();
|
||||
$calendarTab->postProcess();
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitSettings'))
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
if (Configuration::updateValue('TRACKING_DIRECT_TRAFFIC', (int)(Tools::getValue('tracking_dt'))))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.Tools::getValue('token'));
|
||||
|
||||
if (ModuleGraph::getDateBetween() != Configuration::get('PS_REFERRERS_CACHE_LIKE') OR Tools::isSubmit('submitRefreshCache'))
|
||||
Referrer::refreshCache();
|
||||
if (Tools::isSubmit('submitRefreshIndex'))
|
||||
Referrer::refreshIndex();
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
foreach (array('http_referer_like', 'http_referer_regexp', 'request_uri_like', 'request_uri_regexp') as $field)
|
||||
$obj->{$field} = str_replace('\\', '\\\\', $obj->{$field});
|
||||
$uri = Tools::getHttpHost(true, true).__PS_BASE_URI__;
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/affiliation.png" /> '.$this->l('Affiliate').'</legend>
|
||||
<label>'.$this->l('Name').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="20" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Password').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="password" name="passwd" value="" />
|
||||
<p>'.$this->l('Leave blank if no change').'</p>
|
||||
</div>
|
||||
<p>
|
||||
'.$this->l('Affiliates can access their own data with this name and password.').'<br />
|
||||
'.$this->l('Front access:').' <a href="'.$uri.'modules/trackingfront/stats.php" style="font-style: italic;">'.$uri.'modules/trackingfront/stats.php</a>
|
||||
</p>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
<fieldset><legend><img src="../img/admin/money.png" /> '.$this->l('Commission plan').'</legend>
|
||||
<label>'.$this->l('Click fee').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="8" name="click_fee" value="'.number_format((float)($this->getFieldValue($obj, 'click_fee')), 2).'" />
|
||||
<p>'.$this->l('Fee given for each visit.').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Base fee').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="8" name="base_fee" value="'.number_format((float)($this->getFieldValue($obj, 'base_fee')), 2).'" />
|
||||
<p>'.$this->l('Fee given for each order placed.').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Percent fee').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="8" name="percent_fee" value="'.number_format((float)($this->getFieldValue($obj, 'percent_fee')), 2).'" />
|
||||
<p>'.$this->l('Percent of the sales.').'</p>
|
||||
</div>';
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</fieldset>
|
||||
<br class="clear" />
|
||||
<fieldset><legend onclick="$(\'#tracking_help\').slideToggle();" style="cursor: pointer;"><img src="../img/admin/help.png" /> '.$this->l('Help').'</legend>
|
||||
<div id="tracking_help" style="display: none;">
|
||||
<p>'.$this->l('Definitions:').'</p>
|
||||
<ul style="list-style: disc; margin-left: 20px;">
|
||||
<li>
|
||||
'.$this->l('The field `http_referer` is the website from which your customers arrive.').'<br />
|
||||
'.$this->l('For example, visitors coming from Google will have a `http_referer` like this one: "http://www.google.com/search?q=prestashop".').'<br />
|
||||
'.$this->l('If the visitor arrives directly (by typing the URL of your shop or by using their bookmarks, for example), `http_referer` will be empty.').'<br />
|
||||
'.$this->l('So if you want all the visitors coming from google, you can type "%google%" in this field, or "%google.fr%" if you want the visitors coming from Google France only.').'<br />
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
'.$this->l('The field `request_uri` is the URL from which the customers come to your website.').'<br />
|
||||
'.$this->l('For example, if the visitor accesses a product page, the URL will be').' "'.$uri.'music-ipods/1-ipod-nano.html".<br />
|
||||
'.$this->l('This is interesting because you can add some tags or tokens in the links pointing to your website. For example, you can post a link').' "'.$uri.'index.php?prestashop" '.$this->l('in the forum and get statistics by entering "%prestashop" in the field `request_uri`. You will get all the visitors coming from the forum.').'
|
||||
'.$this->l('This method is more reliable than the `http_referer` one, but there is a danger: if a search engine read a page with your link, then it will be displayed in its results and you will have not only the forum visitors, but also the ones from the search engine.').'
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
'.$this->l('The fields `include` indicate what has to be included in the URL.').'
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
'.$this->l('The fields `exclude` indicate what has to be excluded from the URL.').'
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
'.$this->l('When using the simple mode, you can use some generic characters which can replace any characters:').'
|
||||
<ul>
|
||||
<li>'.$this->l('"_" will replace one character. If you want to use the real "_", you should type').' "\\\\_".</li>
|
||||
<li>'.$this->l('"%" will replace any number of characters. If you want to use the real "%", you should type').' "\\\\%".</li>
|
||||
</ul>
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
'.$this->l('The simple mode uses the MySQL "LIKE", but for a higher potency you can use MySQL regular expressions.').'
|
||||
<a href="http://dev.mysql.com/doc/refman/5.0/en/regexp.html" target="_blank" style="font-style: italic;">'.$this->l('Take a look at the document for more details...').'</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
<fieldset><legend><img src="../img/admin/affiliation.png" /> '.$this->l('Technical information - Simple mode').'</legend>
|
||||
<a style="cursor: pointer; font-style: italic;" onclick="$(\'#tracking_help\').slideToggle();"><img src="../img/admin/help.png" /> '.$this->l('Get help!').'</a><br />
|
||||
<br class="clear" />
|
||||
<h3>'.$this->l('HTTP referrer').'</h3>
|
||||
<label>'.$this->l('Include').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="http_referer_like">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_like'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<label>'.$this->l('Exclude').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="http_referer_like_not">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_like_not'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<h3>'.$this->l('Request Uri').'</h3>
|
||||
<label>'.$this->l('Include').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="request_uri_like">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_like'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<label>'.$this->l('Exclude').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="request_uri_like_not">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_like_not'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<br class="clear" />
|
||||
'.$this->l('If you know how to use MySQL regular expressions, you can use the').' <a style="cursor: pointer; font-weight: bold;" onclick="$(\'#tracking_expert\').slideToggle();">'.$this->l('expert mode').'.</a>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
<fieldset><legend onclick="$(\'#tracking_expert\').slideToggle();" style="cursor: pointer;"><img src="../img/admin/affiliation.png" /> '.$this->l('Technical information - Expert mode').'</legend>
|
||||
<div id="tracking_expert" style="display: none;">
|
||||
<h3>'.$this->l('HTTP referrer').'</h3>
|
||||
<label>'.$this->l('Include').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="http_referer_regexp">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_regexp'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<label>'.$this->l('Exclude').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="http_referer_regexp_not">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_regexp_not'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<h3>'.$this->l('Request Uri').'</h3>
|
||||
<label>'.$this->l('Include').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="request_uri_regexp">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_regexp'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<label>'.$this->l('Exclude').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea cols="40" rows="1" name="request_uri_regexp_not">'.str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_regexp_not'), ENT_COMPAT, 'UTF-8')).'</textarea>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function viewreferrer()
|
||||
{
|
||||
$referrer = new Referrer((int)(Tools::getValue('id_referrer')));
|
||||
|
||||
$displayTab = array(
|
||||
'uniqs' => $this->l('Unique visitors'),
|
||||
'visitors' => $this->l('Visitors'),
|
||||
'visits' => $this->l('Visits'),
|
||||
'pages' => $this->l('Pages viewed'),
|
||||
'registrations' => $this->l('Registrations'),
|
||||
'orders' => $this->l('Orders'),
|
||||
'sales' => $this->l('Sales'),
|
||||
'reg_rate' => $this->l('Registration rate'),
|
||||
'order_rate' => $this->l('Order rate'),
|
||||
'click_fee' => $this->l('Click fee'),
|
||||
'base_fee' => $this->l('Base fee'),
|
||||
'percent_fee' => $this->l('Percent fee'));
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function updateConversionRate(id_product)
|
||||
{
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$this->context->employee->id.',token:"'.Tools::getValue('token').'",id_referrer:'.$referrer->id.',id_product:id_product},
|
||||
function(j) {';
|
||||
foreach ($displayTab as $key => $value)
|
||||
echo '$("#'.$key.'").html(j[0].'.$key.');';
|
||||
echo ' }
|
||||
)
|
||||
}
|
||||
|
||||
function fillProducts(filter)
|
||||
{
|
||||
var form = document.layers ? document.forms.product : document.product;
|
||||
var filter = form.filterProduct.value;
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",
|
||||
{ajaxReferrers:1,ajaxFillProducts:1,id_employee:'.(int)$this->context->employee->id.',token:"'.Tools::getValue('token').'",id_lang:'.(int)$this->context->language->id.',filter:filter},
|
||||
function(j) {
|
||||
|
||||
form.selectProduct.length = j.length + 1;
|
||||
for (var i = 0; i < j.length; i++)
|
||||
{
|
||||
form.selectProduct.options[i+1].value = j[i].id_product;
|
||||
form.selectProduct.options[i+1].text = j[i].name;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<fieldset style="float:left"><legend><img src="../img/admin/tab-stats.gif" /> Statistics</legend>
|
||||
<h2>'.$referrer->name.'</h2>
|
||||
<table>';
|
||||
foreach ($displayTab as $data => $label)
|
||||
echo '<tr><td>'.$label.'</td><td style="color:green;font-weight:bold;padding-left:20px;" id="'.$data.'"></td></tr>';
|
||||
echo '</table>
|
||||
<br class="clear" />
|
||||
<form id="product" name="product">
|
||||
'.$this->l('Filter by product:').'
|
||||
<select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);">
|
||||
<option value="0" selected="selected">-- '.$this->l('All').' --</option>
|
||||
</select> <input type="text" size="25" id="filterProduct" name="filterProduct" onkeyup="fillProducts();" class="space" />
|
||||
</form>
|
||||
</fieldset>
|
||||
<script type="text/javascript">
|
||||
updateConversionRate(0);
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function displayListContent($token = NULL)
|
||||
{
|
||||
$irow = 0;
|
||||
if ($this->_list)
|
||||
foreach ($this->_list AS $tr)
|
||||
{
|
||||
$id = $tr[$this->identifier];
|
||||
echo '<tr id="trid_'.$id.'"'.($irow++ % 2 ? ' class="alt_row"' : '').'>
|
||||
<td class="center"><input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" /></td>';
|
||||
foreach ($this->fieldsDisplay AS $key => $params)
|
||||
{
|
||||
echo '<td onclick="showProductLines('.$id.');" class="pointer '.(isset($params['align']) ? $params['align'] : '').'">'.(isset($params['prefix']) ? $params['prefix'] : '');
|
||||
if (isset($tr[$key]) AND isset($params['price']))
|
||||
echo Tools::displayPrice($tr[$key], $this->context->currency);
|
||||
elseif (isset($tr[$key]))
|
||||
echo $tr[$key];
|
||||
else
|
||||
echo '--';
|
||||
echo (isset($params['suffix']) ? $params['suffix'] : '').'</td>';
|
||||
}
|
||||
echo '
|
||||
<td class="center" style="width: 60px">
|
||||
<a href="'.self::$currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'">
|
||||
<img src="../img/admin/details.gif" border="0" alt="'.$this->l('View').'" title="'.$this->l('View').'" /></a>
|
||||
<a href="'.self::$currentIndex.'&'.$this->identifier.'='.$id.'&update'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'">
|
||||
<img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.self::$currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'" onclick="return confirm(\''.addslashes($this->l('Delete item ?')).'\');">
|
||||
<img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,258 +90,276 @@
|
||||
{if $form_id}
|
||||
<input type="hidden" name="id_{$table}" id="id_{$table}" value="{$form_id}" />
|
||||
{/if}
|
||||
<fieldset>
|
||||
{foreach $fields as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
<legend>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
|
||||
{$field.title}
|
||||
</legend>
|
||||
{elseif $key == 'input'}
|
||||
{foreach $field as $input}
|
||||
{if $input.name == 'id_state'}
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{foreach $fields as $f => $fieldset}
|
||||
<fieldset id="fieldset_{$f}">
|
||||
{foreach $fieldset.form as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
<legend>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
|
||||
{$field.title}
|
||||
</legend>
|
||||
{elseif $key == 'input'}
|
||||
{foreach $field as $input}
|
||||
{if $input.name == 'id_state'}
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
{/block}
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
|
||||
{else}
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{/block}
|
||||
{if $input.type == 'text'}
|
||||
{if isset($input.lang)}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<input type="text"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
value="{$fields_value[$input.name][$language.id_lang]}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
|
||||
{if isset($input.class)}class="{$input.class}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{$input.name}"
|
||||
value="{$fields_value[$input.name]}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
|
||||
{if isset($input.class)}class="{$input.class}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
{if isset($input.suffix)}{$input.suffix}{/if}
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
{elseif $input.type == 'select'}
|
||||
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
|
||||
{$input.empty_message}
|
||||
{$input.required = false}
|
||||
{$input.p = null}
|
||||
{else}
|
||||
<select name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
{if isset($input.multiple)}multiple="multiple" {/if}
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
||||
{if isset($input.options.default)}
|
||||
<option value="{$input.options.default.value}">{$input.options.default.label}</option>
|
||||
{/if}
|
||||
{if isset($input.options.optiongroup)}
|
||||
{foreach $input.options.optiongroup.query AS $optiongroup}
|
||||
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
|
||||
{foreach $optiongroup[$input.options.options.query] as $option}
|
||||
<option value="{$option[$input.options.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
{/block}
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
|
||||
{else}
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{/block}
|
||||
{if $input.type == 'text'}
|
||||
{if isset($input.lang)}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<input type="text"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
value="{$fields_value[$input.name][$language.id_lang]}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
|
||||
{if isset($input.class)}class="{$input.class}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $input.options.query AS $option}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio"
|
||||
name="{$input.name}"
|
||||
id="{$value.id}"
|
||||
value="{$value.value|escape:'htmlall':'UTF-8'}"
|
||||
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
|
||||
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
|
||||
{if isset($input.is_bool) && $input.is_bool == true}
|
||||
{if $value.value == 1}
|
||||
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{else}
|
||||
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{/if}
|
||||
{else}
|
||||
{$value.label}
|
||||
{/if}
|
||||
</label>
|
||||
{if isset($input.br) && $input.br}<br />{/if}
|
||||
{/foreach}
|
||||
{elseif $input.type == 'textarea'}
|
||||
{if isset($input.lang)}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if $input.autoload_rte}class="autoload_rte"{/if} >{$fields_value[$input.name][$language.id_lang]}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
|
||||
{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{foreach $input.values.query as $value}
|
||||
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
|
||||
<input type="checkbox"
|
||||
name="{$id_checkbox}"
|
||||
id="{$id_checkbox}"
|
||||
{if isset($value.val)}value="{$value.val}"{/if}
|
||||
{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
|
||||
{/foreach}
|
||||
{elseif $input.type == 'file'}
|
||||
{if isset($input.display_image) && $input.display_image}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div id="image">
|
||||
{$fields_value.image}
|
||||
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a href="{$current}&id_category={$form_id}&token={$token}&deleteImage=1">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
|
||||
</a>
|
||||
</div><br />
|
||||
{/if}
|
||||
{/if}
|
||||
<input type="file" name="{$input.name}" />
|
||||
{elseif $input.type == 'password'}
|
||||
<input type="password"
|
||||
name="{$input.name}"
|
||||
size="{$input.size}"
|
||||
value="" />
|
||||
{elseif $input.type == 'birthday'}
|
||||
{foreach $input.options as $key => $select}
|
||||
<select name="{$key}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{foreach $select as $k => $v}
|
||||
<option value="{$k}" {if $k == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $select as $v}
|
||||
<option value="{$v}" {if $v == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/foreach}
|
||||
{elseif $input.type == 'group'}
|
||||
{assign var=groups value=$input.values}
|
||||
{include file='helper/form/form_group.tpl'}
|
||||
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
|
||||
{include file='helper/form/form_shop.tpl'}
|
||||
{elseif $input.type == 'categories'}
|
||||
{include file='helper/form/form_category.tpl' categories=$input.values}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<input type="color"
|
||||
size="{$input.size}"
|
||||
data-hex="true"
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]}" />
|
||||
{elseif $input.type == 'date'}
|
||||
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<input type="text"
|
||||
size="{$input.size}"
|
||||
data-hex="true"
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="datepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]}" />
|
||||
{elseif $input.type == 'free'}
|
||||
{$fields_value[$input.name]}
|
||||
{/if}
|
||||
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
|
||||
{if isset($input.p)}
|
||||
<p class="clear">
|
||||
{if is_array($input.p)}
|
||||
{foreach $input.p as $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}<br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
{$input.p}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{$input.name}"
|
||||
value="{$fields_value[$input.name]}"
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
|
||||
{if isset($input.class)}class="{$input.class}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
|
||||
{if isset($input.suffix)}{$input.suffix}{/if}
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{/if}
|
||||
</p>
|
||||
{elseif $input.type == 'select'}
|
||||
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
|
||||
{$input.empty_message}
|
||||
{$input.required = false}
|
||||
{$input.p = null}
|
||||
{else}
|
||||
<select name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
{if isset($input.multiple)}multiple="multiple" {/if}
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
||||
{if isset($input.options.default)}
|
||||
<option value="{$input.options.default.value}">{$input.options.default.label}</option>
|
||||
{/if}
|
||||
{if isset($input.options.optiongroup)}
|
||||
{foreach $input.options.optiongroup.query AS $optiongroup}
|
||||
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
|
||||
{foreach $optiongroup[$input.options.options.query] as $option}
|
||||
<option value="{$option[$input.options.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $input.options.query AS $option}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio"
|
||||
name="{$input.name}"
|
||||
id="{$value.id}"
|
||||
value="{$value.value|escape:'htmlall':'UTF-8'}"
|
||||
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
|
||||
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
|
||||
{if isset($input.is_bool) && $input.is_bool == true}
|
||||
{if $value.value == 1}
|
||||
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{else}
|
||||
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
|
||||
{/if}
|
||||
{else}
|
||||
{$value.label}
|
||||
{/if}
|
||||
</label>
|
||||
{if isset($input.br) && $input.br}<br />{/if}
|
||||
{/foreach}
|
||||
{elseif $input.type == 'textarea'}
|
||||
{if isset($input.lang)}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if $input.autoload_rte}class="autoload_rte"{/if} >{$fields_value[$input.name][$language.id_lang]}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
|
||||
{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{foreach $input.values.query as $value}
|
||||
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
|
||||
<input type="checkbox"
|
||||
name="{$id_checkbox}"
|
||||
id="{$id_checkbox}"
|
||||
{if isset($value.val)}value="{$value.val}"{/if}
|
||||
{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
|
||||
{/foreach}
|
||||
{elseif $input.type == 'file'}
|
||||
{if isset($input.display_image) && $input.display_image}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div id="image">
|
||||
{$fields_value.image}
|
||||
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a href="{$current}&id_category={$form_id}&token={$token}&deleteImage=1">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
|
||||
</a>
|
||||
</div><br />
|
||||
{/if}
|
||||
{/if}
|
||||
<input type="file" name="{$input.name}" />
|
||||
{elseif $input.type == 'password'}
|
||||
<input type="password"
|
||||
name="{$input.name}"
|
||||
size="{$input.size}"
|
||||
value="" />
|
||||
{elseif $input.type == 'birthday'}
|
||||
{foreach $input.options as $key => $select}
|
||||
<select name="{$key}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{foreach $select as $k => $v}
|
||||
<option value="{$k}" {if $k == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $select as $v}
|
||||
<option value="{$v}" {if $v == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/foreach}
|
||||
{elseif $input.type == 'group'}
|
||||
{assign var=groups value=$input.values}
|
||||
{include file='helper/form/form_group.tpl'}
|
||||
{elseif $input.type == 'shop' OR $input.type == 'group_shop'}
|
||||
{include file='helper/form/form_shop.tpl'}
|
||||
{elseif $input.type == 'categories'}
|
||||
{include file='helper/form/form_category.tpl' categories=$input.values}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<input type="color"
|
||||
size="{$input.size}"
|
||||
data-hex="true"
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]}" />
|
||||
{elseif $input.type == 'date'}
|
||||
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<input type="text"
|
||||
size="{$input.size}"
|
||||
data-hex="true"
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="datepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]}" />
|
||||
{elseif $input.type == 'free'}
|
||||
{$fields_value[$input.name]}
|
||||
{/if}
|
||||
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
|
||||
{if isset($input.p)}
|
||||
<p class="clear">
|
||||
{if is_array($input.p)}
|
||||
{foreach $input.p as $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}<br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.p}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{if isset($languages)}<div class="clear"></div>{/if}
|
||||
{block name="end_field_block"}</div>{/block}
|
||||
{/if}
|
||||
{if isset($languages)}<div class="clear"></div>{/if}
|
||||
{block name="end_field_block"}</div>{/block}
|
||||
{/if}
|
||||
{if $input.name == 'id_state'}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{elseif $key == 'submit'}
|
||||
<div class="margin-form">
|
||||
<input type="submit"
|
||||
id="{$table}_form_submit_btn"
|
||||
value="{$field.title}"
|
||||
name="{$submit_action}{if isset($field.stay) && $field.stay}AndStay{/if}"
|
||||
{if isset($field.class)}class="{$field.class}"{/if} />
|
||||
</div>
|
||||
{if $input.name == 'id_state'}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{elseif $key == 'submit'}
|
||||
<div class="margin-form">
|
||||
<input type="submit"
|
||||
id="{$table}_form_submit_btn"
|
||||
value="{$field.title}"
|
||||
name="{$submit_action}{if isset($field.stay) && $field.stay}AndStay{/if}"
|
||||
{if isset($field.class)}class="{$field.class}"{/if} />
|
||||
</div>
|
||||
{elseif $key == 'p'}
|
||||
<p class="clear">
|
||||
{if is_array($field)}
|
||||
{foreach $field as $k => $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}
|
||||
{if isset($field[$k+1])}<br />{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$field}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{block name="other_input"}{/block}
|
||||
{/foreach}
|
||||
{if $required_fields}
|
||||
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
|
||||
{/if}
|
||||
{block name="other_input"}{/block}
|
||||
{/foreach}
|
||||
{if $required_fields}
|
||||
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
|
||||
{/if}
|
||||
{if isset($fields.tinymce) && $fields.tinymce}
|
||||
<script type="text/javascript">
|
||||
var iso = '{$iso}';
|
||||
var pathCSS = '{$path_css}';
|
||||
var ad = '{$ad}';
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="../js/tinymce.inc.js"></script>
|
||||
{/if}
|
||||
</fieldset>
|
||||
{block name="other_fieldsets"}{/block}
|
||||
{if isset($fields.tinymce) && $fields.tinymce}
|
||||
<script type="text/javascript">
|
||||
var iso = '{$iso}';
|
||||
var pathCSS = '{$path_css}';
|
||||
var ad = '{$ad}';
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="../js/tinymce.inc.js"></script>
|
||||
{/if}
|
||||
</fieldset>
|
||||
{block name="other_fieldsets"}{/block}
|
||||
{if isset($fields[$f+1])}<br class="clear" />{/if}
|
||||
{/foreach}
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||
{/if}
|
||||
|
||||
{block name="override_header"}{/block}
|
||||
|
||||
<form method="post" action="{$action}" class="form">
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
<table class="table_grid">
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9795 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{extends file="../helper/form/form.tpl"}
|
||||
|
||||
{block name="other_fieldsets"}
|
||||
{if $f == 1}
|
||||
<br class="clear" />
|
||||
<fieldset>
|
||||
<legend onclick="$('#tracking_help').slideToggle();" style="cursor:pointer;">
|
||||
<img src="../img/admin/help.png" /> {l s='Help'}
|
||||
</legend>
|
||||
<div id="tracking_help" style="display: none;">
|
||||
<p>{l s='Definitions:'}</p>
|
||||
<ul style="list-style: disc; margin-left: 20px;">
|
||||
<li>
|
||||
{l s='The field `http_referer` is the website from which your customers arrive.'}<br />
|
||||
{l s='For example, visitors coming from Google will have a `http_referer` like this one: "http://www.google.com/search?q=prestashop".'}<br />
|
||||
{l s='If the visitor arrives directly (by typing the URL of your shop or by using their bookmarks, for example), `http_referer` will be empty.'}<br />
|
||||
{l s='So if you want all the visitors coming from google, you can type "%google%" in this field, or "%google.fr%" if you want the visitors coming from Google France only.'}<br />
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
{l s='The field `request_uri` is the URL from which the customers come to your website.'}<br />
|
||||
{l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br />
|
||||
{l s='This is interesting because you can add some tags or tokens in the links pointing to your website. For example, you can post a link'} "{$uri}index.php?prestashop" {l s='in the forum and get statistics by entering "%prestashop" in the field `request_uri`. You will get all the visitors coming from the forum.'}
|
||||
{l s='This method is more reliable than the `http_referer` one, but there is a danger: if a search engine read a page with your link, then it will be displayed in its results and you will have not only the forum visitors, but also the ones from the search engine.'}
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
{l s='The fields `include` indicate what has to be included in the URL.'}
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
{l s='The fields `exclude` indicate what has to be excluded from the URL.'}
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
{l s='When using the simple mode, you can use some generic characters which can replace any characters:'}
|
||||
<ul>
|
||||
<li>{l s='"_" will replace one character. If you want to use the real "_", you should type'} "\\_".</li>
|
||||
<li>{l s='"%" will replace any number of characters. If you want to use the real "%", you should type'} "\\%".</li>
|
||||
</ul>
|
||||
</li>
|
||||
<br />
|
||||
<li>
|
||||
{l s='The simple mode uses the MySQL "LIKE", but for a higher potency you can use MySQL regular expressions.'}
|
||||
<a href="http://dev.mysql.com/doc/refman/5.0/en/regexp.html" target="_blank" style="font-style: italic;">{l s='Take a look at the document for more details...'}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="other_input"}
|
||||
|
||||
{if $key == 'help'}
|
||||
<a style="cursor:pointer;font-style:italic;" onclick="$('#tracking_help').slideToggle();">
|
||||
<img src="../img/admin/help.png" /> {l s='Get help!'}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="label"}
|
||||
|
||||
{if $input.name == 'http_referer_regexp'}
|
||||
<div id="tracking_expert" style="display: none;">
|
||||
{/if}
|
||||
|
||||
{if isset($input.h3)}
|
||||
<h3>{$input.h3}</h3>
|
||||
{/if}
|
||||
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="end_field_block"}
|
||||
</div>
|
||||
|
||||
{if $input.name == 'request_uri_regexp_not'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('fieldset#fieldset_3 legend').css('cursor', 'pointer');
|
||||
$('fieldset#fieldset_3 legend').click(function(){
|
||||
$('#tracking_expert').slideToggle();
|
||||
});
|
||||
});
|
||||
|
||||
{/block}
|
||||
@@ -0,0 +1,65 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8971 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
</div>
|
||||
|
||||
<div style="margin-left:280px">
|
||||
<fieldset>
|
||||
<legend>
|
||||
<img src="../img/admin/tab-preferences.gif" /> {l s='Settings'}
|
||||
</legend>
|
||||
<form action="{$current}&token={$token}" method="post" id="settings_form" name="settings_form">
|
||||
<label>{l s='Save direct traffic'}</label>
|
||||
<div class="margin-left">
|
||||
<label class="t" for="tracking_dt_on"><img src="../img/admin/enabled.gif" alt="{l s='Yes'}" title="{l s='Yes'}" /></label>
|
||||
<input type="radio" name="tracking_dt" id="tracking_dt_on" value="1" {if $tracking_dt}checked="checked"{/if} />
|
||||
<label class="t" for="tracking_dt_on"> {l s='Yes'}</label>
|
||||
<label class="t" for="tracking_dt_off"><img src="../img/admin/disabled.gif" alt="{l s='No'}" title="{l s='No'}" style="margin-left: 10px;" /></label>
|
||||
<input type="radio" name="tracking_dt" id="tracking_dt_off" value="0" {if !$tracking_dt}checked="checked"{/if}/>
|
||||
<label class="t" for="tracking_dt_off"> {l s='No'}</label>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<p>{l s='Direct traffic can be quite consuming. You should consider enabling it only if you have a strong database server and a strong need for it.'}</p>
|
||||
<input type="submit" class="button" value="{l s=' Save '}" name="submitSettings" id="submitSettings" />
|
||||
</form>
|
||||
<hr />
|
||||
<form action="{$current}&token={$token}" method="post" id="refresh_index_form" name="refresh_index_form">
|
||||
<p class="bold">{l s='Indexation'}</p>
|
||||
<p>{l s='There is a huge quantity of data, so each connection corresponding to a referrer is indexed. You can refresh this index by clicking on the button above. Be aware that it may take a long time and it is only needed if you modified or added a referrer and if you want your changes to be retroactive.'}</p>
|
||||
<input type="submit" class="button" value="{l s='Refresh index'}" name="submitRefreshIndex" id="submitRefreshIndex" />
|
||||
</form>
|
||||
<hr />
|
||||
<form action="{$current}&token={$token}" method="post" id="refresh_cache_form" name="refresh_cache_form">
|
||||
<p class="bold">{l s='Cache'}</p>
|
||||
<p>{l s='For you to sort and filter your data, it is cached. You can refresh the cache by clicking on the button above.'}</p>
|
||||
<input type="submit" class="button" value="{l s='Refresh cache'}" name="submitRefreshCache" id="submitRefreshCache" />
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="clear"> </div>
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9639 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helper/list/list_header.tpl"}
|
||||
|
||||
{block name="override_header"}
|
||||
<script language="javascript">
|
||||
$(function() {
|
||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||
var btn_submit_calendar = $('#submitDatePicker');
|
||||
|
||||
if (btn_save_calendar.length > 0 && btn_submit_calendar.length > 0)
|
||||
{
|
||||
btn_submit_calendar.hide();
|
||||
btn_save_calendar.click(function() {
|
||||
btn_submit_calendar.before('<input type="hidden" name="'+btn_submit_calendar.attr("name")+'" value="1" />');
|
||||
|
||||
$('#calendar_form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
var btn_save_settings = $('span[class~="process-icon-save-settings"]').parent();
|
||||
var btn_submit_settings = $('#submitSettings');
|
||||
|
||||
if (btn_save_settings.length > 0 && btn_submit_settings.length > 0)
|
||||
{
|
||||
btn_submit_settings.hide();
|
||||
btn_save_settings.click(function() {
|
||||
btn_submit_settings.before('<input type="hidden" name="'+btn_submit_settings.attr("name")+'" value="1" />');
|
||||
|
||||
$('#settings_form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
var btn_save_refresh_index = $('span[class~="process-icon-refresh-index"]').parent();
|
||||
var btn_submit_refresh_index = $('#submitRefreshIndex');
|
||||
|
||||
if (btn_save_refresh_index.length > 0 && btn_submit_refresh_index.length > 0)
|
||||
{
|
||||
btn_submit_refresh_index.hide();
|
||||
btn_save_refresh_index.click(function() {
|
||||
btn_submit_refresh_index.before('<input type="hidden" name="'+btn_submit_refresh_index.attr("name")+'" value="1" />');
|
||||
|
||||
$('#refresh_index_form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
var btn_save_refresh_cache = $('span[class~="process-icon-refresh-cache"]').parent();
|
||||
var btn_submit_refresh_cache = $('#submitRefreshCache');
|
||||
|
||||
if (btn_save_refresh_cache.length > 0 && btn_submit_refresh_cache.length > 0)
|
||||
{
|
||||
btn_submit_refresh_cache.hide();
|
||||
btn_save_refresh_cache.click(function() {
|
||||
btn_submit_refresh_cache.before('<input type="hidden" name="'+btn_submit_refresh_cache.attr("name")+'" value="1" />');
|
||||
|
||||
$('#refresh_cache_form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.toolbarBox .process-icon-save-calendar { background-image: url(themes/default/process-icon-save.png);}
|
||||
.toolbarBox .process-icon-save-settings { background-image: url(themes/default/process-icon-save.png);}
|
||||
.toolbarBox .process-icon-refresh-index { background-image: url(themes/default/process-icon-stats.png);}
|
||||
.toolbarBox .process-icon-refresh-cache { background-image: url(themes/default/process-icon-stats.png);}
|
||||
</style>
|
||||
{if $enable_calendar}
|
||||
{$calendar_form}
|
||||
{$settings_form}
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -0,0 +1,134 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8897 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helper/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
<script language="javascript">
|
||||
$(function() {
|
||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||
var btn_submit_calendar = $('#submitDatePicker');
|
||||
|
||||
if (btn_save_calendar.length > 0 && btn_submit_calendar.length > 0)
|
||||
{
|
||||
btn_submit_calendar.hide();
|
||||
btn_save_calendar.click(function() {
|
||||
btn_submit_calendar.before('<input type="hidden" name="'+btn_submit_calendar.attr("name")+'" value="1" />');
|
||||
|
||||
$('#calendar_form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.toolbarBox .process-icon-save-calendar { background-image: url(themes/default/process-icon-save.png);}
|
||||
</style>
|
||||
|
||||
{if $enable_calendar}
|
||||
{$calendar_form}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function updateConversionRate(id_product)
|
||||
{
|
||||
$.getJSON('ajax.php',
|
||||
{
|
||||
ajaxReferrers:1,
|
||||
ajaxProductFilter:1,
|
||||
id_employee:{$id_employee},
|
||||
token:'{$token}',
|
||||
id_referrer:{$referrer->id},
|
||||
id_product:id_product
|
||||
},
|
||||
function(j) {
|
||||
{foreach $display_tab as $key => $value}
|
||||
$("#{$key}").html(j[0].{$key});
|
||||
{/foreach}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function fillProducts(filter)
|
||||
{
|
||||
var form = document.layers ? document.forms.product_referrers : document.product_referrers;
|
||||
var filter = form.filterProduct.value;
|
||||
$.getJSON('ajax.php',
|
||||
{
|
||||
ajaxReferrers:1,
|
||||
ajaxFillProducts:1,
|
||||
id_employee:{$id_employee},
|
||||
token:'{$token}',
|
||||
id_lang:{$id_lang},
|
||||
filter:filter
|
||||
},
|
||||
function(j) {
|
||||
|
||||
form.selectProduct.length = j.length + 1;
|
||||
for (var i = 0; i < j.length; i++)
|
||||
{
|
||||
form.selectProduct.options[i+1].value = j[i].id_product;
|
||||
form.selectProduct.options[i+1].text = j[i].name;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<fieldset style="margin-left: 280px;">
|
||||
<legend>
|
||||
<img src="../img/admin/tab-stats.gif" /> {l s='Statistics'}
|
||||
</legend>
|
||||
<h2>{$referrer->name}</h2>
|
||||
<table>
|
||||
{foreach $display_tab as $data => $label}
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td style="color:green;font-weight:bold;padding-left:20px;" id="{$data}"></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<br class="clear" />
|
||||
<form id="product_referrers" name="product_referrers">
|
||||
<label>{l s='Filter by product:'}</label>
|
||||
<div class="margin-left">
|
||||
<select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);">
|
||||
<option value="0" selected="selected">-- {l s='All'} --</option>
|
||||
</select>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<label>{l s='Search:'}</label>
|
||||
<div class="margin-left">
|
||||
<input type="text" size="34" id="filterProduct" name="filterProduct" onkeyup="fillProducts();" />
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
<script type="text/javascript">
|
||||
updateConversionRate(0);
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{$translations.Calendar}
|
||||
</legend>
|
||||
<div>
|
||||
<form action="{$current}&token={$token}" method="post">
|
||||
<form action="{$current}&token={$token}{if $action && $table}&{$action}{$table}{/if}{if $identifier && $id}&{$identifier}={$id}{/if}" method="post" id="calendar_form" name="calendar_form">
|
||||
<input type="submit" name="submitDateDay" class="button" value="{$translations.Day}">
|
||||
<input type="submit" name="submitDateMonth" class="button" value="{$translations.Month}">
|
||||
<input type="submit" name="submitDateYear" class="button" value="{$translations.Year}"><br />
|
||||
@@ -45,7 +45,7 @@
|
||||
<p>{if isset($translations.To)}{$translations.To}{else}{l s='From:'}{/if}
|
||||
<input type="text" name="datepickerTo" id="datepickerTo" value="{$datepickerTo}">
|
||||
</p>
|
||||
<input type="submit" name="submitDatePicker" class="button" value="{if isset($translations.Save)}{$translations.Save}{else}{l s=' Save '}{/if}" />
|
||||
<input type="submit" name="submitDatePicker" id="submitDatePicker" class="button" value="{if isset($translations.Save)}{$translations.Save}{else}{l s=' Save '}{/if}" />
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<form action="{$current}&token={$token}" method="post">
|
||||
<form action="{$current}&token={$token}" method="post" id="settings_form" name="settings_form">
|
||||
<fieldset style="width:230px;">
|
||||
<legend>
|
||||
<img src="../img/admin/tab-preferences.gif" />{l s='Settings'}
|
||||
@@ -54,7 +54,7 @@
|
||||
{l s='No grid engine module installed'}
|
||||
{/if}
|
||||
</p>
|
||||
<p><input type="submit" value="{l s=' Save '}" name="submitSettings" class="button" /></p>
|
||||
<p><input type="submit" value="{l s=' Save '}" name="submitSettings" id="submitSettings" class="button" /></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="clear space"> </div>
|
||||
@@ -0,0 +1,64 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8897 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helper/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
<script language="javascript">
|
||||
$(function() {
|
||||
var btn_save_calendar = $('span[class~="process-icon-save-calendar"]').parent();
|
||||
var btn_submit_calendar = $('#submitDatePicker');
|
||||
|
||||
if (btn_save_calendar.length > 0 && btn_submit_calendar.length > 0)
|
||||
{
|
||||
btn_submit_calendar.hide();
|
||||
btn_save_calendar.click(function() {
|
||||
btn_submit_calendar.before('<input type="hidden" name="'+btn_submit_calendar.attr("name")+'" value="1" />');
|
||||
|
||||
$('#calendar_form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
var btn_save_settings = $('span[class~="process-icon-save-settings"]').parent();
|
||||
var btn_submit_settings = $('#submitSettings');
|
||||
|
||||
if (btn_save_settings.length > 0 && btn_submit_settings.length > 0)
|
||||
{
|
||||
btn_submit_settings.hide();
|
||||
btn_save_settings.click(function() {
|
||||
btn_submit_settings.before('<input type="hidden" name="'+btn_submit_settings.attr("name")+'" value="1" />');
|
||||
|
||||
$('#settings_form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.toolbarBox .process-icon-save-calendar { background-image: url(themes/default/process-icon-save.png);}
|
||||
.toolbarBox .process-icon-save-settings { background-image: url(themes/default/process-icon-save.png);}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
@@ -76,6 +76,9 @@ class AdminControllerCore extends Controller
|
||||
public $tpl_option_vars = array();
|
||||
public $tpl_view_vars = array();
|
||||
|
||||
/** @var bool if you want more fieldsets in the form */
|
||||
public $multiple_fieldsets = false;
|
||||
|
||||
public $fields_value = false;
|
||||
|
||||
/** @var array Errors displayed after post processing */
|
||||
@@ -1358,8 +1361,12 @@ class AdminControllerCore extends Controller
|
||||
$this->content .= $this->context->smarty->fetch($this->context->smarty->template_dir[0].'form_submit_ajax.tpl');
|
||||
if ($this->fields_form && is_array($this->fields_form))
|
||||
{
|
||||
if (!$this->multiple_fieldsets)
|
||||
$this->fields_form = array(array('form' => $this->fields_form));
|
||||
|
||||
if (empty($this->toolbar_title))
|
||||
$this->initToolbarTitle();
|
||||
|
||||
$this->getlanguages();
|
||||
$helper = new HelperForm($this);
|
||||
$helper->override_folder = $this->tpl_folder;
|
||||
@@ -1368,6 +1375,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||
$helper->fields_value = $this->getFieldsValue($this->object);
|
||||
$helper->tpl_vars = $this->tpl_form_vars;
|
||||
$helper->multiple_fieldsets = $this->multiple_fieldsets;
|
||||
if ($this->tabAccess['view'])
|
||||
{
|
||||
if (Tools::getValue('back'))
|
||||
@@ -1852,14 +1860,16 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
if (isset($this->fields_form['input']))
|
||||
foreach ($this->fields_form['input'] as $input)
|
||||
if (empty($this->fields_value[$input['name']]))
|
||||
if (isset($input['lang']) && $input['lang'])
|
||||
foreach ($this->_languages as $language)
|
||||
$this->fields_value[$input['name']][$language['id_lang']] = $this->getFieldValue($obj, $input['name'], $language['id_lang']);
|
||||
else
|
||||
$this->fields_value[$input['name']] = $this->getFieldValue($obj, $input['name']);
|
||||
info($this->fields_form);
|
||||
foreach ($this->fields_form as $fieldset)
|
||||
if (isset($fieldset['form']['input']))
|
||||
foreach ($fieldset['form']['input'] as $input)
|
||||
if (empty($this->fields_value[$input['name']]))
|
||||
if (isset($input['lang']) && $input['lang'])
|
||||
foreach ($this->_languages as $language)
|
||||
$this->fields_value[$input['name']][$language['id_lang']] = $this->getFieldValue($obj, $input['name'], $language['id_lang']);
|
||||
else
|
||||
$this->fields_value[$input['name']] = $this->getFieldValue($obj, $input['name']);
|
||||
|
||||
return $this->fields_value;
|
||||
}
|
||||
|
||||
+11
-13
@@ -31,22 +31,18 @@ class HelperFormCore extends Helper
|
||||
public $first_call = true;
|
||||
public $toolbar = true;
|
||||
|
||||
/**
|
||||
* @var array of forms fields
|
||||
* Usage :
|
||||
*
|
||||
*/
|
||||
/** @var array of forms fields */
|
||||
protected $fields_form = array();
|
||||
|
||||
/** @var array values of form fields */
|
||||
public $fields_value = array();
|
||||
|
||||
public $table;
|
||||
|
||||
/** @var if not null, a title will be added on that list */
|
||||
/** @var string if not null, a title will be added on that list */
|
||||
public $title = null;
|
||||
|
||||
/**
|
||||
* Used to override default 'submitAdd' parameter in form action attribute
|
||||
* @var string
|
||||
*/
|
||||
/** @var string Used to override default 'submitAdd' parameter in form action attribute */
|
||||
public $submit_action = '';
|
||||
|
||||
public $token;
|
||||
@@ -76,7 +72,7 @@ class HelperFormCore extends Helper
|
||||
if (isset($this->fields_form['asso_shop']) && Shop::isFeatureActive())
|
||||
if ($this->fields_form['asso_shop'] == 'group')
|
||||
$asso_shop = $this->displayAssoShop('group_shop');
|
||||
elseif ($this->fields_form['asso_shop'] == 'shop')
|
||||
else if ($this->fields_form['asso_shop'] == 'shop')
|
||||
$asso_shop = $this->displayAssoShop();
|
||||
|
||||
$iso = $this->context->language->iso_code;
|
||||
@@ -103,12 +99,14 @@ class HelperFormCore extends Helper
|
||||
'asso_shop' => isset($asso_shop) ? $asso_shop : null,
|
||||
'iso' => file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en',
|
||||
'path_css' => _THEME_CSS_DIR_,
|
||||
'ad' => dirname($_SERVER["PHP_SELF"]),
|
||||
|
||||
'ad' => dirname($_SERVER['PHP_SELF'])
|
||||
));
|
||||
return parent::generate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there are required fields
|
||||
*/
|
||||
public function getFieldsRequired()
|
||||
{
|
||||
if (isset($this->fields_form['input']))
|
||||
|
||||
+92
-73
@@ -30,7 +30,7 @@ class ReferrerCore extends ObjectModel
|
||||
public $id_shop;
|
||||
public $name;
|
||||
public $passwd;
|
||||
|
||||
|
||||
public $http_referer_regexp;
|
||||
public $http_referer_like;
|
||||
public $request_uri_regexp;
|
||||
@@ -39,25 +39,43 @@ class ReferrerCore extends ObjectModel
|
||||
public $http_referer_like_not;
|
||||
public $request_uri_regexp_not;
|
||||
public $request_uri_like_not;
|
||||
|
||||
|
||||
public $base_fee;
|
||||
public $percent_fee;
|
||||
public $click_fee;
|
||||
|
||||
public $date_add;
|
||||
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array('name' => 64, 'http_referer_regexp' => 64, 'request_uri_regexp' => 64, 'http_referer_like' => 64, 'request_uri_like' => 64, 'passwd' => 32);
|
||||
protected $fieldsValidate = array(
|
||||
'id_shop' => 'isUnsignedInt',
|
||||
'name' => 'isGenericName', 'passwd' => 'isPasswd',
|
||||
'http_referer_regexp' => 'isCleanHtml', 'request_uri_regexp' => 'isCleanHtml', 'http_referer_like' => 'isCleanHtml', 'request_uri_like' => 'isCleanHtml',
|
||||
'http_referer_regexp_not' => 'isCleanHtml', 'request_uri_regexp_not' => 'isCleanHtml', 'http_referer_like_not' => 'isCleanHtml', 'request_uri_like_not' => 'isCleanHtml',
|
||||
'base_fee' => 'isFloat', 'percent_fee' => 'isFloat', 'click_fee' => 'isFloat');
|
||||
|
||||
protected $table = 'referrer';
|
||||
protected $identifier = 'id_referrer';
|
||||
|
||||
public $date_add;
|
||||
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array(
|
||||
'name' => 64,
|
||||
'http_referer_regexp' => 64,
|
||||
'request_uri_regexp' => 64,
|
||||
'http_referer_like' => 64,
|
||||
'request_uri_like' => 64,
|
||||
'passwd' => 32
|
||||
);
|
||||
|
||||
protected $fieldsValidate = array(
|
||||
'id_shop' => 'isUnsignedInt',
|
||||
'name' => 'isGenericName',
|
||||
'passwd' => 'isPasswd',
|
||||
'http_referer_regexp' => 'isCleanHtml',
|
||||
'request_uri_regexp' => 'isCleanHtml',
|
||||
'http_referer_like' => 'isCleanHtml',
|
||||
'request_uri_like' => 'isCleanHtml',
|
||||
'http_referer_regexp_not' => 'isCleanHtml',
|
||||
'request_uri_regexp_not' => 'isCleanHtml',
|
||||
'http_referer_like_not' => 'isCleanHtml',
|
||||
'request_uri_like_not' => 'isCleanHtml',
|
||||
'base_fee' => 'isFloat',
|
||||
'percent_fee' => 'isFloat',
|
||||
'click_fee' => 'isFloat'
|
||||
);
|
||||
|
||||
protected $table = 'referrer';
|
||||
protected $identifier = 'id_referrer';
|
||||
|
||||
protected static $_join = '(r.http_referer_like IS NULL OR r.http_referer_like = \'\' OR cs.http_referer LIKE r.http_referer_like)
|
||||
AND (r.request_uri_like IS NULL OR r.request_uri_like = \'\' OR cs.request_uri LIKE r.request_uri_like)
|
||||
AND (r.http_referer_like_not IS NULL OR r.http_referer_like_not = \'\' OR cs.http_referer NOT LIKE r.http_referer_like_not)
|
||||
@@ -66,7 +84,7 @@ class ReferrerCore extends ObjectModel
|
||||
AND (r.request_uri_regexp IS NULL OR r.request_uri_regexp = \'\' OR cs.request_uri REGEXP r.request_uri_regexp)
|
||||
AND (r.http_referer_regexp_not IS NULL OR r.http_referer_regexp_not = \'\' OR cs.http_referer NOT REGEXP r.http_referer_regexp_not)
|
||||
AND (r.request_uri_regexp_not IS NULL OR r.request_uri_regexp_not = \'\' OR cs.request_uri NOT REGEXP r.request_uri_regexp_not)';
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
@@ -87,7 +105,7 @@ class ReferrerCore extends ObjectModel
|
||||
$fields['date_add'] = pSQL($this->date_add);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
if (!($result = parent::add($autodate, $nullValues)))
|
||||
@@ -106,11 +124,11 @@ class ReferrerCore extends ObjectModel
|
||||
SELECT id_referrer, id_connections_source
|
||||
FROM '._DB_PREFIX_.'referrer r
|
||||
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
|
||||
WHERE id_connections_source = '.(int)($id_connections_source).'
|
||||
WHERE id_connections_source = '.(int)$id_connections_source.'
|
||||
)';
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get list of referrers connections of a customer
|
||||
*
|
||||
@@ -124,7 +142,7 @@ class ReferrerCore extends ObjectModel
|
||||
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON c.id_connections = cs.id_connections
|
||||
LEFT JOIN '._DB_PREFIX_.'referrer r ON ('.self::$_join.')
|
||||
LEFT JOIN '._DB_PREFIX_.'shop s ON s.id_shop = c.id_shop
|
||||
WHERE g.id_customer = '.(int)($id_customer).'
|
||||
WHERE g.id_customer = '.(int)$id_customer.'
|
||||
AND r.name IS NOT NULL
|
||||
ORDER BY c.date_add DESC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
@@ -145,7 +163,7 @@ class ReferrerCore extends ObjectModel
|
||||
$join = 'LEFT JOIN `'._DB_PREFIX_.'page` p ON cp.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`';
|
||||
$where = ' AND pt.`name` = \'product\'
|
||||
AND p.`id_object` = '.(int)($id_product);
|
||||
AND p.`id_object` = '.(int)$id_product;
|
||||
}
|
||||
|
||||
$sql = 'SELECT COUNT(DISTINCT cs.id_connections_source) AS visits,
|
||||
@@ -183,9 +201,9 @@ class ReferrerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON cp.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`';
|
||||
$where = ' AND pt.`name` = \'product\'
|
||||
AND p.`id_object` = '.(int)($id_product);
|
||||
AND p.`id_object` = '.(int)$id_product;
|
||||
}
|
||||
|
||||
|
||||
$sql = 'SELECT COUNT(DISTINCT cu.id_customer) AS registrations
|
||||
FROM '._DB_PREFIX_.'referrer_cache rc
|
||||
LEFT JOIN '._DB_PREFIX_.'referrer_shop rs ON rc.id_referrer = rs.id_referrer
|
||||
@@ -199,7 +217,7 @@ class ReferrerCore extends ObjectModel
|
||||
'.$shop->addSqlRestriction(false, 'c').'
|
||||
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER, 'cu').'
|
||||
AND cu.date_add > cs.date_add
|
||||
AND rc.id_referrer = '.(int)($this->id)
|
||||
AND rc.id_referrer = '.(int)$this->id
|
||||
.$where;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
return (int)$result['registrations'];
|
||||
@@ -218,9 +236,9 @@ class ReferrerCore extends ObjectModel
|
||||
if ($id_product)
|
||||
{
|
||||
$join = 'LEFT JOIN '._DB_PREFIX_.'order_detail od ON oo.id_order = od.id_order';
|
||||
$where = ' AND od.product_id = '.(int)($id_product);
|
||||
$where = ' AND od.product_id = '.(int)$id_product;
|
||||
}
|
||||
|
||||
|
||||
$sql = 'SELECT oo.id_order
|
||||
FROM '._DB_PREFIX_.'referrer_cache rc
|
||||
LEFT JOIN '._DB_PREFIX_.'referrer_shop rs ON rc.id_referrer = rs.id_referrer
|
||||
@@ -234,16 +252,16 @@ class ReferrerCore extends ObjectModel
|
||||
'.$shop->addSqlRestriction(false, 'c').'
|
||||
'.$shop->addSqlRestriction(Shop::SHARE_ORDER, 'oo').'
|
||||
AND oo.date_add > cs.date_add
|
||||
AND rc.id_referrer = '.(int)($this->id).'
|
||||
AND rc.id_referrer = '.(int)$this->id.'
|
||||
AND oo.valid = 1'
|
||||
.$where;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
|
||||
$implode = array();
|
||||
foreach ($result as $row)
|
||||
if ((int)$row['id_order'])
|
||||
$implode[] = (int)$row['id_order'];
|
||||
|
||||
|
||||
if ($implode)
|
||||
{
|
||||
$sql = 'SELECT COUNT(id_order) AS orders, SUM(total_paid_real / conversion_rate) AS sales
|
||||
@@ -256,7 +274,7 @@ class ReferrerCore extends ObjectModel
|
||||
else
|
||||
return array('orders' => 0, 'sales' => 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refresh cache data of referrer statistics in referrer_shop table
|
||||
*
|
||||
@@ -265,31 +283,31 @@ class ReferrerCore extends ObjectModel
|
||||
*/
|
||||
public static function refreshCache($referrers = null, $employee = null)
|
||||
{
|
||||
if (!$referrers OR !is_array($referrers))
|
||||
if (!$referrers || !is_array($referrers))
|
||||
$referrers = Db::getInstance()->executeS('SELECT id_referrer FROM '._DB_PREFIX_.'referrer');
|
||||
foreach ($referrers as $row)
|
||||
{
|
||||
$referrer = new Referrer($row['id_referrer']);
|
||||
foreach (Shop::getShops(true, null, true) as $shopID)
|
||||
foreach (Shop::getShops(true, null, true) as $shop_id)
|
||||
{
|
||||
if (!$referrer->isAssociatedToShop($shopID))
|
||||
if (!$referrer->isAssociatedToShop($shop_id))
|
||||
continue;
|
||||
|
||||
$shop = new Shop($shopID);
|
||||
$statsVisits = $referrer->getStatsVisits(null, $employee, $shop);
|
||||
$shop = new Shop($shop_id);
|
||||
$stats_visits = $referrer->getStatsVisits(null, $employee, $shop);
|
||||
$registrations = $referrer->getRegistrations(null, $employee, $shop);
|
||||
$statsSales = $referrer->getStatsSales(null, $employee, $shop);
|
||||
$stats_sales = $referrer->getStatsSales(null, $employee, $shop);
|
||||
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'referrer_shop', array(
|
||||
'cache_visitors' => $statsVisits['uniqs'],
|
||||
'cache_visits' => $statsVisits['visits'],
|
||||
'cache_pages' => $statsVisits['pages'],
|
||||
'cache_registrations' =>$registrations,
|
||||
'cache_orders' => $statsSales['orders'],
|
||||
'cache_sales' => number_format($statsSales['sales'], 2, '.', ''),
|
||||
'cache_reg_rate' => $statsVisits['uniqs'] ? $registrations / $statsVisits['uniqs'] : 0,
|
||||
'cache_order_rate' => $statsVisits['uniqs'] ? $statsSales['orders'] / $statsVisits['uniqs'] : 0,
|
||||
), 'UPDATE', 'id_referrer = '.$referrer->id.' AND id_shop = '.$shopID);
|
||||
'cache_visitors' => $stats_visits['uniqs'],
|
||||
'cache_visits' => $stats_visits['visits'],
|
||||
'cache_pages' => $stats_visits['pages'],
|
||||
'cache_registrations' => $registrations,
|
||||
'cache_orders' => $stats_sales['orders'],
|
||||
'cache_sales' => number_format($stats_sales['sales'], 2, '.', ''),
|
||||
'cache_reg_rate' => $stats_visits['uniqs'] ? $registrations / $stats_visits['uniqs'] : 0,
|
||||
'cache_order_rate' => $stats_visits['uniqs'] ? $stats_sales['orders'] / $stats_visits['uniqs'] : 0,
|
||||
), 'UPDATE', 'id_referrer = '.$referrer->id.' AND id_shop = '.$shop_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +315,7 @@ class ReferrerCore extends ObjectModel
|
||||
Configuration::updateValue('PS_REFERRERS_CACHE_DATE', date('Y-m-d H:i:s'));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cache liaison between connections_source data and referrers data
|
||||
*
|
||||
@@ -305,7 +323,7 @@ class ReferrerCore extends ObjectModel
|
||||
*/
|
||||
public static function refreshIndex($referrers = null)
|
||||
{
|
||||
if (!$referrers OR !is_array($referrers))
|
||||
if (!$referrers || !is_array($referrers))
|
||||
{
|
||||
Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'referrer_cache');
|
||||
Db::getInstance()->execute('
|
||||
@@ -318,46 +336,47 @@ class ReferrerCore extends ObjectModel
|
||||
else
|
||||
foreach ($referrers as $row)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)($row['id_referrer']));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)$row['id_referrer']);
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
||||
SELECT id_referrer, id_connections_source
|
||||
FROM '._DB_PREFIX_.'referrer r
|
||||
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
|
||||
WHERE id_referrer = '.(int)($row['id_referrer']).'
|
||||
WHERE id_referrer = '.(int)$row['id_referrer'].'
|
||||
)');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getAjaxProduct($id_referrer, $id_product, $employee = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'));
|
||||
$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$referrer = new Referrer($id_referrer);
|
||||
$statsVisits = $referrer->getStatsVisits($id_product, $employee);
|
||||
$registrations = $referrer->getRegistrations($id_product, $employee);
|
||||
$statsSales = $referrer->getStatsSales($id_product, $employee);
|
||||
$stats_visits = $referrer->getStatsVisits($id_product, $employee, $context->shop);
|
||||
$registrations = $referrer->getRegistrations($id_product, $employee, $context->shop);
|
||||
$stats_sales = $referrer->getStatsSales($id_product, $employee, $context->shop);
|
||||
|
||||
// If it's a product and it has no visits nor orders
|
||||
if ((int)($id_product) AND !$statsVisits['visits'] AND !$statsSales['orders'])
|
||||
if ((int)$id_product && !$stats_visits['visits'] && !$stats_sales['orders'])
|
||||
exit;
|
||||
|
||||
$jsonArray = array();
|
||||
$jsonArray[] = '"id_product":"'.(int)($product->id).'"';
|
||||
$jsonArray[] = '"product_name":"'.addslashes($product->name).'"';
|
||||
$jsonArray[] = '"uniqs":"'.(int)($statsVisits['uniqs']).'"';
|
||||
$jsonArray[] = '"visitors":"'.(int)($statsVisits['visitors']).'"';
|
||||
$jsonArray[] = '"visits":"'.(int)($statsVisits['visits']).'"';
|
||||
$jsonArray[] = '"pages":"'.(int)($statsVisits['pages']).'"';
|
||||
$jsonArray[] = '"registrations":"'.(int)($registrations).'"';
|
||||
$jsonArray[] = '"orders":"'.(int)($statsSales['orders']).'"';
|
||||
$jsonArray[] = '"sales":"'.Tools::displayPrice($statsSales['sales'], $currency).'"';
|
||||
$jsonArray[] = '"cart":"'.Tools::displayPrice(((int)($statsSales['orders']) ? $statsSales['sales'] / (int)($statsSales['orders']) : 0), $currency).'"';
|
||||
$jsonArray[] = '"reg_rate":"'.number_format((int)($statsVisits['uniqs']) ? (int)($registrations) / (int)($statsVisits['uniqs']) : 0, 4, '.', '').'"';
|
||||
$jsonArray[] = '"order_rate":"'.number_format((int)($statsVisits['uniqs']) ? (int)($statsSales['orders']) / (int)($statsVisits['uniqs']) : 0, 4, '.', '').'"';
|
||||
$jsonArray[] = '"click_fee":"'.Tools::displayPrice((int)($statsVisits['visits']) * $referrer->click_fee, $currency).'"';
|
||||
$jsonArray[] = '"base_fee":"'.Tools::displayPrice($statsSales['orders'] * $referrer->base_fee, $currency).'"';
|
||||
$jsonArray[] = '"percent_fee":"'.Tools::displayPrice($statsSales['sales'] * $referrer->percent_fee / 100, $currency).'"';
|
||||
die ('[{'.implode(',', $jsonArray).'}]');
|
||||
|
||||
$json_array = array();
|
||||
$json_array[] = '"id_product":"'.(int)$product->id.'"';
|
||||
$json_array[] = '"product_name":"'.addslashes($product->name).'"';
|
||||
$json_array[] = '"uniqs":"'.(int)$stats_visits['uniqs'].'"';
|
||||
$json_array[] = '"visitors":"'.(int)$stats_visits['visitors'].'"';
|
||||
$json_array[] = '"visits":"'.(int)$stats_visits['visits'].'"';
|
||||
$json_array[] = '"pages":"'.(int)$stats_visits['pages'].'"';
|
||||
$json_array[] = '"registrations":"'.(int)$registrations.'"';
|
||||
$json_array[] = '"orders":"'.(int)$stats_sales['orders'].'"';
|
||||
$json_array[] = '"sales":"'.Tools::displayPrice($stats_sales['sales'], $currency).'"';
|
||||
$json_array[] = '"cart":"'.Tools::displayPrice(((int)$stats_sales['orders'] ? $stats_sales['sales'] / (int)$stats_sales['orders'] : 0), $currency).'"';
|
||||
$json_array[] = '"reg_rate":"'.number_format((int)$stats_visits['uniqs'] ? (int)$registrations / (int)$stats_visits['uniqs'] : 0, 4, '.', '').'"';
|
||||
$json_array[] = '"order_rate":"'.number_format((int)$stats_visits['uniqs'] ? (int)$stats_sales['orders'] / (int)$stats_visits['uniqs'] : 0, 4, '.', '').'"';
|
||||
$json_array[] = '"click_fee":"'.Tools::displayPrice((int)$stats_visits['visits'] * $referrer->click_fee, $currency).'"';
|
||||
$json_array[] = '"base_fee":"'.Tools::displayPrice($stats_sales['orders'] * $referrer->base_fee, $currency).'"';
|
||||
$json_array[] = '"percent_fee":"'.Tools::displayPrice($stats_sales['sales'] * $referrer->percent_fee / 100, $currency).'"';
|
||||
die ('[{'.implode(',', $json_array).'}]');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..');
|
||||
|
||||
if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)Tab::getIdFromClassName('AdminReferrers').(int)Tools::getValue('id_employee')))
|
||||
{
|
||||
if (Tools::isSubmit('ajaxProductFilter'))
|
||||
Referrer::getAjaxProduct(
|
||||
(int)Tools::getValue('id_referrer'),
|
||||
(int)Tools::getValue('id_product'),
|
||||
new Employee((int)Tools::getValue('id_employee'))
|
||||
);
|
||||
else if (Tools::isSubmit('ajaxFillProducts'))
|
||||
{
|
||||
$json_array = array();
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT p.id_product, pl.name
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl
|
||||
ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)Tools::getValue('id_lang').')
|
||||
'.(Tools::getValue('filter') != 'undefined' ? 'WHERE name LIKE "%'.pSQL(Tools::getValue('filter')).'%"' : '')
|
||||
);
|
||||
|
||||
foreach ($result as $row)
|
||||
$json_array[] = '{id_product:'.(int)$row['id_product'].',name:\''.addslashes($row['name']).'\'}';
|
||||
|
||||
die ('['.implode(',', $json_array).']');
|
||||
}
|
||||
}
|
||||
|
||||
class AdminReferrersControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'referrer';
|
||||
$this->className = 'Referrer';
|
||||
$this->fieldsDisplay = array(
|
||||
'id_referrer' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'width' => 25,
|
||||
'align' => 'center'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 80
|
||||
),
|
||||
'cache_visitors' => array(
|
||||
'title' => $this->l('Visitors'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_visits' => array(
|
||||
'title' => $this->l('Visits'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_pages' => array(
|
||||
'title' => $this->l('Pages'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_registrations' => array(
|
||||
'title' => $this->l('Reg.'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_orders' => array(
|
||||
'title' => $this->l('Ord.'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_sales' => array(
|
||||
'title' => $this->l('Sales'),
|
||||
'width' => 80,
|
||||
'align' => 'right',
|
||||
'prefix' => '<b>',
|
||||
'suffix' => '</b>',
|
||||
'price' => true
|
||||
),
|
||||
'cart' => array(
|
||||
'title' => $this->l('Avg. cart'),
|
||||
'width' => 50,
|
||||
'align' => 'right',
|
||||
'price' => true
|
||||
),
|
||||
'cache_reg_rate' => array(
|
||||
'title' => $this->l('Reg. rate'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'cache_order_rate' => array(
|
||||
'title' => $this->l('Order rate'),
|
||||
'width' => 30,
|
||||
'align' => 'center'
|
||||
),
|
||||
'fee0' => array(
|
||||
'title' => $this->l('Click'),
|
||||
'width' => 30,
|
||||
'align' => 'right',
|
||||
'price' => true
|
||||
),
|
||||
'fee1' => array(
|
||||
'title' => $this->l('Base'),
|
||||
'width' => 30,
|
||||
'align' => 'right',
|
||||
'price' => true
|
||||
),
|
||||
'fee2' => array(
|
||||
'title' => $this->l('Percent'),
|
||||
'width' => 30,
|
||||
'align' => 'right',
|
||||
'price' => true
|
||||
)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initList()
|
||||
{
|
||||
// Display list Referrers:
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
|
||||
SUM(sa.cache_registrations) AS cache_registrations, SUM(sa.cache_orders) AS cache_orders, SUM(sa.cache_sales) AS cache_sales,
|
||||
IF(sa.cache_orders > 0, ROUND(sa.cache_sales/sa.cache_orders, 2), 0) as cart, (sa.cache_visits*click_fee) as fee0,
|
||||
(sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'referrer_shop` sa
|
||||
ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).'))';
|
||||
|
||||
$this->_group = 'GROUP BY sa.id_referrer';
|
||||
|
||||
$this->toolbar_btn['save-calendar'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save Calendar')
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-settings'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save Settings')
|
||||
);
|
||||
|
||||
$this->toolbar_btn['refresh-index'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Refresh Index')
|
||||
);
|
||||
|
||||
$this->toolbar_btn['refresh-cache'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Refresh Cache')
|
||||
);
|
||||
|
||||
$this->tpl_list_vars = array(
|
||||
'enable_calendar' => $this->enableCalendar(),
|
||||
'calendar_form' => $this->displayCalendar(),
|
||||
'settings_form' => $this->displaySettings()
|
||||
);
|
||||
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
$uri = Tools::getHttpHost(true, true).__PS_BASE_URI__;
|
||||
|
||||
$this->fields_form[0] = array('form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Affiliate'),
|
||||
'image' => '../img/admin/affiliation.png'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name:'),
|
||||
'name' => 'name',
|
||||
'size' => 20,
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'password',
|
||||
'label' => $this->l('Password:'),
|
||||
'name' => 'passwd',
|
||||
'size' => 20,
|
||||
'p' => $this->l('Leave blank if no change')
|
||||
)
|
||||
),
|
||||
'p' => array(
|
||||
$this->l('Affiliates can access their own data with this name and password.'),
|
||||
$this->l('Front access:').' <a href="'.$uri.'modules/trackingfront/stats.php" style="font-style: italic;">'.$uri.'modules/trackingfront/stats.php</a>'
|
||||
)
|
||||
));
|
||||
|
||||
$this->fields_form[1] = array('form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Commission plan'),
|
||||
'image' => '../img/admin/money.png'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Click fee:'),
|
||||
'name' => 'click_fee',
|
||||
'size' => 8,
|
||||
'p' => $this->l('Fee given for each visit.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Base fee:'),
|
||||
'name' => 'base_fee',
|
||||
'size' => 8,
|
||||
'p' => $this->l('Fee given for each order placed.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Percent fee:'),
|
||||
'name' => 'percent_fee',
|
||||
'size' => 8,
|
||||
'p' => $this->l('Percent of the sales.')
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form[1]['form']['input'][] = array(
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields_form[2] = array('form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Technical information - Simple mode'),
|
||||
'image' => '../img/admin/affiliation.png'
|
||||
),
|
||||
'help' => true,
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Include:'),
|
||||
'name' => 'http_referer_like',
|
||||
'cols' => 40,
|
||||
'rows' => 1,
|
||||
'h3' => $this->l('HTTP referrer')
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Exclude:'),
|
||||
'name' => 'http_referer_like_not',
|
||||
'cols' => 40,
|
||||
'rows' => 1
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Include:'),
|
||||
'name' => 'request_uri_like',
|
||||
'cols' => 40,
|
||||
'rows' => 1,
|
||||
'h3' => $this->l('Request Uri')
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Exclude:'),
|
||||
'name' => 'request_uri_like_not',
|
||||
'cols' => 40,
|
||||
'rows' => 1
|
||||
)
|
||||
),
|
||||
'p' => $this->l('If you know how to use MySQL regular expressions, you can use the').'
|
||||
<a style="cursor: pointer; font-weight: bold;" onclick="$(\'#tracking_expert\').slideToggle();">'.$this->l('expert mode').'.</a>',
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
)
|
||||
));
|
||||
|
||||
$this->fields_form[3] = array('form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Technical information - Expert mode'),
|
||||
'image' => '../img/admin/affiliation.png'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Include:'),
|
||||
'name' => 'http_referer_regexp',
|
||||
'cols' => 40,
|
||||
'rows' => 1,
|
||||
'h3' => $this->l('HTTP referrer')
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Exclude:'),
|
||||
'name' => 'http_referer_regexp_not',
|
||||
'cols' => 40,
|
||||
'rows' => 1
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Include:'),
|
||||
'name' => 'request_uri_regexp',
|
||||
'cols' => 40,
|
||||
'rows' => 1,
|
||||
'h3' => $this->l('Request Uri')
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Exclude:'),
|
||||
'name' => 'request_uri_regexp_not',
|
||||
'cols' => 40,
|
||||
'rows' => 1
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
$this->multiple_fieldsets = true;
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$this->fields_value = array(
|
||||
'click_fee' => number_format((float)($this->getFieldValue($obj, 'click_fee')), 2),
|
||||
'base_fee' => number_format((float)($this->getFieldValue($obj, 'base_fee')), 2),
|
||||
'percent_fee' => number_format((float)($this->getFieldValue($obj, 'percent_fee')), 2),
|
||||
'http_referer_like' => str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_like'), ENT_COMPAT, 'UTF-8')),
|
||||
'http_referer_like_not' => str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'http_referer_like_not'), ENT_COMPAT, 'UTF-8')),
|
||||
'request_uri_like' => str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_like'), ENT_COMPAT, 'UTF-8')),
|
||||
'request_uri_like_not' => str_replace('\\', '\\\\', htmlentities($this->getFieldValue($obj, 'request_uri_like_not'), ENT_COMPAT, 'UTF-8'))
|
||||
);
|
||||
|
||||
//Added values of object Shop
|
||||
if ($obj->id)
|
||||
{
|
||||
$assos = array();
|
||||
$sql = 'SELECT `id_shop`, `'.pSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.pSQL($this->table).'_shop`
|
||||
WHERE `'.pSQL($this->identifier).'` = '.(int)$obj->id;
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$this->fields_value['shop'][$row['id_shop']][] = $row[$this->identifier];
|
||||
}
|
||||
|
||||
$this->tpl_form_vars = array('uri' => $uri);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function displayCalendar($action = null, $table = null, $identifier = null, $id = null)
|
||||
{
|
||||
return AdminStatsTabController::displayCalendarForm(array(
|
||||
'Calendar' => $this->l('Calendar'),
|
||||
'Day' => $this->l('Today'),
|
||||
'Month' => $this->l('Month'),
|
||||
'Year' => $this->l('Year')
|
||||
), $this->token, $action, $table, $identifier, $id);
|
||||
}
|
||||
|
||||
public function displaySettings()
|
||||
{
|
||||
if (!Tools::isSubmit('viewreferrer'))
|
||||
{
|
||||
$tpl = $this->context->smarty->createTemplate($this->tpl_folder.'form_settings.tpl');
|
||||
|
||||
$tpl->assign(array(
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'tracking_dt' => (int)Tools::getValue('tracking_dt', Configuration::get('TRACKING_DIRECT_TRAFFIC'))
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
private function enableCalendar()
|
||||
{
|
||||
return (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table) && !Tools::isSubmit('update'.$this->table));
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->enableCalendar())
|
||||
{
|
||||
$calendar_tab = new AdminStatsController();
|
||||
$calendar_tab->postProcess();
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitSettings'))
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
if (Configuration::updateValue('TRACKING_DIRECT_TRAFFIC', (int)Tools::getValue('tracking_dt')))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.Tools::getValue('token'));
|
||||
|
||||
if (ModuleGraph::getDateBetween() != Configuration::get('PS_REFERRERS_CACHE_LIKE') || Tools::isSubmit('submitRefreshCache'))
|
||||
Referrer::refreshCache();
|
||||
if (Tools::isSubmit('submitRefreshIndex'))
|
||||
Referrer::refreshIndex();
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function initView()
|
||||
{
|
||||
$this->toolbar_btn['save-calendar'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save Calendar')
|
||||
);
|
||||
|
||||
$referrer = new Referrer((int)Tools::getValue('id_referrer'));
|
||||
|
||||
$display_tab = array(
|
||||
'uniqs' => $this->l('Unique visitors'),
|
||||
'visitors' => $this->l('Visitors'),
|
||||
'visits' => $this->l('Visits'),
|
||||
'pages' => $this->l('Pages viewed'),
|
||||
'registrations' => $this->l('Registrations'),
|
||||
'orders' => $this->l('Orders'),
|
||||
'sales' => $this->l('Sales'),
|
||||
'reg_rate' => $this->l('Registration rate'),
|
||||
'order_rate' => $this->l('Order rate'),
|
||||
'click_fee' => $this->l('Click fee'),
|
||||
'base_fee' => $this->l('Base fee'),
|
||||
'percent_fee' => $this->l('Percent fee'));
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
'enable_calendar' => $this->enableCalendar(),
|
||||
'calendar_form' => $this->displayCalendar($this->action, $this->table, $this->identifier, (int)Tools::getValue($this->identifier)),
|
||||
'referrer' => new Referrer((int)Tools::getValue('id_referrer')),
|
||||
'display_tab' => $display_tab,
|
||||
'id_employee' => (int)$this->context->employee->id,
|
||||
'id_lang' => (int)$this->context->language->id
|
||||
);
|
||||
|
||||
return parent::initView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,17 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
public function initContent()
|
||||
{
|
||||
$this->toolbar_title = $this->l('Stats');
|
||||
|
||||
$this->toolbar_btn['save-calendar'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save Calendar')
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-settings'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save Settings')
|
||||
);
|
||||
|
||||
if ($this->display == 'view')
|
||||
{
|
||||
// Some controllers use the view action without an object
|
||||
@@ -59,7 +70,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
|
||||
public function displayCalendar()
|
||||
{
|
||||
return $this->displayCalendarForm(array(
|
||||
return self::displayCalendarForm(array(
|
||||
'Calendar' => $this->l('Calendar', 'AdminStatsTab'),
|
||||
'Day' => $this->l('Day', 'AdminStatsTab'),
|
||||
'Month' => $this->l('Month', 'AdminStatsTab'),
|
||||
@@ -67,19 +78,24 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
'From' => $this->l('From:', 'AdminStatsTab'),
|
||||
'To' => $this->l('To:', 'AdminStatsTab'),
|
||||
'Save' => $this->l('Save', 'AdminStatsTab')
|
||||
));
|
||||
), $this->token);
|
||||
}
|
||||
|
||||
public function displayCalendarForm($translations)
|
||||
public static function displayCalendarForm($translations, $token, $action = null, $table = null, $identifier = null, $id = null)
|
||||
{
|
||||
$tpl = $this->context->smarty->createTemplate('stats/calendar.tpl');
|
||||
$context = Context::getContext();
|
||||
$tpl = $context->smarty->createTemplate('stats/calendar.tpl');
|
||||
|
||||
$tpl->assign(array(
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'token' => $token,
|
||||
'action' => $action,
|
||||
'table' => $table,
|
||||
'identifier' => $identifier,
|
||||
'id' => $id,
|
||||
'translations' => $translations,
|
||||
'datepickerFrom' => Tools::getValue('datepickerFrom', $this->context->employee->stats_date_from),
|
||||
'datepickerTo' => Tools::getValue('datepickerTo', $this->context->employee->stats_date_to)
|
||||
'datepickerFrom' => Tools::getValue('datepickerFrom', $context->employee->stats_date_from),
|
||||
'datepickerTo' => Tools::getValue('datepickerTo', $context->employee->stats_date_to)
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
|
||||
Reference in New Issue
Block a user