There are questions remain, We'll search for the answers together. But one thing we known for sure,the future is not set!

【原创文章】修改ECSHOP大商创默认商品重量单位为克和商品单位为包的方法

ecshop 百蔬君 2846℃ 已收录 0评论

1,首先把商品重量和商品单位搬到商品名称下面。
\public_html\admin\templates\goods_info.dwt
这个很简单,把“其他信息”下面的代码

<div class="item">
<div class="step_label">{$lang.goods_weight}:</div>
<div class="step_value">
<input type="text" name="goods_weight" class="text" autocomplete="off" value="{$goods.goods_weight_by_unit}"/>
<div class="value_select">
<div id="commodity_weight" class="imitate_select select_w60">
<div class="cite">{$lang.unit_kg}</div>
<ul style="display: none;">
{foreach from=$unit_list item=item key=key}
<li><a href="javascript:;" data-value="{$key}" class="ftx-01">{$item}</a></li>
{/foreach}
</ul>
<input name="weight_unit" type="hidden" value="{$weight_unit}" id="company_val">
</div>
</div>
</div>
</div>
<div class="item">
<div class="step_label">{$lang.goods_unit}:</div>
<div class="step_value">
<input type="text" name="goods_unit" class="text" autocomplete="off" value="{$goods.goods_unit}"/>
<div class="notic">{$lang.goods_unit_notic}</div>
</div>
</div>

搬到“通用信息”中

<div class="item">
<div class="step_label">{$lang.lab_bar_simple_desc}:</div>
<div class="step_value">
<textarea class="textarea" name="goods_brief">{$goods.goods_brief|escape}</textarea>
</div>

这段代码上面。
这样编辑产品的时候就很容易修改这个产品重量和单位了。

 

2,修改默认商品单位为克。

\public_html\admin\goods.php


$smarty->assign('weight_unit', $is_add ? '1' : (1 <= $goods['goods_weight'] ? '1' : '0.001'));

修改为
$smarty->assign('weight_unit', (!$is_add) ? '1' : (1 <= $goods['goods_weight'] ? '1' : '0.001'));

上面的方法从代码上面看的出来,只有在新增产品的时候,默认单位才是“克”。如果是复制产品呢,则还是“千克”。

如果主要是修改产品参数时可以这样修改

把\public_html\admin\goods.php中
$smarty->assign('weight_unit', $is_add ? '1' : (1 <= $goods['goods_weight'] ? '1' : '0.001'));

修改为
$smarty->assign('weight_unit', $is_add ? '0.001' : (1 <= $goods['goods_weight'] ? '1' : '0.001'));

这样在新增产品及修改产品时单位都是“克”.

然后把
\public_html\admin\includes\lib_goods.php

function get_unit_list()
{
	return array(1 => $GLOBALS['_LANG']['unit_kg'],'0.001' => $GLOBALS['_LANG']['unit_g']);
}

修改为

function get_unit_list()
{
	return array( '0.001' => $GLOBALS['_LANG']['unit_g'],1 => $GLOBALS['_LANG']['unit_kg']); //daokers
}

这样就解决问题了

3,修改默认商品单位为“包”。

admin/goods.php

'goods_unit' => '个',修改 'goods_unit' => '包',</code。

languages/zh_cn/admin/goods.php

$_LANG['goods_unit_notic'] = '比如:个,件,份,套。默认为个';  修改为  $_LANG['goods_unit_notic'] = '比如:包,罐,个,件,份,套。默认为包';

4,修改商品页默认提示信息

如果想默认自动隐藏这个系统提示,除了上面注释外,也可以这样修改

\admin\templates\goods_info.dwt

<div class="explanation" id="explanation">
<div class="ex_tit"><i class="sc_icon"></i><h4>{$lang.operating_hints}</h4><span id="explanationZoom" title="{$lang.fold_tips}"></span></div>
<ul>

修改为

<div class="explanation" id="explanation" style="width: 100px;">
<div class="ex_tit" style="margin-bottom: 0px;"><i class="sc_icon"></i><h4>{$lang.operating_hints}</h4><span id="explanationZoom" title="{$lang.fold_tips}" class="shopUp"></span></div>
<ul style="display: none;">

当然也可以直接注释掉这些信息。

<!--<div class="explanation" id="explanation">
            	<div class="ex_tit"><i class="sc_icon"></i><h4>{$lang.operating_hints}</h4><span id="explanationZoom" title="{$lang.fold_tips}"></span></div>
                <ul>
                	<li>{$lang.operation_prompt_content_common}</li>
                    <li>{$lang.operation_prompt_content.info.0}</li>
                    <li>{$lang.operation_prompt_content.info.1}</li>
                    <li>{$lang.operation_prompt_content.info.2}</li>
                </ul>
            </div>-->

 

5,自动展开“其他信息”
默认情况下,商品页的这个其他信息是折叠起来的。
每次要修改内容都要点击一次才能打开,很是不方便。
默认打开方法
\admin\templates\goods_info.dwt

<div class="step w190">
<div class="step_title"><i class="ui-step"></i><h3>{$lang.tab_mix}</h3><span class="stop stop_jia" ectype="outerInfo" title="{$lang.details_out}"></span></div>
<div class="step_content" style="display:none;">

修改为

<div class="step">
<div class="step_title"><i class="ui-step"></i><h3>{$lang.tab_mix}</h3><span class="stop" ectype="outerInfo" title="{$lang.details_out}"></span></div>
<div class="step_content" >

 

 

mark下,以后不用重新找了。

转载请注明:百蔬君 » 【原创文章】修改ECSHOP大商创默认商品重量单位为克和商品单位为包的方法

喜欢 (4)or分享 (0)
发表我的评论
取消评论

请证明您不是机器人(^v^):

表情