Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Product show by category id in new.phtml
 
tuannx
Jr. Member
 
Total Posts:  3
Joined:  2012-10-01
 

I have file new.phtml, it’s show product by set Product as New from Date. I want to show by call for category id ... help me please!

file attach and code:

<?php

$_productCollection=$this->getLoadedProductCollection();
$columnCount = themeOptions('column_count');
$hoverSwap = themeOptions('hover_swap');
$this->setColumnCount($columnCount);
$_helper = $this->helper('catalog/output');


?>

<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="newproducts">
<div class="carousel">
<div class="slider">
<?php $i=0; foreach ($_products->getItems() as $_product): $i++; ?>
<div class="item slide <?php if(($i == 4 && $_products->getSize() < 5) || ($i == $_products->getSize()) ) echo 'last'?>">
<?php include('view/labels.phtml') ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<a href="<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>” class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(210) ?>” width="210" height="210" alt="<?php echo $this->htmlEscape($_product->getName()) ?>” /></a>
<div class="new-description">
<h3><a href="<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h3>
<?php echo $this->getPriceHtml($_product, true) ?>

<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>” class="button btn-cart” onclick="setLocation(’<?php echo $this->getAddToCartUrl($_product) ?>’)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<div style="clear: both;"></div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php if($_products->getSize() > 4): ?>
<div class="prev new-arrow"> </div>
<div class="next new-arrow"> </div>
<?php endif; ?>
</div>
<div style="clear: both;"></div>
<?php if($_products->getSize() > 4): ?>
<script type="text/javascript\">
jQuery(’.new-arrow.prev’).addClass(’disabled’);
jQuery(’.carousel’).iosSlider({
desktopClickDrag: true,
snapToChildren: true,
infiniteSlider: false,
navNextSelector: ‘.new-arrow.next’,
navPrevSelector: ‘.new-arrow.prev’,
lastSlideOffset: 3,
onFirstSlideComplete: function(){
jQuery(’.new-arrow.prev’).addClass(’disabled’);
},
onLastSlideComplete: function(){
jQuery(’.new-arrow.next’).addClass(’disabled’);
},
onSlideChange: function(){
jQuery(’.new-arrow.prev’).removeClass(’disabled’);
jQuery(’.new-arrow.next’).removeClass(’disabled’);
}
});
</script>
<?php endif; ?>
<?php endif; ?>

File Attachments
new.phtml  (File Size: 4KB - Downloads: 41)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Lyonscg
Sr. Member
 
Avatar
Total Posts:  173
Joined:  2009-11-13
Chicago IL
 

I don’t quite understand what you are trying to do. Do you want to get the category ID’s that a product is associated to, or load all products associated to a specific category by using the category ID?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tuannx
Jr. Member
 
Total Posts:  3
Joined:  2012-10-01
 

Yes I want show product as by slide

ex: i have a category fashion id =2 and add block :

{{block type="catalog/product_new" category="2" name="blanco.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}

It show product of category fashion

thanks so much!

Image Attachments
image slide1.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top