This functionality not available by default in Magento. I have used the below solution.
You can call this event checkout_cart_product_add_after in the observer.
File Path app/code/local/{namespace}/{yourmodule}/etc/config.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<config> ... <frontend> ... <events> <checkout_cart_product_add_after> <observers> <unique_event_name> <class>{{modulename}}/observer</class> <method>overridePrice</method> </unique_event_name> </observers> </checkout_cart_product_add_after> </events> ... </frontend> ... </config> |
And then create an Observer class in this file app/code/local/{namespace}/{yourmodule}/Model/Observer.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php class <namespace>_<modulename>_Model_Observer { public function overridePrice(Varien_Event_Observer $observer) { // Get the quote item $item = $observer->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; //use $item to determine your custom price. return $price; } } ?> |
[crayon-63d3e988db63d242004998/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.