0
  1. In Controller Abstract.php file, I want to override the public function allcartAction() to add one more parameter to $item->addToCart($cart, $isOwner)) ie to change the function as $item->addToCart($cart, $isOwner,$params))

  2. In Block/Abstract.php file I want to modify the public function getWishlistItems() { function to remove the visisbility filter

So instead of overriding the files to app/code/local/Mage folder, is there any nice way of doing it

1
  • 1
    Girish SH,Abstract is not Override .Only solution is copy to local folder
    – Amit Bera
    Feb 11, 2015 at 17:02

1 Answer 1

1

By default, you should not be overriding Abstract classes. When you override in the app/code/local/Mage folder, you are locking that file into it's particular version. Now you must maintain that file separately and you risk breaking upgrades.

Try to think of a different approach instead of an abstract override.

How about controller rewrites?

<!-- Magento 1.4 controller rewrites -->
<global>
    <routers>
        <wishlist>
            <rewrite>
                <index>
                    <actions>
                        <allcart>
                            <to>custom_route/your_controller/overriding_action</to>
                        </allcart>
                    </actions>
                </index>
            </rewrite>
        </wishlist> 
    </routers> 
</global>

If you rewrite Mage_Wishlist_IndexController (for example) and override only those methods you need changed, you can then maintain compatibility.

Is this the easiest way? No. But it is the right way to maintain maximum upgradability.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.