本文整理汇总了PHP中Referrer::isAssociatedToShop方法的典型用法代码示例。如果您正苦于以下问题:PHP Referrer::isAssociatedToShop方法的具体用法?PHP Referrer::isAssociatedToShop怎么用?PHP Referrer::isAssociatedToShop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Referrer
的用法示例。
在下文中一共展示了Referrer::isAssociatedToShop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshCache
/**
* Refresh cache data of referrer statistics in referrer_shop table
*
* @param array $referrers
* @param int $employee
* @return true
*/
public static function refreshCache($referrers = null, $employee = null)
{
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 $shop_id) {
if (!$referrer->isAssociatedToShop($shop_id)) {
continue;
}
$stats_visits = $referrer->getStatsVisits(null, $employee);
$registrations = $referrer->getRegistrations(null, $employee);
$stats_sales = $referrer->getStatsSales(null, $employee);
Db::getInstance()->update('referrer_shop', array('cache_visitors' => (int) $stats_visits['uniqs'], 'cache_visits' => (int) $stats_visits['visits'], 'cache_pages' => (int) $stats_visits['pages'], 'cache_registrations' => (int) $registrations, 'cache_orders' => (int) $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), 'id_referrer = ' . (int) $referrer->id . ' AND id_shop = ' . (int) $shop_id);
}
}
Configuration::updateValue('PS_REFERRERS_CACHE_LIKE', ModuleGraph::getDateBetween($employee));
Configuration::updateValue('PS_REFERRERS_CACHE_DATE', date('Y-m-d H:i:s'));
return true;
}