Ecshop Purchase quantity increase plus minus button plug-in (including shopping cart product number increased decrease, automatic Update)

Source: Internet
Author: User

Ecshop product page Purchase quantity plus minus button ecshop Shopping cart page add minus button plugin

The default template is an example of a detailed tutorial:

Find the following code in flow.php

ElseIf ($_request[' step '] = = ' Update_cart ')    {        if (isset ($_post[' Goods_number ']) && Is_array ($_post[') Goods_number '])        {            Flow_update_cart ($_post[' goods_number '));        }        Show_message ($_lang[' Update_cart_notice '), $_lang[' Back_to_cart '], ' flow.php ');        Exit;    }  

Modified to:

ElseIf ($_request[' step '] = = ' Update_cart ') {    if (isset ($_post[' Goods_number ']) && Is_array ($_post[' goods _number '])    {        Flow_update_cart ($_post[' goods_number '));    } Ecs_header ("Location:flow.php?  step=cart\n ");    show_message ($_lang[' Update_cart_notice '), $_lang[' Back_to_cart '], ' flow.php ');    Exit;}  

First, product page

Open: GOODS.DWT

{* Contains script file *}
{insert_scripts files= ' common.js '} under this paragraph:

<script type= "Text/javascript" >
function $id (Element) {
return document.getElementById (Element);
}
Cutting Screen--is the button, _v is the content platform, _h is the content Library
function Reg (str) {
var bt= $id (str+ "_b"). getElementsByTagName ("H2");
for (Var i=0;i<bt.length;i++) {
BT[I].SUBJ=STR;
Bt[i].pai=i;
bt[i].style.cursor= "Pointer";
Bt[i].onclick=function () {
$id (this.subj+ "_v"). Innerhtml= $id (this.subj+ "_h"). getElementsByTagName ("blockquote") [this.pai].innerhtml;
for (Var j=0;j< $id (this.subj+ "_b"). getElementsByTagName ("H2"). length;j++) {
var _bt= $id (this.subj+ "_b"). getElementsByTagName ("H2") [j];
var Ison=j==this.pai;
_bt.classname= (ISON? "": "H2BG");
}
}
}
$id (str+ "_h"). Classname= "None";
$id (str+ "_v"). Innerhtml= $id (str+ "_h"). getElementsByTagName ("blockquote") [0].innerhtml;
}

</script>

Modified to:

<script type= "Text/javascript" >
function $id (Element) {
return document.getElementById (Element);
}
Cutting Screen--is the button, _v is the content platform, _h is the content Library
function Reg (str) {
var bt= $id (str+ "_b"). getElementsByTagName ("H2");
for (Var i=0;i<bt.length;i++) {
BT[I].SUBJ=STR;
Bt[i].pai=i;
bt[i].style.cursor= "Pointer";
Bt[i].onclick=function () {
$id (this.subj+ "_v"). Innerhtml= $id (this.subj+ "_h"). getElementsByTagName ("blockquote") [this.pai].innerhtml;
for (Var j=0;j< $id (this.subj+ "_b"). getElementsByTagName ("H2"). length;j++) {
var _bt= $id (this.subj+ "_b"). getElementsByTagName ("H2") [j];
var Ison=j==this.pai;
_bt.classname= (ISON? "": "H2BG");
}
}
}
$id (str+ "_h"). Classname= "None";
$id (str+ "_v"). Innerhtml= $id (str+ "_h"). getElementsByTagName ("blockquote") [0].innerhtml;
}


Actually just added this part
Function del () {
var num = document.getElementById ("number");
var n = parseint (num.value);
if (n-1<=0) {
Alert ("A product must be selected");
}else{
Num.value = n-1;
}
}
function Add () {
var num = document.getElementById ("number");
var n = parseint (num.value);
Num.value = n+1;
}

Actually just added this part


</script>

Search:

<dd>
<strong>{$lang .number}:</strong>
<input name= "number" type= "text" id= "number" value= "1" size= "4" onblur= "Changeprice ()" style= "border:1px solid #ccc; "/>
</dd>

Modified to:

<table>
<tr>
&LT;TD valign= "Middle" height= "all" width= "align=" "right" ><font>{$lang .number}:</font> </td>
&LT;TD valign= "Middle" > </td>
<td><input name= "number" type= "text" id= "number" value= "1" size= "4" onblur= "Changeprice ()" Style= "border:1px Solid #ccc; height:25px; width:30px; Text-align:center; "/></td>
<td> </td>
</tr>
</table>

Place the following image in the template directory:(note to change the path to your picture)

Two. Shopping Cart page

Open: FLOW.DWT

1. Find

{* Contains script file *}
{insert_scripts files= ' common.js,shopping_flow.js '}

<!--Add the following script code--

<script language= "javascript" type= "Text/javascript" >
function Goods_cut ($val) {
var Num_val=document.getelementbyid (' number ' + $val);
var New_num=num_val.value;
if (IsNaN (new_num)) {alert (' Please enter a number '); return false}
var Num = parseint (new_num);
if (num>1) num=num-1;
Num_val.value=num;
document.getElementById (' Updatecart '). Click ();
}
function Goods_add ($val) {
var Num_val=document.getelementbyid (' number ' + $val);
var New_num=num_val.value;
if (IsNaN (new_num)) {alert (' Please enter a number '); return false}
var Num = parseint (new_num);
num=num+1;
Num_val.value=num;
document.getElementById (' Updatecart '). Click ();
}
</script>

2. Search:

<input type= "text" Name= "goods_number[{$goods. rec_id}]" id= "goods_number_{$goods. rec_id}" value= "{$goods. Goods_ Number} "size=" 4 "class=" INPUTBG "style=" Text-align:center "onkeydown=" Showdiv (This) "/>

Modified to:

<span class= "Goods_cut" onclick= "Goods_cut (' {$goods. rec_id} ');" ></span>
<input type= "text" Name= "goods_number[{$goods. rec_id}]" id= "number{$goods. rec_id}" value= "{$goods. Goods_number} "Size=" 4 "class=" number "onblur=" if (IsNaN (this.value)) {alert (' Please enter numbers '); return False}else{document.getelementbyid (' Updatecart '). Click ();} " Title= "{$lang. Goods_number_tip}"/>
<span class= "Goods_add" onclick= "Goods_add (' {$goods. rec_id} ');" ></span>

3. Search:

<input name= "Submit" type= "Submit" class= "Bnt_blue_1" value= "{$lang. Update_cart}"/> modified to:

<input name= "Submit" type= "Submit" id= "Updatecart" value= "{$lang. Update_cart}" class= "Btn_s3"/>

Open: Style.css file, add below Bottom

. goods_cut {Background:url ("images/yy.gif") no-repeat scroll 0 0 transparent;border:0 None;cursor:pointer;display:blo ck;float:left;font-size:0;height:15px;line-height:0;margin:8px 3px 0;width:15px;} Input.goodsbuybox, Input.number {border:1px solid #DDDDDD; float:left;font-size:10px;height:18px;line-height:18px; margin:5px 6px 0;padding:0;text-align:center;width:32px;}. Goods_add {background:url ("images/yy.gif") no-repeat scroll 0-15px transparent;
border:0 none;









. goods_number_tit{






}

5. Place the following image in the template directory:(note change to your picture path)

The novice is using the default template to directly overwrite the following attachments:

Ecshop shopping cart plus minus plugin download: www.ecshop119.com/moban-318.html

Note: The number of product pages in the original text increases the decrease button does not add a price change function, if you view the original, add Changeprice on the button ()

As follows:

<table>
<tr>
&LT;TD valign= "Middle" height= "all" width= "" "align=" right "><font class=" shop ">{$lang. Number}:</font > </td>
&LT;TD valign= "Middle" >Changeprice ()"/> </td>
<td><input name= "number" type= "text" id= "number" value= "1" size= "4" onblur= "Changeprice ()" Style= "border:1px Solid #ccc; height:25px; width:30px; Text-align:center; "/></td>
<td>Changeprice () "/> </td>
</tr>
</table>

Reprint Please specify: ECshop119 template house-ecshop Tutorial Network (the country's most professional ecshop plug-in manufacturers-professional ecshop two times development)

Ecshop Purchase quantity increase plus minus button plug-in (including shopping cart product number increased decrease, automatic Update)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.