deivisonarthur
5/9/2013 - 5:21 AM

catalogo.php

<?php
   function getFeaturedProducts1($page, $pageSize = 6) {
        $attributesToSelect = array("news_from_date", "news_to_date", "name", "price", "special_price", "small_image");
        $categoryId = "332"; //Mage::getStoreConfig('designtheme/homepage/featureds')
        $category = Mage::getModel('catalog/category')->load($categoryId);

        return  Mage::getModel('catalog/product')
                    ->getCollection()
                    ->setPage($page)
                    ->addAttributeToSelect($attributesToSelect)
                    ->setPageSize($pageSize)
                    ->addCategoryFilter($category)
                    ->load();
     }
     
     
    function getFeaturedProducts2($categoryId, $page, $pageSize) {
        $this->loadDepartamentConfigPaths();
        $configPath = $this->departamentConfigPaths[$categoryId];
        return $this->getProductsFromCategory(Mage::getStoreConfig($configPath . "featured"), $pageSize, $page);
    }     
?>

<?php foreach ($this->getFeaturedProducts1(1) as $product):?>
<div class="article column width3 first">
	<div class="homeboxwidth3">
		<h3>
			<a href="<?php echo $product->getProductUrl()?>" title=""><?php echo $product->getName() ?></a>
		</h3>

		<a href="<?php echo $product->getProductUrl()?>" title="<?php echo $product->getName() ?>">
			<img src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(117, 135); ?>" width="117" height="135" alt="<?php echo $product->getName() ?>" />
		</a>

		<div class="price">
			<a href="#" title="">
				<?php $price = $product->getPrice()?>
				<?php $finalPrice = $product->getFinalPrice() ?>
				<?php if($price != $finalPrice):?>
				    <?php echo Mage::helper('core')->currency($product->getPrice(),true,false);?>
				<?php endif;?>
				<strong class="by">Por <span><?php echo Mage::helper('core')->currency($product->getFinalPrice(),true,false);?></span></strong>
				<span class="red">ou 6x sem juros de <?php echo Mage::helper('core')->currency($product->getFinalPrice() / 6,true,false);?></span>
				ou <strong>R$ <?php echo Mage::helper('core')->currency($product->getFinalPrice() * 0.9,true,false);?></strong> no boleto
			</a>
		</div>
		<?php $newFromDate = $product->getNewsFromDate(); ?>
<?php $newToDate = $product->getNewsToDate(); ?>
<?php if($newFromDate < $now && $newToDate > $now): ?>
    <a href="<?php echo $product->getProductUrl()?>" title="" class="button-launch">Lançamento</a>
<?php endif; ?>
	</div>
</div>
<?php endforeach;?>