public function preFilter($email, $params) { $subscriber = Mage::getSingleton('newsletter/subscriber')->loadByEmail($email); $rq = Mage::app()->getRequest(); $fullaction = (string) $rq->getRequestedRouteName() . $rq->getRequestedControllerName() . $rq->getRequestedActionName(); if (Mage::Registry("aux_lastmethod")) { if (isset($params['oldEmail'])) { $subscriber->setOldEmail($params['oldEmail']); } return true; } if (!$subscriber->getData() or 'newslettersubscribernew' == $fullaction or 'customeraccountcreatepost' == $fullaction) { if ('customeraccountcreatepost' == $fullaction) { Mage::register("aux_lastmethod", $fullaction); } $customSession = Mage::getSingleton('customer/session')->getCustomer(); $subscriber = Mage::getSingleton('customer/customer')->setWebsiteId($customSession->getWebsiteId())->loadByEmail($email); if (!$subscriber->getData()) { $subscriber = $customSession; if (!$subscriber->getEmail()) { $subscriber->setStoreId(Mage::app()->getStore()->getStoreId())->setCustomerId(0)->setEmail($email); } } else { $subscriber->setCustomerId($subscriber->getEntityId()); } if (isset($params['oldEmail'])) { $subscriber->setOldEmail($params['oldEmail']); } return $this->mailChimpFilter($subscriber, $params); } else { if (isset($params['oldEmail'])) { $subscriber->setOldEmail($params['oldEmail']); } return true; } }
/** * Get the Item Google Shopping Account Id * This is the current product. * * @return mixed */ public function getItemGoogleShoppingId() { $currentProduct = Mage::Registry('current_product'); return $currentProduct ? $currentProduct->getSku() : false; }