Magento Change Tab Order in Edit Product Section - magento

I want to change order of tabs in edit product section.For example,categories and inventory tab must be swapped.Overriding Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs block doesn't seem to work.
config.xml
<config>
<global>
<blocks>
<my_module>
<class>Company_Adminhtml_Block</class>
</my_module>
<adminhtml>
<rewrite>
<catalog_product_edit_tabs>Company_Adminhtml_Block_Catalog_Product_Edit_Tabs</catalog_product_edit_tabs>
</rewrite>
</adminhtml>
</blocks>
<global>
</config>
I copied Company_Adminhtml_Block_Catalog_Product_Edit_Tabs into local folder and swapped the category and inventory addTab code.Any pointers?

Make sure you have configured your module correctly. To do this, you can simply call from a controller action.
echo get_class(Mage::getBlockSingleton('adminhtml/catalog_product_edit_tabs'));
It should return Company_Adminhtml_Block_Catalog_Product_Edit_Tabs if you configuration is correct, or Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs if your configuration is failed.

Had the same issue. Flushing the cache helped.

Related

Magento extend cms block class

I'm trying to extend the magento class Mage_Cms_Block_Block. I've got my module active. I think the reason why its failing is to do with the config.xml.
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<VisibleBlocks_ShowBlocks>
<!-- The version of our module, starting at 0.0.1 -->
<version>0.0.1</version>
</VisibleBlocks_ShowBlocks>
</modules>
<global>
<blocks>
<mage_cms>
<rewrite>
<cms_blocks>VisibleBlocks_ShowBlocks_Block_Border</cms_blocks>
</rewrite>
</mage_cms>
</blocks>
</global>
</config>
Can someone explain to me what the tags inside the global tags mean? Can the tags inside rewrite be called anything?
OK seems that asking the questions made it clearer to me. Hope this hasn't a waste of time for anyone. 'mage_cms' should be 'cms' as that is the module i'm extending and 'cms_blocks' should be 'block'.
i have explain the details,please check
<global>
<blocks>
<cms><!--module name of rewrite class mage_cms -->
<rewrite>
<!-- file path of Block of app/code/core/mage/cms/block.php -->
<blocks>VisibleBlocks_ShowBlocks_Block_Border</blocks>
</rewrite>
</cms>
</blocks>
</global>
<config>
<global>
<blocks>
<cms>
<rewrite>
<block>VisibleBlocks_ShowBlocks_Block_Cms_Block</block>
</rewrite>
</cms>
</blocks>
</global>
</config>
With these tags, we say we will configure a block of Magento’s core called cms and we will rewrite () the « block » block of this module
Also make sure your module is active & being displayed in system/config/Advanced

Extending Mage Core Files Without Loosing Namespace

I would like to introduce my own entities into particular Magento module namespaces for example I might want to be able to call
Mage::getModel('catalog/brand')->load(1);
Brand is not currently a model included in the catalog module. I don't want to modify core files nor do I want to hack the core by just adding a Mage folder to the local directory.
I was thinking perhaps syntax inside of my namespaces config file similar to this:
<models>
<catalog>
<args>
<modules>
<AJW_Catalog before="Mage_Catalog">AJW_Catalog</AJW_Catalog>
</modules>
</args>
</catalog>
<ajw_catalog>
<class>AJW_Catalog_Model</class>
</ajw_catalog>
</models>
but it does not seem to work.
Does anyone know how this can be accomplished?
Maybe possible with some trickery, but not officially supported, and generally a bad idea. The before= syntax you've used only works for the routers node. There's no framework code to let you do what you're trying to do. Also, there's a strong bias in the Magento framework code towards individual modules "owning" their namespace/package name. Defining new models in an existing namespace (catalog) introduces the theoretical possibility that your code may conflicts with a future version of Magento's code.
This may be a possible fix (brain fart)
Create a module named Customnamespace_Catalog and then just rewrite the catalog module with a node that doesnt exist in the default mage module:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Catalog>
<version>0.1.0</version>
</Namespace_Catalog>
</modules>
<global>
<models>
<catalog>
<rewrite>
<brand>Namespace_Brand_Model_Brand</brand>
</rewrite>
</catalog>
</models>
</global>
</config>
Followed by an additional module:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Brand>
<version>0.1.0</version>
</Namespace_Brand>
</modules>
<global>
<models>
<brand>
<class>Namespace_Brand_Model</class>
</brand>
</models>
</global>
</config>
This will allow you to call Mage::getModel('catalog/brand')
echo get_class(Mage::getModel('catalog/brand'); // Namespace_Brand_Model_Brand

Custom menu gives 404 in magento on server

I created a custom menu in admin tab in magento admin. It was working perfectly on localhost, but when i deployed my code on the server, it is giving a 404 page not found error. What can be the issue there!
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_CoffeeFreak>
<version>0.1.0</version>
</Inchoo_CoffeeFreak>
</modules>
<global>
<blocks>
<coffefreakblock1>
<class>Inchoo_CoffeeFreak_Block</class>
</coffefreakblock1>
<coffefreakblock2>
<class>Inchoo_CoffeeFreak_Block_EditSpecial</class>
</coffefreakblock2>
</blocks>
<helpers>
<coffefreakhelper1>
<class>Inchoo_CoffeeFreak_Helper</class>
</coffefreakhelper1>
</helpers>
</global>
<admin>
<routers>
<samplerouter1>
<use>admin</use>
<args>
<module>Inchoo_CoffeeFreak_AdminControllersHere</module>
<frontName>print</frontName>
<modules>
<sintax after="Inchoo_CoffeeFreak_AdminControllersHere">Mage_Adminhtml</sintax>
</modules>
</args>
</samplerouter1>
</routers>
</admin>
<adminhtml>
<menu>
<mymenu1 translate="title" module="coffefreakhelper1">
<title>PrintInfo</title>
<sort_order>20</sort_order>
<children>
<!-- Note the misleading "module" attribute.
It actualy refers to one of the declared helpers -->
<myitem1 translate="title" module="coffefreakhelper1">
<title>Add/Change Config</title>
<action>samplerouter1/settings</action>
<sort_order>1</sort_order>
</myitem1>
</children>
</mymenu1>
</menu>
</adminhtml>
</config>
Your server may be running on Linux which is case sensitive so you need to check that you module file and folder should be according Magento standard like controller should be IndexController not indexController etc.
and your localhost running on window which is not case sensitive.
Normally this is when you are logged in. Logout and login again. Then it should work.
Assuming that cache is turn off / cleared
1) Logout and log back in again
If you still getting a 404 error
2) Check your server error log, you maybe missing your module helper file
Login In/Out,clear cache, should be the solution.But you can try below points (though it may find foolish).
1) Check your xml contents.(line by line with your localhost xml)
2) Spellings matter (hope <sintax> spelling is correct is your xml )
3) Remove unwanted space (like before <global> tag) and comments.
4) Opening & closing of tags.
5) Proper Indentation (this will help to find your flaw if it is there)
6) Atlast directly copy the same localhost xml file in your server.
I really wish this will help you to find the bug.

Magento Overwrite admin template phtml with one from my module

I've gotten quite used to overwriting magento's frontend layout files, so I thought it would be easy to overwrite a phtml template in the admin panel - but I've gotten nowhere in the last six hours. All tutorials I've found so far are concentrating on creating a controller, but I only need to overwrite two phtml files since I only want to change the dispaly of the ordered items a little.
Specifically I want to overwrite the default/template/sales/order/view/items.phtml, normally i'd just match that path in my design folder of my own module and call it a day.
I can overwrite the block php file in Mage/Adminhtml/Sales/Order/View/Items.php through my config.xml:
<config>
...
<global>
...
<blocks>
...
<adminhtml>
<rewrite>
<sales_order_view_items>MyCompany_MyModule_Block_Adminhtml_Sales_Order_View_Items</sales_order_view_items>
</rewrite>
</adminhtml>
</blocks>
...
</global>
...
</config>
How can I tell Magento to use my phtml file in design/adminhtml//default/sales/order/view/items.phtml ?
Shouldn't these lines in my config.xml work?
<config>
...
<adminhtml>
<layout>
<updates>
<my_module>
<file>order_list.xml</file>
</my_module>
</updates>
</layout>
</adminhtml>
...
</config>
Any help is really appreciated! I really hope I've just overlooked something...
What you could do is put your custom module before Mage_Adminhtml
<admin>
<routers>
<adminhtml>
<args>
<modules>
<My_Module before="Mage_Adminhtml">My_Module_Adminhtml</My_Module>
</modules>
</args>
</adminhtml>
</routers>
</admin>
Then copy to your order_list.xml
<adminhtml_sales_order_view>
....
</adminhtml_sales_order_view>
from /app/design/adminhtml/default/default/layout/sales.xml
In order_list.xml you could now replace the block type and template file (phtml) location

Overriding Magento Block

I'm stuck. Been messing with this all day. To me this looks like it should work but It's not, and its not outputting any errors to magento error log.
What I tried to do was simply override the getPriceHtml() function in Catalog/Block/Product.php. The module is active from the 'Advanced' tab via the system configuration.
My config.xml in app/code/local/Brian/Pricefix/etc/config.xml:
<config>
<modules>
<Brian_Pricefix>
<version>1.0</version>
</Brian_Pricefix>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<product>Brian_Pricefix_Catalog_Block_Product</product>
</rewrite>
</catalog>
</blocks>
</global>
</config>
My Brian_Pricefix.xml in app/etc/modules:
<config>
<modules>
<Brian_Pricefix>
<active>true</active>
<codePool>local</codePool>
</Brian_Pricefix>
</modules>
</config>
My Product.php in app/code/local/Brian/Pricefix/Catalog/Block/Product.php
class Brian_Pricefix_Catalog_Block_Product extends Mage_Catalog_Block_Product
{
public function getPriceHtml($product)
{
Mage::log("IM IN YOUR MODULEZ");
$this->setTemplate('catalog/product/price_fix.phtml');
$this->setProduct($product);
return $this->toHtml();
}
}
The new module isn't taking, its not logging anything or outputting price_fix.phtml
Any suggestions? I've done a few hours or research and this appears to be the right way to extend a block, so i'm not sure whats going on. The lack of error output is frustrating.
Thanks.
Looks like Mage_Catalog_Block_Product is not used anywhere.
catalog.xml contains mainly Mage_Catalog_Block_Product_View or Mage_Catalog_Block_Product_List calls.
You config looks fine. Try overriding another block.
Can you precise the page you are testing on?

Resources