Magento module works well on localhost but not on

2020-04-14 16:13发布

I have a weird case here....

I'm making a simple magento module right now. Some kind of script injection module (similar to google analytics module). I've built the admin config for that module (which is defined from system.xml) enter image description here

as seen on the image. This module works very well on my localhost. But it's getting weird on the live server. The modules looks like it doesn't enabled at all although I have totally make sure it's all already enabled. Both via magento admin area and also via app/etc/modules. That admin config area never appear on live server's magento installation.

does anybody know what's the issue with this problem? or at least tell me how and where should I debug it? I've been digging it to magento core code but getting stuck on getSingleton() function somewhere around magento core code. I don't understand that way-too-MVC stuff :p

I would be very glad if someone could explain and guide me on this

thanks :)

标签: php magento
4条回答
▲ chillily
2楼-- · 2020-04-14 16:42

Thumb rules while deploying magento custom module on the live server-

  1. Deploy your custom module
  2. Flush your all magento cache or at-least refresh them [System->Cache Management]
  3. If you have enabled compilation re-run the compilation or disable compilation until the testing is done. [System-Tools->Compilation]
查看更多
放我归山
3楼-- · 2020-04-14 16:46

The most common problems are associated with case sensitivity. If you have Windows hosting, then the error in the uppercase/lowercase characters is not visible and it works. But as soon as it gets to linux hosting, the module will not work.

Check the paths in the settings and folders/files - so that they match.

查看更多
啃猪蹄的小仙女
4楼-- · 2020-04-14 16:51

Usually there are three things:

  • typos in xml files (validate them with validator)
  • cache is not cleared after installation (clear cache)
  • ACL rules are not reinitiated (re-save admin roles)
查看更多
forever°为你锁心
5楼-- · 2020-04-14 16:55

If you adjust the layout/add your own layout in the backoffice of magento, it's best to clear the cache (remove everything in the var/cache/ folder) and to logout and re-login.

查看更多
登录 后发表回答