Magento Themes and Magento Extensions

Magento Clear Shopping Cart and Session

Posted on March 4th, 2013 | Posted by admin

If you ever need to programmatically clear Magento’s shopping cart, use the snippet of code below. If you need to clear the user’s entire session, including the shopping cart, shipping information, billing information and chosen payment methods, please refer to the snippet further below.

Clear shopping cart

foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
    Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();


Posted on March 2nd, 2013 | Posted by admin

A web robot or simply robot can be described as a program that starts a specific function on the web that too automatically. It doesn’t matter if it’s for search engine indexing or simply for HTML and link validation.

Two of the most common web robots are: – Googlebot & Bingbot.

A measure of data that is sent across the internet is termed as bandwidth; every time a person visits your website a portion of bandwidth is utilized. Same is the case with web-robots; every time a web-robot visits your website they in turn utilize a small part of bandwidth.

Magento – Nested ifconfig for better Layouts

Posted on February 27th, 2013 | Posted by admin

By default, Magento allows you to use ifconfig in the following way:

10 <action method="addItem" ifconfig="path/to/config/status/enabled"><type>skin_js</type><name>js/script_one.js</name></action>

the javascript js/script_one.js will be included if path/to/config/status/enabled is true.
Unfortunately, Magento does not allow you to use the “else” block for ifconfig.

for example:
Let’s say, you want to implement the following logic:
if path/to/config/status/enabled is true
include the javacript js/script_one.js
include the javacript js/script_two.js

An Overview of Magento’s Get and Set Methods

Posted on February 26th, 2013 | Posted by admin

Magento handles its get and set methods in a way that if you do not understand how it works it can be confusing to you. In the beginning of this article you have to take a leap of faith and believe in magic.
In Magento you can take nearly any model and get all the information about it with a simple function call. See the example below:

$product = Mage::getModel('catalog/product')->load(1500);

This code will return an array of all the basic information about the product. For this example lets say that it only returned two elements to the array “name” and “meta_description”.

Now in order to get this information you will have to take the information and camel case it to create the function. So to get the information you would write the following:

echo $product->getName();
echo $product->getMetaDescription();

Do you see how the Meta Description function was formatted? The first letter of the words are capitalized (or camelized) to create the function. So lets say you had an attribute called this_really_important_long_attribute you would call $product->getThisReallyImportantLongAttribute()

Now that you understand that, in order to set the attributes value, you simply replace “get” with “set” and pass the variable as a parameter of the function. So to set the name you would make the following function call:


Ok remember when I said that you had to believe in magic? That is because if you look at the Product model, you will not find these functions defined anywhere. In fact if you are hardcore you can follow the class all the way to the top and you will not find these functions defined.

Ok now that you believe in magic, let’s take the curtain away and show you how Magneto accomplishes this. Nearly every class in Magento extends from the Varien Object (which is located in the /lib/Varien/Object.php file). You will see there is a getData() and setData() functions. These look like they could do the actual setting and getting but this is not the magic we are looking for.

Farther down in the file you are going to find the __call() function. This is the magic. This magic here is actually from PHP. The __call() function gets called anytime you call a function on a class that does not exist. The __call() function takes two parameters. The first one is the name of function that was called, the second one is the data that was passed to the function.

Magento Pre Launch Checklist

Posted on February 25th, 2013 | Posted by admin

When all the design work is completed, and the store is fully stocked with products, it’s time to start thinking about going live. It can be intimidating, especially if you haven’t done it before. Hopefully our Magento Launch Checklist will take some of the stress out of going live…

Magento Launch Checklist

  1. Favicon
  2. Place a favicon image in your theme’s folder skin/frontend/default/your-theme/favicon.ico

  3. HTML Head
  4. Change the title and set the meta description and keywords, these are important for SEO.
    System → Configuration →General → Design → HTML Head.

  5. Placeholder Images
  6. Create placeholder images for your site and place them in: catalog/products/placeholder/image.jpg, catalog/products/
    placeholder/small_image.jpg and catalog/products/placeholder/thumbnail.jpg. Alternatively they
    can be uploaded in admin: System → Configuration → Catalog → Catalog → Product Image Placeholders.