Magento Themes and Magento Extensions

ProductListing based on Attribute in Magento

Posted on September 26th, 2012 | Posted by admin

I would like to show “Suggestions” in my product listing in Magento. I made an attribute “Suggestion” which is Yes/No and global active. Now in the listing I would like to show the suggestions first, then some text and stuff, and then the rest of products.

I tried it like this:

/* .... */
$_productCollection->clear()->addAttributeToFilter('suggestion', 1)->load();

But this ends in an exception:

You cannot define a correlation name ‘_price_rule’ more than once

Now the question is, how to solve this?

Troubleshooting Email Sending Problems in Magento

Posted on September 25th, 2012 | Posted by admin

We just upgraded from Magento 1.3 to Magento 1.4.2, switched hosting providers, and suddenly our transactional emails were not being sent out. We were using the SMTP Pro extension by Ashley Schroeder (highly recommended, btw).

The problem turned out to be with our hosting provider, Nexcess. They were blocking port 587 in their firewall. The SMTP Pro extension connects to your Google Apps account through port 587.

We figured this out using a very simple script that can be helpful in a variety of ways (this was originally found on Google Groups, I can’t seem to find it again or I would be happy to give attribution):

$fp = fsockopen(“”, 25, &$errno, &$errstr, 10);
if(!$fp) {
echo “ 587 – $errstr ($errno) n”;
} else {
echo “ 587 – ok n”;

Make ‘Ship to This Address’ Default in Magento Checkout

Posted on September 22nd, 2012 | Posted by admin

This code will allow you to preselect the ’ship to address’ during your Magento checkout. Most often customers will not require shipping to multiple addresses therefore the preselected option should be automatically set to ‘Ship to this Address’.

This really should be setup as core, or at least an option in the admin section, but for the time being here’s how to make the change.

Bespoke or default template

Good practice would dictate to do this within your bespoke template.

Either Locate your template over-ride file:

app/design/frontend/< yourtheme >/< yourtheme >/template/checkout/onepage/billing.phtml

How to Create Custom Column Renderer in magento grid

Posted on September 21st, 2012 | Posted by admin

Magento Admin Grid provides the tabular data from database in grid format. This is convenient for all text data. In Some cases we may have other data type to be shown in grid which is not plain text data. For example Image data.

For this purpose magento provides us the flexibility to define our own column renderer. We can use this to add additional markup before and after the required data.

In this article we will see how to add our own column renderer to show an image file in our custom module. I’ll cover only the portions that show the image in admin grid. After adding our basic skeleton module. we need to do a few additional steps.

Step 1: In this step we are adding and saving some test data. Initially our grid will display only the image name.

Override Controllers in Magento

Posted on September 20th, 2012 | Posted by admin

While working in Magento you may sometimes run into situations where you would like to override the functionality of the Magento core controllers. But you cannot edit the core controllers of  Magento as it will hinder you from upgrading your Magento version. So we have to find a simple solution for that. Don’t worry, today we will see how to override Magento core controllers.
For this, you have to create a custom module. If you do not know how to create a custom module, then read this post.
Now suppose we want to override the checkout/cart controller. To do this, we will have to edit just two files in our custom module.
Suppose our custom module is present in the namespace ’Company’ and our module is named as ’Web’.

Step 1:
Open the app\code\local\Company\Web\etc\config.xml and edit it as follows:
The name of the core module to be overridden is written in between the router tags. Here we want to override the checkout module so checkout is to be wrapped in <routers> tags.
After that we will tell Magento to call our custom module before the Mage/Checkout module

Page 2 of 5«12345»