• 技术文章 >web前端 >html教程

    ECshop详细页面 颜色 尺码 等规格和库存相连动 和淘宝的格式一样_html/css_WEB-ITnose

    2016-06-21 09:14:04原创591

    二、添加css文件 找到style.css

    .catt{width:100%;height:auto;overflow:hidden;padding-bottom:5px;}
    .catt a{border: #7E7E7E 1px solid; text-align: center; background-color: #fff; margin-left:5px;margin-top:6px;padding-left: 10px;padding-right: 10px;display: block; white-space: nowrap;color:#000; text-decoration:none; float:left;}
    .catt a:hover {border:#ED0036 2px solid; margin: -1px; margin-left:4px;margin-top:5px;}
    .catt a:focus {outline-style:none;}
    .cattsel {border:#ED0036 2px solid; margin: -1px;background: url("images/test.gif") no-repeat bottom right; margin-left:4px;margin-top:5px;}
    .cattsel a:hover {border: #ED0036 2px solid;margin:-1px;background: url("images/test.gif") no-repeat bottom right;}

    三、添加循环文件,找到goods.dwt文件

    找到:



    替换为:




    href="javascript:;" name="{$value.id}" title="[{if $value.price gt 0}{$lang.plus}{elseif $value.price

    lt 0}{$lang.minus}{/if} {$value.format_price|abs}]">{$value.label}
    id="spec_value_{$value.id}" type="radio" name="spec_{$spec_key}" value="{$value.id}" {if $key eq 0}

    checked{/if} />




    四、添加js文件:

    function changeAtt(t,a,goods_id) {
    t.lastChild.checked='checked';
    for (var i = 0; i if (t.parentNode.childNodes[i].className == 'cattsel') {
    t.parentNode.childNodes[i].className = '';
    }
    }

    t.className = "cattsel";
    var formBuy = document.forms['ECS_FORMBUY'];
    spec_arr = getSelectedAttributes(formBuy);
    Ajax.call('goods.php?act=get_products_info', 'id=' + spec_arr+ '&goods_id=' + goods_id, shows_number,

    'GET', 'JSON');
    changePrice();
    }
    function shows_number(result)
    {
    if(result.product_number !=undefined)
    {
    document.getElementById('shows_number').innerHTML = result.product_number+'件';
    }
    else
    {
    document.getElementById('shows_number').innerHTML = '未设置'
    }
    }

    五、添加php文件代码 打开goods.php ,大约在71行下添加一下代码

    if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'get_products_info')
    {
    include('includes/cls_json.php');

    $json = new JSON;
    // $res = array('err_msg' => '', 'result' => '', 'qty' => 1);

    $spce_id = $_GET['id'];
    $goods_id = $_GET['goods_id'];
    $row = get_products_info($goods_id,explode(",",$spce_id));
    //$res = array('err_msg'=>$goods_id,'id'=>$spce_id);
    die($json->encode($row));

    }


    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:html滚动窗口效果展示_html/css_WEB-ITnose 下一篇:自己动手写 PHP MVC 框架(40节精讲/巨细/新人进阶必看)

    相关文章推荐

    • 如何向当前的html文档输入一段字符_html/css_WEB-ITnose• 引入外部CSS的两种方式及区别_html/css_WEB-ITnose• 浏览器得到地址栏的相关信息_html/css_WEB-ITnose• 18、HTML_html/css_WEB-ITnose• 在每次创建一个新的dialog和对它进行拖拽和拉伸之后,怎么保存下每个dialog的位置和大小代码如下。_html/css_WEB-ITnose
    1/1

    PHP中文网