How can I add the shopping cart function to the list and homepage of destoon mall?
Currently, the function of adding to the shopping cart only exists in the details page of the mall. Sometimes we want to use the function of adding to the shopping cart on the list page when purchasing in batches.
For the modification steps, see:
For example, add this function on the homepage and list page of the mall channel.
Step 1: Modify the mall/index.htm Template
Tip: If you want to add the function to the shopping cart on the homepage, you need to add one more line of code:
Add the following code after {template 'footer '}:
<SCRIPT type = "text/JavaScript"> var mallurl = '{$ module [16] [linkurl]}'; var s_s = {'1': 0, '2 ': 0, '3': 0}; var M_L = {no_comment: 'No comments', no_order: 'No deals ', no_goods: 'item does not exist or has been dismounted ', no_self: 'item cannot be added. ', lastone :''}; </SCRIPT> <SCRIPT type = "text/JavaScript" src = "{dt_static} file/script/Mall. JS "> </SCRIPT>
Tip: If you want to add the function to the shopping cart on the homepage, you need to add one more line of code:
<link rel="stylesheet" type="text/css" href="{DT_SKIN}mall.css"/><script type="text/javascript" src="{DT_STATIC}file/script/mall.js"></script>
Step 2: Modify the block tag block file template/default/Tag/thumb-mall.htm
Modify it to the following code:
In <Table width = "100%">{Loop $ tags $ I $ t}FrontAdd the following code:
<Div id = "cart_tip" style = "display: none; "> <p> message </P> <div> added to the shopping cart! There are <span id = "cart_num"> 0 </span> items in the shopping cart </div> <center> <input type = "button" value = "and then click" onclick = ""DH ('cart _ tip '); "/> & nbsp; <input type = "button" value = "unsettle" onclick = "Go ('{$ module [16] [linkurl]} cart. PHP '); "/> </center> </div>
In <li> <SPAN class = "f_price" >¥ {$ t [price]} </span> </LI>BackAdd the following code:
<Br/> <a href = "javascript: void (0)" onclick = "addcart ({$ t [Itemid]});"> Add to shopping cart </a>
Step 3: Find the file/script/mall. js file and change the function addcart () to addcart (itmeid). The specific code of the function is as follows:
function AddCart(itemid) { itemid = typeof itemid == ‘undefined‘ || itemid === null ? mallid : itemid; makeRequest(‘action=ajax&itemid=‘+itemid+‘&s1=‘+s_s[1]+‘&s2=‘+s_s[2]+‘&s3=‘+s_s[3], mallurl+‘cart.php‘, ‘_AddCart‘);}
You can add the convenient shopping cart button after the preceding modification.
Add the shopping cart function to the list and homepage of destoon mall