How to override abstract block app/code/core/Mage/Wishlist/Block/Abstract.php and app/code/core/mage/Controller/Abstract.php

  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


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 -->

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.

Similar questions

Call to a member function rewrite() on a non-object in app/code/core/Mage/Core/Controller/Varien/Front.php on line 165
My site is not loading, as I get this error message when type in the URL: Fatal error: Call to a member function rewrite() on a non-object in app/code/core/Mage/Core/Controller/Varien/Front.php on line 165 Does any one familiar with what could be wrong here?
Override a function from app/code/core/Mage/Core/functions.php file into a Custom module
Recently I came across a site which contains some modifications in app/code/core/Mage/Core/functions.php file. I would like to keep code clean and move the changes to custom module in local scope; but as the functions.php file does not fall under any basic magento block, I don't know how to create custom module for it. I would like to hear if you h...
Magento - Fatal error: Call to a member function getBackend() on a non-object in app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816
Getting this error when trying to use a custom filter inside a custom theme. I have set up the new attribute "is_featured" and its in an attribute set. I made a product that assigned it as featured (yes/no choice) My home page (in the CMS section) is including the following "panel" featured_list.phtml looks like this: It seems like the issue is wit...
How to fix the error “Notice: Undefined variable : block in app/code/core/Mage/Core/Model/Email/Template/Filter.php”
After I have installed the following patches: SUPEE-6285-1.9.1v2, SUPEE-6482-, SUPEE-6788-, SUPEE-7405-, my system.log file is filled with full of the following errors: Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187 Notice: Undefined variable: block in app/code/core/Mage...
how to override /app/code/core/Mage/Catalog/Block/Product/List/Random.php
I have been trying to override the Random.php file and have looked at inchoo and another method here. When I do the change on the core file the change takes effect immediately, but when I created the override, the modification do not take effect. I am trying to override /app/code/core/Mage/Catalog/Block/Product/List/Random.php. I have created /app/...
Google App Engine app.yaml file for PHP app (Magenta App)
I am working on this app.yaml file to put Magento app on GAE. I have read most replies related to app.yaml files. Here is one for wordpress app. However, I feel very confused with so many different versions. But, the Magent...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.