本文整理汇总了PHP中Referrer类的典型用法代码示例。如果您正苦于以下问题:PHP Referrer类的具体用法?PHP Referrer怎么用?PHP Referrer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Referrer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: log
static function log($referrerUrl, $page) {
$isExternal = (
strpos($referrerUrl,Director::baseURL()) === FALSE
);
$referrer = new Referrer();
$referrer->URL = $referrerUrl;
$referrer->PageID = $page->ID;
$referrer->IsExternal = $isExternal;
$referrer->write();
}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:11,代码来源:Referrer.php
示例2: add
public function add($autodate = true, $nullValues = false)
{
if ($result = parent::add($autodate, $nullValues)) {
Referrer::cacheNewSource($this->id);
}
return $result;
}
开发者ID:nmardones,项目名称:PrestaShop,代码行数:7,代码来源:ConnectionsSource.php
示例3: displayAccount
public function displayAccount()
{
global $smarty, $cookie;
if (!isset($cookie->stats_date_from)) {
$cookie->stats_date_from = date('Y-m-d');
}
if (!isset($cookie->stats_date_to)) {
$cookie->stats_date_to = date('Y-m-t');
}
$fakeEmployee = new Employee();
$fakeEmployee->stats_date_from = $cookie->stats_date_from;
$fakeEmployee->stats_date_to = $cookie->stats_date_to;
Referrer::refreshCache(array(array('id_referrer' => intval($cookie->tracking_id))), $fakeEmployee);
$referrer = new Referrer(intval($cookie->tracking_id));
$smarty->assign('referrer', $referrer);
$smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from);
$smarty->assign('datepickerTo', $fakeEmployee->stats_date_to);
$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'), 'base_fee' => $this->l('Base fee'), 'percent_fee' => $this->l('Percent fee'), 'click_fee' => $this->l('Click fee'), 'sales' => $this->l('Sales'), 'cart' => $this->l('Average cart'), 'reg_rate' => $this->l('Registration rate'), 'order_rate' => $this->l('Order rate'));
$smarty->assign('displayTab', $displayTab);
$products = Product::getSimpleProducts(intval($cookie->id_lang));
$productsArray = array();
foreach ($products as $product) {
$productsArray[] = $product['id_product'];
}
$echo = '
<script type="text/javascript" src="../../js/jquery/datepicker/ui/i18n/ui.datepicker-' . Db::getInstance()->getValue('SELECT iso_code FROM ' . _DB_PREFIX_ . 'lang WHERE `id_lang` = ' . intval($cookie->id_lang)) . '.js"></script>
<script type="text/javascript">
$("#datepickerFrom").datepicker({
prevText:"",
nextText:"",
dateFormat:"yy-mm-dd"});
$("#datepickerTo").datepicker({
prevText:"",
nextText:"",
dateFormat:"yy-mm-dd"});
function updateValues()
{
$.getJSON("stats.php",{ajaxProductFilter:1,id_referrer:' . $referrer->id . ',token:"' . $cookie->tracking_passwd . '",id_product:0},
function(j) {';
foreach ($displayTab as $key => $value) {
$echo .= '$("#' . $key . '").html(j[0].' . $key . ');';
}
$echo .= ' }
)
}
var productIds = new Array(\'' . implode('\',\'', $productsArray) . '\');
var referrerStatus = new Array();
function newProductLine(id_referrer, result, color)
{
return \'\'+
\'<tr id="trprid_\'+id_referrer+\'_\'+result.id_product+\'" style="background-color: rgb(\'+color+\', \'+color+\', \'+color+\');">\'+
\' <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>\'+
\'</tr>\';
}
function showProductLines()
{
var irow = 0;
for (var i = 0; i < productIds.length; ++i)
$.getJSON("stats.php",{ajaxProductFilter:1,token:"' . $cookie->tracking_passwd . '",id_referrer:' . $referrer->id . ',id_product:productIds[i]},
function(result) {
var newLine = newProductLine(' . $referrer->id . ', result[0], (irow++%2 ? 204 : 238));
$(newLine).hide().insertBefore($(\'#trid_dummy\')).fadeIn();
}
);
}
</script>';
$echo2 = '
<script type="text/javascript">
updateValues();
//showProductLines();
</script>';
return $this->display(__FILE__, 'header.tpl') . $echo . $this->display(__FILE__, 'account.tpl') . $echo2;
}
开发者ID:vincent,项目名称:theinvertebrates,代码行数:90,代码来源:trackingfront.php
示例4: viewcustomer
public function viewcustomer()
{
global $currentIndex, $cookie, $link;
$irow = 0;
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
$defaultLanguage = (int) $configurations['PS_LANG_DEFAULT'];
$defaultCurrency = (int) $configurations['PS_CURRENCY_DEFAULT'];
if (!($customer = $this->loadObject())) {
return;
}
$customerStats = $customer->getStats();
$addresses = $customer->getAddresses($defaultLanguage);
$products = $customer->getBoughtProducts();
$discounts = Discount::getCustomerDiscounts($defaultLanguage, (int) $customer->id, false, false);
$orders = Order::getCustomerOrders((int) $customer->id, true);
$carts = Cart::getCustomerCarts((int) $customer->id);
$groups = $customer->getGroups();
$messages = CustomerThread::getCustomerMessages((int) $customer->id);
$referrers = Referrer::getReferrers((int) $customer->id);
if ($totalCustomer = Db::getInstance()->getValue('SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = ' . $customer->id . ' AND valid = 1')) {
Db::getInstance()->getValue('SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 GROUP BY id_customer HAVING SUM(total_paid_real) > ' . $totalCustomer);
$countBetterCustomers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
} else {
$countBetterCustomers = '-';
}
echo '
<fieldset style="width:400px;float: left"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
<span style="font-weight: bold; font-size: 14px;">' . $customer->firstname . ' ' . $customer->lastname . '</span>
<img src="../img/admin/' . ($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')) . '.gif" style="margin-bottom: 5px" /><br />
<a href="mailto:' . $customer->email . '" style="text-decoration: underline; color: blue">' . $customer->email . '</a><br /><br />
' . $this->l('ID:') . ' ' . sprintf('%06d', $customer->id) . '<br />
' . $this->l('Registration date:') . ' ' . Tools::displayDate($customer->date_add, (int) $cookie->id_lang, true) . '<br />
' . $this->l('Last visit:') . ' ' . ($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], (int) $cookie->id_lang, true) : $this->l('never')) . '<br />
' . ($countBetterCustomers != '-' ? $this->l('Rank: #') . ' ' . (int) $countBetterCustomers . '<br />' : '') . '
</fieldset>
<fieldset style="width:300px;float:left;margin-left:50px">
<div style="float: right">
<a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a>
</div>
' . $this->l('Newsletter:') . ' ' . ($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Opt-in:') . ' ' . ($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Age:') . ' ' . $customerStats['age'] . ' ' . (!empty($customer->birthday['age']) ? '(' . Tools::displayDate($customer->birthday, (int) $cookie->id_lang) . ')' : $this->l('unknown')) . '<br /><br />
' . $this->l('Last update:') . ' ' . Tools::displayDate($customer->date_upd, (int) $cookie->id_lang, true) . '<br />
' . $this->l('Status:') . ' ' . ($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />');
if ($customer->isGuest()) {
echo '
<div>
' . $this->l('This customer is registered as') . ' <b>' . $this->l('guest') . '</b>';
if (!Customer::customerExists($customer->email)) {
echo '
<form method="POST" action="index.php?tab=AdminCustomers&id_customer=' . (int) $customer->id . '&token=' . Tools::getAdminTokenLite('AdminCustomers') . '">
<input type="hidden" name="id_lang" value="' . (int) (sizeof($orders) ? $orders[0]['id_lang'] : Configuration::get('PS_LANG_DEFAULT')) . '" />
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="' . $this->l('Transform to customer') . '" /></p>
' . $this->l('This feature generates a random password and sends an e-mail to the customer') . '</form>';
} else {
echo '</div><div><b style="color:red;">' . $this->l('A registered customer account exists with the same email address') . '</b>';
}
echo '
</div>
';
}
echo '
</fieldset>
<div class="clear"> </div>';
echo '<fieldset style="height:190px"><legend><img src="../img/admin/cms.gif" /> ' . $this->l('Add a private note') . '</legend>
<p>' . $this->l('This note will be displayed to all the employees but not to the customer.') . '</p>
<form action="ajax.php" method="post" onsubmit="saveCustomerNote();return false;" id="customer_note">
<textarea name="note" id="noteContent" style="width:600px;height:100px" onkeydown="$(\'#submitCustomerNote\').removeAttr(\'disabled\');">' . Tools::htmlentitiesUTF8($customer->note) . '</textarea><br />
<input type="submit" id="submitCustomerNote" class="button" value="' . $this->l(' Save ') . '" style="float:left;margin-top:5px" disabled="disabled" />
<span id="note_feedback" style="float:left;margin:10px 0 0 10px"></span>
</form>
</fieldset>
<div class="clear"> </div>
<script type="text/javascript">
function saveCustomerNote()
{
$("#note_feedback").html("<img src=\\"../img/loader.gif\\" />").show();
var noteContent = $("#noteContent").val();
$.post("ajax.php", {submitCustomerNote:1,id_customer:' . (int) $customer->id . ',note:noteContent}, function (r) {
$("#note_feedback").html("").hide();
if (r == "ok")
{
$("#note_feedback").html("<b style=\\"color:green\\">' . addslashes($this->l('Your note has been saved')) . '</b>").fadeIn(400);
$("#submitCustomerNote").attr("disabled", "disabled");
}
else if (r == "error:validation")
$("#note_feedback").html("<b style=\\"color:red\\">' . addslashes($this->l('Error: your note is not valid')) . '</b>").fadeIn(400);
else if (r == "error:update")
$("#note_feedback").html("<b style=\\"color:red\\">' . addslashes($this->l('Error: cannot save your note')) . '</b>").fadeIn(400);
$("#note_feedback").fadeOut(3000);
});
}
</script>';
echo '<h2>' . $this->l('Messages') . ' (' . sizeof($messages) . ')</h2>';
if (sizeof($messages)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('Status') . '</th>
<th class="center">' . $this->l('Message') . '</th>
//.........这里部分代码省略.........
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:AdminCustomers.php
示例5: getAjaxProduct
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);
$stats_visits = $referrer->getStatsVisits($id_product, $employee);
$registrations = $referrer->getRegistrations($id_product, $employee);
$stats_sales = $referrer->getStatsSales($id_product, $employee);
// If it's a product and it has no visits nor orders
if ((int) $id_product && !$stats_visits['visits'] && !$stats_sales['orders']) {
exit;
}
$json_array = array('id_product' => (int) $product->id, 'product_name' => addslashes($product->name), 'uniqs' => (int) $stats_visits['uniqs'], 'visitors' => (int) $stats_visits['visitors'], 'visits' => (int) $stats_visits['visits'], 'pages' => (int) $stats_visits['pages'], 'registrations' => (int) $registrations, 'orders' => (int) $stats_sales['orders'], 'sales' => Tools::displayPrice($stats_sales['sales'], $currency), 'cart' => Tools::displayPrice((int) $stats_sales['orders'] ? $stats_sales['sales'] / (int) $stats_sales['orders'] : 0, $currency), 'reg_rate' => number_format((int) $stats_visits['uniqs'] ? (int) $registrations / (int) $stats_visits['uniqs'] : 0, 4, '.', ''), 'order_rate' => number_format((int) $stats_visits['uniqs'] ? (int) $stats_sales['orders'] / (int) $stats_visits['uniqs'] : 0, 4, '.', ''), 'click_fee' => Tools::displayPrice((int) $stats_visits['visits'] * $referrer->click_fee, $currency), 'base_fee' => Tools::displayPrice($stats_sales['orders'] * $referrer->base_fee, $currency), 'percent_fee' => Tools::displayPrice($stats_sales['sales'] * $referrer->percent_fee / 100, $currency));
die('[' . Tools::jsonEncode($json_array) . ']');
}
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:16,代码来源:Referrer.php
示例6: viewcustomer
public function viewcustomer()
{
global $currentIndex, $cookie;
$irow = 0;
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
$defaultLanguage = intval($configurations['PS_LANG_DEFAULT']);
$defaultCurrency = intval($configurations['PS_CURRENCY_DEFAULT']);
$customer = $this->loadObject();
$customerStats = $customer->getStats();
$addresses = $customer->getAddresses($defaultLanguage);
$discounts = Discount::getCustomerDiscounts($defaultLanguage, $customer->id, false, false);
$orders = Order::getCustomerOrders($customer->id);
$carts = Cart::getCustomerCarts($customer->id);
$groups = $customer->getGroups();
$referrers = Referrer::getReferrers($customer->id);
echo '
<div style="float: left">
<fieldset style="width: 400px"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
<span style="font-weight: bold; font-size: 14px;">' . $customer->firstname . ' ' . $customer->lastname . '</span>
<img src="../img/admin/' . ($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')) . '.gif" style="margin-bottom: 5px" /><br />
<a href="mailto:' . $customer->email . '" style="text-decoration: underline; color: blue">' . $customer->email . '</a><br /><br />
' . $this->l('ID:') . ' ' . sprintf('%06d', $customer->id) . '<br />
' . $this->l('Registration date:') . ' ' . Tools::displayDate($customer->date_add, intval($cookie->id_lang), true) . '<br />
' . $this->l('Last visit:') . ' ' . ($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], intval($cookie->id_lang), true) : $this->l('never')) . '
</fieldset>
</div>
<div style="float: left; margin-left: 50px">
<fieldset style="width: 300px"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
' . $this->l('Newsletter:') . ' ' . ($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Opt-in:') . ' ' . ($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Age:') . ' ' . $customerStats['age'] . ' ' . (!empty($customer->birthday['age']) ? '(' . Tools::displayDate($customer->birthday, intval($cookie->id_lang)) . ')' : $this->l('unknown')) . '<br /><br />
' . $this->l('Last update:') . ' ' . Tools::displayDate($customer->date_upd, intval($cookie->id_lang), true) . '<br />
' . $this->l('Status:') . ' ' . ($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '
</fieldset>
</div>
<div class="clear"> </div>';
// display hook specified to this page : AdminCustomers
if (($hook = Module::hookExec('adminCustomers', array('id_customer' => $customer->id))) !== false) {
echo '<div>' . $hook . '</div>';
}
echo '<h2>' . $this->l('Groups') . ' (' . sizeof($groups) . ')</h2>';
if ($groups and sizeof($groups)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('ID') . '</th>
<th class="center">' . $this->l('Name') . '</th>
<th class="center">' . $this->l('Actions') . '</th>
</tr>';
$tokenGroups = Tools::getAdminToken('AdminGroups' . intval(Tab::getIdFromClassName('AdminGroups')) . intval($cookie->id_employee));
foreach ($groups as $group) {
$objGroup = new Group($group);
echo '
<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminGroups&id_group=' . $objGroup->id . '&viewgroup&token=' . $tokenGroups . '\'">
<td class="center">' . $objGroup->id . '</td>
<td>' . $objGroup->name[$defaultLanguage] . '</td>
<td align="center"><a href="?tab=AdminGroups&id_group=' . $objGroup->id . '&viewgroup&token=' . $tokenGroups . '"><img src="../img/admin/details.gif" /></a></td>
</tr>';
}
echo '
</table>';
}
echo '<div class="clear"> </div>';
echo '<h2>' . $this->l('Orders') . ' (' . sizeof($orders) . ')</h2>';
if ($orders and sizeof($orders)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('ID') . '</th>
<th class="center">' . $this->l('Date') . '</th>
<th class="center">' . $this->l('Quantity') . '</th>
<th class="center">' . $this->l('Total') . '</th>
<th class="center">' . $this->l('Payment') . '</th>
<th class="center">' . $this->l('State') . '</th>
<th class="center">' . $this->l('Actions') . '</th>
</tr>';
$tokenOrders = Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee));
foreach ($orders as $order) {
echo '
<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order=' . $order['id_order'] . '&vieworder&token=' . $tokenOrders . '\'">
<td class="center">' . sprintf('%06d', $order['id_order']) . '</td>
<td>' . Tools::displayDate($order['date_add'], intval($cookie->id_lang), true) . '</td>
<td align="right">' . $order['nb_products'] . '</td>
<td align="right">' . Tools::displayPrice($order['total_paid'], new Currency(intval($order['id_currency']))) . '</td>
<td>' . $order['payment'] . '</td>
<td>' . $order['order_state'] . '</td>
<td align="center"><a href="?tab=AdminOrders&id_order=' . $order['id_order'] . '&vieworder&token=' . $tokenOrders . '"><img src="../img/admin/details.gif" /></a></td>
</tr>';
}
echo '
</table>';
} else {
echo $customer->firstname . ' ' . $customer->lastname . ' ' . $this->l('has placed no orders yet');
}
echo '<div class="clear"> </div>
<h2>' . $this->l('Addresses') . ' (' . sizeof($addresses) . ')</h2>';
if (sizeof($addresses)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
//.........这里部分代码省略.........
开发者ID:redb,项目名称:prestashop,代码行数:101,代码来源:AdminCustomers.php
示例7: renderView
//.........这里部分代码省略.........
$sql = 'SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = %d AND valid = 1';
if ($total_customer = Db::getInstance()->getValue(sprintf($sql, $customer->id))) {
$sql = 'SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 AND id_customer != ' . (int) $customer->id . ' GROUP BY id_customer HAVING SUM(total_paid_real) > %d';
Db::getInstance()->getValue(sprintf($sql, (int) $total_customer));
$count_better_customers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
} else {
$count_better_customers = '-';
}
$orders = Order::getCustomerOrders($customer->id, true);
$total_orders = count($orders);
for ($i = 0; $i < $total_orders; $i++) {
$orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
$orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int) $orders[$i]['id_currency']));
}
$messages = CustomerThread::getCustomerMessages((int) $customer->id);
$total_messages = count($messages);
for ($i = 0; $i < $total_messages; $i++) {
$messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
$messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
if (isset(self::$meaning_status[$messages[$i]['status']])) {
$messages[$i]['status'] = self::$meaning_status[$messages[$i]['status']];
}
}
$groups = $customer->getGroups();
$total_groups = count($groups);
for ($i = 0; $i < $total_groups; $i++) {
$group = new Group($groups[$i]);
$groups[$i] = array();
$groups[$i]['id_group'] = $group->id;
$groups[$i]['name'] = $group->name[$this->default_form_language];
}
$total_ok = 0;
$orders_ok = array();
$orders_ko = array();
foreach ($orders as $order) {
if (!isset($order['order_state'])) {
$order['order_state'] = $this->l('There is no status defined for this order.');
}
if ($order['valid']) {
$orders_ok[] = $order;
$total_ok += $order['total_paid_real_not_formated'];
} else {
$orders_ko[] = $order;
}
}
$products = $customer->getBoughtProducts();
$carts = Cart::getCustomerCarts($customer->id);
$total_carts = count($carts);
for ($i = 0; $i < $total_carts; $i++) {
$cart = new Cart((int) $carts[$i]['id_cart']);
$this->context->cart = $cart;
$summary = $cart->getSummaryDetails();
$currency = new Currency((int) $carts[$i]['id_currency']);
$carrier = new Carrier((int) $carts[$i]['id_carrier']);
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
$carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
$carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
$carts[$i]['name'] = $carrier->name;
}
$sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
FROM ' . _DB_PREFIX_ . 'cart_product cp
JOIN ' . _DB_PREFIX_ . 'cart c ON (c.id_cart = cp.id_cart)
JOIN ' . _DB_PREFIX_ . 'product p ON (cp.id_product = p.id_product)
WHERE c.id_customer = ' . (int) $customer->id . '
AND NOT EXISTS (
SELECT 1
FROM ' . _DB_PREFIX_ . 'orders o
JOIN ' . _DB_PREFIX_ . 'order_detail od ON (o.id_order = od.id_order)
WHERE product_id = cp.id_product AND o.valid = 1 AND o.id_customer = ' . (int) $customer->id . '
)';
$interested = Db::getInstance()->executeS($sql);
$total_interested = count($interested);
for ($i = 0; $i < $total_interested; $i++) {
$product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']);
if (!Validate::isLoadedObject($product)) {
continue;
}
$interested[$i]['url'] = $this->context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $this->default_form_language), null, null, $interested[$i]['cp_id_shop']);
$interested[$i]['id'] = (int) $product->id;
$interested[$i]['name'] = Tools::htmlentitiesUTF8($product->name);
}
$emails = $customer->getLastEmails();
$connections = $customer->getLastConnections();
if (!is_array($connections)) {
$connections = array();
}
$total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++) {
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
}
$referrers = Referrer::getReferrers($customer->id);
$total_referrers = count($referrers);
for ($i = 0; $i < $total_referrers; $i++) {
$referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'], null, true);
}
$customerLanguage = new Language($customer->id_lang);
$shop = new Shop($customer->id_shop);
$this->tpl_view_vars = array('customer' => $customer, 'gender' => $gender, 'gender_image' => $gender_image, 'registration_date' => Tools::displayDate($customer->date_add, null, true), 'customer_stats' => $customer_stats, 'last_visit' => Tools::displayDate($customer_stats['last_visit'], null, true), 'count_better_customers' => $count_better_customers, 'shop_is_feature_active' => Shop::isFeatureActive(), 'name_shop' => $shop->name, 'customer_birthday' => Tools::displayDate($customer->birthday), 'last_update' => Tools::displayDate($customer->date_upd, null, true), 'customer_exists' => Customer::customerExists($customer->email), 'id_lang' => $customer->id_lang, 'customerLanguage' => $customerLanguage, 'customer_note' => Tools::htmlentitiesUTF8($customer->note), 'messages' => $messages, 'groups' => $groups, 'orders' => $orders, 'orders_ok' => $orders_ok, 'orders_ko' => $orders_ko, 'total_ok' => Tools::displayPrice($total_ok, $this->context->currency->id), 'products' => $products, 'addresses' => $customer->getAddresses($this->default_form_language), 'discounts' => CartRule::getCustomerCartRules($this->default_form_language, $customer->id, false, false), 'carts' => $carts, 'interested' => $interested, 'emails' => $emails, 'connections' => $connections, 'referrers' => $referrers, 'show_toolbar' => true);
return parent::renderView();
}
开发者ID:nmardones,项目名称:PrestaShop,代码行数:101,代码来源:AdminCustomersController.php
示例8: postProcess
public function postProcess()
{
global $currentIndex;
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($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();
}
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:22,代码来源:AdminReferrers.php
示例9: displayAccount
public function displayAccount()
{
if (!isset($this->context->cookie->stats_date_from)) {
$this->context->cookie->stats_date_from = date('Y-m-01');
}
if (!isset($this->context->cookie->stats_date_to)) {
$this->context->cookie->stats_date_to = date('Y-m-t');
}
Referrer::refreshCache(array(array('id_referrer' => (int) $this->context->cookie->tracking_id)));
$referrer = new Referrer((int) $this->context->cookie->tracking_id);
$this->smarty->assign('referrer', $referrer);
$this->smarty->assign('datepickerFrom', $this->context->cookie->stats_date_from);
$this->smarty->assign('datepickerTo', $this->context->cookie->stats_date_to);
$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'), 'base_fee' => $this->l('Base fee'), 'percent_fee' => $this->l('Percent fee'), 'click_fee' => $this->l('Click fee'), 'sales' => $this->l('Sales'), 'cart' => $this->l('Average cart'), 'reg_rate' => $this->l('Registration rate'), 'order_rate' => $this->l('Order rate'));
$this->smarty->assign('displayTab', $display_tab);
$products = Product::getSimpleProducts($this->context->language->id);
$products_array = array();
foreach ($products as $product) {
$products_array[] = $product['id_product'];
}
$js_files = array();
$jquery_files = Media::getJqueryPath();
if (is_array($jquery_files)) {
$js_files = array_merge($js_files, $jquery_files);
} else {
$js_files[] = $jquery_files;
}
$jquery_ui_files = Media::getJqueryUIPath('ui.datepicker', 'base', true);
$js_files = array_merge($js_files, $jquery_ui_files['js']);
$css_files = $jquery_ui_files['css'];
$js_files[] = $this->_path . 'js/trackingfront.js';
$js_tpl_var = array('product_ids' => implode(', ', $products_array), 'referrer_id' => $referrer->id, 'token' => $this->context->cookie->tracking_passwd, 'display_tab' => implode('", "', array_keys($display_tab)));
$this->smarty->assign(array('js' => $js_files, 'css' => $css_files, 'js_tpl_var' => $js_tpl_var));
return $this->display(__FILE__, 'views/templates/front/account.tpl');
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:35,代码来源:trackingfront.php
示例10: postProcess
public function postProcess()
{
if ($this->enableCalendar()) {
// Warning, instantiating a controller here changes the controller in the Context...
$calendar_tab = new AdminStatsController();
$calendar_tab->postProcess();
// ...so we set it back to the correct one here
$this->context->controller = $this;
}
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();
}
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:24,代码来源:AdminReferrersController.php
示例11: header
include "../class.mysqldb.php";
include "../class.referrer.php";
include "../class.shoutbox.php";
include "../class.news.php";
include "../class.patient.php";
include "../class.anesthesiologist.php";
include "../class.site.php";
include "../class.kbase.php";
include "../class.nurse.php";
include "../initsession.php";
$db = new MySQLDB;
$conn = $db->connid();
$db->selectdb("openaims");
$referrer = new Referrer;
$anes = new Anes;
$nurse = new Nurse;
$patient = new Patient;
$site = new Site;
$kbase = new Kbase;
$shoutbox = new Shoutbox;
if (!$site->apply_iprestriction($_SERVER["REMOTE_ADDR"],"DSS")) {
session_destroy();
header("location: warning.html");
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
开发者ID:BackupTheBerlios,项目名称:chits-svn,代码行数:30,代码来源:index.php
示例12: getAjaxProduct
public static function getAjaxProduct($id_referrer, $id_product, $employee = null)
{
$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);
// If it's a product and it has no visits nor orders
if ((int) $id_product and !$statsVisits['visits'] and !$statsSales['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) . '}]');
}
开发者ID:greench,项目名称:prestashop,代码行数:30,代码来源:Referrer.php
示例13: getAjaxProduct
public static function getAjaxProduct($id_referrer, $id_product, $employee = null)
{
$product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'));
$currency = new Currency(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);
// If it's a product and it has no visits nor orders
if (intval($id_product) and !$statsVisits['visits'] and !$statsSales['orders']) {
exit;
}
$jsonArray = array();
$jsonArray[] = 'id_product:\'' . intval($product->id) . '\'';
$jsonArray[] = 'product_name:\'' . addslashes($product->name) . '\'';
$jsonArray[] = 'uniqs:\'' . intval($statsVisits['uniqs']) . '\'';
$jsonArray[] = 'visitors:\'' . intval($statsVisits['visitors']) . '\'';
$jsonArray[] = 'visits:\'' . intval($statsVisits['visits']) . '\'';
$jsonArray[] = 'pages:\'' . intval($statsVisits['pages']) . '\'';
$jsonArray[] = 'registrations:\'' . intval($registrations) . '\'';
$jsonArray[] = 'orders:\'' . intval($statsSales['orders']) . '\'';
$jsonArray[] = 'sales:\'' . Tools::displayPrice($statsSales['sales'], $currency) . '\'';
$jsonArray[] = 'cart:\'' . Tools::displayPrice(intval($statsSales['orders']) ? $statsSales['sales'] / intval($statsSales['orders']) : 0, $currency) . '\'';
$jsonArray[] = 'reg_rate:\'' . number_format(intval($statsVisits['uniqs']) ? intval($registrations) / intval($statsVisits['uniqs']) : 0, 4, '.', '') . '\'';
$jsonArray[] = 'order_rate:\'' . number_format(intval($statsVisits['uniqs']) ? intval($statsSales['orders']) / intval($statsVisits['uniqs']) : 0, 4, '.', '') . '\'';
$jsonArray[] = 'click_fee:\'' . Tools::displayPrice(intval($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) . '}]');
}
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:30,代码来源:Referrer.php
示例14: init
function init() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
$request = $this->getRequest();
if($request) {
$referrerUrl = $request->getHeader('Referer');
if($referrerUrl) {
Referrer::log($referrerUrl, $this);
}
}
}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:15,代码来源:Page.php
注:本文中的Referrer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论