Sharing is helping.

We offer you this space to share your knowledge about Magento and learn from our experienced customers.


    Home Forums Reply To: Pager in Hellominty missing on search results pages Reply To: Pager in Hellominty missing on search results pages

    #18350

    Ivan

    Hi, AllIf someone also wants to use the new GoogleAnalytics-Module inidse Magento v1.4.0.1 please do not only copy the code from the Magento v1.5-trunk or the v1.6-trunk (which are nearly the same) but also apply this patch to get a valid backport:Index: brodering/app/code/core/Mage/GoogleAnalytics/Model/Observer.php===================================================================— brodering/app/code/core/Mage/GoogleAnalytics/Model/Observer.php(revision 15)+++ brodering/app/code/core/Mage/GoogleAnalytics/Model/Observer.php(revision )@@ -57,13 +57,14 @@ */ public function setGoogleAnalyticsOnOrderSuccessPageView(Varien_Event_Observer $observer) {- $orderIds = $observer->getEvent()->getOrderIds();- if (empty($orderIds) || !is_array($orderIds)) {+ $quoteId = Mage::getSingleton(‘checkout/session’)->getLastQuoteId();+ if (!$quoteId) { return; } $block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock(‘google_analytics’);- if ($block) {- $block->setOrderIds($orderIds);+ if ($block instanceof Mage_Core_Block_Abstract) {+ $quote = Mage::getModel(‘sales/quote’)->load($quoteId);+ $block->setQuote($quote); } }Index: brodering/app/code/core/Mage/GoogleAnalytics/Block/Ga.php===================================================================— brodering/app/code/core/Mage/GoogleAnalytics/Block/Ga.php(revision 15)+++ brodering/app/code/core/Mage/GoogleAnalytics/Block/Ga.php(revision )@@ -104,37 +104,33 @@ */ protected function _getOrdersTrackingCode() {- $orderIds = $this->getOrderIds();- if (empty($orderIds) || !is_array($orderIds)) {- return;+ $order = $this->getQuote();+ if (!$order) {+ return ”; }- $collection = Mage::getResourceModel(‘sales/order_collection’)- ->addFieldToFilter(‘entity_id’, array(‘in’ => $orderIds))- ;- $result = array();- foreach ($collection as $order) {+- if ($order->getIsVirtual()) {- $address = $order->getBillingAddress();- } else {- $address = $order->getShippingAddress();- }- $result[] = sprintf(“_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);”,- $order->getIncrementId(), Mage::app()->getStore()->getFrontendName(), $order->getBaseGrandTotal(),- $order->getBaseTaxAmount(), $order->getBaseShippingAmount(),- $this->jsQuoteEscape($address->getCity()),- $this->jsQuoteEscape($address->getRegion()),- $this->jsQuoteEscape($address->getCountry())- );- foreach ($order->getAllVisibleItems() as $item) {- $result[] = sprintf(“_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s']);”,- $order->getIncrementId(),- $this->jsQuoteEscape($item->getSku()), $this->jsQuoteEscape($item->getName()),- null, // there is no “category” defined for the order item- $item->getBasePrice(), $item->getQtyOrdered()- );- }- $result[] = “_gaq.push(['_trackTrans']);”;+ if ($order->getIsVirtual()) {+ $address = $order->getBillingAddress();+ } else {+ $address = $order->getShippingAddress();+ }+ $result[] = sprintf(“_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);”,+ $order->getIncrementId(), Mage::app()->getStore()->getFrontendName(), $order->getBaseGrandTotal(),+ $order->getBaseTaxAmount(), $order->getBaseShippingAmount(),+ $this->jsQuoteEscape($address->getCity()),+ $this->jsQuoteEscape($address->getRegion()),+ $this->jsQuoteEscape($address->getCountry())+ );+ foreach ($order->getAllVisibleItems() as $item) {+ $result[] = sprintf(“_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s']);”,+ $order->getIncrementId(),+ $this->jsQuoteEscape($item->getSku()), $this->jsQuoteEscape($item->getName()),+ null, // there is no “category” defined for the order item+ $item->getBasePrice(), $item->getQtyOrdered()+ );+ }+ $result[] = “_gaq.push(['_trackTrans']);”;- }+ return implode(“\n”, $result); }