Appointment successful!
A dedicated customer service will contact you later

Mall Demo Appointment

商淘wstmart多用戶商城系統的商品價格篩選的實現原理及代碼展現

2020-07-09 16:07:34 725

Classification:Web Promotion

現在的B2B2C商城系統裏,在瀏覽商品的時候有一個價格篩選功能,這是為了方面客戶查看瀏覽符合自己心裏預算價格的商品,那麽在商淘wstmart多用戶商城系統中,實現商品價格篩選的原理是什麽呢?

現在的B2B2C商城系統裏,在瀏覽商品的時候有一個價格篩選功能,這是為了方面客戶查看瀏覽符合自己心裏預算價格的商品,那麽在商淘wstmart多用戶商城系統中,實現商品價格篩選的原理是什麽呢?接下來就一起來看看吧。

根據B2B2C商城系統前臺傳遞的最低價格和最高價格,多用戶商城系統後臺根據傳遞的參數進行組合查詢出符合條件的商品。若用戶只輸入了最低價格,沒有輸入最高價格,wstmart多用戶商城系統後臺根據商品價格大於最低價格來查詢所有的商品。若用戶只輸入了最高價格,沒有輸入最低價格,B2B2C商城系統後臺則根據商品價格小於最高價格來查詢所有的商品。

以下是部分代碼示例:

$minPrice = input("param.minPrice");//最低價格
   $maxPrice = input("param.maxPrice");//最高價格
if($minPrice!='' && $maxPrice!=''){
       $where[] = ['shopPrice','between',[(int)$minPrice,(int)$maxPrice]];
   }elseif($minPrice!=''){
       $where[] = ['shopPrice','>=',(int)$minPrice];
}elseif($maxPrice!=''){
   $where[] = ['shopPrice','<=',(int)$maxPrice];
}
$list = Db::name("goods")

->where($where)->
   ->order("goodsId desc")
   ->paginate(input('pagesize/d',16))->toArray();

以上就是關於商淘wstmart多用戶商城系統中,商品價格篩選實現的原理介紹及部分的代碼展示,若是想要了解關於商淘B2B2C商城系統的更多詳細操作設置講解,或需要開發一套屬於自己的多用戶商城系統,可以登錄商淘軟件的官方網站進行咨詢查閱的哦。

Shangtaoyun multi-user mall system
Shangtaoyun three-level distribution system

Popular Tutorials