【问题标题】:Custom attribute text in Magento Cart CrossellingMagento Cart Crosselling 中的自定义属性文本
【发布时间】:2015-05-06 13:22:17
【问题描述】:

目前我在 crosselling.phtml 中有这个:

  <?php if($this->getItemCount()): ?>
<div class="crosssell">
    <h2><?php echo $this->__('Service:') ?></h2>
    <ul id="crosssell-products-list">
    <?php foreach ($this->getItems() as $_item): ?>
        <li class="item">
            <a class="product-image" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(75, 75); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
            <div class="product-details">
                <h3 class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h3>
                <?php echo $this->getPriceHtml($_item, true) ?>

                    <p><?php
$custom = Mage::getModel('catalog/product')->load($_item->getProductId());
echo $custom->getAttributeText('servicetekst');
?></p>
                <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <ul class="add-to-links">               
                </ul>
            </div>
        </li>
    <?php endforeach; ?>
    </ul>
    <script type="text/javascript">decorateList('crosssell-products-list', 'none-recursive')</script>
</div>
<?php endif; ?>

一切正常,除了自定义属性“servicetekst”。从这里开始,我不确定如何继续?

【问题讨论】:

    标签: magento attributes cart


    【解决方案1】:

    我发现了一些对我有用的东西,可以在 crossell 模板 Magento 1.9.2.2 中显示自定义属性。这很容易。

    <?php echo $this->escapeHtml($_item->getCustom_attribute()) ?>
    

    确保“在产品列表中使用”设置为“是”并重新索引。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多