Magento Themes and Magento Extensions

Magento: Working on a Product Import Script

Posted on May 30th, 2011 | Posted by admin

While Magento did a good thing of creating the ability to import a CSV from within the Magento admin, it still lacks a bit, and it is extremely slow. It has improved in speed since 1.0 came out (it took me 15 hours to import 4500 products), but it still is very slow. It can even be a little overly picky sometimes.

That is why I started learning the eav database setup early, and began importing my own products with my own PHP script. With the first script I made, I was able to import those same 4500 products in 18 seconds instead of 15 hours. That is a time savings of 14 hours, 59 minutes, and 42 seconds.

My script wasn’t at all built smart though. It required a very specific number of columns, in a specific order, and with a specific text delimiter. All of the attribute ids and other variables were all hard-coded into the script, making it tedious to customize for a different system. I just recently learned that the attribute id values for different installations of Magento can be completely different.

So, I am on a mission to create a “smart” product import script. I plan to have different configuration options all at the top of the php script, which would keep the user out of the core and make setting it up easy. My goal is to make it so that you can create a CSV file of your products, with headers that match Magento’s attribute_code in any order you want it in. Even custom attributes that you create will be easily imported.

The script has already been started. Much of the core import features are already done. I took what I already had and gave the script to a friend of mine to test out, and he imported 12,630 products in 60 seconds. But, that script still required a specific column order.

Twitter: Follow the Product Import Script on Twitter

Posted on May 30th, 2011 | Posted by admin

There are definitely better ways to keep people up-to-date on a project that is often changing than a web page or blog posts. So, for little updates, and updates about the Magento Product Import Script that I am working on, I’ve setup a Twitter account for any of you who are interested in keeping up with the latest things that I’m working on.

My Twitter page is: Check it out, and stay updated!

If you haven’t seen already, I’ve also added my twitter posts to the right side bar of the blog here. Well, that’s enough for now. Time to go work on the script for a little while!

Magento: How to get all active payment modules

Posted on May 30th, 2011 | Posted by admin

This code bellow will get you all active Magento payment modules. This example below return an array which you can use to create drop down menu or something else in Magento’s front-end or admin sections.

class Inchoo_Vendor_Model_Activpayment
public function getActivPaymentMethods()
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
foreach ($payments as $paymentCode=>$paymentModel) {
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
$methods[$paymentCode] = array(
'label' => $paymentTitle,
'value' => $paymentCode,
return $methods;

eCommerce with Magento

Posted on May 30th, 2011 | Posted by admin

If you haven’t yet heard of Magento, you ought to check it out. For the past couple years, I have been using Zen Cart and I’ve done one installation of X-Cart. While these shopping carts work fairly well, the overall design and feel of these platforms is becoming quite out-dated.

Magento was first announced in April, 2007 as a new open-source ecommerce solution. Version 1.0 was launched in late March, 2008 and it is currently on version 1.1.4 (with 1.1.5 release later this month).

I have been using it ever since the release of 1.0. A warning to the php-dabblers: Magento is extremely complex and utilizes OOP PHP practices, and heavily utilizes the Zend Framework. It isn’t built for the average Joe. Skinning this beast requires a lot of effort in figuring out how Magento uses it’s layout XML files, and template PHTML files. While this is a warning for those who are not very comfortable with PHP, to those of you out there that are sick of the open-source ecommerce plague of ugly code in platforms such as Zen Cart, you will be very pleased with the Magento framework. It is extremely well thought out, and some say that it’s possibly TOO well thought out.

Magento: Accessing Customer Session

Posted on May 30th, 2011 | Posted by admin

I needed to create some custom shipping functionality within Magento today which would charge wholesale customers $5.00 flat rate, and all other customers got free shipping. This required having to access the customer group number. Wholesale customers are have a group id of 2.

So, I wrote a simple if statement in /template/checkout/onepage/shipping_method/available.phtml to check.

You may also want to simply check if users are logged in or not but don’t really need their customer group number. Here is how you can easily access this information from anywhere:

Check if User is Logged In

# Returns boolean
$logged_in = Mage::getSingleton( 'customer/session' )->isLoggedIn();

Get Customers Group ID

$group = Mage::getSingleton('customer/session')->getCustomerGroupId();

Page 3 of 39«12345»102030...Last »