本文整理汇总了PHP中Piwik_Site::isEcommerceEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site::isEcommerceEnabled方法的具体用法?PHP Piwik_Site::isEcommerceEnabled怎么用?PHP Piwik_Site::isEcommerceEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Site
的用法示例。
在下文中一共展示了Piwik_Site::isEcommerceEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setColumnsToDisplay
public function setColumnsToDisplay($columnsNames)
{
$newColumnsNames = array();
$goals = array();
$idSite = $this->getIdSite();
if ($idSite) {
$goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
$ecommerceGoal = array('idgoal' => Piwik_Archive::LABEL_ECOMMERCE_ORDER, 'name' => Piwik_Translate('Goals_EcommerceOrder'));
$site = new Piwik_Site($idSite);
//Case Ecommerce report table
if ($this->isEcommerce) {
$goals = array($ecommerceGoal);
} elseif ($site->isEcommerceEnabled()) {
$goals = array_merge(array($ecommerceGoal), $goals);
}
}
foreach ($columnsNames as $columnName) {
if (in_array($columnName, array('goal_%s_conversion_rate', 'goal_%s_nb_conversions', 'goal_%s_revenue_per_visit', 'goal_%s_revenue', 'goal_%s_avg_order_revenue', 'goal_%s_items'))) {
foreach ($goals as $goal) {
$idgoal = $goal['idgoal'];
// Columns names are escaped in smarty via | escape:'html'
$goal['name'] = Piwik_Common::unsanitizeInputValue($goal['name']);
if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal && !$this->isEcommerce) {
continue;
}
$name = Piwik_Translate($this->getColumnTranslation($columnName), $goal['name']);
$columnNameGoal = str_replace('%s', $idgoal, $columnName);
$this->setColumnTranslation($columnNameGoal, $name);
$this->setDynamicMetricDocumentation($columnName, $columnNameGoal, $goal['name'], $goal['idgoal']);
if (strpos($columnNameGoal, '_rate') === false && $this->processOnlyIdGoal == Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW) {
continue;
}
if (strstr($columnNameGoal, '_revenue') !== false) {
$this->columnsToRevenueFilter[] = $columnNameGoal;
} else {
$this->columnsToConversionFilter[] = $columnNameGoal;
}
$newColumnsNames[] = $columnNameGoal;
}
} else {
$newColumnsNames[] = $columnName;
}
}
parent::setColumnsToDisplay($newColumnsNames);
}
示例2: addMenus
function addMenus()
{
$idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
$goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
$mainGoalMenu = $this->getGoalCategoryName($idSite);
$site = new Piwik_Site($idSite);
if (count($goals) == 0) {
Piwik_AddMenu($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'addNewGoal', 'idGoal' => $site->isEcommerceEnabled() ? Piwik_Archive::LABEL_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
Piwik_AddMenu($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik_Archive::LABEL_ECOMMERCE_ORDER), true, 1);
}
Piwik_AddMenu($mainGoalMenu, 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal'));
} else {
Piwik_AddMenu($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'index', 'idGoal' => $site->isEcommerceEnabled() ? Piwik_Archive::LABEL_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
Piwik_AddMenu($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik_Archive::LABEL_ECOMMERCE_ORDER), true, 1);
}
Piwik_AddMenu($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), true, 2);
foreach ($goals as $goal) {
Piwik_AddMenu($mainGoalMenu, str_replace('%', '%%', Piwik_TranslationWriter::clean($goal['name'])), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal']));
}
}
}
示例3: array
function test_setDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps()
{
// test that they return default values
$defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
$this->assertEqual($defaultTimezone, 'UTC');
$defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
$this->assertEqual($defaultCurrency, 'USD');
$excludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
$this->assertEqual($excludedIps, '');
$excludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
$this->assertEqual($excludedQueryParameters, '');
// test that when not specified, defaults are set as expected
$idsite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'));
$site = new Piwik_Site($idsite);
$this->assertEqual($site->getTimezone(), 'UTC');
$this->assertEqual($site->getCurrency(), 'USD');
$this->assertEqual($site->getExcludedQueryParameters(), '');
$this->assertEqual($site->getExcludedIps(), '');
$this->assertEqual($site->isEcommerceEnabled(), false);
// set the global timezone and get it
$newDefaultTimezone = 'UTC+5.5';
Piwik_SitesManager_API::getInstance()->setDefaultTimezone($newDefaultTimezone);
$defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
$this->assertEqual($defaultTimezone, $newDefaultTimezone);
// set the default currency and get it
$newDefaultCurrency = 'EUR';
Piwik_SitesManager_API::getInstance()->setDefaultCurrency($newDefaultCurrency);
$defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
$this->assertEqual($defaultCurrency, $newDefaultCurrency);
// set the global IPs to exclude and get it
$newGlobalExcludedIps = '1.1.1.*,1.1.*.*,150.1.1.1';
Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($newGlobalExcludedIps);
$globalExcludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
$this->assertEqual($globalExcludedIps, $newGlobalExcludedIps);
// set the global URL query params to exclude and get it
$newGlobalExcludedQueryParameters = 'PHPSESSID,blabla, TesT';
// removed the space
$expectedGlobalExcludedQueryParameters = 'PHPSESSID,blabla,TesT';
Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($newGlobalExcludedQueryParameters);
$globalExcludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
$this->assertEqual($globalExcludedQueryParameters, $expectedGlobalExcludedQueryParameters);
// create a website and check that default currency and default timezone are set
// however, excluded IPs and excluded query Params are not returned
$idsite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'), $ecommerce = 1, '', '', $newDefaultTimezone);
$site = new Piwik_Site($idsite);
$this->assertEqual($site->getTimezone(), $newDefaultTimezone);
$this->assertEqual($site->getCreationDate()->toString(), date('Y-m-d'));
$this->assertEqual($site->getCurrency(), $newDefaultCurrency);
$this->assertEqual($site->getExcludedIps(), '');
$this->assertEqual($site->getExcludedQueryParameters(), '');
$this->assertEqual($site->isEcommerceEnabled(), true);
}