2014-01-10 4 views
0

이벤트는 한 번만 실행됩니다. 제품 견적에 주문 값을 추가 할 때 옵저버를 통해 이벤트 checkout_quote_init 에 제대로 표시되지만 고객이 로그인하여 주문을하면 첫 주문 값이 견적에 잘 삽입되지만 관찰자가 실행되지 않습니다. . 당신은 당신이 (Mage_Checkout_Model_Session::getQuote()을)이 표시됩니다 사용하고있는 이벤트를 전달 코드를 살펴 경우옵저버는 한 번만 실행됩니다.

<checkout_quote_init> 
    <observers> 
     <youva_custom> 
      <type>singleton</type> 
      <class>custom/observer</class> 
      <method>setqoutevalue</method> 
     </youva_custom> 
    </observers> 
</checkout_quote_init> 

public function setqoutevalue($observer) { 
    $event = $observer->getEvent(); 
    $_quote = $event->getQuote(); 
    $_quote->setCustomevalue($customevalue); 
    $_quote->save(); 
} 

답변

0

:

 if (!$this->getQuoteId()) { 
      if ($customerSession->isLoggedIn() || $this->_customer) { 
       $customer = ($this->_customer) ? $this->_customer : $customerSession->getCustomer(); 
       $quote->loadByCustomer($customer); 
       $this->setQuoteId($quote->getId()); 
      } else { 
       $quote->setIsCheckoutCart(true); 
       Mage::dispatchEvent('checkout_quote_init', array('quote'=>$quote)); 
      } 
     } 

이 이벤트가 견적이 생성 된 경우에만 전달되는 것을 의미한다 . 사용자가 로그인하지 않은 경우에만 해당합니다. 즉 세션에 이미 견적 아이디가 있으면 이벤트가 전달되지 않습니다.

다른 이벤트를 사용하는 것이 좋습니다. 예 : checkout_cart_product_add_after