0

我正在为一个相当令人沮丧的 Magento 问题寻求帮助,我似乎无法理解。

在我们的 Magento 网站上,我们有几个捆绑产品。这些工作正常等,但捆绑产品的所有项目都显示在页面上;它使页面不必要的长并且不需要列表,因为项目是固定的,客户不能更改或编辑任何项目。

理想情况下,我想做的是停止显示这些项目,使其看起来更像一个普通的产品页面。

我尝试编辑位于以下位置的 view.phtml 文件:

应用程序/设计/前端/默认/my_theme/模板/目录/产品/

我发现了以下代码块:

<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>

<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>

删除“container2”行时,它确实删除了捆绑商品的列表,但也删除了“添加到购物车”按钮。

感谢您对此的任何帮助,因为我无法使用 Google Sensei 解决此问题。

4

2 回答 2

0
Step:1 First Remove below Lines from --template\catalog\product\view.phtml 

if ($_product->isSaleable() && $this->hasOptions()):?>
                <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif; ?>

Step2: Add Below Lines inplace of Above lines

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/view/addtocart.phtml')->toHtml(); ?>



Step3: --template\catalog\product\view\addtocart.phtml
Remove All Lines from file and add below code
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>

<div class="add-to-cart">
    <?php  ?>
    <label for="qty"><?php echo $this->__('Qty:') ?></label>
    <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />

    <!--<button type="button" title="<?php echo $this->__('Add to Cart') ?>"        class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product)   ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>-->
    <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart"  onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button></p>
    <?php echo $this->getChildHtml('', true, true) ?>
</div>

第 4 步: - 转到管理面板,转到产品,如果自定义选项被标记为必需,则将它们标记为不需要。

有关更多信息,请参阅此屏幕截图

谢谢...

于 2013-06-24T11:36:58.953 回答
0

虽然这是一个非常古老的问题,但认为这可能对遇到要求的人有用。您要做的就是编辑呈现 Bundle 项目的 .phtml 文件。

这就是我解决它的方法:

通常您要编辑的文件是:YOUR_THEME->default->template->bundle->catalog->product->view->type->bundle->option->select.phtml

如果您在主题中找不到此路径,则:

Step1) 从系统->配置打开模板提示。单击开发人员,然后在调试选项卡下,启用模板提示。

步骤 2) 刷新或转到列出捆绑商品的产品视图页面,通过模板提示找到文件。

进入 select.phtml 文件后,您可以执行任何您想要隐藏、显示或更改代码的操作。我刚刚添加了一个带有“display:none”样式的 div,它隐藏了整个“Bundle Item”块。

于 2015-05-12T06:46:15.387 回答