Leo27 Posted November 20, 2008 Share Posted November 20, 2008 Hi ppl, I'm a newbie here! I need some help from the gurus here, I know that this is possibly not very dificult, but I can't do it. this is the code: <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?> <div class="box recently"> <h3><?php echo $this->__('New Products') ?></h3> <table cellspacing="0" class="recently-list" id="recently-compared-list-table"> <tr> <?php $i=0; foreach ($_products->getItems() as $_product): ?> <?php if ($i>9): continue; endif; ?> <td> </tr> <div> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"> <img class="product-image" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(80, 77) ?>" width="80" height="77" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /> </a> </div> <p><a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $this->htmlEscape($_product->getName()) ?></a></p> <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?> <?php echo $this->getPriceHtml($_product) ?> <?php if($_product->isSaleable()): ?> <button class="form-comprar" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><img src="<?php echo $this->getSkinURL('images/comprar.png')?>" /></span></button> <?php else: ?> <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div> <?php endif; ?> <div class="clear"></div> <p class="add-to"> <?php if ($this->helper('wishlist')->isAllow()) : ?> <a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist') ?></a> <?php endif; ?> <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?><br /> <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a> <?php endif; ?> </p> </td> <?php $i++; endforeach; ?> <?php for($i;$i%9!=0;$i++): ?> <td> </td> <?php endfor ?> </table> </div> <?php endif; ?> Its limiting it to display 10 products, but the products are only displayed in the same rows. So I wan't to add 2 more rows, 4 per row. Can anyone help me implementing this? Thanks in advance, Best regards L. Nunes Quote Link to comment https://forums.phpfreaks.com/topic/133512-how-to-add-more-rows-to-this-code/ Share on other sites More sharing options...
Mark Baker Posted November 20, 2008 Share Posted November 20, 2008 Have a look at this line <?php if ($i>9): continue; endif; ?> and see what affect changing the "9" has. Quote Link to comment https://forums.phpfreaks.com/topic/133512-how-to-add-more-rows-to-this-code/#findComment-694450 Share on other sites More sharing options...
Leo27 Posted November 20, 2008 Author Share Posted November 20, 2008 Thanks for the reply Mark Baker, It sets to how many products it will show, but for the same row, I was wondering, if I remove the table ( <table cellspacing="0" class="recently-list" id="recently-compared-list-table"> ) the products are displayed 1 per row, so from here I can implement another code, what do you think? Quote Link to comment https://forums.phpfreaks.com/topic/133512-how-to-add-more-rows-to-this-code/#findComment-694502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.