Posts Categorized: PHP

Magento Admin Menus

Posted by & filed under Magento.

Add a menu item to the top level admin menu Take a look at the Magento core file for CMS item is defined in app/code/core/Mage/Cms/etc/adminhtml.xml. Add a menu item as a child under an existing top level menu Take a look at another core file for the Wigets item of the CMS menu is defined… Read more »

Magento translate renderTotals()

Posted by & filed under Magento, PHP.

I had an issue where Magento was not picking up translation of “Free Shipping – Free” on my Checkout page. I got round this by adding a function inside /app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php inside the collect() function:

Foreign key restraints

Posted by & filed under Magento, mySQL.

Trying to import a Magento table into a database (drop table if exists) I got an error: The way to get round this is to remove the foreign key constraint CHECK, delete the table, then add the check again:

Testing PayPal IPN results

Posted by & filed under PHP.

If you are getting 400 errors back from paypal make sure you add a Host header. It won’t do any harm to add the Connection close header too. Notice the host depends on whether you’re aiming at sandbox or live paypal.

Zend Framework Application.ini Cheat Sheets

Posted by & filed under Zend Framework.

DESPATCH Here’s a link to a PDF detailing despatch process, NOT ZF2.x. http://nethands.de/download/zenddispatch_en.pdf APPLICATION.INI https://github.com/feibeck/application.ini STANDARD METHODS http://www.iostream.eu/wp-content/uploads/2012/11/zend_cheat_sheet.html

Handle mysql_query() error without a variable

Posted by & filed under mySQL, PHP.

Thought this was a neat way of testing/handling query errors without assigning the result to a variable because you don’t need a variable unless you are using SELECT. mysql_error() returns empty string if there was no error, which evaluates to false, as pointed out by jakub-arnold in this post