如何在magento 1.9.2中的不同产品中添加不同的尺寸指南?

时间:2015-10-31 09:03:50

标签: php magento-1.9

如何在magento 1.9.2中的不同产品中添加不同尺寸指南?

我有magento建立的电子商务商店。在产品中,我们有一个尺寸表,详细显示了男性和女性的尺寸。

2 个答案:

答案 0 :(得分:1)

创建属性 属性代码:'select_size_guide_table', 范围:全球, 商店目录输入类型:下拉列表, 商店所有者的目录输入类型:下拉列表, 独特价值:不, 所需值:不, 商店所有者的输入验证:无, 适用于:所有类型的产品, 用于创建可配置产品:否, 在快速搜索中使用:不, 在快速搜索中使用:不, 在高级搜索中使用:不, 可比较前端:不, 在分层导航中使用:否 在搜索结果中使用分层导航:不, 用于促销规则条件:否 位置:0 在前端允许HTML标记:是, 在前端的产品视图页面上可见:否, 用于产品清单:不, 用于产品清单中的排序:否

NEXT

管理标签/选项 在文本字段中:选择尺寸指南表 管理选项 在文本字段:Women-Bottom-Full

NEXT

转到静态区块 - >添加新 - > Block Title:尺码指南 - 女装底部, - >标识符:女装 - 全装, - > 添加内容或图像(您想要哪个)

NEXT

app \ design \ frontend \ yourtheme \ template \ catalog \ product \ view \ type \ options \ configurable.phtml REPLACE Below

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
        <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>
        </dd>
        <?php if(strlen(strstr($_attribute->getLabel(),'Size'))>0) : ?>
                <?php
                $sizeGuideTableAttribute = $_product->getResource()->getAttribute('select_size_guide_table');
                if($sizeGuideTableAttribute):
                    $sizeGuideTableAttributeValue = $sizeGuideTableAttribute->getFrontend()->getValue($_product);

                    if ($sizeGuideTableAttributeValue != 'No') :
                    ?>
                    <a href="#" class="size-guide-link" id="popup" onclick="div_show()">
                        <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/indianink/images/catalog/product/size-chart.jpg" alt="size guide"/>
                        Size Guide
                    </a>
                    <script>
                        //function to display Popup
                        function div_show(){ 
                        document.getElementById('size_guide').style.display = "block";
                        }
                        //function to hide Popup
                        function div_hide(){ 
                        document.getElementById('size_guide').style.display = "none";
                        }
                    </script>
                    <style>
                    #size_guide{
                        width: 100%;
                        height: 100%;
                        display: none;
                        position: fixed;            
                        background-color: #313131;
                        overflow:auto;
                        top: 0;
                        left: 0;
                        z-index: 9999;
                        overflow: hidden;  
                        }

                        img#close{
                        position: absolute;
                        right: -14px;
                        top: -14px;
                        cursor: pointer;
                        }

                        div#popupContact{
                            width: 40%;
                            margin-left: 29%;
                            margin-top: 5%;
                            background: #fff;
                        }
                        .validation-passed{float: right;}
                        .close{float: right;}
                    </style>
                    <div id="size_guide" style="display: none;">
                         <!-- Popup div starts here -->
                         <div id="popupContact"> 
                            <!--<img src="3.png" id="close" onclick="div_hide()">-->
                            <div class="modal fade" id="size-guide-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" onclick="div_hide()">X</button>
                                        </div>
                                        <div class="modal-body">
                                            <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($sizeGuideTableAttributeValue)->toHtml(); ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                         </div> 
                     <!-- Popup div ends here -->
                     </div>
                <?php endif; //$sizeGuideTableAttributeValue
                endif; //$sizeGuideTableAttribute
                ?>
            <?php endif; //strlen ?>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>

答案 1 :(得分:0)

最好的方法是使用第三方扩展,因为Magento没有这个功能。我建议使用Averun公司的扩展尺寸表 - https://averun.com/magento-size-chart.html。您可以为不同的产品或类别添加不同的尺寸指南。该扩展包含一些国际尺寸的盒子。此外,您的客户将建议选择正确的尺寸。

相关问题