Articles Archive for November 2009
Magento »
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 »
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 »
To be able to write your custom log message, you have to enable logging from Magento Admin.
To enable logging, go to
Magento Admin Panel -> System -> Configuration -> Developer -> Log Settings -> Enabled = Yes
Javascript »
Here, I will be demonstrating on showing or hiding a div when a link is clicked. I have done this with Javascript and CSS.
I have called showHideDiv() Js function when the link is clicked. The display of the div where content is present, is visible or hidden on each click. For this, CSS styling is used (display: none).
Magento »
Different stores can be set in Magento. A product can be made visible in selected stores.
1 2 3 4 5 6 7 8 9 10 11 12 | /** * get store id */ $storeId = Mage::app()->getStore()->getId(); /** * call the Magento catalog/product model * set the current store ID * load the product */ $product = Mage::getModel('catalog/product') ->setStoreId($storeId) ->load($key); |
Hope it helps. Thanks.
Magento »
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 »
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 »
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 »
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 »
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’);
Magento »
You can choose the Catalog view option as grid only or list only. The default is Grid/List. You can change it to List/Grid as well.
To do so:
Javascript »
You can add html elements dynamically with Javascript. In this article, I will show you how to do so. I have created two Javascript functions. One for creating html elements and the other for removing them.
In my html elements, I have created ‘li’ and ‘strong’ elements inside ‘div’. The div id is ‘summary’. I have written comment in the code so that it would be easy to understand.
Mukesh Chapagain is a graduate of Kathmandu University (Dhulikhel, Nepal) from where he holds a Masters degree in Computer Engineering. Mukesh is a passionate web developer who has keen interest in open source technologies, programming & blogging.