Files
xstore/inc/Hura8/Components/Product/Controller/bProductCollectionController.php
2025-10-04 11:46:59 +07:00

63 lines
1.5 KiB
PHP

<?php
namespace Hura8\Components\Product\Controller;
use Hura8\Components\Product\Model\ProductCollectionLanguageModel;
use Hura8\Components\Product\Model\ProductCollectionModel;
use Hura8\System\Controller\aCategoryBaseController;
class bProductCollectionController extends aCategoryBaseController
{
static $image_folder = "media/category";
protected $objProductCollectionModel;
public function __construct()
{
$this->objProductCollectionModel = new ProductCollectionModel();
if(!$this->isDefaultLanguage()) {
//$this->objProductCategoryLanguageModel->createTableLang();
parent::__construct(
$this->objProductCollectionModel,
new ProductCollectionLanguageModel()
);
}else{
parent::__construct(
$this->objProductCollectionModel
);
}
}
public function getTotalProduct($collection_id, array $condition = [])
{
return $this->objProductCollectionModel->getTotalProduct($collection_id, $condition);
}
public function getListProduct($collection_id, array $condition = []) {
return $this->objProductCollectionModel->getListProduct($collection_id, $condition);
}
protected function formatItemInList(array $info) : array
{
return $this->formatItemInfo($info);
}
protected function formatItemInfo(?array $info) : ?array
{
$info['url'] = "/collection/".$info['url_index'];
return $info;
}
}