Category Archives: Magento

Fetch a collection by custom filter in Magento

Example of fetching categories in Magento and filtering by a custom attribute: $categories = Mage::getModel(’catalog/category’)->getCollection(); $categories->addAttributeToSelect(’name’); $categories->addAttributeToFilter(’featured_category’, 1);   foreach($categories as $key => $category) { echo $category->getName(); }

Posted in Magento | Tagged | Leave a comment

Delete all test order data from Magento

These commands can be pasted into PHPMyAdmin, or some similar client. Tested on Magento version 1.4.2.0 SET FOREIGN_KEY_CHECKS=0;   TRUNCATE sales_flat_order; TRUNCATE sales_flat_order_address; TRUNCATE sales_flat_order_grid; TRUNCATE sales_flat_order_item; TRUNCATE sales_flat_order_status_history; TRUNCATE sales_flat_quote; TRUNCATE sales_flat_quote_address; TRUNCATE sales_flat_quote_address_item; TRUNCATE sales_flat_quote_item; TRUNCATE sales_flat_quote_item_option; TRUNCATE sales_flat_order_payment; TRUNCATE sales_flat_quote_payment; TRUNCATE sales_flat_shipment; TRUNCATE sales_flat_shipment_item; TRUNCATE sales_flat_shipment_grid; TRUNCATE sales_flat_invoice; TRUNCATE sales_flat_invoice_grid; TRUNCATE sales_flat_invoice_item; [...]

Posted in Magento | Leave a comment

Fix the Worldpay Magento Extension for Magento v1.4 and newer.

There is a community extension developed by Phoenix Maiden for the integration of RBS Worldpay payment gateway into the Magento ecommerce system. However, due to changes in the templating engine, it doesn’t work for newer versions of Magento. This is how I fixed it for Magento version 1.4.2.0. I am using version 1.3.1 of the [...]

Posted in Magento | Tagged | Leave a comment

Magento template path hints in adminhtml

Template path hints are a great Magento feature to help you customise the frontend of your store. They can also be enabled for the admin backend. Override the app/code/core/Mage/Core/etc/system.xml file with the following. In my case I have put the override file in an extension app/code/local/Deanoj/Theme/etc/system.xml <?xml version="1.0"?> <config> <sections> <dev translate="label" module="core"> <groups> <debug [...]

Posted in Magento | 3 Comments

Adding custom content blocks to Magento CMS pages

In this case I wanted to add a custom block containing the company contact details to the right sidebar on a CMS page. In the admin panel > CMS > ‘your page’ > design view, I set the Layout to a 3 column view. In the Layout Update XML I added a reference to my [...]

Posted in Magento | 1 Comment