webmaker1
webmaker1

Reputation: 389

Get 'active from' attribute from category in magento 1.7

There are pre-defined attributes in Mangento 1.7 categories named

I can fetch Name of the current product's category using this:

 $productId=$_helper->productAttribute($_product, $_product->getId(), 'id');
 $product = Mage::getModel('catalog/product')->load($productId);
 $cats = $product->getCategoryIds();
 foreach ($cats as $category_id) {
 $_cat = Mage::getModel('catalog/category')->load($category_id) ;
 echo $_cat->getName();
 } ?>

but I need to find the active from date of current category also. How do I fetch this?

Upvotes: 0

Views: 1040

Answers (1)

Drew Hunter
Drew Hunter

Reputation: 10114

It is probably worth noting that these values are for the active state of a custom design for the category, and not the actual active state of the category itself...

As an array together:

$_cat = Mage::getModel('catalog/category')->load($category_id);
$_customDesignDates = $_cat->getCustomDesignDate();

Or individually:

$_cat = Mage::getModel('catalog/category')->load($category_id);
$fromDate = $_cat->getData('custom_design_from');
$toDate = $_cat->getData('custom_design_to');

Upvotes: 3

Related Questions