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

Zufällige Artikel auf Startseite
 
flopapa
Member
 
Total Posts:  32
Joined:  2011-07-27
 

Hallo Leute,

ich kriegs nicht hin. Ich will auf der Startseite zufällige Artikel erscheinen lassen. Kategorie übergreifend.
Hab auch schon was entsprechendes gefunden jedoch wird bei mir garnix angezeigt.

{{block type="catalog/product_list"  category_id="4" template="catalog/product/list_random.phtml"}}

list_random.phtml

<?php
Mage

::getSingleton('catalog/layer')->setData("product_collection",NULL);
$this->_productCollection null;
$_productCollection=$this->getLoadedProductCollection();
?>

<?php $_productCollection

=$this->getLoadedProductCollection() ?>
<?php 
if(!$_productCollection->count()): ?>
<div class="padder">
<
div class="note-msg">
<?php echo $this->__('There are no products matching the selection.'?>
</div>
</
div>
<?php else: ?>

<?php

// Grid Mode ?>
<div class="listing-type-grid catalog-listing padder"> <!-- the class name will change to .listing-type-cell if viewing in list mode -->
<?php $_collectionSize $_productCollection->count() ?>

<?php $_items

$_productCollection->getItems();
shuffle($_items); ?>

<table cellspacing="0" class="generic-product-grid" id="product-list-table">
<?php $i=0; foreach ($_items as $_product): ?>
<?php 
if ($i++%4==0): ?>
<tr>
<?php endif ?>
<td>
<
class="product-image">
<
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
<
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(170, 170); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
</
a>
</
p>
<
h5><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h5>
<?php if($_product->getRatingSummary()): ?>
<!--?php echo $this->getReviewsSummaryHtml($_product'short') ?-->
<?php echo $this->getReviewsSummaryHtml($_product?>
<?php 
endif; ?>

<?php

echo $this->getPriceHtml($_producttrue?>

<div class="clear"></div>
<
ul class="add-to">

<?php if($_product->isSaleable()): ?>
<li class="add-to-cart-textlink"><a href="#" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span>Add to Cart</span></a></li>
<?php else: ?>
<li><?php echo $this->__('Out of stock'?></li>
<?php endif; ?>

<?php

if ($this->helper('wishlist')->isAllow()) : ?>
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist'?></a></li>
<?php endif; ?>
<?php 
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
<li><a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare'?></a></li>
<?php endif; ?>
</ul>
</
td>
<?php if ($i%4==&& $i!=$_collectionSize): ?>
</tr>
<?php endif ?>

<?php

if ($i==4) break; // show 4 products max ?>

<?php endforeach ?>
<?php 
for($i;$i%4!=0;$i++): ?>
<td class="empty-product">&nbsp;</td>
<?php endfor ?>
<?php 
if ($i%4==0): ?>
</tr>
<?php endif ?>
</table>
<
script type="text/javascript">decorateTable('product-list-table')</script>
</div>

<?php endif; ?>

Bitte helft mir

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top