【问题标题】:How to add different size-guide in different product in magento 1.9.2?如何在 magento 1.9.2 的不同产品中添加不同的尺寸指南?
【发布时间】:2015-10-31 09:03:50
【问题描述】:

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

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

【问题讨论】:

标签: php magento-1.9


【解决方案1】:

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

下一个

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

下一个

转到静态块 -> 添加新块 -> 块标题:尺寸指南 - 女性底部完整,->标识符:女性底部完整,-> 添加内容或图片(你想要哪个)

下一个

app\design\frontend\yourtheme\template\catalog\product\view\type\options\configurable.phtml 替换下面

<?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;?>

【讨论】:

    【解决方案2】:

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

    【讨论】:

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