交叉销售集团产品中的所有简单产品。可能?

时间:2012-10-25 15:49:00

标签: magento magento-1.7

我有一个产品的多个版本,我将它们组合成一个分组产品。当我交叉销售它们时,我希望所有简单的产品都是可点击的(而不是默认的,Magento选择其中一个简单的产品)。基本上是这样的:

How I want cross-sells to appear on the cart page

1 个答案:

答案 0 :(得分:0)

复制到您当地的商店模板/app/design/frontend/base/default/template/checkout/cart/crosssell.phtml

<?php if($this->getItemCount()): ?>
    <div class="crosssell">
      .........

      <?php foreach ($this->getItems() as $_item): ?>
        <?php if ($_item->getTypeId() == 'grouped')
        {
            $associatedProducts = $_item->getTypeInstance(true)->getAssociatedProducts($_item);

             <?php foreach ($associatedProducts as $ap): ?>
                   //display associated group products here
                   <li class="item">
                          ......
                        copy existing html structure and replace $_item with $ap
                        <?php echo $this->htmlEscape($ap->getName()) ?>
                    </li>
                <?php ?>
          <?php }
               else
               { ?>
                 <li class="item">
                     ......
                     // copy existing code here
                 </li>
          <?php } ?>

       <?php endforeach; ?>

         .................

请参阅Magento - how do I get associated products of product Group?