Showing posts with label Attribute. Show all posts
Showing posts with label Attribute. Show all posts

Friday, September 7, 2012

Magento Add attribute Filter

Magento has filterable condition which help to sort out the result.Let Look How it works

addAttributeToFilter is a function that can be called on a product collection in Magento. it adds a condition to the WHERE part of the MySQL query used to extract a product collection from the database

Saturday, July 14, 2012

Magento Maximum Length of Attribute

In Magento By default maximum length of an attribute is less than 30 synbols

we can upgrade to new value just need to edit one file

app/code/core/Mage/Eav/Model/Entity/Attribute.php copy to

app/code/local/Mage/Eav/Model/Entity/Attribute.php and

Find  CONST ATTRIBUTE_CODE_MAX_LENGTH = 30; and

Replace CONST ATTRIBUTE_CODE_MAX_LENGTH = 50;

Hope this will help you

Tuesday, January 10, 2012

Magento display the custom attribute value in Frontend

Add an attribute from magento admin and that attribute should belong to corect attribute set
Then edit the template file either view.phtml or list.phtml
For example we are using in list.phtml
app/design/frontend/default/your-theme/template/catalog/product/list.phtml
and use one of these methods to pull your attribute on the product listing page (list or grid view):

<?php foreach ($_productCollection as $_product): ?>

    <!-- these are regular text attributes -->
      <?php echo $_product->getMyAttribute() ?>
      <?php echo $_product->getAnotherCustomAttribute() ?>
   
    <!-- this is dropdown attribute -->
      <?php echo $_product->getAttributeText('your_attribute') ?>
   
    <!-- this is a boolean attribute -->
      <?php echo $_product->getMyAttributeName() ? "Yes" : "No" ?>

<?php endforeach?>

LinkWithin

Blog has moved, searching new blog...