diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index e7dbd1bb088..88c82fd809d 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -115,7 +115,7 @@ public function cleanOldSessions(?Mage_Api_Model_User $user) Varien_Db_Adapter_Interface::INTERVAL_SECOND ); $where = [ - $readAdapter->quote(Varien_Date::now()) . ' > '. $timeSubtract + $readAdapter->quote(Varien_Date::now()) . ' > ' . $timeSubtract ]; if ($user) { $where['user_id = ?'] = $user->getId(); diff --git a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php index e37dad30466..87e15762254 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php +++ b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php @@ -429,8 +429,8 @@ public function addStoreLabel($storeId) ['store_label' => $adapter->getIfNullSql('al.value', 'main_table.frontend_label')] ); $this->_addedStoreLabelsFlag = $storeId; - } // check that previous call $storeId matches current call - elseif ($this->_addedStoreLabelsFlag !== $storeId) { + } elseif ($this->_addedStoreLabelsFlag !== $storeId) { + // check that previous call $storeId matches current call throw new Exception('Cannot call addStoreLabel for different store views on the same collection'); } diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index be0ab696a93..477c684f47d 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -67,7 +67,7 @@ protected function _getPageTrackingCodeAnalytics4($accountId) //add user_id if ($this->helper('googleanalytics')->isUserIdEnabled() && Mage::getSingleton('customer/session')->isLoggedIn()) { $customer = Mage::getSingleton('customer/session')->getCustomer(); - $trackingCode.= " + $trackingCode .= " gtag('set', 'user_id', '{$customer->getId()}'); "; } @@ -185,12 +185,9 @@ protected function _getEnhancedEcommerceDataForAnalytics4() } } - /** - * This event signifies that some content was shown to the user. Use this event to discover the most popular items viewed. - * - * @link https://developers.google.com/tag-platform/gtagjs/reference/events#view_item - */ if ($moduleName == 'catalog' && $controllerName == 'product') { + // This event signifies that some content was shown to the user. Use this event to discover the most popular items viewed. + // @see https://developers.google.com/tag-platform/gtagjs/reference/events#view_item $productViewed = Mage::registry('current_product'); $category = Mage::registry('current_category') ? Mage::registry('current_category')->getName() : false; $eventData = []; @@ -209,14 +206,9 @@ protected function _getEnhancedEcommerceDataForAnalytics4() } array_push($eventData['items'], $_item); $result[] = "gtag('event', 'view_item', " . json_encode($eventData, JSON_THROW_ON_ERROR) . ");"; - } - - /** - * Log this event when the user has been presented with a list of items of a certain category. - * - * @link https://developers.google.com/tag-platform/gtagjs/reference/events#view_item_list - */ - elseif ($moduleName == 'catalog' && $controllerName == 'category') { + } elseif ($moduleName == 'catalog' && $controllerName == 'category') { + // Log this event when the user has been presented with a list of items of a certain category. + // @see https://developers.google.com/tag-platform/gtagjs/reference/events#view_item_list $layer = Mage::getSingleton('catalog/layer'); $category = $layer->getCurrentCategory(); $productCollection = clone $layer->getProductCollection(); @@ -231,7 +223,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4() $eventData = []; $eventData['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode(); $eventData['value'] = 0.00; - $eventData['item_list_id'] = 'category_'.$category->getUrlKey(); + $eventData['item_list_id'] = 'category_' . $category->getUrlKey(); $eventData['item_list_name'] = $category->getName(); $eventData['items'] = []; @@ -255,14 +247,9 @@ protected function _getEnhancedEcommerceDataForAnalytics4() } $eventData['value'] = $helper->formatPrice($eventData['value']); $result[] = "gtag('event', 'view_item_list', " . json_encode($eventData, JSON_THROW_ON_ERROR) . ");"; - } - - /** - * This event signifies that a user viewed his cart. - * - * @link https://developers.google.com/tag-platform/gtagjs/reference/events#view_cart - */ - elseif ($moduleName == 'checkout' && $controllerName == 'cart') { + } elseif ($moduleName == 'checkout' && $controllerName == 'cart') { + // This event signifies that a user viewed his cart. + // @see https://developers.google.com/tag-platform/gtagjs/reference/events#view_cart $productCollection = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); $eventData = []; $eventData['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode(); @@ -292,14 +279,9 @@ protected function _getEnhancedEcommerceDataForAnalytics4() } $eventData['value'] = $helper->formatPrice($eventData['value']); $result[] = "gtag('event', 'view_cart', " . json_encode($eventData, JSON_THROW_ON_ERROR) . ");"; - } - - /** - * This event signifies that a user has begun a checkout. - * - * @link https://developers.google.com/tag-platform/gtagjs/reference/events#begin_checkout - */ - elseif ($moduleName == static::CHECKOUT_MODULE_NAME && $controllerName == static::CHECKOUT_CONTROLLER_NAME) { + } elseif ($moduleName == static::CHECKOUT_MODULE_NAME && $controllerName == static::CHECKOUT_CONTROLLER_NAME) { + // This event signifies that a user has begun a checkout. + // @see https://developers.google.com/tag-platform/gtagjs/reference/events#begin_checkout $productCollection = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); if ($productCollection) { $eventData = []; @@ -332,11 +314,8 @@ protected function _getEnhancedEcommerceDataForAnalytics4() } } - /** - * This event signifies when one or more items is purchased by a user. - * - * @link https://developers.google.com/tag-platform/gtagjs/reference/events?hl=it#purchase - */ + // This event signifies when one or more items is purchased by a user. + // @see https://developers.google.com/tag-platform/gtagjs/reference/events?hl=it#purchase $orderIds = $this->getOrderIds(); if (!empty($orderIds) && is_array($orderIds)) { $collection = Mage::getResourceModel('sales/order_collection') diff --git a/lib/Varien/Data/Collection/Db.php b/lib/Varien/Data/Collection/Db.php index 141f3aa077a..a35fc1ecd7f 100644 --- a/lib/Varien/Data/Collection/Db.php +++ b/lib/Varien/Data/Collection/Db.php @@ -265,7 +265,7 @@ public function getSelectCountSql() $bindParams = array_map(function ($token) { return ltrim($token, ':'); }, array_keys($this->_bindParams)); - $bindPattern = '/:('.implode('|', $bindParams).')/'; + $bindPattern = '/:(' . implode('|', $bindParams) . ')/'; $joinUsingBind = array_filter($leftJoins, function ($table) use ($bindPattern) { return !empty($table['joinCondition']) && preg_match($bindPattern, $table['joinCondition']); });