Пример #1
0
    $orderTrans['order_tax'] = $order->order_tax;
    $orderTrans['order_shipping'] = $order->order_shipping;
    $orderTrans['city'] = $billingaddresses->city;
    if (isset($billingaddresses->country_code)) {
        $orderTrans['state'] = $order_functions->getStateName($billingaddresses->state_code, $billingaddresses->country_code);
    }
    if (isset($billingaddresses->country_code)) {
        $orderTrans['country'] = $order_functions->getCountryName($billingaddresses->country_code);
    }
    // Collect data for google analytics
    // Initiallize variable
    $analyticsData = array();
    // Collect data to add transaction = order
    $analyticsData['addtrans'] = $orderTrans;
    // Start array to collect data to addItems
    $analyticsData['addItem'] = array();
    for ($k = 0; $k < count($orderitem); $k++) {
        $orderaddItem = array();
        $orderaddItem['order_id'] = $orderitem[$k]->order_id;
        $orderaddItem['product_number'] = $orderitem[$k]->order_item_sku;
        $orderaddItem['product_name'] = $orderitem[$k]->order_item_name;
        $orderaddItem['product_category'] = $model->getCategoryNameByProductId($orderitem[$k]->product_id);
        $orderaddItem['product_price'] = $orderitem[$k]->product_item_price;
        $orderaddItem['product_quantity'] = $orderitem[$k]->product_quantity;
        $analyticsData['addItem'][] = $orderaddItem;
    }
    $googleanalytics->placeTrans($analyticsData);
    $model->UpdateAnalytics_status($order->order_id);
} else {
    $googleanalytics->placeTrans();
}
Пример #2
0
if (count($sgportal) > 0) {
    $portal = $sgportal->shopper_group_portal;
}
$user = JFactory::getUser();
if ($task != 'loadProducts' && $task != "downloadProduct" && $task != "discountCalculator" && $task != "ajaxupload" && $task != 'getShippingrate' && $task != 'addtocompare' && $task != 'ajaxsearch' && $task != "Download" && $task != 'addtowishlist') {
    echo "<div id='redshopcomponent' class='redshop'>";
    if ($format != 'final' && $layout != 'receipt') {
        /*
         * get redSHOP Google Analytics Plugin is Enable?
         * If it is Disable than load Google Analytics From redSHOP
         */
        $isredGoogleAnalytics = JPluginHelper::isEnabled('system', 'redgoogleanalytics');
        if (!$isredGoogleAnalytics && GOOGLE_ANA_TRACKER_KEY != "") {
            require_once JPATH_COMPONENT . '/helpers/google_analytics.php';
            $google_ana = new googleanalytics();
            $anacode = $google_ana->placeTrans();
        }
    }
}
if (PORTAL_SHOP == 1) {
    if ($controller == 'product' && $productid > 0 && $user->id > 0) {
        $checkcid = $helper->getShopperGroupProductCategory($productid);
        if ($checkcid == true) {
            $controller = 'login';
            JRequest::setVar('view', 'login');
            JRequest::setVar('layout', 'portal');
            $app->enqueuemessage(JText::_('COM_REDSHOP_AUTHENTICATIONFAIL'));
        }
    } elseif ($controller == 'category' && $categoryid > 0 && $user->id > 0) {
        $checkcid = $helper->getShopperGroupCategory($categoryid);
        if ($checkcid == "") {