делаю фронт контролер желаемых товаров в лк пользователя, проблема, не отображается товар тоесть не могу его найти или чтото такое, чучуть нага*нокодил, посмотрите что не так, где ошыбки или что надо ещо
<?php
class FavoriteProductsProductsModuleFrontController extends ProductListingFrontController
{
public function __construct(){
parent::__construct();
$this->module=Module::getInstanceByName("favoriteproducts");
}
public $module;
//public $query;
public $customerId;
public function setMedia()
{
$this->registerStylesheet(
'front-controller-module',
'modules/' . $this->module->name . '/views/css/front/favoriteproducts-list.css',
[
'media' => 'all',
'priority' => 1000,
]
);
$this->registerJavascript(
'front-controller-module',
'modules/' . $this->module->name . '/views/js/front/ajax/ajax_favoriteproducts_list.js',
[
'position' => 'bottom',
'priority' => 1000,
]
);
$this->registerJavascript(
'front-controller-module-del',
'modules/' . $this->module->name . '/views/js/front/ajax/ajax_favoriteproducts_del.js',
[
'position' => 'bottom',
'priority' => 1000,
]
);
$this->registerJavascript(
'front-controller-module-buy',
'modules/' . $this->module->name . '/views/js/front/ajax/ajax_favoriteproducts_buy.js',
[
'position' => 'bottom',
'priority' => 1000,
]
);
return parent::setMedia();
}
function doProductSearch($template, $params = [], $locale = null)
{
if ($this->ajax) {
ob_end_clean();
header('Content-Type: application/json');
$this->ajaxRender(json_encode($this->getAjaxProductSearchVariables()));
return;
} else {
$variables = $this->getProductSearchVariables();
$this->context->smarty->assign([
'listing' => $variables,
]);
$this->setTemplate($template, $params, $locale);
}
}
//public function checkAccess()
// {
// return true;
// }
public function initContent()
{
parent::initContent();
//if ($this->customerId->checkAccess($this->context->customerId->id)) {
$this->doProductSearch(
//'catalog/listing/customerId',
[
// 'entity' => 'customerId',
'id' => $this->customerId->id
]
);
//}
if (Context::getContext()->customer->logged) {
$admin = false;
$customerShow = true;
$id_customer = (int)$this->context->customer->id;
$db = Db::getInstance();
$id_shop = (int)Context::getContext()->shop->id;
$sql = new DbQuery();
$sql->select('id_product');
$sql->from('favorite_products', 'c');
$sql->where('c.id_customer = ' . (int)$id_customer);
$sql->where('c.id_shop = ' . (int)$id_shop);
$sql->innerJoin('customer', 'pa', 'c.id_customer = ' . (int)$id_customer);
$sql->groupBy('c.id_product');
$products = $db->executeS($sql);
$contextObject = $this->context;
$this->context->smarty->assign(array(
'id' => (int)$contextObject->customer->id,
'id_customer' => $id_customer,
'first_name' => $contextObject->customer->firstname,
'last_name' => $contextObject->customer->lastname,
'customerShow' => $customerShow,
'products' => $query,
'admin' => $admin,
));
return $this->setTemplate("module:favoriteproducts/views/templates/front/products.tpl");
} else {
$this->context->smarty->assign(array(
'result' => false,
'error' => 'ERROR you need to register',
));
return $this->setTemplate("module:favoriteproducts/views/templates/front/show-info.tpl");
}
}
public function getListingLabel()
{
}
protected function getProductSearchQuery()
{
$query = new FavoriteProductSearchQuery();
$query
->setIdCustomer($this->customerId->id);
return $query;
}
protected function getDefaultProductSearchProvider()
{
return new FavoriteCategoryProductSearchProvider(
$this->getIdCustomer(),
$this->customerId
);
}
}
два класа что дописал, чуть изменил добавил во вложениях