var isValidZip = /(^d{5}$)|(^d{5}-d{4}$)/.test(zip);
if(isValidZip==false)
alert(“Invalid zip”);
var isValidZip = /(^d{5}$)|(^d{5}-d{4}$)/.test(zip);
if(isValidZip==false)
alert(“Invalid zip”);
echo $currentPage = Mage::getBlockSingleton(‘cms/page’)->getPage()->getIdentifier();
echo $currentPageId =$this->getRequest()->getParam(‘page_id’);
$mainCategory = Mage::getModel(‘catalog/category’)->load($categoryId);
$mainCategoryName = $mainCategory->getName();
$productCollection = Mage::getResourceModel(‘catalog/product_collection’)
->addCategoryFilter($_category)
->addAttributeToSelect(‘*’)
->setPageSize(5);
$productCollection->load();
$collection = Mage::getModel(‘catalog/category’)->getCollection()
->addFieldToFilter(‘name’,array(‘like’ => ‘%New Arrivals%’))
->addFieldToFilter(‘parent_id’, array(‘eq’=>$categoryId ))
->load();
foreach ($collection as $category):
echo $category->getName();
endforeach;
<?php
$_category = Mage::getModel(‘catalog/category’)->load(17); //$categoryid for which the child categories to be found
$childCategories = $category_model->getResource()->getAllChildren($_category); //array consisting of all child categories id
print_r($childCategories);
?>
{{block type="cms/block" block_id="your_block_id"}}
delete from wp_comments where comment_approved=’trash’;
1) Create the file app/code/local/Mage/Eav/Model/Entity/Attribute/Source/Cms.php and paste the code
<?php
class Mage_Eav_Model_Entity_Attribute_Source_Cms extends Mage_Eav_Model_Entity_Attribute_Source_Table{
public function getAllOptions($withEmpty = true){
if (!$this->_options) {
$options = array();
$options[] = array(
‘value’ => ‘0’,
‘label’ => ‘No’,
);
$options[] = array(
‘value’ => ‘1’,
‘label’ => ‘Yes’,
);
$this->_options = $options;
}
$options = $this->_options;
if ($withEmpty) {
array_unshift($options, array(
‘value’ => ”,
‘label’ => ‘Please Select’,
));
}
return $options;
}