本文整理匯總了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;
}