Magento themes and extensions

Dealing with Magento Model or Collections

Share
Posted on November 27th, 2012 | Posted by admin

As We know that the implementation of a “Models Tier” is a important part of any MVC framework. It represents the data of your application, and most applications are useless without data. Magento Models play an even important role, as they contain the “Business Logic” that’s often relegated to the Controller or Helper methods in other PHP MVC frameworks.

Actually in case of collections in Magento. Collection is a Model type containing other Models, it is basically used in Magento to handle product lists from a category or a bundle option, but not only.

Below is a simple example of loading some product collection from a category and ordering them on their product name using Magento’s API.

$collection = Mage::getModel('catalog/category')->load($categoryId)
    ->getProductCollection()
    ->addAttributeToSort('name', 'ASC');

Magento Google Analytics Code Has Errors

Share
Posted on November 26th, 2012 | Posted by admin

Last week we deployed another successful Magento ecommerce website. To track the visitors we signed up for a free Google Analytics account, and then plugged their tracking code into the admin section of the Magento administrator area. When we applied the API, the site quickly confirmed that the tracking code was in place through the Google Analytics dashboard.

Zend Studio debugger doesn’t work on Magento

Share
Posted on November 25th, 2012 | Posted by admin

Learning Magento is hard enough and when you’re debugger won’t stop at any breakpoints, that’s enough to take any developer out of his game

how to configure various debuggers to work with Magento. Below is how to configure your magento project with Zend Studio for Eclipse.

ZEND STUDIO FOR ECLIPSE
The following assumes that Magento can be reached from http://127.0.0.1/magento
- From the “Run” menu, select “Debug Configurations”
- On the left, right-click on “PHP Web Page” and select “New”
- Name: Magento
- Server Debugger: Zend Debugger
- PHP Server: Click on the “New” link

Adding multiple products to the cart simultaneously in Magento

Share
Posted on November 24th, 2012 | Posted by admin

A while ago I wrote about adding multiple products to the shopping cart simultaneously. It turns out this seems to have stopped working from Magento 1.4 or so. Up until now, I’ve not really had the time to look in detail to figure out why. Finally, this evening, I got some time. So I dug deeper.

It turns out there seems to have been some changes in the way models persist their data, and unsetting and unloading/resetting them didn’t seem to cut it any more. Anyway, below is a fixed version of the previous post. Tested on 1.4.2.0 and 1.6.0.0.

This is a replacement for the file app/code/local/BTS/AddMultipleProducts/controllers/AddController.php;

HTTPS + MAGENTO CACHE + INTERNET EXPLORER = NO IMAGE

Share
Posted on November 23rd, 2012 | Posted by admin

Magento uses by default an advanced cache system in order to display templates content faster. But default configuration of this cache can sometime creates some issues.

Recently, we had some images that were not displayed in the top menu when we switch from an http page to a https page using Internet Explorer browser. Images in this menu still have a non secured (http) URI. Internet Explorer is not pleased with such content. By default, this browser does not display unsecured content on a secured page. We have this security warning displayed when some image have http URI on a https page:

Block displaying top menu was using cache system but this cache was not regenerated when we switch from a http to a https page. That’s why images were still having http URI.