Example of the total number of items displayed on the ecshop background order details page

Source: Internet
Author: User
Tags php file

Sometimes there are hundreds of small items in a list, so it is necessary to display the total number of items on the order details page. The following is the modification method:

This method does not add additional SQL statements to query the total number of items, but in order. php is transformed based on existing loops. It is more efficient to query itself than to write another SQL statement to the database, but it may be difficult for new users to operate, therefore, you must find the location of the code.

1. Open the admin/order. Php file and find it (about 316 rows)
$ Res = $ db-> query ($ SQL );
(Note: Be sure to find the correct line, because several lines can be found when you search for this line of code in order. php. Make sure the line appears at the top. If you can see the number of rows in the editor, it is about 316 rows)
Add a line of code below it
$ Goods_nums = 0;
2. Continue searching (about 346 rows). Repeat the secondary development of ecshop.
$ Goods_list [] = $ row;
Add a line of code below it
$ Goods_nums + = $ row ['goods _ number'];
3. Continue searching (about 361 rows)
$ Smarty-> assign ('goods _ list', $ goods_list );
Add a line of code under it
$ Smarty-> assign ('goods _ nums', $ goods_nums );
4. Modify admin/templates/order_info.htm
Set

The code is as follows: Copy code
<Tr>
<Td> </td>
<Td> & nbsp; </td>
Change
<Tr>
<Td> {if $ goods_nums} <div align = "right"> <strong> Total number of items: </strong> </div >{/ if} </td>
<Td> {if $ goods_nums} <div align = "right" >{$ goods_nums} </div >{/ if} </td>

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.