update
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Components\Product\AdminController;
|
||||
|
||||
use Hura8\Components\Product\Controller\bProductController;
|
||||
use Hura8\Components\Product\Model\ProductImageModel;
|
||||
use Hura8\Components\Product\Model\ProductInfoModel;
|
||||
|
||||
// Main class extend from base class implementing an interface
|
||||
// Main class use traits shared by other classes with same responsibilities
|
||||
|
||||
class AProductController extends bProductController {
|
||||
|
||||
|
||||
protected function extendFilterConditions(): array
|
||||
{
|
||||
return [
|
||||
"price" => array('max' => 0, 'min'=> 0),
|
||||
"brand" => array(), // array(1,2,3,)
|
||||
"collection" => array(), // array(1,2,3,)
|
||||
"supplier" => array(), // array(1,2,3,)
|
||||
"rating" => array(), // array(1,2,3,)
|
||||
"category" => array(), // array(1,2,3,)
|
||||
"status" => array(), // array(1,2,3,)
|
||||
"hotType" => array(),// array(saleoff | not | new)
|
||||
"attribute" => array(), // array(1,2,3,)
|
||||
"promotion" => "",
|
||||
"storeId" => array(), // array(1,2,3,)
|
||||
"other_filter" => array(), // array(in-stock, has-promotion etc...)
|
||||
"spec_group_id" => array(), // array(1,2,3,)
|
||||
];
|
||||
}
|
||||
|
||||
//get product image list
|
||||
public function productImageList($proId){
|
||||
$objProductImageModel = new ProductImageModel($proId);
|
||||
$result = array();
|
||||
foreach ( $objProductImageModel->getList(["numPerPage" => 100]) as $rs ) {
|
||||
|
||||
$rs['image'] = static::getResizedImageCollection($rs['img_name']);
|
||||
|
||||
$result[] = $rs;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// get only from tb_product_info
|
||||
public function getInfoMore($id)
|
||||
{
|
||||
$objProductInfoModel = new ProductInfoModel();
|
||||
$info = $objProductInfoModel->getInfo($id);
|
||||
|
||||
if(!$this->isDefaultLanguage() && $info) {
|
||||
$language_info = $this->iEntityLanguageModel->getInfo($id);
|
||||
$final_info = [];
|
||||
foreach ($info as $_k => $_v) {
|
||||
$final_info[$_k] = $language_info[$_k] ?? $_v;
|
||||
}
|
||||
|
||||
return $final_info;
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
public function getInfoMoreEmpty($addition_field_value = [])
|
||||
{
|
||||
$objProductInfoModel = new ProductInfoModel();
|
||||
return $objProductInfoModel->getEmptyInfo($addition_field_value);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user