-1

我需要为我的 magento 商店添加不同产品的不同尺寸表。

任何人都可以在这里解释,如何做到这一点,并给我一个解决方案来做到这一点。

提前感谢formygalaxy

4

2 回答 2

1

您可以将产品属性(例如制造商)与静态块联系起来。

请参阅此代码:

$sizeGuideIdentifier = trim($_product->getAttributeText('manufacturer'));
$sizeGuideIdentifier = str_replace(' ','-',strtolower($sizeGuideIdentifier)) .'-size-guide';

if($this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml()):

echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml();

else:

echo $this->getLayout()->createBlock('cms/block')->setBlockId('product-sizeguide')->toHtml();

endif;   

它将尝试回显一个名为“nike-sizeguide”的块,如果该块不存在,它将回退到默认的 sizeguide。

于 2012-11-16T08:59:14.197 回答
1

是的,这在 Magento 1.9CE 上运行良好,尽管对我来说 Erwin 的解决方案需要插入到“app/design/frontend/.../.../template/catalog/product/view/type/options/configurable.phtml ”。

真正简单的解决方案和很好的结果;我们现在自动为每个品牌(制造商)弹出一个fancybox sizechart 图像,无需编码,我们的库存经理不需要考虑它。

真的很棒 - 非常感谢 Erwin Smit。我希望好业力已经拜访了你;)

    <dd <?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
        <div class="input-box">
            <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                <option><?php echo $this->__('Choose an Option...') ?></option>
              </select>
          </div>

        <div class="size-box"><?php 
                $sizeGuideIdentifier = trim($_product->getAttributeText('manufacturer')); 
                $sizeGuideIdentifier = str_replace(' ','-',strtolower($sizeGuideIdentifier)) .'-size-guide';
                if($this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml()):
                echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideIdentifier)->toHtml();
                else:
                echo $this->getLayout()->createBlock('cms/block')->setBlockId('product-sizeguide')->toHtml();
            endif;?>
        </div>
    </dd>
于 2014-07-13T03:34:50.143 回答