the upsell.phtml is built a little bit dated imho. It loads rows and then products for each row. I'd like to load every product without a table.

Something like

<?php if(count($this->getItemCollection()->getItems())): ?>
    <?php for($_i=0;$_i<$this->getProductCount();$_i++): ?>
        <!-- DOM for Upsell Product -->
    <?php endfor; ?>
<?php endif ?>

How could I achieve this?

<?php if(count($this->getItemCollection()->getItems())): ?>
<?php $_columnCount = $this->getColumnCount(); ?>
      <div class="box-collateral box-up-sell">
         <h2><?php echo $this->__('You may also be interested in the following  product(s)') ?></h2>
         <ul class="product-small-view products-grid products-grid--max-<?php echo $_columnCount; ?>-col" id="upsell-product-table">
            <?php $this->resetItemsIterator() ?>
            <?php foreach ($this->getItemCollection()->getItems() as $_link): ?>
              <li class="item">
                 <a href="<?php echo $_link->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_link->getName()) ?>" class="product-image">
                    <img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(220,176) ?>" alt="<?php echo $this->escapeHtml($_link->getName()) ?>" />
                 <div class="product-details">
                    <div class="product-info">
                      <h3 class="product-name"><a href="<?php echo $_link->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_link->getName()) ?>"><?php echo $this->escapeHtml($_link->getName()) ?></a></h3>
                      <?php echo '<span class="manufacturer_logo" ><img src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/atlas/responsive/images/marcas/' . str_replace(' ', '_', $_link->getAttributeText('marca')) . '.png' . '" style="width:48px;" title="' . $_link->getAttributeText('marca') . '"></span>' ?>
                    <div class="clearfix"></div>
                    <div class="product-price pull-both">
                      <?php echo $this->getPriceHtml($_link, true, '-upsell') ?>
                <?php echo $this->getReviewsSummaryHtml($_link) ?>
         <?php endforeach; ?>

<?php endif ?>

This is a working code. Check it


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.