Ecshop page implementation of custom pages in the application using the ECS self-contained pager

Source: Internet
Author: User
Tags foreach
/*------------------------------------------------------ */
--Shop Service list
/*------------------------------------------------------ */

if ($_request[' act '] = = ' list ')
{
/* Check Permissions */
Admin_priv (' Shop_service ');
Include pagination method
$sql = "Select COUNT (*) from". $ecs->table (' Shop_service '). "Where Status=1";
$filter [' record_count '] = $GLOBALS [' db ']->getone ($sql);
$filter = Page_and_size ($filter);
$sql = "Select a.ID as Service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_ Img,from_unixtime (a.create_time) as Create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_ Name,d.type_name,e.img_url as List_page_img from ". $ecs the->table (' Shop_service ')." As a LEFT join Ecs_business_service _join as B on a.user_id=b.user_id left join Ecs_service_option as C in A.option_id=c.id left join Ecs_join_shop_type as D On B.shop_type=d.id left join Ecs_user_pic as E in a.list_page_img=e.id where A.status=1 order by A.create_time LIMIT ". $filter [' Start ']. ',' . $filter [' page_size '];
Set_filter ($filter, $sql);
$rs = $GLOBALS [' db ']->getall ($sql);
foreach ($rs as $k = = $v) {
if ($v [' list_page_img ']! = ') {
$rs [$k] [' list_page_img '] = site_url. ' public/uploads/'. $v [' list_page_img '];
}else{
$rs [$k] [' list_page_img '] = site_url. ' public/uploads/'. ' Default.png ';
}
}
$lists = Array (' shop_service_list ' = = $rs, ' filter ' = $filter,
' Page_count ' = $filter [' Page_count '], ' record_count ' and ' = ' $filter [' record_count ']);
$smarty->assign (' shop_service_list ', $lists [' shop_service_list ']);
$smarty->assign (' filter ', $lists [' Filter ']);
$smarty->assign (' Record_count ', $lists [' Record_count ']);
$smarty->assign (' Page_count ', $lists [' Page_count ']);
$smarty->assign (' Full_page ', 1);
$smarty->display (' shop_service_list.htm ');
}
ElseIf ($_request[' act '] = = ' query ') {
$sql = "Select COUNT (*) from". $ecs->table (' Shop_service '). "Where Status=1";
$filter [' record_count '] = $GLOBALS [' db ']->getone ($sql);
$filter = Page_and_size ($filter);
$sql = "Select a.ID as Service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_ Img,from_unixtime (a.create_time) as Create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_ Name,d.type_name,e.img_url as List_page_img from ". $ecs the->table (' Shop_service ')." As a LEFT join Ecs_business_service _join as B on a.user_id=b.user_id left join Ecs_service_option as C in A.option_id=c.id left join Ecs_join_shop_type as D On B.shop_type=d.id left join Ecs_user_pic as E in a.list_page_img=e.id where A.status=1 order by A.create_time LIMIT ". $filter [' Start ']. ',' . $filter [' page_size '];
Set_filter ($filter, $sql);
$rs = $GLOBALS [' db ']->getall ($sql);
foreach ($rs as $k = = $v) {
if ($v [' list_page_img ']! = ') {
$rs [$k] [' list_page_img '] = site_url. ' public/uploads/'. $v [' list_page_img '];
}else{
$rs [$k] [' list_page_img '] = site_url. ' public/uploads/'. ' Default.png ';
}
}
$lists = Array (' shop_service_list ' = = $rs, ' filter ' = $filter,
' Page_count ' = $filter [' Page_count '], ' record_count ' and ' = ' $filter [' record_count ']);
$smarty->assign (' shop_service_list ', $lists [' shop_service_list ']);
$smarty->assign (' filter ', $lists [' Filter ']);
$smarty->assign (' Record_count ', $lists [' Record_count ']);
$smarty->assign (' Page_count ', $lists [' Page_count ']);
$smarty->assign (' Full_page ', 1);
Make_json_result ($smarty->fetch (' shop_service_list.htm '), ', Array (' filter ' = ' $lists [' filter '], ' Page_ Count ' = $lists [' Page_count ']);
}

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.