Layout anpassen

      Layout anpassen

      Hallo,

      versuche verzweifelt die Datei new.phtml anzupassen. Immer wenn ich ein mehr als 4 Produkte anzeigen lassen will, macht das System keinen Zeilenumbruch sondern setzt das Produkt an das vierte Bild dran ?

      PHP-Quellcode

      1. <?php
      2. /**
      3. * Magento
      4. *
      5. * NOTICE OF LICENSE
      6. *
      7. * This source file is subject to the Academic Free License (AFL 3.0)
      8. * that is bundled with this package in the file LICENSE_AFL.txt.
      9. * It is also available through the world-wide-web at this URL:
      10. * http://opensource.org/licenses/afl-3.0.php
      11. * If you did not receive a copy of the license and are unable to
      12. * obtain it through the world-wide-web, please send an email
      13. * to license@magentocommerce.com so we can send you a copy immediately.
      14. *
      15. * DISCLAIMER
      16. *
      17. * Do not edit or add to this file if you wish to upgrade Magento to newer
      18. * versions in the future. If you wish to customize Magento for your
      19. * needs please refer to http://www.magentocommerce.com for more information.
      20. *
      21. * @category default_default
      22. * @package Mage
      23. * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
      24. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
      25. */
      26. ?>
      27. <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
      28. <div class="listing-type-grid catalog-listing padder">
      29. <table cellspacing="0" class="generic-product-grid" id="new-products-list-table">
      30. <tr>
      31. <?php $i=0; foreach ($_products->getItems() as $_product): ?>
      32. <?php if ($i>4): continue; endif; ?>
      33. <td>
      34. <p class="product-image">
      35. <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) ?>" width="170" height="170" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
      36. </p>
      37. <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>
      38. <?php echo $this->getPriceHtml($_product, true, '-new') ?>
      39. <div class="clear"></div>
      40. </td>
      41. <?php $i++; endforeach; ?>
      42. <?php for($i;$i%4!=0;$i++): ?>
      43. <td>&nbsp;</td>
      44. <?php endfor ?>
      45. </tr>
      46. </table>
      47. <script type="text/javascript">decorateTable('new-products-list-table');</script>
      48. </div>
      49. <?php endif; ?>


      Wäre sehr dankbar wenn mir jemand helfen kann ?


      Gruß
      Klaus
      Hallo Klaus,

      versuch mal aus dem "($i>4)" ein "($i<4)" zu machen. Bin zwar kein Coder, aber die Bedingung sagt ja sonst aus, er soll weitermachen, wenn der Zähler den Wert von i auf >4 gesetzt hat. Das kann doch eigentlich nicht richtig sein ...


      Gruß
      Ingo

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Ingo“ ()

      Ich muss gestehen, dass ich "continue" heute zum ersten mal sehe (), daher würde ich das Problem mit den mir bekannten Mitteln lösen (ungetestet):

      PHP-Quellcode

      1. <?php
      2. /**
      3. * Magento
      4. *
      5. * NOTICE OF LICENSE
      6. *
      7. * This source file is subject to the Academic Free License (AFL 3.0)
      8. * that is bundled with this package in the file LICENSE_AFL.txt.
      9. * It is also available through the world-wide-web at this URL:
      10. * http://opensource.org/licenses/afl-3.0.php
      11. * If you did not receive a copy of the license and are unable to
      12. * obtain it through the world-wide-web, please send an email
      13. * to license@magentocommerce.com so we can send you a copy immediately.
      14. *
      15. * DISCLAIMER
      16. *
      17. * Do not edit or add to this file if you wish to upgrade Magento to newer
      18. * versions in the future. If you wish to customize Magento for your
      19. * needs please refer to http://www.magentocommerce.com for more information.
      20. *
      21. * @category default_default
      22. * @package Mage
      23. * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
      24. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
      25. */
      26. ?>
      27. <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
      28. <div class="listing-type-grid catalog-listing padder">
      29. <table cellspacing="0" class="generic-product-grid" id="new-products-list-table">
      30. <tr>
      31. <?php $i=0; foreach ($_products->getItems() as $_product): ?>
      32. <td>
      33. <p class="product-image">
      34. <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) ?>" width="170" height="170" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
      35. </p>
      36. <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>
      37. <?php echo $this->getPriceHtml($_product, true, '-new') ?>
      38. <div class="clear"></div>
      39. </td>
      40. <?php $i++; if($i >= 4) { echo '<tr>'; $i=0; } ?>
      41. <?php endforeach; ?>
      42. </tr>
      43. </table>
      44. <script type="text/javascript">decorateTable('new-products-list-table');</script>
      45. </div>
      46. <?php endif; ?>
      Magento Hosting | Cloud Server | Shopware Hosting | Elasticsearch Hosting
      Unsere Hosting-Lösungen nutzen ultraschnelle SSDs und sind jederzeit skalierbar.