Ejemplo n.º 1
0
 /**
  * Saving information about quote
  *
  * @param   Mage_Log_Model_Visitor $visitor
  * @return  Mage_Log_Model_Resource_Visitor
  */
 protected function _saveQuoteInfo($visitor)
 {
     $adapter = $this->_getWriteAdapter();
     if ($visitor->getDoQuoteCreate()) {
         $data = new Varien_Object(array('quote_id' => (int) $visitor->getQuoteId(), 'visitor_id' => (int) $visitor->getId(), 'created_at' => Mage::getSingleton('core/date')->gmtDate()));
         $bind = $this->_prepareDataForTable($data, $this->getTable('log/quote_table'));
         $adapter->insert($this->getTable('log/quote_table'), $bind);
         $visitor->setDoQuoteCreate(false);
     }
     if ($visitor->getDoQuoteDestroy()) {
         /**
          * We have delete quote from log because if original quote was
          * deleted and Mysql restarted we will get key duplication error
          */
         $condition = array('quote_id = ?' => (int) $visitor->getQuoteId());
         $adapter->delete($this->getTable('log/quote_table'), $condition);
         $visitor->setDoQuoteDestroy(false);
         $visitor->setQuoteId(null);
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Saving information about quote
  *
  * @param   Mage_Log_Model_Visitor $visitor
  * @return  Mage_Log_Model_Mysql4_Visitor
  */
 protected function _saveQuoteInfo($visitor)
 {
     $write = $this->_getWriteAdapter();
     if ($visitor->getDoQuoteCreate()) {
         $write->insert($this->getTable('log/quote_table'), array('quote_id' => $visitor->getQuoteId(), 'visitor_id' => $visitor->getId(), 'created_at' => now()));
         $visitor->setDoQuoteCreate(false);
     }
     if ($visitor->getDoQuoteDestroy()) {
         /**
          * We have delete quote from log because if original quote was
          * deleted and Mysql restarted we will get key duplication error
          */
         $write->delete($this->getTable('log/quote_table'), $write->quoteInto('quote_id=?', $visitor->getQuoteId()));
         //            $write->update($this->getTable('log/quote_table'),
         //                array('deleted_at'=> now()),
         //                $write->quoteInto('quote_id=?', $visitor->getQuoteId())
         //            );
         $visitor->setDoQuoteDestroy(false);
         $visitor->setQuoteId(null);
     }
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Saving information about quote
  *
  * @param   Mage_Log_Model_Visitor $visitor
  * @return  Mage_Log_Model_Mysql4_Visitor
  */
 protected function _saveQuoteInfo($visitor)
 {
     $write = $this->_getWriteAdapter();
     if ($visitor->getDoQuoteCreate()) {
         $write->insert($this->getTable('log/quote_table'), array('quote_id' => $visitor->getQuoteId(), 'visitor_id' => $visitor->getId(), 'created_at' => now()));
         $visitor->setDoQuoteCreate(false);
     }
     if ($visitor->getDoQuoteDestroy()) {
         $write->update($this->getTable('log/quote_table'), array('deleted_at' => now()), $write->quoteInto('quote_id=?', $visitor->getQuoteId()));
         $visitor->setDoQuoteDestroy(false);
         $visitor->setQuoteId(null);
     }
     return $this;
 }