我正在寻找一种方法来从结帐购物车中删除商品选项的价值,只需删除下面突出显示的文字:
我相信它位于文件app / design / frontend / base / default / template / checkout / cart / item / default.phtml中作为“item-option”
<?php if ($_options = $this->getOptionList()):?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
<?php if (isset($_formatedOptionValue['full_view'])): ?>
<div class="truncated_full_value">
<dl class="item-options">
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
</dl>
</div>
<?php endif; ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif;?>
感谢您的帮助
答案 0 :(得分:3)
要解决此问题,您必须覆盖* Mage_Bundle_Helper_Catalog_Product_Configuration *类。
在您的本地广告中创建一个新的 Mage 文件夹,其中包含帮助程序的相应子文件夹
/---app
| /---code
| /---local
| /---Mage
| /---Bundle
| /---Helper
| /---Catalog
| /---Product
| /---Configuration.php
复制帮助程序并编辑方法getBundleOptions。你必须删除$ option ['value']这段代码
Mage::helper('core')->currency($this->getSelectionFinalPrice($item, bundleSelection)
获得这种新方法
public function getBundleOptions(Mage_Catalog_Model_Product_Configuration_Item_Interface $item)
{
$options = array();
$product = $item->getProduct();
/**
* @var Mage_Bundle_Model_Product_Type
*/
$typeInstance = $product->getTypeInstance(true);
// get bundle options
$optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
$bundleOptionsIds = $optionsQuoteItemOption ? unserialize($optionsQuoteItemOption->getValue()) : array();
if ($bundleOptionsIds) {
/**
* @var Mage_Bundle_Model_Mysql4_Option_Collection
*/
$optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product);
// get and add bundle selections collection
$selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');
$selectionsCollection = $typeInstance->getSelectionsByIds(
unserialize($selectionsQuoteItemOption->getValue()),
$product
);
$bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
foreach ($bundleOptions as $bundleOption) {
if ($bundleOption->getSelections()) {
$option = array(
'label' => $bundleOption->getTitle(),
'value' => array()
);
$bundleSelections = $bundleOption->getSelections();
foreach ($bundleSelections as $bundleSelection) {
$qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
if ($qty) {
$option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName());
}
}
if ($option['value']) {
$options[] = $option;
}
}
}
}
return $options;
}
答案 1 :(得分:0)
你也可以通过纯css获得相同的结果。请尝试使用css中的以下代码来删除捆绑产品的价格。
.item-options dd span.price{ display:none; }