Magento Themes and Magento Extensions

Create a custom category attribute in Magento

Share
Posted on April 4th, 2013 | Posted by admin

Create a custom category attribute in Magento
Copy and paste the following code in your header.phtml

Magento Custom Category Listing Block

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

Here I wanted to show you how to build a custom Magento category listing block that you can use on your own Magento store. We will go over each step at getting a category listing of your magneto categories and even a sub category listing.

Here is the finished code for your new category listing block.

<?php
$cats = Mage::getModel('catalog/category')->load(2)->getChildren();
$catIds = explode(',',$cats);
?>
<ul>
<?php foreach($catIds as $catId): ?>
	<li>
    	<?php
			$category = Mage::getModel('catalog/category')->load($catId);
			echo $category->getName();

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:

Disable state/province option in the Magento

Share
Posted on April 1st, 2013 | Posted by admin

Sometime your Magento site doesn’t need the region/state for customer address and you don’t know how to turn it off without touching in many places in the complex source code. Please try to run following SQL statements to try

1
2
update core_config_data set `value`=0 where path = 'general/region/display_all';
update core_config_data set `value`='' where path = 'general/region/state_required';

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)