本文整理汇总了PHP中Referrer::getStatsVisits方法的典型用法代码示例。如果您正苦于以下问题:PHP Referrer::getStatsVisits方法的具体用法?PHP Referrer::getStatsVisits怎么用?PHP Referrer::getStatsVisits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Referrer
的用法示例。
在下文中一共展示了Referrer::getStatsVisits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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) . '}]');
}
示例2: 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) . ']');
}
示例3: 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) . '}]');
}