예제 #1
0
 /**
  * Get the crawler http client
  *
  * @return Varien_Http_Client
  */
 public function getCrawlerClient()
 {
     if (is_null($this->_crawlerClient)) {
         $this->_crawlerClient = new Varien_Http_Client(null, array('useragent' => sprintf('Nexcessnet_Turpentine/%s Magento/%s Varien_Http_Client', Mage::helper('turpentine/data')->getVersion(), Mage::getVersion()), 'keepalive' => true));
         $this->_crawlerClient->setCookie('frontend', 'crawler-session');
     }
     return $this->_crawlerClient;
 }
예제 #2
0
 public function customerLogin($observer)
 {
     $cookie = Mage::getSingleton('core/cookie');
     if (!Mage::getStoreConfig('subsystem/general/enable') || $cookie->get('magestoreloggedin')) {
         return;
     }
     $customer = $observer['customer'];
     // Set loggedin cookie
     $path = Mage::getStoreConfig('subsystem/general/path');
     $domain = Mage::getStoreConfig('subsystem/general/domain');
     $cookie->set('magestoreloggedin', 1, null, $path, $domain);
     // Login to Magestore
     try {
         $url = Mage::getStoreConfig('subsystem/general/account') . 'login';
         $client = new Varien_Http_Client($url);
         $client->setCookie('frontend', $this->getFrontend());
         $client->setParameterPost('pk', self::PK);
         $client->setParameterPost('email', $customer->getEmail());
         $response = $client->request(Varien_Http_Client::POST);
         $cookie->set('frontend', $response->getBody(), null, $path, $domain);
         Mage::getSingleton('core/session')->setData('magestore_login', 1);
     } catch (Exception $e) {
     }
 }