Magento分组产品未显示产品/价格


Magento Grouped Product Not showing products / prices

当使用已创建和库存的简单产品构建新的分组产品时,当使用我的自定义模板时,完成的分组产品不会在右侧列显示列出产品标题和价格的表。

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

有人知道如何解决这个问题吗?

很难说,但可能没有使用模板文件。您可以检查模板中的布局文件是否有一个块引用了PRODUCT_TYPE_grouped节点中的grouped.phtml。还要检查view.phtml是否发出类似的调用

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

以参考块。

将您的模板文件与进行比较

  • app''design''frontend''base''default''template''catalog''product''view.phtml
  • app''design''frontend''base''default''layout''catalog.xml

看看我的意思。

<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>