Tuesday , December 12 2017
Home >> Tag Archives: Magento tutorials (page 2)

Tag Archives: Magento tutorials

Magento Developers’ Guide – Part 10: Rewrite to modify a Magento controller

How to make a rewrite of a controller ? Because your module will not know where to search for your extended class…you have to make a require in your controller. require_once “Mage/Checkout/controllers/CartController.php”; This gives you something like: require_once “Mage/Checkout/controllers/CartController.php”; class Pfay_Checkout_CartController extends Mage_Checkout_CartController {     # Rewrite of indexAction     public function indexAction() {         die(‘your method has been rewrited !!’);     } } The require_once is important if your ...

Read More »

Magento Developers' Guide – Part 10: Rewrite to modify a Magento controller

How to make a rewrite of a controller ? Because your module will not know where to search for your extended class…you have to make a require in your controller. require_once “Mage/Checkout/controllers/CartController.php”; This gives you something like: require_once “Mage/Checkout/controllers/CartController.php”; class Pfay_Checkout_CartController extends Mage_Checkout_CartController {     # Rewrite of indexAction     public function indexAction() {         die(‘your method has been rewrited !!’);     } } The require_once is important if your ...

Read More »

How to add search by category in magento mini search

There is no free extension in magento commerce which will help you to search your store with particular category. But you can do as following: First create the drop down list of all category in form.mini.phtml <select name=“category” id=“category_search_field”> <option value=“”>– Any Category –</option> <?php foreach ($catalog->getStoreCategories() as $_category): ?> <?php if($_category->hasChildren()): ?> <option class=“parent-cat” value=“<?php echo $_category->getId(); ?>”><?php echo $_category->getName();?></option> <?php foreach ($_category->getChildren() as $subcategory): if($subcategory->getIsActive()) : ?> <option value=“<?php echo $subcategory->getId(); ?>”<?php echo ($this->getRequest()->getQuery(‘category’) == $subcategory->getId() ? ‘ selected=”selected”‘: “”) ?>><?php echo $subcategory->getName(); ?></option> <?php endif; endforeach; ?> <?php elseif($_category->getIsActive()): ?> <option value=“<?php echo $_category->getId(); ?>”><?php echo $_category->getName();?></option> <?php endif; ?> <?php endforeach ?> </select> ...

Read More »

How to filter payment method in one page checkout?

1

There are several way to filter payment method in one page checkout: By overriding template: app/design/frontend/[interface]/[theme]/template/checkout/onepage/payment/methods.phtml By overriding method: Mage_Checkout_Block_Onepage_Payment_Methods::_canUseMethod()  By overriding method: Mage_Payment_Model_Method_Abstract::isAvailable()  By overriding method: Mage_Checkout_Block_Onepage_Payment_Methods::getMethods()  By observing event: payment_method_is_active Among above methods obviously using event-observer technique is the best way to go. And here I will be ...

Read More »
Heap | Mobile and Web Analytics