コード例 #1
0
ファイル: product.php プロジェクト: ralfeus/moomi-daeri.com
 /**
  *
  */
 public function index()
 {
     $this->language->load('product/product');
     if (isset($this->request->get['path'])) {
         $path = '';
         foreach (explode('_', $this->request->get['path']) as $path_id) {
             if (!$path) {
                 $path = $path_id;
             } else {
                 $path .= '_' . $path_id;
             }
             $category = CategoryDAO::getInstance()->getCategory($path_id);
             if ($category) {
                 #kabantejay synonymizer start
                 $razdel = $category->getDescription()->getName();
                 #kabantejay synonymizer end
                 $this->setBreadcrumbs([['text' => $category->getDescription()->getName(), 'route' => 'product/category&path=' . $path]]);
             }
         }
     }
     if (isset($this->request->get['manufacturer_id'])) {
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->getUrl()->link('product/manufacturer'), 'separator' => $this->language->get('text_separator'));
         $manufacturer_info = ManufacturerDAO::getInstance()->getManufacturer($this->request->get['manufacturer_id']);
         if ($manufacturer_info) {
             $this->data['breadcrumbs'][] = array('text' => $manufacturer_info['name'], 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id']), 'separator' => $this->language->get('text_separator'));
         }
     }
     if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_tag'])) {
         $url = '';
         if (isset($this->request->get['filter_name'])) {
             $url .= '&filter_name=' . $this->request->get['filter_name'];
         }
         if (isset($this->request->get['filter_tag'])) {
             $url .= '&filter_tag=' . $this->request->get['filter_tag'];
         }
         if (isset($this->request->get['filter_description'])) {
             $url .= '&filter_description=' . $this->request->get['filter_description'];
         }
         if (isset($this->request->get['filter_category_id'])) {
             $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
         }
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_search'), 'href' => $this->getUrl()->link('product/search', $url), 'separator' => $this->language->get('text_separator'));
     }
     if (isset($this->request->get['product_id'])) {
         $productId = $this->request->get['product_id'];
     } else {
         $productId = 0;
     }
     try {
         $product = ProductDAO::getInstance()->getProduct($productId, false, true);
         $description = is_null($product->getDescription($this->getLanguage()->getId())) ? new \model\localization\Description($this->getLanguage()->getId(), '') : $product->getDescription($this->getLanguage()->getId());
         $this->data['product_info'] = $product;
         //print_r($product_info);exit;
         $url = '';
         if (isset($this->request->get['path'])) {
             $url .= '&path=' . $this->request->get['path'];
         }
         if (isset($this->request->get['manufacturer_id'])) {
             $url .= '&manufacturer_id=' . $this->request->get['manufacturer_id'];
         }
         if (isset($this->request->get['filter_name'])) {
             $url .= '&filter_name=' . $this->request->get['filter_name'];
         }
         if (isset($this->request->get['filter_tag'])) {
             $url .= '&filter_tag=' . $this->request->get['filter_tag'];
         }
         if (isset($this->request->get['filter_description'])) {
             $url .= '&filter_description=' . $this->request->get['filter_description'];
         }
         if (isset($this->request->get['filter_category_id'])) {
             $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
         }
         $this->data['breadcrumbs'][] = array('text' => $product->getName(), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $this->request->get['product_id']), 'separator' => $this->language->get('text_separator'));
         if (!empty($description->getSeoTitle())) {
             $this->document->setTitle($description->getSeoTitle());
         } else {
             $this->document->setTitle($product->getName());
         }
         $this->document->setDescription($description->getMetaDescription());
         $this->document->setKeywords($description->getMetaKeyword());
         //$this->document->addLink($this->getUrl()->link('product/product', 'product_id=' . $this->request->get['product_id']), 'canonical');
         $this->data['seo_h1'] = $description->getSeoH1();
         $this->data['heading_title'] = $product->getName();
         $this->data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product->getMinimum());
         $this->getLoader()->model('catalog/review');
         $this->data['tab_review'] = sprintf($this->language->get('tab_review'), $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']));
         $this->data['product_id'] = $product->getId();
         $this->data['manufacturer'] = $product->getManufacturer()->getName();
         $this->data['manufacturers'] = $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $product->getManufacturer()->getId());
         $this->data['model'] = $product->getModel();
         $this->data['reward'] = $product->getRewards();
         $this->data['points'] = $product->getPoints();
         if ($product->getQuantity() <= 0) {
             $this->data['stock'] = $product->getStockStatusId();
         } elseif ($this->getConfig()->get('config_stock_display')) {
             $this->data['stock'] = $product->getQuantity();
         } else {
             $this->data['stock'] = $this->language->get('text_instock');
         }
         if ($product->getImagePath()) {
             $this->data['popup'] = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_popup_width'), $this->getConfig()->get('config_image_popup_height'));
         } else {
             $this->data['popup'] = '';
         }
         $results = ProductDAO::getInstance()->getProductImages($this->request->get['product_id']);
         if ($results) {
             $this->data['thumb'] = ImageService::getInstance()->resize($results[0]->getImagePath(), $this->getConfig()->get('config_image_thumb_width'), $this->getConfig()->get('config_image_thumb_height'));
         } else {
             if ($product->getImagePath()) {
                 $this->data['thumb'] = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_thumb_width'), $this->getConfig()->get('config_image_thumb_height'));
             } else {
                 $this->data['thumb'] = '';
             }
         }
         $this->data['images'] = array();
         foreach ($results as $tag) {
             $this->data['images'][] = array('popup' => ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_popup_width'), $this->getConfig()->get('config_image_popup_height')), 'thumb' => ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_additional_width'), $this->getConfig()->get('config_image_additional_height')));
         }
         if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
             $this->data['price'] = $this->getCurrentCurrency()->format($product->getPrice());
         } else {
             $this->data['price'] = false;
         }
         if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
             $this->data['special'] = $this->getCurrentCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
         } else {
             $this->data['special'] = false;
         }
         //			if ($this->getConfig()->get('config_tax')) {
         //				$this->data['tax'] = $this->getCurrentCurrency()->format((float)$product_info->getSpecial'] ? $product_info['special'] : $product_info['price());
         //			} else {
         //				$this->data['tax'] = false;
         //			}
         $discounts = ProductDAO::getInstance()->getProductDiscounts($product->getId());
         $this->data['discounts'] = array();
         foreach ($discounts as $discount) {
             $this->data['discounts'][] = array('quantity' => $discount['quantity'], 'price' => $this->getCurrentCurrency()->format($discount['price']));
         }
         $this->data['options'] = array();
         foreach (ProductDAO::getInstance()->getProductOptions($this->request->get['product_id']) as $productOption) {
             if ($productOption->getOption()->isMultiValueType()) {
                 $option_value_data = array();
                 foreach ($productOption->getValue() as $option_value) {
                     if (is_null($option_value->getOptionValue())) {
                         continue;
                     }
                     if (!$option_value->getSubtract() || $option_value->getQuantity() > 0) {
                         $option_value_data[] = array('product_option_value_id' => $option_value->getId(), 'option_value_id' => $option_value->getOptionValue()->getId(), 'name' => $option_value->getOptionValue()->getName(), 'image' => ImageService::getInstance()->resize($option_value->getOptionValue()->getImage(), 50, 50), 'price' => (double) $option_value->getPrice() ? $this->getCurrentCurrency()->format($option_value->getPrice()) : false, 'price_prefix' => $option_value->getPrice() < 0 ? '-' : '+');
                     }
                 }
                 $this->data['options'][] = array('product_option_id' => $productOption->getId(), 'option_id' => $productOption->getOption()->getId(), 'name' => $productOption->getOption()->getName(), 'type' => $productOption->getType(), 'option_value' => $option_value_data, 'required' => $productOption->isRequired());
             } elseif ($productOption->getOption()->isSingleValueType()) {
                 $this->data['options'][] = array('product_option_id' => $productOption->getId(), 'option_id' => $productOption->getOption()->getId(), 'name' => $productOption->getOption()->getName(), 'type' => $productOption->getType(), 'option_value' => $productOption->getValue(), 'required' => $productOption->isRequired());
             }
         }
         if ($product->getMinimum()) {
             $this->data['minimum'] = $product->getMinimum();
         } else {
             $this->data['minimum'] = 1;
         }
         $date_added = getdate(strtotime($product->getDateAdded()));
         $date_added = mktime(0, 0, 0, $date_added['mon'], $date_added['mday'], $date_added['year']);
         $this->data['review_status'] = $this->getConfig()->get('config_review_status');
         $this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int) $product->getReviewsCount());
         $this->data['rating'] = (int) $product->getRating();
         $this->data['description'] = html_entity_decode($description->getDescription(), ENT_QUOTES, 'UTF-8');
         $this->data['image_description'] = html_entity_decode($product->getImageDescription(), ENT_QUOTES, 'UTF-8');
         $this->data['attribute_groups'] = $product->getAttributes();
         $this->data['hot'] = $date_added + 86400 * $this->getConfig()->get('config_product_hotness_age') > time();
         $this->data['weight'] = $this->weight->format($product->getWeight()->getWeight(), $product->getWeight()->getUnit()->getId());
         $this->data['products'] = array();
         #kabantejay synonymizer start
         if (!is_null($product->getManufacturer())) {
             $brand = '';
         } else {
             $brand = $product->getManufacturer();
         }
         if (!isset($razdel)) {
             $razdel = '';
         }
         if (!isset($category)) {
             $syncat = '';
         } else {
             $syncat = $category->getDescription()->getName();
         }
         if (!is_null($product->getModel())) {
             $synmod = '';
         } else {
             $synmod = $product->getModel();
         }
         if ($this->data['special'] == false) {
             $synprice = $this->data['price'];
         } else {
             $synprice = $this->data['special'];
         }
         $syntext = array(array("%H1%", $product->getName()), array("%BRAND%", $brand), array("%RAZDEL%", $razdel), array("%CATEGORY%", $syncat), array("%MODEL%", $synmod), array("%PRICE%", $synprice));
         for ($it = 0; $it < 6; $it++) {
             $this->data['description'] = str_replace($syntext[$it][0], $syntext[$it][1], $this->data['description']);
         }
         $this->data['description'] = preg_replace_callback('/\\{  (.*?)  \\}/xs', function ($m) {
             $ar = explode("|", $m[1]);
             return $ar[array_rand($ar, 1)];
         }, $this->data['description']);
         #kabantejay synonymizer end
         //			$results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
         //        $results = $product_info->getRelated();
         foreach ($product->getRelated() as $tag) {
             if ($tag->getImagePath()) {
                 $image = ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_related_width'), $this->getConfig()->get('config_image_related_height'));
             } else {
                 $image = false;
             }
             if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
                 $price = $this->getCurrentCurrency()->format($tag->getPrice());
             } else {
                 $price = false;
             }
             if ((double) $tag->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
                 $special = $this->getCurrentCurrency()->format($tag->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
             } else {
                 $special = false;
             }
             if ($this->getConfig()->get('config_review_status')) {
                 $rating = (int) $tag->getRating();
             } else {
                 $rating = false;
             }
             $this->data['products'][] = array('product_id' => $tag->getId(), 'thumb' => $image, 'name' => $tag->getName(), 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $tag->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', 'product_id=' . $tag->getId()));
         }
         $this->data['tags'] = array();
         //			$results = $this->model_catalog_product->getProductTags($this->request->get['product_id']);
         foreach ($product->getTags() as $tag) {
             $this->data['tags'][] = array('tag' => $tag, 'href' => $this->getUrl()->link('product/search', 'filter_tag=' . $tag));
         }
         ProductDAO::getInstance()->updateViewed($product->getId());
         $this->setBreadcrumbs();
         $this->children = array('common/header', 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer');
         $templateFile = '/template/product/product.tpl';
         $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default';
         $this->getResponse()->setOutput($this->render($templateDir . $templateFile));
     } catch (InvalidArgumentException $exc) {
         $url = '';
         if (isset($this->request->get['path'])) {
             $url .= '&path=' . $this->request->get['path'];
         }
         if (isset($this->request->get['manufacturer_id'])) {
             $url .= '&manufacturer_id=' . $this->request->get['manufacturer_id'];
         }
         if (isset($this->request->get['filter_name'])) {
             $url .= '&filter_name=' . $this->request->get['filter_name'];
         }
         if (isset($this->request->get['filter_tag'])) {
             $url .= '&filter_tag=' . $this->request->get['filter_tag'];
         }
         if (isset($this->request->get['filter_description'])) {
             $url .= '&filter_description=' . $this->request->get['filter_description'];
         }
         if (isset($this->request->get['filter_category_id'])) {
             $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
         }
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_error'), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $productId), 'separator' => $this->language->get('text_separator'));
         $this->document->setTitle($this->language->get('text_error'));
         $this->data['heading_title'] = $this->language->get('text_error');
         $this->data['text_error'] = $this->language->get('text_error');
         $this->data['button_continue'] = $this->language->get('button_continue');
         $this->data['continue'] = $this->getUrl()->link('common/home');
         $this->children = array('common/header', 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer');
         $this->getResponse()->setOutput($this->render($this->getConfig()->get('config_template') . '/template/error/not_found.tpl'));
     }
 }
コード例 #2
0
ファイル: product.php プロジェクト: ralfeus/moomi-daeri.com
 private function getOptionForm()
 {
     $this->getLoader()->language('catalog/option');
     $this->data['text_create_option'] = $this->language->get('text_create_option');
     $this->data['text_choose'] = $this->language->get('text_choose');
     $this->data['text_option_select'] = $this->language->get('text_option_select');
     $this->data['text_radio'] = $this->language->get('text_radio');
     $this->data['text_checkbox'] = $this->language->get('text_checkbox');
     $this->data['text_image'] = $this->language->get('text_image');
     $this->data['text_input'] = $this->language->get('text_input');
     $this->data['text_text'] = $this->language->get('text_text');
     $this->data['text_textarea'] = $this->language->get('text_textarea');
     $this->data['text_file'] = $this->language->get('text_file');
     $this->data['text_date'] = $this->language->get('text_date');
     $this->data['text_datetime'] = $this->language->get('text_datetime');
     $this->data['text_time'] = $this->language->get('text_time');
     $this->data['text_image_manager'] = $this->language->get('text_image_manager');
     $this->data['text_browse'] = $this->language->get('text_browse');
     $this->data['text_clear'] = $this->language->get('text_clear');
     $this->data['entry_option_name'] = $this->language->get('entry_option_name');
     $this->data['entry_type'] = $this->language->get('entry_type');
     $this->data['entry_value'] = $this->language->get('entry_value');
     $this->data['entry_image'] = $this->language->get('entry_image');
     $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
     $this->data['button_add_option_value'] = $this->language->get('button_add_option_value');
     $this->data['button_remove'] = $this->language->get('button_remove');
     $this->data['token'] = $this->getSession()->data['token'];
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->getSession()->data['success'])) {
         $this->data['success'] = $this->getSession()->data['success'];
         unset($this->getSession()->data['success']);
     } else {
         $this->data['success'] = '';
     }
     if (isset($this->error['name'])) {
         $this->data['error_name'] = $this->error['name'];
     } else {
         $this->data['error_name'] = array();
     }
     if (isset($this->error['option_value'])) {
         $this->data['error_option_value'] = $this->error['option_value'];
     } else {
         $this->data['error_option_value'] = array();
     }
     $this->data['languages'] = $this->getLoader()->model('localisation/language')->getLanguages();
     if (isset($this->request->post['option_description']) && !empty($this->error)) {
         $this->data['option_description'] = $this->request->post['option_description'];
     } else {
         $this->data['option_description'] = array();
     }
     if (isset($this->request->post['type']) && !empty($this->error)) {
         $this->data['type'] = $this->request->post['type'];
     } else {
         $this->data['type'] = '';
     }
     if (isset($this->request->post['sort_order']) && !empty($this->error)) {
         $this->data['sort_order'] = $this->request->post['sort_order'];
     } else {
         $this->data['sort_order'] = '';
     }
     if (isset($this->request->post['option_value']) && !empty($this->error)) {
         $option_values = $this->request->post['option_value'];
     } else {
         $option_values = array();
     }
     $this->data['option_values'] = array();
     foreach ($option_values as $option_value) {
         if ($option_value['image'] && file_exists(DIR_IMAGE . $option_value['image'])) {
             $image = $option_value['image'];
         } else {
             $image = 'no_image.jpg';
         }
         $this->data['option_values'][] = array('option_value_id' => $option_value['option_value_id'], 'option_value_description' => $option_value['option_value_description'], 'image' => $image, 'thumb' => ImageService::getInstance()->resize($image, 100, 100), 'sort_order' => $option_value['sort_order']);
     }
     $this->error = array();
     $this->data['no_image'] = ImageService::getInstance()->resize('no_image.jpg', 100, 100);
     return $this->render('catalog/product_option_form.tpl');
 }
コード例 #3
0
 public function product()
 {
     $manufacturer = ManufacturerDAO::getInstance()->getManufacturer($this->parameters['manufacturerId']);
     if ($manufacturer) {
         if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle())) {
             $this->document->setTitle($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle());
         } else {
             $this->document->setTitle($manufacturer->getName());
         }
         if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription())) {
             $this->document->setDescription($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription());
         }
         if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword())) {
             $this->document->setKeywords($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword());
         }
         if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1())) {
             $this->data['seo_h1'] = $manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1();
         }
         $this->data = array_merge($this->data, $this->parameters);
         $this->data['heading_title'] = $manufacturer->getName();
         $this->data['compare'] = $this->getUrl()->link('product/compare');
         $url = '';
         if (isset($this->request->get['sort'])) {
             $url .= '&sort=' . $this->request->get['sort'];
         }
         if (isset($this->request->get['order'])) {
             $url .= '&order=' . $this->request->get['order'];
         }
         if (isset($this->request->get['page'])) {
             $url .= '&page=' . $this->request->get['page'];
         }
         if (isset($this->request->get['limit'])) {
             $url .= '&limit=' . $this->request->get['limit'];
         }
         #kabantejay synonymizer start
         $this->data['description'] = preg_replace_callback('/\\{  (.*?)  \\}/xs', function ($m) {
             $ar = explode("|", $m[1]);
             return $ar[array_rand($ar, 1)];
         }, html_entity_decode(!is_null($manufacturer->getDescription($this->getLanguage()->getId())) ? $manufacturer->getDescription($this->getLanguage()->getId())->getDescription() : "", ENT_QUOTES, 'UTF-8'));
         #kabantejay synonymizer end
         $this->data['products'] = array();
         $data = array('filterManufacturerId' => $this->parameters['manufacturerId'], 'sort' => $this->parameters['sort'], 'order' => $this->parameters['order'], 'start' => ($this->parameters['page'] - 1) * $this->parameters['limit'], 'limit' => $this->parameters['limit']);
         $product_total = ProductDAO::getInstance()->getProductsCount($data);
         $products = ProductDAO::getInstance()->getProducts($data, $this->parameters['sort'], $this->parameters['order'], ($this->parameters['page'] - 1) * $this->parameters['limit'], $this->parameters['limit']);
         foreach ($products as $product) {
             if ($product->getImagePath()) {
                 $image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
             } else {
                 $image = false;
             }
             if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
                 //					$price = $this->currency->format($this->tax->calculate($product->getPrice(), $product->getTaxClassId(), $this->getConfig()->get('config_tax')));
                 $price = $this->getCurrentCurrency()->format($product->getPrice());
             } else {
                 $price = false;
             }
             if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
                 //					$special = $this->currency->format($this->tax->calculate($product->getSpecials(), $product->getTaxClassId(), $this->getConfig()->get('config_tax')));
                 $special = $this->getCurrentCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
             } else {
                 $special = false;
             }
             //				if ($this->getConfig()->get('config_tax')) {
             //					$tax = $this->currency->format((float)$product->getSpecial() ? $product->getSpecial() : $product->getPrice());
             //				} else {
             //					$tax = false;
             //				}
             //              #kabantejay synonymizer start
             if (is_null($product->getDescriptions())) {
                 $description = '';
             } else {
                 $description = preg_replace_callback('/\\{  (.*?)  \\}/xs', function ($m) {
                     $ar = explode("|", $m[1]);
                     return $ar[array_rand($ar, 1)];
                 }, $product->getDescriptions()->getDescription($this->getLanguage()->getId()));
             }
             //	   		#kabantejay synonymizer end
             $this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => utf8_truncate(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')), 400, '&nbsp;&hellip;', true), 'price' => $price, 'special' => $special, 'rating' => $this->getConfig()->get('config_review_status') ? $product->getRating() : false, 'reviews' => sprintf($this->getLanguage()->get('text_reviews'), $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&manufacturer_id=' . $product->getManufacturer()->getId() . '&product_id=' . $product->getId()));
         }
         $url = '';
         if (isset($this->request->get['limit'])) {
             $url .= '&limit=' . $this->request->get['limit'];
         }
         $this->data['sorts'] = array();
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.sort_order&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=DESC' . $url));
         $url = '';
         if (isset($this->request->get['sort'])) {
             $url .= '&sort=' . $this->request->get['sort'];
         }
         if (isset($this->request->get['order'])) {
             $url .= '&order=' . $this->request->get['order'];
         }
         $this->data['limits'] = array();
         $this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=' . $this->getConfig()->get('config_catalog_limit')));
         $this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=25'));
         $this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=50'));
         $this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=75'));
         $this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=100'));
         $url = '';
         if (isset($this->request->get['sort'])) {
             $url .= '&sort=' . $this->request->get['sort'];
         }
         if (isset($this->request->get['order'])) {
             $url .= '&order=' . $this->request->get['order'];
         }
         if (isset($this->request->get['limit'])) {
             $url .= '&limit=' . $this->request->get['limit'];
         }
         $this->setBreadcrumbs([['text' => $this->getLanguage()->get('text_brand'), 'route' => $this->getUrl()->link('product/manufacturer')]]);
         $pagination = new Pagination();
         $pagination->total = $product_total;
         $pagination->page = $this->parameters['page'];
         $pagination->limit = $this->parameters['limit'];
         $pagination->text = $this->getLanguage()->get('text_pagination');
         $pagination->url = $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&page={page}');
         $this->data['pagination'] = $pagination->render();
         $this->data['continue'] = $this->getUrl()->link('common/home');
         $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
         $templateFile = '/template/product/manufacturerInfo.tpl.php';
         $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default';
         $this->getResponse()->setOutput($this->render($templateDir . $templateFile));
     } else {
         $this->document->setTitle($this->getLanguage()->get('text_error'));
         $this->data['heading_title'] = $this->getLanguage()->get('text_error');
         $this->data['continue'] = $this->getUrl()->link('common/home');
         $this->setBreadcrumbs();
         $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
         $templateFile = '/template/error/not_found.tpl';
         $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default';
         $this->getResponse()->setOutput($this->render($templateDir . $templateFile));
     }
 }
コード例 #4
0
 /**
  * @return string Path to generated thumbnail
  */
 public function getThumb()
 {
     if (file_exists(DIR_IMAGE . $this->imagePath)) {
         return ImageService::getInstance()->resize($this->imagePath, 100, 100);
     } else {
         return ImageService::getInstance()->resize('no_image.jpg', 100, 100);
     }
 }
コード例 #5
0
ファイル: search.php プロジェクト: ralfeus/moomi-daeri.com
 public function index()
 {
     //        $this->log->write(print_r($this->request, true));
     $this->getLanguage()->load('product/search');
     if (isset($this->request->get['filter_name'])) {
         $filter_name = $this->request->get['filter_name'];
     } else {
         $filter_name = '';
     }
     //
     //		if (isset($this->request->get['filter_description'])) {
     //			$filter_description = $this->request->get['filter_description'];
     //		} else {
     //			$filter_description = '';
     //		}
     if (isset($this->request->get['filter_category_id'])) {
         $filter_category_id = $this->request->get['filter_category_id'];
     } else {
         $filter_category_id = 0;
     }
     if (isset($this->request->get['filter_sub_category'])) {
         $filter_sub_category = $this->request->get['filter_sub_category'];
     } else {
         $filter_sub_category = '';
     }
     if (isset($this->request->get['sort'])) {
         $sort = $this->request->get['sort'];
     } else {
         $sort = null;
     }
     if (isset($this->request->get['order'])) {
         $order = $this->request->get['order'];
     } else {
         $order = 'ASC';
     }
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     if (isset($this->request->get['limit'])) {
         $limit = $this->request->get['limit'];
     } else {
         $limit = $this->getConfig()->get('config_catalog_limit');
     }
     if (isset($this->request->get['keyword'])) {
         $this->document->setTitle($this->getLanguage()->get('heading_title') . ' - ' . $this->request->get['keyword']);
     } else {
         $this->document->setTitle($this->getLanguage()->get('heading_title'));
     }
     $url = '';
     if (isset($this->request->get['filter_name'])) {
         $url .= '&filter_name=' . $this->request->get['filter_name'];
     }
     if (isset($this->request->get['filter_tag'])) {
         $url .= '&filter_tag=' . $this->request->get['filter_tag'];
     }
     if (isset($this->request->get['filter_description'])) {
         $url .= '&filter_description=' . $this->request->get['filter_description'];
     }
     if (isset($this->request->get['filter_category_id'])) {
         $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
     }
     if (isset($this->request->get['filter_sub_category'])) {
         $url .= '&filter_sub_category=' . $this->request->get['filter_sub_category'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['limit'])) {
         $url .= '&limit=' . $this->request->get['limit'];
     }
     $this->data['text_compare'] = sprintf($this->getLanguage()->get('text_compare'), isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0);
     $this->data['compare'] = $this->getUrl()->link('product/compare');
     // 3 Level Category Search
     $this->data['categories'] = array();
     $categories_1 = CategoryDAO::getInstance()->getCategoriesByParentId(0);
     foreach ($categories_1 as $category_1) {
         $level_2_data = array();
         $categories_2 = CategoryDAO::getInstance()->getCategoriesByParentId($category_1->getId());
         foreach ($categories_2 as $category_2) {
             $level_3_data = array();
             $categories_3 = CategoryDAO::getInstance()->getCategoriesByParentId($category_2->getId());
             foreach ($categories_3 as $category_3) {
                 $level_3_data[] = array('category_id' => $category_3->getId(), 'name' => $category_3->getDescription()->getName());
             }
             $level_2_data[] = array('category_id' => $category_2->getId(), 'name' => $category_2->getDescription()->getName(), 'children' => $level_3_data);
         }
         $this->data['categories'][] = array('category_id' => $category_1->getId(), 'name' => $category_1->getDescription()->getName(), 'children' => $level_2_data);
     }
     #kabantejay synonymizer start
     $result['description'] = null;
     /// Expression below makes no sense as it refers to non-initialized variable
     //        $result['description'] = preg_replace_callback(
     //            '/\{  (.*?)  \}/xs',
     //            function ($m) {
     //                $ar = explode("|", $m[1]);
     //                return $ar[array_rand($ar, 1)];
     //            },
     //            $result['description']
     //        );
     #kabantejay synonymizer end
     $this->data['products'] = array();
     if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_tag'])) {
         $filter = new FilterTree(['filterEnabled' => true, 'filterCategoryId' => $filter_category_id, 'filterSubCategories' => $filter_sub_category], 'AND', new FilterTree(['filterName' => $filter_name], 'OR', new FilterTree(['filterModel' => $filter_name], 'OR', new FilterTree(['filterTag' => $filter_name]))), true);
         $data = array('filterEnabled' => true, 'filterName' => $filter_name, 'filterCategoryId' => $filter_category_id, 'filterSubCategories' => $filter_sub_category, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit);
         $product_total = ProductDAO::getInstance()->getProductsCount($filter);
         $results = ProductDAO::getInstance()->getProducts($filter, $sort, $order, ($page - 1) * $limit, $limit);
         if ($sort == null) {
             $results = $this->sortByRelevance($results, $filter_name);
         }
         foreach ($results as $product) {
             if ($product->getImagePath()) {
                 $image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
             } else {
                 $image = false;
             }
             if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
                 $price = $this->getCurrency()->format($product->getPrice());
             } else {
                 $price = false;
             }
             if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
                 $special = $this->getCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
             } else {
                 $special = false;
             }
             //
             //                if ($this->getConfig()->get('config_review_status')) {
             //					$rating = (int)$product->getRating();
             //				} else {
             //					$rating = false;
             //				}
             $this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => !is_null($product->getDescriptions()->getDescription($this->getLanguage()->getId())) ? utf8_truncate(strip_tags(html_entity_decode($product->getDescriptions()->getDescription($this->getLanguage()->getId())->getDescription(), ENT_QUOTES, 'UTF-8')), 400, '&nbsp;&hellip;', true) : '', 'price' => $price, 'special' => $special, 'rating' => $product->getRating(), 'reviews' => sprintf($this->getLanguage()->get('text_reviews'), (int) $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $product->getId()));
         }
         $url = '';
         if (isset($this->request->get['filter_name'])) {
             $url .= '&filter_name=' . $this->request->get['filter_name'];
         }
         if (isset($this->request->get['filter_tag'])) {
             $url .= '&filter_tag=' . $this->request->get['filter_tag'];
         }
         if (isset($this->request->get['filter_description'])) {
             $url .= '&filter_description=' . $this->request->get['filter_description'];
         }
         if (isset($this->request->get['filter_category_id'])) {
             $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
         }
         if (isset($this->request->get['filter_sub_category'])) {
             $url .= '&filter_sub_category=' . $this->request->get['filter_sub_category'];
         }
         $this->data['sorts'] = array();
         //			$this->data['sorts'][] = array(
         //				'text'  => $this->getLanguage()->get('text_default'),
         //				'value' => 'p.sort_order-ASC',
         //				'href'  => $this->getUrl()->link('product/search', 'sort=p.sort_order&order=ASC' . $url)
         //			);
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('RELEVANCE'), 'value' => null, 'href' => $this->getUrl()->link('product/search', '' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=pd.name&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=pd.name&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=p.price&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=p.price&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=rating&order=DESC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=rating&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=p.model&order=ASC' . $url));
         $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=p.model&order=DESC' . $url));
         $this->data['limits'] = array();
         $this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/search', $url . '&limit=' . $this->getConfig()->get('config_catalog_limit')));
         $this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->getUrl()->link('product/search', $url . '&limit=25'));
         $this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->getUrl()->link('product/search', $url . '&limit=50'));
         $this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->getUrl()->link('product/search', $url . '&limit=75'));
         $this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->getUrl()->link('product/search', $url . '&limit=100'));
         $pagination = new Pagination();
         $pagination->total = $product_total;
         $pagination->page = $page;
         $pagination->limit = $limit;
         $pagination->text = $this->getLanguage()->get('text_pagination');
         $pagination->url = $this->getUrl()->link('product/search', $url . '&page={page}');
         $this->data['pagination'] = $pagination->render();
     }
     $this->data['filter_name'] = $filter_name;
     //		$this->data['filter_description'] = $filter_description;
     $this->data['filter_category_id'] = $filter_category_id;
     $this->data['filter_sub_category'] = $filter_sub_category;
     $this->data['sort'] = $sort;
     $this->data['order'] = $order;
     $this->data['limit'] = $limit;
     $this->setBreadcrumbs();
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $templateFile = '/template/product/search.tpl.php';
     $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : ($templateDir = 'default');
     $this->getResponse()->setOutput($this->render($templateDir . $templateFile));
 }
コード例 #6
0
ファイル: latest.php プロジェクト: ralfeus/moomi-daeri.com
 protected function index($setting)
 {
     $this->data['button_cart'] = $this->language->get('button_cart');
     $this->data['isSaler'] = $this->customer->getCustomerGroupId() == 6;
     $this->data['products'] = array();
     if (isset($_REQUEST['latest_page'])) {
         $page = $_REQUEST['latest_page'];
     } else {
         $page = 1;
     }
     $data = array('sort' => 'p.date_added', 'order' => 'DESC', 'start' => ($page - 1) * $setting['limit'], 'limit' => $setting['limit'], 'filter_category_id' => $setting['category_ids'], 'nocache' => 1);
     if (isset($this->request->get['route']) and $this->request->get['route'] == 'product/category') {
         $category_id = $this->_endc(explode('_', (string) $this->request->get['path']));
         $data['filter_category_id'] = $category_id;
         $data['filter_sub_category'] = TRUE;
     }
     if (isset($this->request->get['route']) and isset($this->request->get['manufacturer_id']) and $this->request->get['route'] == 'product/manufacturer/product') {
         $manufacturer_id = $this->request->get['manufacturer_id'];
         $data['filter_manufacturer_id'] = $manufacturer_id;
     }
     $results = \model\catalog\ProductDAO::getInstance()->getProducts($data, $data['sort'], $data['order'], $data['start'], $data['limit'], true);
     //$this->getLogger()->write(print_r($data, true));
     foreach ($results as $result) {
         if ($result->getImagePath()) {
             $image = \system\helper\ImageService::getInstance()->resize($result->getImagePath(), $setting['image_width'], $setting['image_height']);
         } else {
             $image = false;
         }
         if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
             $price = $this->getCurrency()->format($this->tax->calculate($result->getPrice(), 0, $this->getConfig()->get('config_tax')));
         } else {
             $price = false;
         }
         $specials = $result->getSpecials(true);
         if (!empty($specials)) {
             $special = $this->getCurrency()->format($specials[0]['price']);
         } else {
             $special = false;
         }
         if ($this->getConfig()->get('config_review_status')) {
             $rating = \model\catalog\ProductDAO::getInstance()->getProductRating($result->getId());
         } else {
             $rating = false;
         }
         $date_added = getdate(strtotime($result->getDateAdded()));
         $date_added = mktime(0, 0, 0, $date_added['mon'], $date_added['mday'], $date_added['year']);
         #kabantejay synonymizer start
         //			$result['description'] = preg_replace_callback('/\{  (.*?)  \}/xs', function ($m) {$ar = explode("|", $m[1]);return $ar[array_rand($ar, 1)];}, $result['description']);
         #kabantejay synonymizer end
         $this->data['products'][] = array('product_id' => $result->getId(), 'thumb' => $image, 'name' => $result->getName(), 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), $result->getReviewsCount()), 'href' => $this->url->link('product/product', 'product_id=' . $result->getId()), 'hot' => $date_added + 86400 * $this->getConfig()->get('config_product_hotness_age') > time());
     }
     $listCategoryId = array();
     $strCategories = explode(",", $data['filter_category_id']);
     for ($i = 0; $i < count($strCategories); $i++) {
         $strCategoryId = $strCategories[$i];
         array_push($listCategoryId, $strCategoryId);
     }
     $this->data['listCategories'] = array();
     foreach ($listCategoryId as $cat) {
         $category_info = $this->model_catalog_category->getCategory($cat);
         if ($category_info) {
             $this->data['listCategories'][] = array('text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $category_info['category_id']));
         }
     }
     if (file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . '/template/module/latest.tpl.php')) {
         $this->template = $this->getConfig()->get('config_template') . '/template/module/latest.tpl.php';
     } else {
         $this->template = 'default/template/module/latest.tpl.php';
     }
     $pagination = new Pagination();
     $pagination->total = $this->model_catalog_product->getTotalProducts($data);
     $pagination->page = $page;
     $pagination->limit = $this->setting['limit'];
     $pagination->text = $this->language->get('text_pagination');
     $pagination->url = $this->modifyUrl("latest_page", "{page}");
     //$pagination->url = $this->url->link('sale/order_items', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->render();
 }
コード例 #7
0
ファイル: special.php プロジェクト: ralfeus/moomi-daeri.com
 public function index()
 {
     $this->language->load('product/special');
     if (isset($this->request->get['sort'])) {
         $sort = $this->request->get['sort'];
     } else {
         $sort = 'p.sort_order';
     }
     if (isset($this->request->get['order'])) {
         $order = $this->request->get['order'];
     } else {
         $order = 'ASC';
     }
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     if (isset($this->request->get['limit'])) {
         $limit = $this->request->get['limit'];
     } else {
         $limit = $this->getConfig()->get('config_catalog_limit');
     }
     $this->document->setTitle($this->language->get('heading_title'));
     $url = '';
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['limit'])) {
         $url .= '&limit=' . $this->request->get['limit'];
     }
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['compare'] = $this->getUrl()->link('product/compare');
     $this->data['products'] = array();
     $data = array('sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit);
     $customerGroupId = $this->getCurrentCustomer()->isLogged() ? $this->getCurrentCustomer()->getCustomerGroupId() : $this->getConfig()->get('config_customer_group_id');
     $product_total = ProductDAO::getInstance()->getProductsCount($data);
     $products = ProductDAO::getInstance()->getDiscountedProductsByCustomerGroupId($customerGroupId, $sort, $order, ($page - 1) * $limit, $limit);
     foreach ($products as $product) {
         #kabantejay synonymizer start
         if (is_null($product->getDescriptions()) || is_null($product->getDescriptions()->getDescription($this->getLanguage()->getId()))) {
             $productDescription = '';
         } else {
             $productDescription = preg_replace_callback('/\\{  (.*?)  \\}/xs', function ($m) {
                 $ar = explode("|", $m[1]);
                 return $ar[array_rand($ar, 1)];
             }, $product->getDescriptions()->getDescription($this->getLanguage()->getId())->getDescription());
         }
         #kabantejay synonymizer end
         if ($product->getImagePath()) {
             $image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
         } else {
             $image = false;
         }
         if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
             $price = $this->getCurrency()->format($product->getPrice());
         } else {
             $price = false;
         }
         if ((double) $product->getSpecialPrice($customerGroupId)) {
             $special = $this->getCurrency()->format($product->getSpecialPrice($customerGroupId));
         } else {
             $special = false;
         }
         if ($this->getConfig()->get('config_tax')) {
             $tax = $this->getCurrency()->format((double) $product->getSpecialPrice($customerGroupId) ? $product->getSpecialPrice($customerGroupId) : $product->getPrice());
         } else {
             $tax = false;
         }
         $this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => utf8_truncate(strip_tags(html_entity_decode($productDescription, ENT_QUOTES, 'UTF-8')), 400, '&nbsp;&hellip;', true), 'price' => $price, 'special' => $special, 'tax' => $tax, 'rating' => $product->getRating(), 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $product->getId()));
     }
     $url = '';
     if (isset($this->request->get['limit'])) {
         $url .= '&limit=' . $this->request->get['limit'];
     }
     $this->data['sorts'] = array();
     $this->data['sorts'][] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=p.sort_order&order=ASC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=pd.name&order=ASC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=pd.name&order=DESC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_price_asc'), 'value' => 'ps.price-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=ps.price&order=ASC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_price_desc'), 'value' => 'special-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=special&order=DESC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=rating&order=DESC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=rating&order=ASC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=p.model&order=ASC' . $url));
     $this->data['sorts'][] = array('text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=p.model&order=DESC' . $url));
     $url = '';
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     $this->data['limits'] = array();
     $this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/special', $url . '&limit=' . $this->getConfig()->get('config_catalog_limit')));
     $this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->getUrl()->link('product/special', $url . '&limit=25'));
     $this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->getUrl()->link('product/special', $url . '&limit=50'));
     $this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->getUrl()->link('product/special', $url . '&limit=75'));
     $this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->getUrl()->link('product/special', $url . '&limit=100'));
     $url = '';
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['limit'])) {
         $url .= '&limit=' . $this->request->get['limit'];
     }
     $pagination = new Pagination();
     $pagination->total = $product_total;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $pagination->text = $this->language->get('text_pagination');
     $pagination->url = $this->getUrl()->link('product/special', $url . '&page={page}');
     $this->data['pagination'] = $pagination->render();
     $this->data['sort'] = $sort;
     $this->data['order'] = $order;
     $this->data['limit'] = $limit;
     $this->setBreadcrumbs();
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->getResponse()->setOutput($this->render($this->getConfig()->get('config_template') . '/template/product/special.tpl'));
 }