<?php
$root_category = Mage::getModel('catalog/category')->load(8); // Put your root category ID here.
$subcategories = $root_category->getChildren();
foreach(explode(',',$subcategories) as $subcategory) {
$category = Mage::getModel('catalog/category')->load($subcategory);
$product_id_1_12345=$category->getid();
$catid = $product_id_1_12345;
$category = new Mage_Catalog_Model_Category();
$category->load($catid); // this is your special offers category id!
$collection = $category->getProductCollection();
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
$collection->getSelect()->order('rand()');
$collection->addStoreFilter();
$numProducts = 20;
$collection->setPage(1, $numProducts)->load();
foreach($collection as $product):
$product = Mage::getModel('catalog/product')->load($product->getId());
$product_url258=$product->getProductUrl();
$custom_product_url=str_replace('http://192.168.1.49/mukesh/coach1/default/','',$product_url258);
$main1=$url_s_1.$custom_product_url;
$yes_no=$product->getCoach_featured();
?>
<?php echo $product->getName(); ?>
<?php echo $product->getProductUrl(); ?>
<?php echo $product->getPrice()?>
<?php
endforeach;
}
?>
$root_category = Mage::getModel('catalog/category')->load(8); // Put your root category ID here.
$subcategories = $root_category->getChildren();
foreach(explode(',',$subcategories) as $subcategory) {
$category = Mage::getModel('catalog/category')->load($subcategory);
$product_id_1_12345=$category->getid();
$catid = $product_id_1_12345;
$category = new Mage_Catalog_Model_Category();
$category->load($catid); // this is your special offers category id!
$collection = $category->getProductCollection();
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
$collection->getSelect()->order('rand()');
$collection->addStoreFilter();
$numProducts = 20;
$collection->setPage(1, $numProducts)->load();
foreach($collection as $product):
$product = Mage::getModel('catalog/product')->load($product->getId());
$product_url258=$product->getProductUrl();
$custom_product_url=str_replace('http://192.168.1.49/mukesh/coach1/default/','',$product_url258);
$main1=$url_s_1.$custom_product_url;
$yes_no=$product->getCoach_featured();
?>
<?php echo $product->getName(); ?>
<?php echo $product->getProductUrl(); ?>
<?php echo $product->getPrice()?>
<?php
endforeach;
}
?>
No comments:
Post a Comment