Magento finds module XML in one install, and not another - magento

I've been working on a plugin for Magento, and I have one global block with no xml tags outside of it in my layout/name.xml file as such:
<block name="one.two.three" template="project/button.phtml" />
The idea is to be able to call getBlockHtml("one.two.three") anywhere and be able to see the beta.phtml. I got this working no problem.
To test through my plugin's installation process, I tried installing another magento from scratch. I installed my plugin into the same directories as the first and copied/pasted the getBlockHtml from my older install, and nothing appears (not even the template hint)! Adding default references didn't help.
It's obviously not detecting my xml files, though the adminhtml menu and the mysql install script both work. Any idea why this would be? And yes, I have cleared cache countless times.
Edit:
Both installations are version 1.7.0.2
Both of these installations are on the same computer, so their filesystems and casing are presumably identical. Is it ever the case when two on the same computer could differ in case sensitivity?
Installing plugin: We have a script that copies files into the Magento installation, which has been working so far with the first installation, and is what I have been doing with the second ins. To confirm, the entries and tables in the magento database are added when the files are copied over.
My layout is stored in a general layout folder: app/design/layout/projectEmbeds.xml. I realize this is not common convention but it was like this before I got to this project, and it was working so I didn't mess with it. I assume this decision was made so it would appear independent website theme.
Similarly, my plugin is stored in app/code/local/ -> Project/Embeds, which contains Blocks, controllers, etc, Helper, Model, and sql as it should.
The button.phtml in question is located in app/design/frontend/default/default/project
My config.xml file stored in etc in the above directory is as follows. Anything referencing Project_Banner is important and the Project_Embed one is almost entirely deprecated.
<config>
<modules>
<Project_Embeds>
<version>0.1.0</version>
</Project_Embeds>
</modules>
<frontend>
<routers>
<embeds>
<use>standard</use>
<args>
<module>Project_Embeds</module>
<frontName>embeds</frontName>
</args>
</embeds>
</routers>
<layout>
<updates>
<embeds>
<file>projectEmbeds.xml</file>
</embeds>
</updates>
</layout>
</frontend>
<global>
<resources>
<project_embed_setup>
<setup>
<module>Project_Embeds</module>
<class>Project_Embeds_Model_Mysql4_Setup</class>
</setup>
</project_embed_setup>
</resources>
<models>
<embeds>
<class>Project_Embeds_Model</class>
<resourceModel>embeds_mysql4</resourceModel>
</embeds>
<projectbanner>
<class>Project_Banner_Model</class>
<resourceModel>banner_mysql4</resourceModel>
</projectbanner>
<embeds_mysql4>
<class>Project_Embeds_Model_Mysql4</class>
<entities>
<embeds>
<table>project_embed</table>
</embeds>
<banner>
<table>project_banner</table>
</banner>
</entities>
</embeds_mysql4>
</models>
<resources>
<embeds_setup>
<setup>
<embeds>Project_Embeds</embeds>
</setup>
<connection>
<use>core_setup</use>
</connection>
</embeds_setup>
<embeds_write>
<connection>
<use>core_write</use>
</connection>
</embeds_write>
<embeds_read>
<connection>
<use>core_read</use>
</connection>
</embeds_read>
</resources>
<blocks>
<embeds>
<class>Project_Embeds_Block</class>
</embeds>
</blocks>
<helpers>
<embeds>
<class>Project_Embeds_Helper</class>
</embeds>
</helpers>
</global>
<admin>
<routers>
<thisprojectname>
<use>admin</use>
<args>
<module>Project_Embeds</module>
<frontName>project</frontName>
</args>
</thisprojectname>
</routers>
<!-- default admin design package and theme -->
<design>
<package>
<name>base</name>
</package>
<theme>
<default>default</default>
</theme>
</design>
</admin>
<adminhtml>
<menu>
<embeds translate="title" module="embeds">
<title>Project</title>
<sort_order>9999</sort_order>
<children>
<projectbanner module="embeds">
<title>Edit Coupon</title>
<sort_order>1</sort_order>
<action>embeds/adminhtml_banner</action>
</projectbanner>
</children>
</embeds>
</menu>
<layout>
<updates handle="index_settings">
<embeds>
<file>projectEmbeds.xml</file>
</embeds>
</updates>
</layout>
</config>

Try adding the projectEmbeds.xml file in your theme used i.e default i guess
So add in
/app/design/frontend/default/default/layout/
and call the block inside
<default></default>
Let me know if it helps..

Related

Magento Extension causes 404 Error from the Admin Panel

We have a Magento Extension on our website, written by an ex-employee. This extension was written just for this one website, and I am struggling to find out what is going wrong with this extension. Contacting the ex-employee has proven to be (how should I put this), an ineffective method for solving this problem, so I was hoping someone here could help me out.
The extension works fine on the site, but when we click on the extension in the backend, on the Admin Panel, we get a "404 Not Found 1" error.
Is there anything I can do (like changing log file settings) to find out what file is missing and causing this 404?
QUICK UPDATE
After rolling back a load of patches we have noticed that this problem only occurs after patch 5994. Is there anything in patch 5994 that could be causing these problems?
The extension itself has the following files:
\app\code\local\muz\Worldman\controllers\
WorldmanController.php
\app\code\local\muz\Worldman\controllers\Adminhtml\
WorldmanController.php
\app\code\local\muz\Worldman\controllers\etc
config.xml
\app\code\local\muz\Worldman\controllers\Helper
Data.php
I can make changes to the class names in the \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php and instead of getting a 404 error, I get an actual crash report, stating that Controller file was loaded but class does not exist.
Again, this extension works fine on the site itself. Its just clicking on the extension itself from the Admin Panel menu that causes the 404.
The extension is enabled. I have logged out and back in a hundred times. Indexes have been re-indexed. Caches have been cleared and turned off. Servers have been rebooted. But to no avail.
At this point any suggestions for debugging any Magento extensions would be very much appreciated.
If this helps, here is the config.xml file:
<?xml version="1.0"?>
<config>
<modules>
<muz_Worldman>
<version>1.0.0</version>
</muz_Worldman>
</modules>
<global>
<helpers>
<worldman>
<class>muz_Worldman_Helper</class>
</worldman>
</helpers>
</global>
<frontend>
<routers>
<worldman>
<use>standard</use>
<args>
<module>muz_Worldman</module>
<frontName>worldman</frontName>
</args>
</worldman>
</routers>
<layout>
<updates>
<worldman>
<file>worldman.xml</file>
</worldman>
</updates>
</layout>
</frontend>
<adminhtml>
<menu>
<cms>
<children>
<worldman_adminform translate="title" module="worldman">
<title>Worldman Manager</title>
<action>worldman/adminhtml_worldman</action>
</worldman_adminform>
</children>
</cms>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<cms>
<children>
<worldman_adminform>
<title>worldman Manager</title>
</worldman_adminform>
</children>
</cms>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<worldman>
<file>worldman.xml</file>
</worldman>
</updates>
</layout>
</adminhtml>
</config>
The ACL settings are not set right for the user, that's why you get a 404. Even with the ACL set correctly you might get this error if you do not flush the Magento config cache and log out and then back in again.
From a quick look at your config, it seems like the XML part of the ACL settings is alright, but you might need to check if the file \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php has a method like this in it:
protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('cms/worldman_adminform');
}
I had a bunch of modules that stopped working because of this missing method after one of Magento's latest patches.
Also, did you try with an admin account where you should automatically have full access?
--------EDIT-------
The patch you mentioned (5994) gave me similar problems with one of my modules. It used frontend routing for the adminhtml-controller, so what I had to do was to remove the XML between <frontend>...</frontend> and replace it with something like this:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<muz_Worldman after="Mage_Adminhtml">muz_Worldman_Adminhtml</muz_Worldman>
</modules>
</args>
</adminhtml>
<worldman>
<use>admin</use>
<args>
<module>muz_Worldman</module>
<frontName>worldman</frontName>
</args>
</worldman>
</routers>
</admin>
and also make sure that the the XML for ACL action - <action>worldman/adminhtml_worldman</action> is right, I had to make some changes to the URL so mine became more like (for you) adminhtml/worldman_adminform.

magento install script 1.8.1

I'm trying to create a symply module for import country region and more in database.It's very simple but the data wasn't import.I can't figure why:
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Province_Italian>
<version>1.0.50</version>
</Province_Italian>
</modules>
<global>
<resources>
<province_italian_setup>
<setup>
<module>Province_Italian</module>
<class>Province_Italian_Model_Resource_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</province_italian_setup>
<province_italian_write>
<connection>
<use>core_write</use>
</connection>
</province_italian_write>
<province_italian_read>
<connection>
<use>core_read</use>
</connection>
</province_italian_read>
</resources>
</global>
</config>
basic configuration file
and i had this folder structure with install script
Province/Italian/Model/Resource/Setup.php
data/province_italian_setup/data-install-x.x.x.php
and usually file in etc folder for configurazion config.xml
It' very simple ,the module is added because i've seen this reference in core_resource table, but seem that can't read installation file from data folder.
Where's mistake?
I'm going mad!
Thanks
"because i've seen this reference in core_resource"
Dalete that reference record from core_resource, delete cache, and try again
A couple of suggestions:
Make sure that have your module enabled, by having a file in app/etc/modules/Province_Italian.xml stating the following information:
<?xml version="1.0"?>
<config>
<modules>
<Province_Italian>
<active>true</active>
<codePool>local</codePool>
<depends><!-- Put your Module dependencies here --></depends>
</Province_Italian>
</modules>
</config>
The code of the module can be found in app/code/local/Province_Italian
The first install file matches the version number of the module. In this case that would be 1.0.50. So the filename must be
app/code/local/Province_Italian/data/province_italian_setup/data-install-10.0.50.php
Once the install script has ran, it cannot run again. Make sure that the code province_italian_setup is absent in the database table core_resource. This will trigger Magento to run the setup script.
Have logging (Mage::log(...)) in your datat install script to see it the script runs.
When you have no custom setup functionality, then the Province_Italian_Model_Resource_Setup.
I also noticed that the models is missing in your XML. Probably your need to add it. Based upon your description, you probably need (1) a model to to manipulate a datastore purely through PHP code, and (2) need a resource model to import the data into a custom database table.
<config>
<modules>
<Province_Italian>
<version>1.0.50</version>
</Province_Italian>
</modules>
<global>
<models>
<province_italian>
<class>Province_Italian_Model</class>
<resourceModel>province_italian_resource</resourceModel>
</province_italian>
<province_italian_resource>
<class>Province_Italian_Model_Resource</class>
<entities>
<!-- Put your entities here -->
</entities>
</province_italian_resource>
</models>
<resources>
<province_italian_setup>
<setup>
<module>Province_Italian</module>
<!-- <class>Province_Italian_Model_Resource_Setup</class> -->
</setup>
</province_italian_setup>
<province_italian_write>
<connection>
<use>core_write</use>
</connection>
</province_italian_write>
<province_italian_read>
<connection>
<use>core_read</use>
</connection>
</province_italian_read>
</resources>
</global>
I hope the above will help.

Magento Hello World Admin Module Returning 404

I'm having a go at building an admin module using the moduleCreator tool found here
Even out of the box it is throwing a 404 when I navigate to the page. I have disabled cash and logged out/in. None of the googled solutions fix the issue. I am running 1.7.2
The key files look like this:
Config.xml
<?xml version="1.0"?>
<config>
<modules>
<Jinkou_MobileAdmin>
<version>0.1.0</version>
</Jinkou_MobileAdmin>
</modules>
<global>
<helpers>
<mobileadmin>
<class>Jinkou_MobileAdmin_Helper</class>
</mobileadmin>
</helpers>
<blocks>
<mobileadmin>
<class>Jinkou_MobileAdmin_Block</class>
</mobileadmin>
</blocks>
</global>
<admin>
<routers>
<mobileadmin>
<use>admin</use>
<args>
<module>Jinkou_MobileAdmin</module>
<frontName>mobileadmin</frontName>
</args>
</mobileadmin>
</routers>
</admin>
<adminhtml>
<menu>
<mobileadmin module="mobileadmin">
<title>MobileAdmin</title>
<sort_order>100</sort_order>
<children>
<mobileadminbackend module="mobileadmin">
<title>Order Processing</title>
<sort_order>0</sort_order>
<action>mobileadmin/adminhtml_mobileadminbackend</action>
</mobileadminbackend>
</children>
</mobileadmin>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<mobileadmin translate="title" module="mobileadmin">
<title>MobileAdmin</title>
<sort_order>1000</sort_order>
<children>
<mobileadminbackend translate="title">
<title>Order Processing</title>
</mobileadminbackend>
</children>
</mobileadmin>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<mobileadmin>
<file>mobileadmin.xml</file>
</mobileadmin>
</updates>
</layout>
</adminhtml>
</config>
MobileBackendController.php
<?php
class Jinkou_MobileAdmin_Adminhtml_MobileAdminbackendController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->_title($this->__("Order Processing"));
$this->renderLayout();
}
}
The MobileAdminbackendController.php does not seem to be loading as I can remove the class and not throw an exception.
Make Sure the following files are there inside the proper folders as given below :
app\code\local\Jinkou\MobileAdmin\Block\Adminhtml\MobileAdminbackend.php
app\code\local\Jinkou\MobileAdmin\controllers\Adminhtml\MobileAdminbackendController.php
app\code\local\Jinkou\MobileAdmin\etc\config.xml
app\code\local\Jinkou\MobileAdmin\Helper\Data.php
app\design\adminhtml\default\default\layout\mobileadmin.xml
app\design\adminhtml\default\default\template\mobileadmin\mobileadminbackend.phtml
app\etc\modules\Jinkou_MobileAdmin.xml
Can you go to the following settings page and check if you can fing "Jinkou_MobileAdmin" in the list?
System -> Configuration -> Advanced
If you can't find it there, you might have forgotten to add the module XML file in your code, to add this, go to:
app -> etc -> modules
Just copy other XML and edit the data in it to your module.
Make sure you name your file "Jinkou_MobileAdmin.xml".
I am on magento 1.8 and I fixed my error(404) by doing the following. Inside Magentotutorial_Helloworld.xml put below code:
codePool local codePool
since I do not have a local folder I put mine into the community folder. Change the code to this and it will work.
'codePool community codePool'

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

Rewrite sql module

Hi I'm trying to rewrite or extend all database update sql's files from core to local without success, until now I have:
CORE:
+core
+Mage
+Mymodule
+...
+etc
-config.xml
+sql
+mymodule_setup
-mysql4-install-0.1.0.php
-mysql4-install-0.1.0-0.1.1.php
-...
LOCAL:
+local
+Mage
+Mynamespace
+Mymodule
+...
+etc
-config.xml
+sql
+mymodule_setup
-mysql4-install-0.1.0.php
-mysql4-install-0.1.0-0.1.1.php
-...
So my question is to avoid problems when upgrading Magento how show I configure the config.xml in core and local, rewrite Block, Model, I did with success, but not for sql, until now I have:
LOCAL
<?xml version="1.0"?>
<config>
<modules>
<Mage_Mymodule>
<version>0.1.1</version>
</Mage_Mymodule>
</modules>
<global>
<resources>
<mynamespace_mymodule_setup>
<setup>
<module>Mynamespace_Mymodule</module>
<class>Mage_Mymodule_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mynamespace_mymodule_setup>
</resources>
<models>
<Mymodule>
<rewrite>
<abc>Mynamespace_Mymodule_Model_Abc</abc>
</rewrite>
</Mymodule>
</models>
</global>
</config>
Thanks in advance for any help.
There's no way to override install/update scripts.
You have to:
1. Set dependency for your module, it must be installed last.
2. In your install script you may use anything.
You'd better use Varien_Db_Adapter_Pdo_Mysql methods.
I think the problem is that you've changed the class in the resource setup to a class that probably doesn't exist. Try :
<setup>
<module>Mynamespace_Mymodule</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
You could make some hack, like in your setup class overwrite the protected method _getAvailableDbFiles and rewriting it using dirname(FILE) instead of Mage::getModuleDir (Mage_Core_Model_Resource_Setup~480)

Resources