當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Products::get方法代碼示例

本文整理匯總了PHP中Products::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Products::get方法的具體用法?PHP Products::get怎麽用?PHP Products::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Products的用法示例。


在下文中一共展示了Products::get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: listRss

function listRss()
{
    header("Content-Type: application/xml; charset=UTF-8");
    $location = Url::rss();
    if ($match = Uri::match('^(.*?)$')) {
        $location = ROOT_URL . $match[1];
        $reLocation = base64_encode($location);
        if ($loadData = Cache::loadKey($reLocation, 60)) {
            $loadData = json_decode($loadData, true);
            return $loadData;
        }
    }
    $inputData = array('limitShow' => 15, 'limitPage' => 0);
    if ($match = Uri::match('\\/page\\/(\\d+)')) {
        $inputData['limitPage'] = $match[1];
    }
    if ($match = Uri::match('\\/category\\/(\\d+)')) {
        $id = $match[1];
        $inputData['where'] = "where catid='{$id}'";
    }
    if ($match = Uri::match('rss\\/products')) {
        $loadData = Products::get($inputData);
    } else {
        $loadData = Post::get($inputData);
    }
    $reLocation = base64_encode($location);
    Cache::saveKey($reLocation, json_encode($loadData));
    return $loadData;
}
開發者ID:neworldwebsites,項目名稱:noblessecms,代碼行數:29,代碼來源:rss.php

示例2: index

 /**
  * Index lists all the products
  *
  * @param  SS_HTTPRequest $request
  * @return PaginatedList
  */
 public function index(SS_HTTPRequest $request)
 {
     $transaction = Session::get("transaction");
     // clear old session data
     if (!empty($transaction)) {
         Session::clear("transaction");
         Session::clear("order");
     }
     $filter = array('Active' => true);
     $searchQuery = $request->getVar('search');
     if ($searchQuery) {
         $filter['ProductDescription:PartialMatch'] = $searchQuery;
     }
     $produts = Products::get()->filter($filter);
     $paginatedProducts = PaginatedList::create($produts, $request);
     $paginatedProducts->setPageLength(10);
     $total = $this->total();
     return array('Products' => $paginatedProducts, 'searchQuery' => $searchQuery, 'CartItems' => $this->CartItems(), 'CartItemsCount' => $this->CartItemsCount(), 'CartTotal' => $total["total"], 'ShippingTotal' => $total["shippingtotal"]);
 }
開發者ID:shoaibali,項目名稱:silverstripe-shop-lite,代碼行數:25,代碼來源:ShopPage.php

示例3: toString

 public function toString()
 {
     $p = Products::get($this->product_slug);
     $s = $p->name . " ";
     foreach ($this->options as $o) {
         $s .= "(" . $o . ") ";
     }
     if ($this->qty > 1) {
         $s .= " @ \$" . $p->val($this->qty, $this->options) . " x" . $this->qty . " ";
     }
     $s .= "= \$" . $this->subtotal() . "\n";
     $shipping = $this->shippingCost();
     if ($shipping > 0) {
         $s .= "+ \$" . $shipping . " shipping\n";
     }
     return $s;
 }
開發者ID:GingerMoon,項目名稱:addStore,代碼行數:17,代碼來源:addStore.php


注:本文中的Products::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。