Home » Archive

Articles in the Magento Category

Magento »

[4 Dec 2009 | 2 Comments]

The following functions can be used to get product’s image height and width. Image functions are defined in Mage_Catalog_Helper_Image class.

getOriginalWidth gives width of image.

Magento »

[4 Dec 2009 | 4 Comments]

You can easily call any static block from template (phtml) file. At first, you have to create a static block.
Let us suppose, you created a static block with the identifier cool_items.

Magento »

[4 Dec 2009 | 3 Comments]

You can call your block directly from a phtml file with the following code. You can keep this code and call the block from any phtml file.
I have assumed my module name as Newmodule and my block name as Newblock.php. The phtml file for the block is assumed to be newmodule/newblock.phtml

Magento »

[3 Dec 2009 | One Comment]

We are not allowed to order configurable and bundle products directly. We have to select product options from product detail page of configurable or bundle product. Only then we can add the product to cart.
The following code fetches the order option selected for configurable and bundle products:

Magento »

[2 Dec 2009 | 54 Comments]

Attribute in Magento is like a property. All Products, Categories, Orders, Customers, etc. have attributes. For example, the attribute of a product is its name, sku, description, image, etc.
This article will show you how to get attribute name and value for any product.

Magento »

[2 Dec 2009 | 19 Comments]

The redirect functions are present in Mage_Core_Controller_Varien_Action class.
/* Redirect to certain url  */
_redirectUrl($url)
/* Redirect to certain path */
_redirect($path, $arguments=array())

Magento »

[27 Nov 2009 | 7 Comments]

Suppose, you want to delete an attribute. But there is no delete option while you edit the attribute. This means that the attribute is system attribute. System attributes cannot be deleted. Only user defined attributes can be deleted.
To delete the attribute, you have to make it user defined.

Magento »

[27 Nov 2009 | 12 Comments]

Difference between EAV and Flat Catalog
In EAV database model, data are stored in different smaller tables rather than storing in a single table.
Like,
product name is stored in catalog_product_entity_varchar table

Magento »

[27 Nov 2009 | One Comment]

To be able to write your custom log message, you have to enable logging from Magento Admin.
To enable logging, go to
Admin Panel -> System -> Configuration -> Developer -> Log Settings -> Enabled = Yes

Magento »

[23 Nov 2009 | 4 Comments]

Different stores can be set in Magento. A product can be made visible in selected stores.

Hope it helps. Thanks.

Magento »

[23 Nov 2009 | 16 Comments]

Scenario:
A simple product is associated with a configurable product. You have the id of the simple product. Now, you need the id of the configurable product with which the simple product is associated.
Get parent product id, i.e. get id of configurable product from a simple product.

Magento »

[23 Nov 2009 | 38 Comments]

You can resize image with fixed height and variable width. Or, you can resize with fixed width and variable height. Following code shows how you do it in Magento.
Fixed width of 600px

Magento »

[23 Nov 2009 | 8 Comments]

Getting URL of a current page you are visiting or working on is a common requirement in any web development project. There are various ways you can get the current URL of a page in Magento. Here are some :-
From Mage_Core_Helper_Url class

Magento »

[23 Nov 2009 | 13 Comments]

When you fetch product data, you get the price as integer. Now, you have to display the price with currency suffix. You can format price with the following code.
Let $_finalPrice be the integer price fetched.

Magento »

[23 Nov 2009 | 9 Comments]

Here are code to Get, Set, and Unset Session in Magento.
Set session with variable Name ‘testing_magento‘. The session value here is ‘hello‘.
Mage::getSingleton(‘core/session’)->setTestingMagento(‘hello’);