コード例 #1
0
/**
 * 
 * @param piwikanalyticsjs $module
 * @return boolean
 */
function upgrade_module_0_6_5($module)
{
    Configuration::updateValue('PIWIK_COOKIE_DOMAIN', '*.' . str_replace('www.', '', Tools::getShopDomain()));
    Configuration::updateValue('PIWIK_SET_DOMAINS', Tools::getShopDomain());
    Configuration::updateValue('PIWIK_DNT', 1);
    Configuration::updateValue('PIWIK_PROXY_SCRIPT', str_replace("http://", '', piwikanalyticsjs::getModuleLink($module->name, 'piwik')));
    return true;
}
コード例 #2
0
 /**
  * @see Module::l
  */
 private static function l($string, $specific = false)
 {
     if (version_compare(_PS_VERSION_, '1.5.0.13', "<=")) {
         return PKHelper::$_module->l($string, $specific ? $specific : 'pkhelper');
     }
     return Translate::getModuleTranslation('piwikanalyticsjs', $string, $specific ? $specific : 'pkhelper');
     // the following lines are need for the translation to work properly
     // $this->l('I need Site ID and Auth Token before i can get your image tracking code')
     // $this->l('E-commerce is not active for your site in piwik!, you can enable it in the advanced settings on this page')
     // $this->l('Site search is not active for your site in piwik!, you can enable it in the advanced settings on this page')
     // $this->l('Unable to connect to api %s')
     // $this->l('E-commerce is not active for your site in piwik!')
     // $this->l('Site search is not active for your site in piwik!')
     // $this->l('A password is required for method PKHelper::getTokenAuth()!')
 }
コード例 #3
0
/**
 * 
 * @param piwikanalyticsjs $module
 * @return boolean
 */
function upgrade_module_0_8($module)
{
    $return = $module->registerHook('displayMaintenance');
    return $return;
}
コード例 #4
0
 public function hookOrderConfirmation($params)
 {
     if ((int) Configuration::get(PKHelper::CPREFIX . 'SITEID') <= 0) {
         return "";
     }
     $order = $params['objOrder'];
     if (Validate::isLoadedObject($order)) {
         $this->__setConfigDefault();
         $this->context->smarty->assign(PKHelper::CPREFIX . 'ORDER', TRUE);
         $this->context->smarty->assign(PKHelper::CPREFIX . 'CART', FALSE);
         $smarty_ad = array();
         foreach ($params['objOrder']->getProductsDetail() as $value) {
             $smarty_ad[] = array('SKU' => $this->parseProductSku($value['product_id'], isset($value['product_attribute_id']) ? $value['product_attribute_id'] : FALSE, isset($value['product_reference']) ? $value['product_reference'] : FALSE), 'NAME' => $value['product_name'], 'CATEGORY' => $this->get_category_names_by_product($value['product_id'], FALSE), 'PRICE' => $this->currencyConvertion(array('price' => isset($value['total_price_tax_incl']) ? floatval($value['total_price_tax_incl']) : (isset($value['total_price_tax_incl']) ? floatval($value['total_price_tax_incl']) : 0.0), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)), 'QUANTITY' => $value['product_quantity']);
         }
         $this->context->smarty->assign(PKHelper::CPREFIX . 'ORDER_PRODUCTS', $smarty_ad);
         if (isset($params['objOrder']->total_paid_tax_incl) && isset($params['objOrder']->total_paid_tax_excl)) {
             $tax = $params['objOrder']->total_paid_tax_incl - $params['objOrder']->total_paid_tax_excl;
         } else {
             if (isset($params['objOrder']->total_products_wt) && isset($params['objOrder']->total_products)) {
                 $tax = $params['objOrder']->total_products_wt - $params['objOrder']->total_products;
             } else {
                 $tax = 0.0;
             }
         }
         $ORDER_DETAILS = array('order_id' => $params['objOrder']->id, 'order_total' => $this->currencyConvertion(array('price' => floatval(isset($params['objOrder']->total_paid_tax_incl) ? $params['objOrder']->total_paid_tax_incl : (isset($params['objOrder']->total_paid) ? $params['objOrder']->total_paid : 0.0)), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)), 'order_sub_total' => $this->currencyConvertion(array('price' => floatval($params['objOrder']->total_products_wt), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)), 'order_tax' => $this->currencyConvertion(array('price' => floatval($tax), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)), 'order_shipping' => $this->currencyConvertion(array('price' => floatval(isset($params['objOrder']->total_shipping_tax_incl) ? $params['objOrder']->total_shipping_tax_incl : (isset($params['objOrder']->total_shipping) ? $params['objOrder']->total_shipping : 0.0)), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)), 'order_discount' => $this->currencyConvertion(array('price' => isset($params['objOrder']->total_discounts_tax_incl) ? $params['objOrder']->total_discounts_tax_incl > 0 ? floatval($params['objOrder']->total_discounts_tax_incl) : false : (isset($params['objOrder']->total_discounts) ? $params['objOrder']->total_discounts > 0 ? floatval($params['objOrder']->total_discounts) : false : 0.0), 'conversion_rate' => isset($params['objOrder']->conversion_rate) ? $params['objOrder']->conversion_rate : 0.0)));
         $this->context->smarty->assign(PKHelper::CPREFIX . 'ORDER_DETAILS', $ORDER_DETAILS);
         // avoid double tracking on complete order.
         self::$_isOrder = TRUE;
         return $this->display(__FILE__, 'views/templates/hook/jstracking.tpl');
     }
 }