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> |