Magento override abstract block - magento

I need to override an abstract Block in Magento : app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
I need to add a function to this class similar as getOptionValues for a specific product type.
I tried to override by adding the same structure (folder creations and copy the Abstract.php file) in app/code/local/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php, but it seems not working.
Anyone can help me ?
Am I missing something ?
Do I need to create app/etc/modules XML or the app/code/local/Mage/Eav/etc XML ?
Thanks a lot !

In order to override the app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
abstract class, you need to place the file as: app/code/local/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
which means your local pool path for Abstract.php is correct.
The only thing that i doubt why it's not loading is: may be Compiler is enabled for your store(be sure to check from System > Tools > Compilation > Status should be Disabled).
Additionally check your log files(var/log/*.log) if there are any errors.
I would refer the following article for configuring your magento for development / debug mode:
http://www.blog.magepsycho.com/configuring-magento-for-development-debug-mode/
Hope this helps a bit.
Regards

Related

Has Magento a fallback for default email templates?

Hi I have created an module with a custom transactional email, which works fine when i place the default-template-file in
app/locale/de_DE/template/email/sales/mymail.html
but i need to place it into my template
app/design/frontend/ultimo/custom/locale/de_DE/templete/email/sales/mymail.html
but on this path it isn't found, i even tried otherplaces like
app/design/frontend/base/default/locale/de_DE/templete/email/sales/mymail.html
app/design/adminhtml/default/default/locale/de_DE/templete/email/sales/mymail.html
but neither works. Isn't there any fallback mechanism for these file? If yes, can anyone explain it to me?
Thanks

Why does a "on a non-object" error occurs with this extension in Magento?

I'm having an Issue with a blog extension in Magento CE 1.6.2.0.
I installed this extension: Neotheme_nBlog.
I created an entry in the administrator.
Then I went to http://www.example.com/index.php/blog/ to see the recently created entry.
What I saw was an error like this:
Fatal error: Call to a member function getName() on a non-object
in /home/example.com/public_html/app/design/frontend/default/caramel/template/magicat/left.phtml
I searched in google the terms: "template/magicat/left.phtml" getName and what I only found is sites having this issue, but no support at all.
Please note: I know what does that error mean in PHP ("unfortunately" I'm not new at that). What I don't understand is what's happening with such [NON/null] object and how to fix it without killing a dozen of kittens.
Question: What can I do to solve it? What is the nature of the error, regarding Magento?(again: not PHP).
Notes: The Magento site (http://magento.stackexchange.com) is somewhat poor and strict to bring support of such nature, so asking there is not an option.
Edit (as answer to comment, and to clarify):
Neotheme is still not responding the request.
Don't know what should I look on such file (instances are not initialized there, but only accessed).
I'm using the default theme (caramel), which has esthetical changes (does not have layout changes).
It's hard to say without seeing your system specifically, but on this
template/magicat/left.phtml
It looks like you've added a template named magicat/left.phtml to your system -- either via an extension or custom development. Somewhere in this file PHP's called getName on a non-object. There's a variety of reasons this could be happening, and without seeing the specific line of code PHP's complaining about in your system, it's hard to say. It'd also be helpful to know if magicat is part of the extension or something else.
The most common reason for this error in a template is code that relies on a block being there that's been removed by another extension (eitehr via layout XML or observer methods)
$this->getLayout()->getBlock('some_block')->getName();
The next most common is people using the registry to communicate between templates and views, but a registry key not being set
Mage::registry('some_item')->getName();
Without knowing the variable and context, it's doubtful anyone will be able to help you.

Magento 1.4.1.1 can't log into the admin area after installing module

I installed a new module and now I get this error and can't log into the admin area of Magento:
Warning: include(Mage/Awautorelated/Helper/Data.php): failed to open stream: No such file or directory in /var/www/spasandstuff.com/lib/Varien/Autoload.php on line 93
I have removed the module, cleared the cache and session folders and it still gives me that error.
I ran grep -r "Awautorelated" * and found nothing on the server. I restarted Apache to clear APC cache. Magento uses Lightspeed but I believe that just uses the Magento cache directory which I cleared. So I am at a loss as to how to fix this issue. Is there a database table that caches module info?
Any help will be greatly appreciated.
Somewhere, a piece of Magento code is attempting to instantiate a helper class with code that looks something like
Mage::helper('awautorelated');
Mage::helper('awautorelated/data');
Since you've removed the module from the server and cleared your cache, there's no <model> node for the <awautorelated> group. That's why Magento is looking for this class in Mage/Awautorelated instead of AW/Awautorelated.
Based on everything you've said, my guess is you have an XML file somewhere, likely in the layout, that still contains an attribute something like this
<sometag ... module="awautorelated" ...>
These module attributes are used to specify a translation helper for "inner nodes". Your Magento system loads the XML file, parses it, sees the module="awautorelated", and then attempts to instantiate a awautorelated helper to translate the nodes. Since you've remove that module files, it can't instantiate the helper and yells at you. Try a case insensitive grep (or ack)
grep -i -r 'awautorelated'
and make sure you search the entire Magento source tree. Not just app/code, but app/design as well.
Did you remove
AW_All.xml
AW_Productrelater.xml
from /app/etc directory
Yes, there is the table core_config_data, but I don't expect removing the module entry from their will be realted to this problem, but you can certainly remove the entry now the module has been removed.
Are you using memcached for caching? you could remove that. I'm not 100% sure restarting apache clears the APC cache either ...

I inherited a Magento project and can't seem to find this particular page?

I took over an implementation of Magento Enterprise.
There is a URL that looks something like this:
mydomain.com/our-solutions
It's got a dynamic part to it; under the CMS tab in the Admin I don't see anything that matches that URL.
In the extended local files, I don't see anything in the config for it but it seems to know to load up a particular template.
I need to be able to modify the controller for this particular page. Any advice would be great.
Thanks.
The quick and dirty way would be to temporarily add some debugging code to the following file
# File app/code/core/Mage/Core/Controller/Front/Action.php
public function preDispatch()
{
//log out the class name
Mage::Log( get_class($this) );
//or just dump it if you don't know how logging works
var_dump(get_class($this));
$this->getLayout()->setArea($this->_currentArea);
parent::preDispatch();
return $this;
}
This will let you discover which class file is the controller for the request, and you can code trace from there.
Also (shameless plug time) I build and sell a commercial product that will (among other things) allow you to (among other things) instantly zero in on which controller, block, model, or collection was used for a particular request. There's a demo page you can checkout, and while it's clearly self-serving of me to mention it, I also truly believe it's the best way for a developer to work with Magento.

Prism / Mef Directory Catalog SatisfyImports

In my app I have a module that I have been referencing direct from the shell (just while I get things working).
i.e.
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MyModule).Assembly));
}
In my module when I've been calling SatisfyImportsOnce for a view this has worked and I can see the view model etc being created.
However, I have now changed my bootstrapper to use a directoryCatalog for my module. I have added some post build events to copy my module assembly, pdb etc to the shell.
So now I have the following in my bootstrapper
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
// add the directory catalog for the modules
AggregateCatalog.Catalogs.Add(new DirectoryCatalog("Modules"));
}
I am now able to run my app and see the views from my module but the SatisfyImportsOnce that used to work now seems to do nothing. I can't see any errors. Are there different attributes I need on my imports / exports now that I'm using the directory catalog?
Thanks.
No, there shouldn't be any difference in the attributes you need to use.
It's hard to tell what's wrong, here's a blog post on general MEF debugging.

Resources