本文整理汇总了PHP中app\Product::getDataForProductList方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getDataForProductList方法的具体用法?PHP Product::getDataForProductList怎么用?PHP Product::getDataForProductList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Product
的用法示例。
在下文中一共展示了Product::getDataForProductList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductList
public function getProductList(Request $request)
{
$dataRequest = $request->all();
$allID = $request->allID;
$pageCurrent = $dataRequest['current'];
$limit = $dataRequest['rowCount'];
$offset = ($pageCurrent - 1) * $limit;
$config = array('limit' => $limit, 'offset' => $offset);
$model = new Product();
$result = $model->getDataForProductList($dataRequest, $config, "category", $allID);
# Render field action
foreach ($result['rows'] as $k => $item) {
$result['rows'][$k]['action'] = create_field_action('admin/product', $item->id);
}
$data['current'] = $pageCurrent;
$data['rowCount'] = $limit;
$data['total'] = $result['total'];
$data['rows'] = $result['rows'];
$data['_token'] = csrf_token();
die(json_encode($data));
}
示例2: getDataAjax
public function getDataAjax(Request $request)
{
$dataRequest = $request->all();
$type = $request->type;
$pageCurrent = $dataRequest['current'];
$limit = $dataRequest['rowCount'];
$offset = ($pageCurrent - 1) * $limit;
$config = array('limit' => $limit, 'offset' => $offset);
$model = new Product();
if ($type == "all") {
$result = $model->getDataForProductList($dataRequest, $config, "all");
} else {
if ($type == "stock") {
$result = $model->getDataForProductList($dataRequest, $config, "stock");
} else {
if ($type == "closed") {
$result = $model->getDataForProductList($dataRequest, $config, "closed");
}
}
}
# Render field action
foreach ($result['rows'] as $k => $item) {
$result['rows'][$k]['action'] = create_field_action('admin/product', $item->id);
}
$data['current'] = $pageCurrent;
$data['rowCount'] = $limit;
$data['total'] = $result['total'];
$data['rows'] = $result['rows'];
$data['_token'] = csrf_token();
die(json_encode($data));
}