2013-11-12 5 views
0

Где в коде я могу изменить «специальную цену» или просто изменить цену за каждый товар magento show?Magento catalogue цена продукта

Я нашел, как изменить цену в кассе,

config.xml:

<frontend> 
    <events> 
     <checkout_cart_product_add_after> 
      <observers> 
       <unique_event_name> 
        <class>discounts/observer</class> 
        <method>modifyPrice</method> 
       </unique_event_name> 
      </observers> 
     </checkout_cart_product_add_after> 
    </events> 
</frontend> 

и наблюдатель:

<?php 

class <namespace>_<module>_Model_Observer 
{ 
    public function modifyPrice(Varien_Event_Observer $obs) 
    { 
     // Get the quote item 
     $item = $obs->getQuoteItem(); 

     // Ensure we have the parent item, if it has one 
     $item = ($item->getParentItem() ? $item->getParentItem() : $item); 

     // Load the custom price 
     $price = $this->_getPriceByItem($item); 

     // Set the custom price 
     $item->setCustomPrice($price); 
     $item->setOriginalCustomPrice($price); 

     // Enable super mode on the product. 
     $item->getProduct()->setIsSuperMode(true); 
    } 

    protected function _getPriceByItem(Mage_Sales_Model_Quote_Item $item) 
    { 
     $price = null; 

     $price = 10; 

     return $price; 
    } 
} 

этот набор кодов все цена до 10 $, но только в "Моя тележка".

Сначала я хочу изменить frontend -> events -> THIS EVENT, но ничего не могу найти.

ответ

0

Вы можете сделать это с помощью события catalog_product_load_after, которое вызывается непосредственно после загрузки модели каждый раз, а не только в корзину.

+0

Я знаю это, просто покажите свой рабочий код, эту часть кода изменения цены в кассе, я не могу найти, как изменить его на сайте! –

+0

Извините, я не понимаю ваш вопрос :( –

Смежные вопросы