public function initContent()
 {
     parent::initContent();
     $this->productSort();
     // Override default configuration values: cause the new products page must display latest products first.
     if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
         $this->orderBy = 'date_add';
         $this->orderWay = 'DESC';
     }
     $nb_products = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
     $this->pagination($nb_products);
     $products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
     $this->addColorsToProductList($products);
     /************************* /Images Array ******************************/
     if (method_exists('Product', 'getProductsImgs')) {
         $image_array = array();
         for ($i = 0; $i < $nb_products; $i++) {
             if (isset($products[$i]['id_product'])) {
                 $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
             }
         }
         $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
     }
     /************************* /Images Array ******************************/
     $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
 }
Example #2
0
 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::initContent();
         $this->productSort();
         $nb_products = (int) ProductSale::getNbSales();
         $this->pagination($nb_products);
         if (!Tools::getValue('orderby')) {
             $this->orderBy = 'sales';
         }
         $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nb_products; $i++) {
                 if (isset($products[$i]['id_product'])) {
                     $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
         $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
Example #3
0
 public function initContent()
 {
     parent::initContent();
     if (method_exists('Product', 'getProductsImgs')) {
         $image_array = array();
         for ($i = 0; $i < count($this->cat_products); $i++) {
             if (isset($this->cat_products[$i]['id_product'])) {
                 $image_array[$this->cat_products[$i]['id_product']] = Product::getProductsImgs($this->cat_products[$i]['id_product']);
             }
         }
         $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
     }
 }
 protected function assignOne()
 {
     $this->manufacturer->description = Tools::nl2br(trim($this->manufacturer->description));
     $nbProducts = $this->manufacturer->getProducts($this->manufacturer->id, null, null, null, $this->orderBy, $this->orderWay, true);
     $this->pagination((int) $nbProducts);
     $products = $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
     $this->addColorsToProductList($products);
     if (method_exists('Product', 'getProductsImgs')) {
         $image_array = array();
         for ($i = 0; $i < $nbProducts; $i++) {
             if (isset($products[$i]['id_product'])) {
                 $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
             }
         }
         $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
     }
     $this->context->smarty->assign(array('nb_products' => $nbProducts, 'products' => $products, 'path' => $this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : '', 'manufacturer' => $this->manufacturer, 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'body_classes' => array($this->php_self . '-' . $this->manufacturer->id, $this->php_self . '-' . $this->manufacturer->link_rewrite)));
 }
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = Product::getPricesDrop($this->context->language->id, null, null, true);
     $this->pagination($nbProducts);
     $products = Product::getPricesDrop($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
     $this->addColorsToProductList($products);
     if (method_exists('Product', 'getProductsImgs')) {
         $image_array = array();
         for ($i = 0; $i < $nbProducts; $i++) {
             if (isset($products[$i]['id_product'])) {
                 $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
             }
         }
         $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
     }
     $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'prices-drop.tpl');
 }
Example #6
0
 protected function assignOne()
 {
     if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
         $this->supplier->description = Tools::nl2br(trim($this->supplier->description));
         $nbProducts = $this->supplier->getProducts($this->supplier->id, null, null, null, $this->orderBy, $this->orderWay, true);
         $this->pagination((int) $nbProducts);
         $products = $this->supplier->getProducts($this->supplier->id, $this->context->cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nbProducts; $i++) {
                 if (isset($products[$i]['id_product'])) {
                     $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('nb_products' => $nbProducts, 'products' => $products, 'path' => $this->supplier->active ? Tools::safeOutput($this->supplier->name) : '', 'supplier' => $this->supplier, 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'body_classes' => array($this->php_self . '-' . $this->supplier->id, $this->php_self . '-' . $this->supplier->link_rewrite)));
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
Example #7
0
 public function ajaxCall()
 {
     global $smarty, $cookie;
     $selected_filters = $this->getSelectedFilters();
     $filter_block = $this->getFilterBlock($selected_filters);
     $this->getProducts($selected_filters, $products, $nb_products, $p, $n, $pages_nb, $start, $stop, $range);
     // Add pagination variable
     $nArray = (int) Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50);
     // Clean duplicate values
     $nArray = array_unique($nArray);
     asort($nArray);
     Hook::exec('actionProductListModifier', array('nb_products' => &$nb_products, 'cat_products' => &$products));
     if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
         $this->context->controller->addColorsToProductList($products);
     }
     // Start  layered mod
     if (method_exists('Product', 'getProductsImgs')) {
         $image_array = array();
         for ($i = 0; $i < $nb_products; $i++) {
             if (isset($products[$i]['id_product'])) {
                 $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
             }
         }
         $smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
     }
     $smarty->assign('iqit_lazy_load', Configuration::get('thmedit_carousel_load'));
     $yotpo = Configuration::get('thmedit_yotpo_stars');
     if ($yotpo) {
         $smarty->assign('yotpoAppkey', Configuration::get('yotpo_app_key'));
         if (Tools::usingSecureMode()) {
             $domain = Tools::getShopDomainSsl(true);
         } else {
             $domain = Tools::getShopDomain(true);
         }
         $smarty->assign('yotpoDomain', $domain);
         $smarty->assign('yotpo_stars_pl', Configuration::get('thmedit_yotpo_stars'));
     }
     // End layered mod
     $category = new Category(Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY')), (int) $cookie->id_lang);
     // Generate meta title and meta description
     $category_title = empty($category->meta_title) ? $category->name : $category->meta_title;
     $category_metas = Meta::getMetaTags((int) $cookie->id_lang, 'category');
     $title = '';
     $keywords = '';
     if (is_array($filter_block['title_values'])) {
         foreach ($filter_block['title_values'] as $key => $val) {
             $title .= ' > ' . $key . ' ' . implode('/', $val);
             $keywords .= $key . ' ' . implode('/', $val) . ', ';
         }
     }
     $title = $category_title . $title;
     if (!empty($title)) {
         $meta_title = $title;
     } else {
         $meta_title = $category_metas['meta_title'];
     }
     $meta_description = $category_metas['meta_description'];
     $keywords = Tools::substr(Tools::strtolower($keywords), 0, 1000);
     if (!empty($keywords)) {
         $meta_keywords = rtrim($category_title . ', ' . $keywords . ', ' . $category_metas['meta_keywords'], ', ');
     }
     $smarty->assign(array('homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'nb_products' => $nb_products, 'category' => $category, 'pages_nb' => (int) $pages_nb, 'p' => (int) $p, 'n' => (int) $n, 'range' => (int) $range, 'start' => (int) $start, 'stop' => (int) $stop, 'n_array' => (int) Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'products' => $products, 'products_per_page' => (int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 'static_token' => Tools::getToken(false), 'page_name' => 'category', 'nArray' => $nArray, 'compareProducts' => CompareProduct::getCompareProducts((int) $this->context->cookie->id_compare)));
     // Prevent bug with old template where category.tpl contain the title of the category and category-count.tpl do not exists
     if (file_exists(_PS_THEME_DIR_ . 'category-count.tpl')) {
         $category_count = $smarty->fetch(_PS_THEME_DIR_ . 'category-count.tpl');
     } else {
         $category_count = '';
     }
     if ($nb_products == 0) {
         $product_list = $this->display(__FILE__, 'blocklayered_mod-no-products.tpl');
     } else {
         $product_list = $smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
     }
     $vars = array('filtersBlock' => utf8_encode($this->generateFiltersBlock($selected_filters)), 'productList' => utf8_encode($product_list), 'pagination' => $smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl'), 'categoryCount' => $category_count, 'meta_title' => $meta_title . ' - ' . Configuration::get('PS_SHOP_NAME'), 'heading' => $meta_title, 'meta_keywords' => isset($meta_keywords) ? $meta_keywords : null, 'meta_description' => $meta_description, 'current_friendly_url' => (int) $n == (int) $nb_products ? '#/show-all' : '#' . $filter_block['current_friendly_url'], 'filters' => $filter_block['filters'], 'nbRenderedProducts' => (int) $nb_products, 'nbAskedProducts' => (int) $n);
     if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
         $vars = array_merge($vars, array('pagination_bottom' => $smarty->assign('paginationId', 'bottom')->fetch(_PS_THEME_DIR_ . 'pagination.tpl')));
     }
     /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
     return Tools::jsonEncode($vars);
 }
Example #8
0
 public function initContent()
 {
     include _PS_MODULE_DIR_ . 'blocksearch_mod' . DIRECTORY_SEPARATOR . 'IqitSearch.php';
     $query = Tools::replaceAccentedChars(urldecode(Tools::getValue('q')));
     $original_query = Tools::getValue('q');
     $search_query_cat = (int) Tools::getValue('search_query_cat');
     if ($this->ajax_search) {
         self::$link = new Link();
         $image = new Image();
         $searchResults = IqitSearch::find((int) Tools::getValue('id_lang'), $query, $search_query_cat, 1, 10, 'position', 'desc', true);
         $taxes = Product::getTaxCalculationMethod();
         $currency = (int) Context::getContext()->currency->id;
         $iso_code = $this->context->language->iso_code;
         if (is_array($searchResults)) {
             foreach ($searchResults as &$product) {
                 $imageID = $image->getCover($product['id_product']);
                 if (isset($imageID['id_image'])) {
                     $imgLink = $this->context->link->getImageLink($product['prewrite'], (int) $product['id_product'] . '-' . $imageID['id_image'], 'small_default');
                 } else {
                     $imgLink = _THEME_PROD_DIR_ . $iso_code . "-default-small_default.jpg";
                 }
                 $product['product_link'] = $this->context->link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']);
                 $product['obr_thumb'] = $imgLink;
                 $product['product_price'] = Product::getPriceStatic((int) $product['id_product'], false, NULL, 2);
                 if ($taxes == 0 or $taxes == 2) {
                     $product['product_price'] = Tools::displayPrice(Product::getPriceStatic((int) $product['id_product'], true), $currency);
                 } elseif ($taxes == 1) {
                     $product['product_price'] = Tools::displayPrice(Product::getPriceStatic((int) $product['id_product'], false), $currency);
                 }
             }
         }
         $this->ajaxDie(Tools::jsonEncode($searchResults));
     }
     // Only controller content initialization when the user use the normal search
     parent::initContent();
     if ($this->instant_search && !is_array($query)) {
         $this->productSort();
         $this->n = abs((int) Tools::getValue('n', $product_per_page));
         $this->p = abs((int) Tools::getValue('p', 1));
         $search = IqitSearch::find($this->context->language->id, $query, $search_query_cat, 1, 10, 'position', 'desc');
         Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
         $nbProducts = $search['total'];
         $this->pagination($nbProducts);
         $this->addColorsToProductList($search['result']);
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nbProducts; $i++) {
                 if (isset($search['result'][$i]['id_product'])) {
                     $image_array[$search['result'][$i]['id_product']] = Product::getProductsImgs($search['result'][$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         $this->context->smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $original_query, 'instant_search' => $this->instant_search, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
     } elseif (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query)) {
         $this->productSort();
         $this->n = abs((int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')));
         $this->p = abs((int) Tools::getValue('p', 1));
         $original_query = $query;
         $query = Tools::replaceAccentedChars(urldecode($query));
         $search = IqitSearch::find($this->context->language->id, $query, $search_query_cat, $this->p, $this->n, $this->orderBy, $this->orderWay);
         if (is_array($search['result'])) {
             foreach ($search['result'] as &$product) {
                 $product['link'] .= (strpos($product['link'], '?') === false ? '?' : '&') . 'search_query=' . urlencode($query) . '&results=' . (int) $search['total'];
             }
         }
         Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
         $nbProducts = $search['total'];
         $this->pagination($nbProducts);
         $this->addColorsToProductList($search['result']);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nbProducts; $i++) {
                 if (isset($search['result'][$i]['id_product'])) {
                     $image_array[$search['result'][$i]['id_product']] = Product::getProductsImgs($search['result'][$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $original_query, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
     } elseif (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag)) {
         $nbProducts = (int) Search::searchTag($this->context->language->id, $tag, true);
         $this->pagination($nbProducts);
         $result = Search::searchTag($this->context->language->id, $tag, false, $this->p, $this->n, $this->orderBy, $this->orderWay);
         Hook::exec('actionSearch', array('expr' => $tag, 'total' => count($result)));
         $this->addColorsToProductList($result);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nbProducts; $i++) {
                 if (isset($result[$i]['id_product'])) {
                     $image_array[$result[$i]['id_product']] = Product::getProductsImgs($result[$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('search_tag' => $tag, 'products' => $result, 'search_products' => $result, 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
     } else {
         $this->context->smarty->assign(array('products' => array(), 'search_products' => array(), 'pages_nb' => 1, 'nbProducts' => 0));
     }
     $this->context->smarty->assign(array('add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'search.tpl');
 }
Example #9
0
 public function buildSubmenuTree(array $dataset, $frontend = false, $cssgenerator = false)
 {
     $id_lang = (int) Context::getContext()->language->id;
     $id_shop = (int) Context::getContext()->shop->id;
     $id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
     $tree = array();
     foreach ($dataset as $id => &$node) {
         if ($cssgenerator) {
             //set style
             if (isset($node['content_s']['br_top_st'])) {
                 $node['content_s']['br_top_st'] = $this->convertBorderType($node['content_s']['br_top_st']);
             }
             if (isset($node['content_s']['br_right_st'])) {
                 $node['content_s']['br_right_st'] = $this->convertBorderType($node['content_s']['br_right_st']);
             }
             if (isset($node['content_s']['br_bottom_st'])) {
                 $node['content_s']['br_bottom_st'] = $this->convertBorderType($node['content_s']['br_bottom_st']);
             }
             if (isset($node['content_s']['br_left_st'])) {
                 $node['content_s']['br_left_st'] = $this->convertBorderType($node['content_s']['br_left_st']);
             }
         }
         if ($frontend) {
             if (isset($node['content_s']['title'][$id_lang]) && $node['content_s']['title'][$id_lang] != '') {
                 $node['content_s']['title'] = $node['content_s']['title'][$id_lang];
             } elseif (isset($node['content_s']['title'][$id_lang_default]) && $node['content_s']['title'][$id_lang_default] != '') {
                 $node['content_s']['title'] = $node['content_s']['title'][$id_lang_default];
             } else {
                 unset($node['content_s']['title']);
             }
             if (isset($node['content_s']['href'][$id_lang]) && $node['content_s']['href'][$id_lang] != '') {
                 $node['content_s']['href'] = $node['content_s']['href'][$id_lang];
             } elseif (isset($node['content_s']['href'][$id_lang_default]) && $node['content_s']['href'][$id_lang_default] != '') {
                 $node['content_s']['href'] = $node['content_s']['href'][$id_lang_default];
             } else {
                 unset($node['content_s']['href']);
             }
             if (isset($node['content_s']['legend'][$id_lang]) && $node['content_s']['legend'][$id_lang] != '') {
                 $node['content_s']['legend'] = $node['content_s']['legend'][$id_lang];
             } elseif (isset($node['content_s']['legend'][$id_lang_default]) && $node['content_s']['legend'][$id_lang_default] != '') {
                 $node['content_s']['legend'] = $node['content_s']['legend'][$id_lang_default];
             } else {
                 unset($node['content_s']['legend']);
             }
             if (isset($node['tabtitle'][$id_lang]) && $node['tabtitle'][$id_lang] != '') {
                 $node['tabtitle'] = $node['tabtitle'][$id_lang];
             } elseif (isset($node['tabtitle'][$id_lang_default]) && $node['tabtitle'][$id_lang_default] != '') {
                 $node['tabtitle'] = $node['tabtitle'][$id_lang_default];
             } else {
                 unset($node['tabtitle']);
             }
             //set variouse links
             if (isset($node['contentType'])) {
                 switch ($node['contentType']) {
                     case 1:
                         if (isset($node['content']['ids'])) {
                             $customhtml = new IqitCreatorHtml((int) $node['content']['ids'], $id_lang);
                             if (Validate::isLoadedObject($customhtml)) {
                                 $node['content']['ids'] = $customhtml->html;
                             }
                         }
                         break;
                     case 4:
                         if (isset($node['content']['ids']) && !empty($node['content']['ids'])) {
                             $node['content']['products'] = Product::getProductsProperties($id_lang, $this->getProducts($node['content']['ids']));
                             $products = $node['content']['products'];
                             $this->addColorsToProductList($node['content']['products']);
                             if (method_exists('Product', 'getProductsImgs')) {
                                 $image_array = array();
                                 for ($i = 0; $i < count($products); $i++) {
                                     if (isset($products[$i]['id_product'])) {
                                         $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                                     }
                                 }
                                 $node['content']['productsimg'] = (isset($image_array) and $image_array) ? $image_array : NULL;
                             }
                             if ($node['content']['view'] == 1 || $node['content']['view'] == 3) {
                                 $node['content']['line_lg'] = $this->convertGridSizeValue($node['content']['line_lg']);
                                 $node['content']['line_md'] = $this->convertGridSizeValue($node['content']['line_md']);
                                 $node['content']['line_sm'] = $this->convertGridSizeValue($node['content']['line_sm']);
                                 $node['content']['line_ms'] = $this->convertGridSizeValue($node['content']['line_ms']);
                                 $node['content']['line_xs'] = $this->convertGridSizeValue($node['content']['line_xs']);
                             }
                         }
                         break;
                     case 2:
                         if (isset($node['content']['ids'])) {
                             if ($node['content']['ids'] == 'n') {
                                 if ($node['content']['o'] == 1) {
                                     $products = Product::getNewProducts($id_lang, 0, (int) $node['content']['limit']);
                                 } else {
                                     $products = Product::getNewProducts($id_lang, 0, (int) $node['content']['limit'], false, $node['content']['o'], $node['content']['ob']);
                                 }
                             } elseif ($node['content']['ids'] == 's') {
                                 if ($node['content']['o'] == 1) {
                                     $products = Product::getPricesDrop($id_lang, 0, (int) $node['content']['limit']);
                                 } else {
                                     $products = Product::getPricesDrop($id_lang, 0, (int) $node['content']['limit'], false, $node['content']['o'], $node['content']['ob']);
                                 }
                             } elseif ($node['content']['ids'] == 'b') {
                                 $products = ProductSale::getBestSales($id_lang, 0, (int) $node['content']['limit'], 'sales');
                             } else {
                                 $category = new Category((int) $node['content']['ids'], $id_lang);
                                 if ($node['content']['o'] == 1) {
                                     $products = $category->getProducts($id_lang, 1, (int) $node['content']['limit'], null, null, false, true, true, (int) $node['content']['limit']);
                                 } else {
                                     $products = $category->getProducts($id_lang, 1, (int) $node['content']['limit'], $node['content']['o'], $node['content']['ob']);
                                 }
                             }
                             $node['content']['products'] = $products;
                             $this->addColorsToProductList($node['content']['products']);
                             if (method_exists('Product', 'getProductsImgs')) {
                                 $image_array = array();
                                 for ($i = 0; $i < count($products); $i++) {
                                     if (isset($products[$i]['id_product'])) {
                                         $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                                     }
                                 }
                                 $node['content']['productsimg'] = (isset($image_array) and $image_array) ? $image_array : NULL;
                             }
                             if ($node['content']['view'] == 1 || $node['content']['view'] == 3) {
                                 $node['content']['line_lg'] = $this->convertGridSizeValue($node['content']['line_lg']);
                                 $node['content']['line_md'] = $this->convertGridSizeValue($node['content']['line_md']);
                                 $node['content']['line_sm'] = $this->convertGridSizeValue($node['content']['line_sm']);
                                 $node['content']['line_ms'] = $this->convertGridSizeValue($node['content']['line_ms']);
                                 $node['content']['line_xs'] = $this->convertGridSizeValue($node['content']['line_xs']);
                             }
                         }
                         break;
                     case 6:
                         if (isset($node['content']['source'][$id_lang]) && $node['content']['source'][$id_lang] != '') {
                             $node['content']['source'] = $node['content']['source'][$id_lang];
                         } elseif (isset($node['content']['source'][$id_lang_default]) && $node['content']['source'][$id_lang_default] != '') {
                             $node['content']['source'] = $node['content']['source'][$id_lang_default];
                         } else {
                             unset($node['content']['source']);
                         }
                         if (isset($node['content']['href'][$id_lang]) && $node['content']['href'][$id_lang] != '') {
                             $node['content']['href'] = $node['content']['href'][$id_lang];
                         } elseif (isset($node['content']['href'][$id_lang_default]) && $node['content']['href'][$id_lang_default] != '') {
                             $node['content']['href'] = $node['content']['href'][$id_lang_default];
                         } else {
                             unset($node['content']['href']);
                         }
                         break;
                     case 7:
                         if ($node['content']['view']) {
                             $node['content']['line_lg'] = $this->convertGridSizeValue($node['content']['line_lg']);
                             $node['content']['line_md'] = $this->convertGridSizeValue($node['content']['line_md']);
                             $node['content']['line_sm'] = $this->convertGridSizeValue($node['content']['line_sm']);
                             $node['content']['line_ms'] = $this->convertGridSizeValue($node['content']['line_ms']);
                             $node['content']['line_xs'] = $this->convertGridSizeValue($node['content']['line_xs']);
                         }
                         break;
                     case 9:
                         $node['content']['module'] = $this->execModuleHook($node['content']['hook'], array(), $node['content']['id_module'], $id_shop);
                         break;
                 }
             }
         }
         if (!$frontend) {
             if (isset($node['contentType']) && $node['contentType'] == 4) {
                 if (isset($node['content']['ids']) && !empty($node['content']['ids'])) {
                     $node['content']['ids'] = $this->getProducts($node['content']['ids']);
                 }
             }
         }
         if ($node['parentId'] === 0) {
             $tree[$id] =& $node;
         } else {
             if (!isset($dataset[$node['parentId']]['children'])) {
                 $dataset[$node['parentId']]['children'] = array();
             }
             $dataset[$node['parentId']]['children'][$id] =& $node;
         }
     }
     $tree = $this->sortArrayTree($tree);
     return $tree;
 }