本文整理汇总了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;
}
示例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'));
}