2016-06-06 7 views
0

Ich versuche, Produktdetails auf meiner Kasse Erfolgsseite in Magento 1.9 zu bekommen, aber ich weiß nicht, warum ich das gleiche Produkt für zwei Mal bekomme. Dies ist, was ich in der app/design/frontend/base/default/template/Kasse/success.phtml DateiKleines Produkt Problem auf der Erfolgsseite Magento

<tbody> 
     <?php 
     foreach ($items as $item): 
      $_product = Mage::getModel('catalog/product')->load($item->getProductId()); 
      $productType = $_product->getTypeId(); 
      $entityId = $_product->getEntityId(); 
      $options = $item->getProductOptions(); 
      if ($productType == "bundle") { 
       $bundled_product = new Mage_Catalog_Model_Product(); 
       $bundled_product->load($entityId); 
       $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(   $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product); 
       $bundled_items = array(); 
       foreach ($selectionCollection as $option) { 
        $bundled_items[] = $option->product_id; 
       }?> 
       <tr> 
        <td rowspan="1"> 
         <img class="product_img" src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75); ?>" alt="product-img" /> 
         <?php echo $item->getName(); 
         $customOptions = $options['options']; 
         if (!empty($customOptions)) { 
          foreach ($customOptions as $option) {?> 
           <span class="bottom-align"> 
            <?php 
            echo '<b>' . $option['label'] . '</b> :'; 
            echo $optionValue = $option['value']; 
            ?> 
           </span> 
           <?php 
          } 
         } 
         ?> 
        </td> 
        <td><?php echo $this->helper('checkout')->formatPrice($item->getPrice()); ?></td> 
        <td><?php echo $item->getQtyOrdered(); ?></td> 
        <td><?php echo $item->getSku(); ?></td> 
        <td><?php echo $this->helper('checkout')->formatPrice($item->getRowTotal()); ?></td> 
       </tr> 
       <?php 
      } else if (in_array($entityId, $bundled_items)) { 

      } else { 
       ?> 
       <tr> 
        <td> 
         <img class="product_img" src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75); ?>" alt="product-img" /> 
         <?php 
         echo $item->getName(); 

         $customOptions = $options['options']; 
         if (!empty($customOptions)) { 
          foreach ($customOptions as $option) { 
           ?> 
           <span class="bottom-align"> 
            <?php 
            echo '<b>' . $option['label'] . '</b> :'; 
            echo $optionValue = $option['value']; 
            ?></span>         
           <?php 
          } 
         } 
         ?> 
        </td> 
        <td><?php echo $this->helper('checkout')->formatPrice($item->getPrice()); ?></td> 
        <td><?php echo $item->getQtyOrdered(); ?></td> 
        <td><?php echo $item->getSku(); ?></td> 
        <td><?php echo $this->helper('checkout')->formatPrice($item->getRowTotal()); ?></td> 
       </tr> 
       <?php 
      } 
      ?> 
     <?php endforeach ?> 
    </tbody> 

enter image description here

Antwort

1

Dies ist das erwartete Verhalten hinzuzufügen. Für Composite-Produkte sind mehrere Zeilen in die Datenbank eingefügt: Bündel, konfigurierbar. In Ihrem Fall ist der erste selbst ein Bündelprodukt, der zweite ist ein ausgewähltes einfaches Produkt. Sie können } else { durch } elseif (!$item->getParentId()) { in Ihrer Vorlage ersetzen, um Kind einfaches Produkt zu überspringen.

Verwandte Themen