2013-12-11 90 views
1

当使用已创建和现货的简单产品构建新的分组产品时,使用我的自定义模板时,成品分组产品不会显示列表右侧列中的产品标题和价格。Magento分组的产品未显示商品/价格

当自定义模板关闭并且默认的Magento模板正在使用时,模板将正确显示标题和价格。 分组的产品模板代码存在一个问题,该问题阻止显示这部分信息,但/app/design/frontend/mytemplate/default/template/catalog/product/view/type/grouped.phtml的代码是与Magento的默认模板相同。

任何人都知道如何解决这个问题?

回答

0

很难说,但可能没有使用模板文件。您可以检查模板中的布局文件是否包含指向PRODUCT_TYPE_grouped节点中的grouped.phtml的块。同时检查view.phtml是否可以拨打

<?php echo $this->getChildHtml('product_type_data') ?> 

以引用该块。

比较你的模板文件:

  • 应用程序\设计\前台\基地\ DEFAULT \模板\目录\产品\ view.phtml
  • 应用程序\设计\前台\基地\ DEFAULT \布局\ catalog.xml

看看我的意思。

+0

我设法把问题缩小到view.phtml和发生时,我更新了主题 当我把代码从以前的版本,它的作品的主题,但我无法检测出的问题是在新版本。 – tsantos

+0

你可以发布一些你的新view.phtml?那里可能有一个

标签。你能发布这个标签里面的内容吗? – Pixelkracht

+0

代码是为了这段时间,所以我把代码放在一个新的答案中 – tsantos

0
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> 

    <?php echo $this->getBlockHtml('formkey'); ?> 
    <div class="no-display"> 
     <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" /> 
     <input type="hidden" name="related_product" id="related-products-field" value="" /> 
    </div> 

    <?php 
     //Product collaterals 
     $section = array(); 

     //Related products. $section['related'] is set only if related products (or replacement) exist 
     $replaceRelated = $theme->getCfg('product_page/replace_related'); 
     if ($replaceRelated == 1) //don't replace with static block 
     { 
      if ($tmpHtml = trim($this->getChildHtml('catalog.product.related'))) 
       $section['related'] = $tmpHtml; 
      //$section['related'] = trim($this->getChildHtml('catalog.product.related')); 
     } 
     elseif ($replaceRelated == 2) //if related is empty, replace with static block 
     { 
      if ($tmpHtml = trim($this->getChildHtml('catalog.product.related'))) 
       $section['related'] = $tmpHtml; 
      else //related empty 
       if ($tmpHtml = $this->getChildHtml('block_product_replace_related')) 
        $section['related'] = '<div class="block_product_replace_related">'. $tmpHtml .'</div>'; 
     } 
     elseif ($replaceRelated == 3) //replace with static block 
     { 
      if ($tmpHtml = $this->getChildHtml('block_product_replace_related')) 
       $section['related'] = '<div class="block_product_replace_related">'. $tmpHtml .'</div>'; 
     } 

     //Up-sell products. $section['upsell'] is set only if up-sell products (or replacement) exist 
     $replaceUpsell = $theme->getCfg('product_page/replace_upsell'); 
     if ($replaceUpsell == 1) //don't replace with static block 
     { 
      if ($tmpHtml = trim($this->getChildHtml('upsell_products'))) 
       $section['upsell'] = $tmpHtml; 
      //$section['upsell'] = $this->getChildHtml('upsell_products'); 
     } 
     elseif ($replaceUpsell == 2) //if upsell is empty, replace with static block 
     { 
      if ($tmpHtml = trim($this->getChildHtml('upsell_products'))) 
       $section['upsell'] = $tmpHtml; 
      else //upsell empty 
       if ($tmpHtml = $this->getChildHtml('block_product_replace_upsell')) 
        $section['upsell'] = '<div class="block_product_replace_upsell">'. $tmpHtml .'</div>'; 
     } 
     elseif ($replaceUpsell == 3) //replace with static block 
     { 
      if ($tmpHtml = $this->getChildHtml('block_product_replace_upsell')) 
       $section['upsell'] = '<div class="block_product_replace_upsell">'. $tmpHtml .'</div>'; 
     } 



     //Assign related products to selected position 
     if (isset($section['related'])) 
     { 
      $relatedPosition = $theme->getCfg('product_page/related_position'); 
      //TODO:remove: $relatedPosition = 11; 
      switch ($relatedPosition) 
      { 
       case 10: 
        $p['secondaryCol'][0] = $section['related']; 
        break; 
       case 11: 
        $p['secondaryCol'][1] = $section['related']; 
        break; 
       case 20: 
        $p['collatSecondaryCol'] = $section['related']; 
        break; 
      } 
     } 



     //Width (in grid units) of product page sections 
     $imgColUnits     = $theme->getCfg('product_page/image_column'); 
     $primaryColUnits    = $theme->getCfg('product_page/primary_column'); 
     $secondaryColUnits    = $theme->getCfg('product_page/secondary_column'); 
     $container2ColUnits    = $imgColUnits + $primaryColUnits; 
     $collatPrimaryColUnits   = $imgColUnits + $primaryColUnits; 
     $collatSecondaryColUnits  = $secondaryColUnits; 

     //If no secondary column 
     if (empty($secondaryColUnits)) 
     { 
      $primaryColUnits   += 12 - ($imgColUnits + $primaryColUnits); 
      $container2ColUnits   = $imgColUnits + $primaryColUnits; 
      $collatPrimaryColUnits  = 9; 
      $collatSecondaryColUnits = 3; 
     } 

     //If no related products, stretch collateral primary column 
     if (!isset($section['related'])) 
     { 
      $container2ColUnits   = 12; 
      $collatPrimaryColUnits  = 12; 
      $collatSecondaryColUnits = 0; 
     } 
     elseif (!isset($p['secondaryCol'])) 
     { 
      $container2ColUnits   = 12; 
     } 

     //Grid classes 
     $imgColGridClass    = 'grid12-' . $imgColUnits; 
     $primaryColGridClass   = 'grid12-' . $primaryColUnits; 
     $secondaryColGridClass   = 'grid12-' . $secondaryColUnits; 
     $container2ColGridClass   = 'grid12-' . $container2ColUnits; 
     $collatPrimaryColGridClass  = 'grid12-' . $collatPrimaryColUnits; 
     $collatSecondaryColGridClass = 'grid12-' . $collatSecondaryColUnits; 
     if (empty($secondaryColUnits)) 
     { 
      $secondaryColGridClass = ''; 
     } 
    ?> 

    <div class="product-img-column <?php echo $imgColGridClass; ?>"> 
     <?php echo $this->getChildHtml('media') ?> 
     <?php //Product labels 
      echo $this->helper('ultimo/labels')->getLabels($_product); 
     ?> 
    </div> 

    <div class="product-shop <?php echo $primaryColGridClass; ?>"> 

     <div class="product-name"> 
      <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1> 
     </div> 

     <?php echo $this->getReviewsSummaryHtml($_product, false, true); //reviews ?> 

     <?php if ($_product->getShortDescription()): ?> 
      <div class="short-description"> 
       <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div> 
      </div> 
     <?php endif;?> 

     <?php if ($theme->getCfg('product_page/sku')): ?> 
      <div class="sku"><span><?php echo $this->__('SKU'); ?>: </span><?php echo $_product->getSku(); ?></div> 
     <?php endif; ?> 



     <?php if ($extrahint_html = $this->getChildHtml('extrahint')): //qty increments ?> 
      <div class="extrahint-wrapper"><?php echo $extrahint_html; ?></div> 
     <?php endif; ?> 

     <div class="product-type-data<?php echo $productTypeClasses; ?>"><?php echo $this->getChildHtml('product_type_data'); ?></div> 

     <?php echo $this->getTierPriceHtml(); //tier prices ?> 

     <?php if (!$this->hasOptions()): //add to cart when no options ?> 
      <?php if($_product->isSaleable()): ?> 
       <div class="add-to-box"> 
        <?php echo $this->getChildHtml('addtocart') ?> 
       </div> 
      <?php endif; ?> 
      <?php echo $this->getChildHtml('extra_buttons') ?> 
     <?php endif; ?> 

     <?php if ($_product->isSaleable() && $this->hasOptions()): ?> 
      <?php if ($container1_html = $this->getChildChildHtml('container1', '', true, true)): ?> 
       <div class="container1-wrapper"><?php echo $container1_html; ?></div> 
      <?php endif; ?> 
     <?php endif;?> 

     <?php if ($addtoLinksHtml = $this->getChildHtml('addto')): //compare, wishlist, to friend ?> 
      <div class="action-box clearer"> 
       <?php echo $addtoLinksHtml; ?> 
      </div> 
     <?php endif; ?> 
     <?php echo $this->getChildHtml('alert_urls'); //alerts ?> 
     <?php echo $this->getChildHtml('other'); ?> 

     <?php if ($tmpHtml = $this->getChildHtml('block_product_primary_bottom')): ?> 
      <div class="feature-wrapper top-border block_product_primary_bottom"><?php echo $tmpHtml; ?></div> 
     <?php endif; ?> 

     <?php if ($tmpHtml = $this->getChildHtml('product_primary_bottom_placeholder')): //Placeholder for extensions ?> 
      <div class="feature-wrapper top-border"><?php echo $tmpHtml; ?></div> 
     <?php endif; ?> 

    </div> <!-- end: product-shop --> 

    <?php if ($secondaryColUnits): //(!empty($secondaryColUnits)): ?> 
     <div class="product-secondary-column <?php echo $secondaryColGridClass; ?> custom-sidebar-right"> 
      <div class="inner"> 

       <?php //Placeholder for extensions ?> 
       <?php if ($tmpHtml = $this->getChildHtml('product_secondary_top_placeholder')): //Placeholder for extensions ?> 
        <div class="margin-bottom"><?php echo $tmpHtml; ?></div> 
       <?php endif; ?> 

       <?php if (isset($p['secondaryCol'][0])): ?> 
        <?php echo $p['secondaryCol'][0]; ?> 
       <?php endif; ?> 

       <?php if ($tmpHtml = $this->getChildHtml('block_product_secondary_bottom')): ?> 
        <div class="feature-wrapper top-border block_product_secondary_bottom"><?php echo $tmpHtml; ?></div> 
       <?php endif; ?> 

       <?php if (isset($p['secondaryCol'][1])): ?> 
        <div class="margin-top"><?php echo $p['secondaryCol'][1]; ?></div> 
       <?php endif; ?> 

       <?php /*?> 
       <?php if (isset($section['related'])): ?> 
        <div class="margin-top"><?php echo $section['related']; ?></div> 
       <?php endif; ?> 
       <?php */?> 

      </div> 
     </div> <!-- end: product-secondary-column --> 
    <?php endif; ?> 

    <?php if ($_product->isSaleable() && $this->hasOptions()): ?> 
     <?php if ($container2_html = $this->getChildChildHtml('container2', '', true, true)): ?> 
      <div class="box-additional <?php echo $container2ColGridClass; ?>"> 
       <div class="container2-wrapper"><?php echo $container2_html; ?></div> 
      </div> 
     <?php endif; ?> 
    <?php endif; ?> 

</form>