<?php
/**
* Created by PhpStorm.
* User: developer
* Date: 6/19/17
* Time: 11:11 AM
*/
use Custom\Layout\Ukrservice2017\LayoutController;
use Custom\Manager\CategoryManager;
use Custom\Manager\CouponManager;
use Custom\Manager\FakePagerManager;
use Custom\Model\CouponModel;
class ControllerUkrservice2017ProductManufacturerInfo extends LayoutController
{
/**
* @return string
*/
protected function index()
{
$this->_extends();
return $this->renderLayout();
}
protected function blockBreadCrumbs()
{
$template = self::TEMPLATE_PATH . '/account/login/bread_crumbs.tpl';
$this->renderBlock('block_bread_crumbs', 'product_manufacturer_info', $template);
}
protected function blockCategoriesFilter()
{
$manufacturerInfoData = $this->getControllerManager()->getData('product_manufacturer_info');
/** @var CategoryManager $categoryManager */
$categoryManager = $this->registry->get('manager.category');
$categories = $categoryManager->getFilterCategories(array(
'manufacturer_id' => $manufacturerInfoData['manufacturer_id'],
), $manufacturerInfoData['urlParams'], 'product/manufacturer/info');
$this->data = array();
$this->data['categories'] = $categories;
$template = self::TEMPLATE_PATH . '/product/manufacturer_info/categories_filter.tpl';
$this->layoutData['block_categories_filter'] = $this->renderTemplate($template);
}
protected function blockProductFilters()
{
$template = self::TEMPLATE_PATH . '/product/category/products/product_filters.tpl';
$this->renderBlock('block_product_filters', 'product_manufacturer_info', $template);
}
protected function blockPagination()
{
$template = self::TEMPLATE_PATH . '/product/category/products/pagination.tpl';
$this->data = $this->getControllerManager()->getData('product_manufacturer_info');
/** @var Pagination $paginationObject */
$paginationObject = $this->data['pagination_object'];
/** @var FakePagerManager $fakePagerManager */
$fakePagerManager = $this->registry->get('manager.fake_pager');
$this->data['pager'] = $fakePagerManager->createFakePager($paginationObject);
$this->layoutData['block_pagination'] = $this->renderTemplate($template);
}
protected function blockProducts()
{
$this->blockProductFilters();
$this->blockPagination();
$template = self::TEMPLATE_PATH . '/product/category/products.tpl';
$this->data = $this->getControllerManager()->getData('product_manufacturer_info');
$this->data['block_product_filters'] = $this->layoutData['block_product_filters'];
$this->data['block_pagination'] = $this->layoutData['block_pagination'];
$products = $this->data['products'];
/** @var CouponManager $couponManager */
$couponManager = $this->registry->get('manager.coupon');
foreach ($products as $key => $product) {
$product_info = $product['product_info'];
$price = $product_info['price'];
$discount = $couponManager->getProductTotal($product['product_id']);
if($discount) {
$products[$key]['special'] = $this->currency->format($this->tax->calculate( ($price + $discount) , $product_info['tax_class_id'], $this->config->get('config_tax')));
}
}
$this->data['products'] = $products;
$this->layoutData['block_products'] = $this->renderTemplate($template);
}
protected function blockContent()
{
$this->blockCategoriesFilter();
$this->blockProducts();
$template = self::TEMPLATE_PATH . '/product/manufacturer_info.tpl';
$this->data = $this->getControllerManager()->getData('product_manufacturer_info');
$this->data['block_products'] = $this->layoutData['block_products'];
$this->data['block_categories_filter'] = $this->layoutData['block_categories_filter'];
$this->layoutData['block_content'] = $this->renderTemplate($template);
}
public function blockCoupon()
{
$categoryController = $this->getCategoryController();
$this->layoutData['block_coupon'] = $categoryController->blockCoupon();
}
public function blockCategoriesFilterScript()
{
$template = self::TEMPLATE_PATH . '/product/manufacturer_info/script/categories_filter.tpl';
$this->renderBlock('block_categories_filter_script', 'common_header', $template);
return $this->layoutData['block_categories_filter_script'];
}
protected function blockScript()
{
parent::blockScript();
$this->blockCategoriesFilterScript();
$template = self::TEMPLATE_PATH . '/product/manufacturer_info/script.tpl';
$this->data = array();
$this->data['block_parent'] = $this->layoutData['block_script'];
$categoryController = $this->getCategoryController();
$this->data['block_grid_script'] = $categoryController->blockGridScript();
$this->data['block_popup_html_script'] = $categoryController->blockPopupHtmlScript();
$this->data['block_popup_script'] = $categoryController->blockPopupScript();
$this->data['block_categories_filter_script'] = $this->layoutData['block_categories_filter_script'];
$this->layoutData['block_script'] = $this->renderTemplate($template);
}
/**
* @return ControllerUkrservice2017ProductCategoryCategory
*/
private function getCategoryController()
{
$action = new Action('ukrservice2017/product/category/category');
require_once($action->getFile());
$categoryController = new ControllerUkrservice2017ProductCategoryCategory($this->registry);
return $categoryController;
}
}
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
'manufacturer' =>
);
Та же фигня..
В чем может быть проблема?