eav_attribute Table in Magento

Share
Posted on May 19th, 2013 | Posted by admin

It is well known that Magento implements an entity-attribute-value data model. A key table in the implementation is the ‘eav_attribute’ table, who’s exposition is the subject of this blog post.

Magento uses five ‘types’ to store attribute data: datetime, decimal, int, text, and varchar(these are strongly motivated by the corresponding mySQL datatypes). So when a new eav entity type is created in Magento there are actually six tables created; one to store the entity and one for each of these ‘types’ of attribute data. The fact that this type of entity has a certain attribute is recorded in the ‘eav_attribute’ table which has the following schema:

CREATE TABLE 'eav_attribute' (
'attribute_id' smallint(5),
'entity_type_id' smallint(5),
'attribute_code' varchar(255),
'attribute_model' varchar(255),
'backend_model' varchar(255),
'backend_type' varchar(8),

Magento – How to find if you are on homepage – getIsHomePage

Share
Posted on May 18th, 2013 | Posted by admin

Magento – How to find if you are on homepage – getIsHomePage
I needed to exclude hot products and recently viewed products block from homepage, so I needed to find if the current page is homepage. The first block of code worked on header.phtml template but not in main page template, so I ended up using 2nd option.

If you need to check this on header.phtml template then use this code:

1 <?php
2 if($this->getIsHomePage()) {
3 echo 'You are in Homepage!';
4 } else {
5 echo 'You are NOT in Homepage!';
6 }
7 ?>

If you want to check from other pages than do this:

Adding magento attribute with custom input renderer

Share
Posted on May 17th, 2013 | Posted by admin

This is example which will explain you, how to add new attribute with custom input render. You will be able to modify existing functionality, add javascript, some other option or change default input renderer by your wishes.

You probably will ask yourself, what is magento input renderer and I will explain. This is Magento php class which is in charge for “rendering” html form elements. In magento there are different classes for rendering, you can find them in next folder:/lib/Varien/Data/Form/Element. In this folder you will notice next classes for rendering: price, date, image and so on.
Let’s go with our example.
First of all, you should create magento setup file which will add new product attribute with custom frontend input render, example is below:

Magento: How To Add The Target To Grid Url Actions

Share
Posted on May 16th, 2013 | Posted by admin

Magento, on administration side, has the concept of “grid”, a table with ability to filter, order, page a collection of data. For example the product list is a grid.

A grid is usually initialized on block implementation that “prepares columns” and when I needed to change the columns of a grid I overloaded the block implementation with a class of mine extending the original one.

The latest modification I made on Magento was on product list tab present on category detail. I found incredibly stupid in Magento the absence of a category filter on product management panel and an edit action on product list on category detail.

Since the simpler thing was to add an action to that table I overrided the

Adminhtml/Block/Catalog/Category/Tab/Product.php

Quick Tip: Override Magento Meta data in XML files

Share
Posted on May 15th, 2013 | Posted by admin

In this quick tip I’ll teach you how to override the meta data using Magento’s XML layout files. You’ll be able to adjust any meta tag in the head with ease. For the changes I’m teaching you to make I recommend you add them to your local.xml file which you may need to create within your theme if it doesn’t already exist (app/design/frontend/[package]/[theme]/layout/local.xml)

Overriding Robots Meta Tag:

<customer_account_login>
  <reference name="head">
    <action method="setRobots">
      <value>NOINDEX, NOFOLLOW</value>
      <name>robots</name>
    </action>
  </reference>
</customer_account_login>

Overriding the Page Title:

Page 2 of 154«12345»102030...Last »