Magento Themes and Magento Extensions

Magento – Add Custom Category Attributes

Share
Posted on April 23rd, 2013 | Posted by admin

Magento – Add Custom Category Attributes

A client wanted to add a description to each of his product categories, such that the first built-in description would be above the product listing, and the second description would be below the product listing.  Rather than have them create static blocks for every category, it was obvious that I’d have to create a new category attribute.

Fortunately, I stumbled upon one possible solution.  The method doesn’t involve creating a full-blown module, rather, just a few database modifications using phpMyAdmin.

Summarized, the process comes down to:

  1. Create a new row in the eav_attribute table, one that mimics a category’s meta-description attribute with everything being the same except for a unique identifier and a label.
  2. Create a new row in the eav_entity_attribute table, to provide a sort order for your newly created attribute, following in the format footsteps of the existing rows.

Stop Empty Attributes Showing as ‘No’ in Magento

Share
Posted on April 2nd, 2013 | Posted by admin

If you don’t complete and attribute for a product in Magento it displays as ‘No’ rather than just hiding them. This means attributes that aren’t relevant for a product will still appear confusing the user. There is a simple fix for this:

Open  /app/design/frontend/default/YOUR THEME/template/catalog/product/view/attribute.phtmland change this:

<?php foreach ($_additional as $_data): ?>
<tr>
<th><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php endforeach; ?>

for this:

Get all attributes from an attribute set in magento.

Share
Posted on March 31st, 2013 | Posted by admin

Get all attributes from an attribute set in magento.

$entityTypeId = Mage::getModel(‘eav/entity’)
->setType(‘catalog_product’)
->getTypeId();
$attributeSetName = ‘Default’; //Edit with your required Attribute Set Name
$attributeSetId = Mage::getModel(‘eav/entity_attribute_set’)
->getCollection()
->setEntityTypeFilter($entityTypeId)

How to get custom attributes value in Magento Frontend

Share
Posted on March 21st, 2013 | Posted by admin

In Magento, you can create unlimited number of custom attributes to show different type of information about your product. These attributes can be different type as Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown, Price, Gallery, Media Image etc. Sometimes you need to get these attributes value to show in different places. There are different way to get different type of attributes.

you can get almost type of attribute value by using the following code:

  1. <?php
  2. echo $_product->getAttributeName();
  3. ?>

For example, suppose you are selling computer monitor in your web store and you created a attribute by using ‘screen_resolution‘ as its attribute code. Then You can get this attribute value by using the following code:

  1. <?php
  2. echo $_product->getScreenResolution();
  3. ?>

If it not work you can also try following code:

Magento Use Custom Product Attributes to Add CMS Static Block to Product Page

Share
Posted on November 23rd, 2012 | Posted by admin

The Magento shopping cart has wonderful tools like attributes that makes it easy for users to control custom content on your products. Recently, I have had a client that needs to display the same information over multiple products. So rather than manually adding it on one product, I thought it would be easier to link a custom cms static block to the product page. While this seems like an easy thing to do, Magento makes this a bit complicated to set up. So this tutorial is meant to show you how to do this! After this tutorial you will be able to control static cms blocks from any product in your Magento store.

So let’s begin.
Setting up your Custom Product Attribute.
First we need to set up a custom product attribute correctly in magento. This will let us create a few cms static blocks and link them to our product. First login to your magento backend and go to Catalog > Attribute > Manage Attributes. Once the page reloads click on “Add New Attribute”. This will take you to a page where you can set up your attribute.

Page 1 of 212»