Magento Themes and Magento Extensions


Posted on April 5th, 2013 | Posted by admin

When we need to get Magento time as as an variable you should use  echo Mage::getModel with timestamp() can display on your Magento font end anywhere and if it needs format date as dd-mm-yyyy it can simply use PHP date function.This example shows how to display the date and format the date time

1 //display the default output
2 echo Mage::getModel('core/date')->timestamp(time());
4 //format the op- dd-mm-YYY
5 echo date('d-M-Y',strtotime(Mage::getModel('core/date')->timestamp(time()));
7 //format date time
8 echo date('d-M-Y H:i:s',strtotime(Mage::getModel('core/date')->timestamp(time()));

Create a custom category attribute in Magento

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

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.

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

Stop Empty Attributes Showing as ‘No’ in Magento

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): ?>
<th><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
<?php endforeach; ?>

for this:

Disable state/province option in the Magento

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

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';