Ectouch Mobile Mall Home Page Call the product under the specified category

Source: Internet
Author: User

Ectouch is the only open source of the domestic market Ecshop Mobile Mall system, for the vast number of e-commerce at the lowest cost to quickly build a mobile mall. The most recent instance of the mall, mobile phone version of the first page needs to call the product under the specified category, Ectouch Mall by default It seems that there is no way to do this call, you can only add it yourself.

Here's how:

1. Open mobile\include\apps\default\model\indexmodel.class.php

Add the following code before the bottom }

/**     *  get the goods under the specified category      */      function assign_cat_goods ($cat _id)  {         $children  = get_children ($cat _id);          $sql  =  ' Select g.goods_id, g.goods_name, g.market_price, g.shop_price as org_price,   '  .                 "Ifnull (mp.user_price, g.shop_price *  ' $_session[discount] ')  AS shop_price, "  .                 ' g.promote_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb,  g.goods_img  '  .                  "from "  .  $this->pre .  ' goods as g  '  .                  "left join "  .  $this->pre .   "member_price as mp "  .                  "On mp.goods_id = g.goods_id and mp.user_rank  =  ' $_session[user_rank] '   '  .                  ' where g.is_on_sale = 1 and g.is_alone_sale  = 1 and  '  .                  ' g.is_delete = 0 and  ('  .  $children  .  ' or  '  . model (' Goods ')->get_extension_goods ($children)  .  ')   ';                   $sql  .=  ' order by g.sort_order,  G.goods_id desc ';         $sql  .=  '  limit 3 ';                  $res  =   $this->query ($sql);          $goods  = array ();         foreach  ($res  AS  $idx  =>  $row)  {            if  ($row [' Promote_price ']  > 0)  {                  $promote _price = bargain_price ($row [' Promote_price '],  $row [' promote_start_date '],   $row [' promote_end_date ']);                  $goods[$idx] [' Promote_price '] =  $promote _price > 0 ? price_format ($promote _price)  :   ';            } else {                  $goods [$idx] [' Promote_price '] =  ';            }               $goods [$IDX] [' ID '] =  $row [' goods_id '];             $goods [$idx] [' Name '] =   $row [' Goods_name '];             $goods [$IDX] [ ' Brief '] =  $row [' Goods_brief '];              $goods [$idx] [' Market_price '] = price_format ($row [' Market_price ']);              $goods [$idx] [' Short_name '] = c (' goods_name_length ')  > 0 ?                      sub_str ($row [' Goods_name '], c (' goods_name_length '))  :  $row [' Goods_name '];              $goods [$idx] [' Shop_price '] = price _format ($row [' Shop_price ']);             $goods [$ idx][' Thumb '] = get_image_path ($row [' goods_id '],  $row [' Goods_thumb '], true];              $goods [$idx] [' goods_img '] = get_image_ Path ($row [' goods_id '],  $row [' goods_img ']);              $goods [$idx] [' url '] = build_uri (' Goods/index ',  array (' id '  =>  $row [' goods_id ']);   &nbsP;     } ectouch::view ()->assign (' Cat_goods_ '  .  $cat _id, $ Goods);         return  $goods;     }

which

$sql. = ' LIMIT 3 ';

The number 3 represents a call to 3 items that can be modified by themselves

2. Open: mobile\include\apps\default\controller\indexcontroller.class.php

Add the following code inside the Public Function index () function:

Home specified categories under the commodity $this->assign (' Cat_id1 ', model (' Index ')->assign_cat_goods (1)); $this->assign (' CAT_ID5 ', model (' Index ')->assign_cat_goods (5));

Numbers 1 and 5 in the code represent categories ID1 and classifications ID5

You can modify or add your own

3. Open the template index.dwt and add the calling code in the appropriate location:

{foreach from= $cat _id5 item=goods name=cat_id5} <li> <a href= "{$goods. URL}" title= "{$goods. name|escape:html} "> <div class=" Products_kuang ">  </div> <div class= "Goods_name" > {$goods. name} </div> <span class= "Price" >{if $goods. promote_price}{$ goods.promote_price}{else}{$goods .shop_price}{/if}</span> </a> </li> {/foreach}

from=$cat _id5

Modify the From Value yourself


Ectouch Mobile Mall Home Page Call the product under the specified category

Related Article

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.