Magento Themes and Magento Extensions

Handling intensive Magento tasks in the background, simulating AJAX via CRON

Posted on June 27th, 2011 | Posted by admin

For those of a weak hart, please skip this article. Before I start presenting the idea, please note that this is just an idea. So what’s it about? In our everyday Magento development there are numerous examples/tasks where we need to import some data into Magento or programmatically create some entries like products, orders, customers, etc. When dealing with larger scale of things, importing/creating 50000 of products can turn out to be a real challenge. Usually we (the developers) strive to a simplest possible solution, which in this case ideally would be to make simple foreach loop where we would have our code handling product creation in each iteration of the loop. Technically this works, but with extreme PHP/environment configurations only.

Second thing that might come to a mind is AJAX approach, like the one seen on the default Magento store where you initiate your product import. This solution is better than previously mentioned as it eliminates the system ending up “resource-less” . If you catch my point. There is one major drawback with this approach as well. That is, this approach works only while your browser is turned on.

Load XLS files into Magento modules using PHP-ExcelReader class

Posted on June 27th, 2011 | Posted by admin

Recently I had a small problem and it turned out that it wasn’t small as a initially thought. I had to read XLS (Microsoft Excel document) into PHP. After I spent almost 2 hours browsing through internet, I found myself most satisfied with open source project “PHP-ExcelReader class“. It has everything I needed (multiple sheets support and it could read data from both Excel 2000 and 2007). On the other hand, Magento doesn’t support XLS, and I decided to write a small method that you can implement in any Magento class.

So, here it goes:
public function loadXML($path_to_XML)

$include_path = dirname(__FILE__);
$path_to_PHP_ExcelReader = $include_path.”/read_xls/Excel/reader.php”;

require_once $path_to_PHP_ExcelReader;

// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();

How to set multiple stores/websites with one magento installation on different domains

Posted on June 27th, 2011 | Posted by admin

This article will describe quickest way how to use and configure one Magento installation on different domains.
Point here is what do you want to have on that different domains, for example you want to have chosen categories/products on one domain and the other one will be on different language.
First you figure that and then go to configuration.

So for each domain you need to create webiste in main Magento admin installation:
System > Manage Stores > Create Website

For Name: you enter name of you desired domain (“”)
For Code: you will enter identifier for that domain (“my_website_com”)

After that you will go to:

Magento: Mass Exclude/Unexclude Images

Posted on June 27th, 2011 | Posted by admin

By default, Magento will check the ‘Exclude’ box for you on all imported images, making them not show up as a thumbnail under the main product image on the product view. Should you ever want to mass unexclude them (or mass exclude your images), you can simply run one of the following sql commands in your database:

# Mass Unexclude
UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '0' WHERE `disabled` = '1';

# Mass Exclude
UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '1' WHERE `disabled` = '0';

Magento: New Extension Idea – Product Image Removal

Posted on June 24th, 2011 | Posted by admin

As you most likely know, when you remove an image from a product, or delete a product, the image file actually stays in it’s place on the server. It is not removed. Rare is the case when I want the image to remain there if I am removing it from a product, or deleting a product. I would much rather it be deleted!

I’m thinking about writing a module that would allow you to easily enable or disable image deletion in these two cases. So, if you have it enabled, when you remove an image from a product, or delete a product, the image would be fully removed. Simple.

I’d like to try and gauge if Magento users would be interested in such an extension. If this sounds like something you’d be interested in, please comment and let me know. Feel free to add any additional ideas as well.