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


PHP Prefs::getProductCategory方法代碼示例

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


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

示例1: beforeUpdate

 public function beforeUpdate($id, $data)
 {
     $defaults = array();
     $files = array();
     if (isset($data['file_id']) && count($data['file_id'])) {
         $data['defaultpic'] = isset($data['defaultpic']) ? $data['defaultpic'] : $data['file_id'][0];
         $data['brchead'] = isset($data['brchead']) ? $data['brchead'] : $data['file_id'][0];
         $data['brc1'] = isset($data['brc1']) ? $data['brc1'] : $data['file_id'][0];
         $data['brc2'] = isset($data['brc2']) ? $data['brc2'] : $data['file_id'][0];
         $data['brc3'] = isset($data['brc3']) ? $data['brc3'] : $data['file_id'][0];
         for ($i = 0; $i < count($data['file_id']); $i++) {
             $files[$data['file_id'][$i]]['thumbnail_url'] = $data['thumbnail_url'][$i];
             $files[$data['file_id'][$i]]['large_url'] = $data['large_url'][$i];
             $files[$data['file_id'][$i]]['medium_url'] = $data['medium_url'][$i];
             $files[$data['file_id'][$i]]['full_url'] = $data['full_url'][$i];
             $files[$data['file_id'][$i]]['delete_type'] = $data['delete_type'][$i];
             $files[$data['file_id'][$i]]['delete_url'] = $data['delete_url'][$i];
             $files[$data['file_id'][$i]]['filename'] = $data['filename'][$i];
             $files[$data['file_id'][$i]]['filesize'] = $data['filesize'][$i];
             $files[$data['file_id'][$i]]['temp_dir'] = $data['temp_dir'][$i];
             $files[$data['file_id'][$i]]['filetype'] = $data['filetype'][$i];
             $files[$data['file_id'][$i]]['fileurl'] = $data['fileurl'][$i];
             $files[$data['file_id'][$i]]['file_id'] = $data['file_id'][$i];
             $files[$data['file_id'][$i]]['caption'] = $data['caption'][$i];
             if ($data['defaultpic'] == $data['file_id'][$i]) {
                 $defaults['thumbnail_url'] = $data['thumbnail_url'][$i];
                 $defaults['large_url'] = $data['large_url'][$i];
                 $defaults['medium_url'] = $data['medium_url'][$i];
                 $defaults['full_url'] = $data['full_url'][$i];
             }
             if ($data['brchead'] == $data['file_id'][$i]) {
                 $defaults['brchead'] = $data['large_url'][$i];
             }
             if ($data['brc1'] == $data['file_id'][$i]) {
                 $defaults['brc1'] = $data['large_url'][$i];
             }
             if ($data['brc2'] == $data['file_id'][$i]) {
                 $defaults['brc2'] = $data['large_url'][$i];
             }
             if ($data['brc3'] == $data['file_id'][$i]) {
                 $defaults['brc3'] = $data['large_url'][$i];
             }
         }
     } else {
         $data['thumbnail_url'] = array();
         $data['large_url'] = array();
         $data['medium_url'] = array();
         $data['full_url'] = array();
         $data['delete_type'] = array();
         $data['delete_url'] = array();
         $data['filename'] = array();
         $data['filesize'] = array();
         $data['temp_dir'] = array();
         $data['filetype'] = array();
         $data['fileurl'] = array();
         $data['file_id'] = array();
         $data['caption'] = array();
         $data['defaultpic'] = '';
         $data['brchead'] = '';
         $data['brc1'] = '';
         $data['brc2'] = '';
         $data['brc3'] = '';
     }
     $data['defaultpictures'] = $defaults;
     $data['files'] = $files;
     $cats = Prefs::getProductCategory()->ProductCatToSelection('slug', 'title', false);
     $data['category'] = $cats[$data['categoryLink']];
     $unitdata = array_merge(array('id' => $id), $data);
     //$this->updateStock($unitdata);
     Commerce::updateStock($unitdata);
     unset($data['outlets']);
     unset($data['outletNames']);
     unset($data['addQty']);
     unset($data['adjustQty']);
     return $data;
 }
開發者ID:awidarto,項目名稱:bilnatracker,代碼行數:76,代碼來源:ProductsController.php

示例2: postAssigncat

 public function postAssigncat()
 {
     $in = Input::get();
     $category = $in['category'];
     $cats = Prefs::getProductCategory()->ProductCatToSelection('slug', 'title', false);
     $product_ids = $in['product_ids'];
     foreach ($product_ids as $p) {
         $prop = Product::find($p);
         $prop->category = $cats[$category];
         $prop->categoryLink = $category;
         $prop->save();
     }
     return Response::json(array('result' => 'OK'));
 }
開發者ID:awidarto,項目名稱:tmadminflat,代碼行數:14,代碼來源:AjaxController.php


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