Add the shopping cart function to the list and homepage of destoon mall

Source: Internet
Author: User
Tags one more line

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

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.