magento网站自定义尺寸修改

admin   ·   发表于 2个月前   ·   网站运维

大佬最后修改的地方

app/code/local/Mage/Catalog/Block/Product/View/Options/Type/Select.php

app/design/frontend/codazon_unlimited/default/template/catalog/product/view/size-guide.phtml

app/design/frontend/codazon_unlimited/default/template/catalog/product/view/view-styles/view-style-02.phtml


改尺码的核心位置 app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php

138行修改

原始                    . $this->escapeHtml($_value->getTitle()) . ' ' . $priceStr . '</label></span>';

修改后                  . $_value->getTitle() . ' ' . $priceStr . '</label></span>';


核心位置2

app/design/frontend/base/default/template/catalog/product/view/options/type/text.phtml

<?php 


$title = preg_replace('# #','', $this->escapeHtml($_option->getTitle()));


$title = explode('(', $title);

$title = strtolower($title[0]);


$placeholder = '';


if ($title == 'shoessize') {

    $placeholder = 'Leave your shoes size or Foot length(end with inches).';

}else if($title == 'otherdetails'){

    $placeholder = 'Leave your Wear Date and addtional request here. For customized size, We at least need your height, bust/chest, waist, hips size, but you can add more size here to make your customized costumes better.';

}



 ?>

<dt class="dt-<?php echo $title ?>"><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo  $this->escapeHtml($_option->getTitle()) ?></label>

    <?php echo $this->getFormatedPrice() ?></dt>

<dd class="<?php echo $title ?>" <?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>


app/design/frontend/codazon_unlimited/default/template/catalog/product/view/view-styles/view-style-02.phtml



<style type="text/css">

    .dt-height, .height, .dt-weight, .weight, .dt-chest, .chest, .dt-waist, .waist, .dt-hips, .hips, .dt-shoulderwidth, .shoulderwidth, .dt-calf, .calf, .dt-otherdetails, .otherdetails, .dt-footlength, .footlength, .dt-shoessize, .shoessize {

        display: none;

    }


    .size-chart {

        background-color: #c3c3c3c9;

        position: fixed;

        padding-top: 40px;

        width: 100%;

        height: 100%;

        z-index: 11111;

        overflow-x: hidden;

        overflow-y: auto;

        top: 0;

        left: 0;

        text-align: center;

    }


    .img-responsive {

        vertical-align: middle;

        display: inline;

    }


    .size-chart-main {

        text-align: left;

    }


    .size-chart-main-al {

        width: 50%;

        display: inline-block;

        background-color: #fff;

    }


    .size-chart-main .modal-header {

        text-align: left;

    }


    .modal-header {

        display: none;

    }


    .size-chart .size-chart-main .modal-header {

        display: block;

    }


</style>

<script type="text/javascript">

    jQuery(document).ready(function () {

        jQuery('.including').change(function () {


            jQuery('.including option:selected').text();

            jQuery('.dt-footlength, .footlength, .dt-shoessize, .shoessize').hide();

            var text = jQuery('.including option:selected').text();

            var sear = new RegExp('(with shoes/boots)|(with EVA Soles)|(with foot pad)');


            if (sear.test(text)) {

                jQuery('.dt-footlength, .footlength, .dt-shoessize, .shoessize').show();

            }


            shoes();

        })


        jQuery('.size').change(function () {

            var val = Number(jQuery(this).val());

            //select 当前当前选中的最后一个 option对象

            var first = Number(jQuery(".size option:nth-child(2)").val());


            jQuery('.dt-height, .height, .dt-weight, .weight, .dt-chest, .chest, .dt-waist, .waist, .dt-hips, .hips, .dt-shoulderwidth, .shoulderwidth, .dt-calf, .calf, .dt-otherdetails, .otherdetails').hide();


            if (first == val) {

                jQuery('.dt-height, .height, .dt-weight, .weight, .dt-chest, .chest, .dt-waist, .waist, .dt-hips, .hips, .dt-shoulderwidth, .shoulderwidth, .dt-calf, .calf, .dt-otherdetails, .otherdetails').show();

            } else {

                jQuery('.dt-otherdetails, .otherdetails').show();

            }

        })


        function shoes() {

            var obj = jQuery(".including ").get(0);


            if (obj) {

                for (var i = 0; i < obj.options.length; i++) {

                    var tmp = obj.options[i].text;

                    var sear = new RegExp('(with shoes/boots)|(with EVA Soles)|(with foot pad)');


                    if (sear.test(tmp)) {

                        return false;

                    }

                }

            }



            jQuery('.dt-footlength, .footlength, .dt-shoessize, .shoessize').show();

        }


        shoes();


        jQuery('#size-chart').click(function () {

            jQuery('.modal-body').addClass('size-chart');

            jQuery('.size-chart-main').addClass('size-chart-main-al');

        });



        jQuery('.modal-body').bind("click", function (e) {


            if (!jQuery(this).hasClass("size-chart")) {

                return false;

            }

            var target = jQuery(e.target);

            if (target.closest(".size-chart-main").length == 0) {//点击size-chart-main之外的地方触发

                jQuery('.modal-body').removeClass('size-chart');

                jQuery('.size-chart-main').removeClass('size-chart-main-al');

            }

        });



        jQuery('.modal-header button').bind("click", function (e) {

            jQuery('.modal-body').removeClass('size-chart');

            jQuery('.size-chart-main').removeClass('size-chart-main-al');

        });


    });


</script>



<!-- <div class="size-chart-bg"></div> -->

0 Reply   |  Until 2个月前 | 106 View
LoginCan Publish Content