Example #1
0
 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     if ($this->image) {
         $imageDiv = $xml->createElement('div', ['class' => 'image-container']);
         $node->appendChild($imageDiv);
         $imageDiv->appendChild($xml->createImgElement($this->image->getUrl(), 'image', $this->image->getSize()));
     }
     parent::getHTMLNodeInner($node, $xml, $settings);
 }
 function hookHome($params)
 {
     global $smarty;
     $products = Product::getNewProducts((int) $params['cookie']->id_lang, 0, 5);
     $smarty->assign(array('products' => $products, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'blocknewestproducts.tpl');
 }
Example #3
0
 function hookRightColumn($params)
 {
     global $smarty, $category_path;
     $category_path_ids = array();
     foreach ($category_path as $cat) {
         $category_path_ids[] = $cat['id_category'];
     }
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 25);
     $best_sellers = array();
     $nr = 0;
     foreach ($bestsellers as $bestseller) {
         if ($nr >= 5) {
             break;
         }
         $display = false;
         foreach (Product::getIndexedCategories($bestseller['id_product']) as $row) {
             if (in_array($row['id_category'], $category_path_ids)) {
                 $display = true;
                 break;
             }
         }
         if ($display) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStaticLC(intval($bestseller['id_product'])), $currency, false, false);
             $best_sellers[] = $bestseller;
             $nr += 1;
         }
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'static_token' => Tools::getToken(false)));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 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';
     }
     $nbProducts = (int) Product::getNewProducts($this->context->language->id, null, null, true);
     $this->pagination($nbProducts);
     $products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
     $this->addColorsToProductList($products);
     $this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     if ($this->ajax) {
         $product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
         $pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
         $nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
         $nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
         echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
         die;
     } else {
         $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
     }
 }
 public function process()
 {
     if ($id_supplier = Tools::getValue('id_supplier')) {
         $this->supplier = new Supplier((int) $id_supplier, self::$cookie->id_lang);
         if (Validate::isLoadedObject($this->supplier) and $this->supplier->active) {
             $nbProducts = $this->supplier->getProducts($id_supplier, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
             $this->pagination((int) $nbProducts);
             self::$smarty->assign(array('nb_products' => $nbProducts, 'products' => $this->supplier->getProducts($id_supplier, (int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay), 'path' => $this->supplier->active ? Tools::safeOutput($this->supplier->name) : '', 'supplier' => $this->supplier));
         } else {
             header('HTTP/1.1 404 Not Found');
             header('Status: 404 Not Found');
             $this->errors[] = Tools::displayError('Supplier does not exist');
         }
     } else {
         if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
             $data = call_user_func(array('Supplier', 'getSuppliers'), true, (int) self::$cookie->id_lang, true);
             $nbProducts = count($data);
             $this->pagination($nbProducts);
             $data = call_user_func(array('Supplier', 'getSuppliers'), true, (int) self::$cookie->id_lang, true, $this->p, $this->n);
             $imgDir = _PS_MANU_IMG_DIR_;
             foreach ($data as &$item) {
                 $item['image'] = !file_exists($imgDir . '/' . $item['id_supplier'] . '-medium.jpg') ? Language::getIsoById((int) self::$cookie->id_lang) . '-default' : $item['id_supplier'];
             }
             self::$smarty->assign(array('pages_nb' => ceil($nbProducts / (int) $this->n), 'nbSuppliers' => $nbProducts, 'mediumSize' => Image::getSize('medium'), 'suppliers' => $data, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')));
         } else {
             self::$smarty->assign('nbSuppliers', 0);
         }
     }
 }
 public function process()
 {
     $this->productSort();
     $nbProducts = (int) ProductSale::getNbSales();
     $this->pagination($nbProducts);
     self::$smarty->assign(array('products' => ProductSale::getBestSales((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
 }
Example #7
0
 public function __construct()
 {
     $this->name = 'flexiblebrands';
     $this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
     $this->orderValue = array('sales' => $this->l('Sales'), 'price' => $this->l('Price'), 'discount' => $this->l('Discount'), 'add' => $this->l('Add Date'), 'rand' => $this->l('Random'));
     $this->orderType = array('asc' => $this->l('Ascending'), 'desc' => $this->l('Descending'));
     $this->display = array('all' => $this->l('All'), 'condition-new' => $this->l('New'), 'condition-used' => $this->l('Used'), 'condition-refurbished' => $this->l('Refurbished'));
     $this->groupType = array('auto' => $this->l('Auto'), 'manual' => $this->l('Manual'));
     $this->moduleLayout = array('default' => $this->l('Layout [default]'));
     $this->tempPath = dirname(__FILE__) . '/images/temps/';
     $this->bannerPath = dirname(__FILE__) . '/images/banners/';
     $this->iconPath = dirname(__FILE__) . '/images/icons/';
     if (Configuration::get('PS_SSL_ENABLED')) {
         $this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
     } else {
         $this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
     }
     $this->secure_key = Tools::encrypt('ovic-' . $this->name);
     $this->tab = 'front_office_features';
     $this->version = '1.0';
     $this->author = 'OvicSoft [SonNC]';
     $this->bootstrap = true;
     parent::__construct();
     $this->displayName = $this->l('Ovic Flexible Brands Module');
     $this->description = $this->l('Ovic Flexible Brands Module');
     $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
     //$this->cache = new FlexibleBrandFastCache();
 }
 function hookRightColumn($params)
 {
     global $smarty;
     $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
     $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blocknewproducts.tpl');
 }
 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 #10
0
 public function __construct()
 {
     $this->name = 'groupcategory';
     //$this->cache = new GroupCategoryFastCache();
     $this->arrType = array('saller' => $this->l('Best Sellers'), 'view' => $this->l('Most View'), 'special' => $this->l('Specials'), 'arrival' => $this->l('New Arrivals'));
     $this->secure_key = Tools::encrypt('ovic-soft[group-category]' . $this->name);
     $this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
     $this->arrLayout = array('default' => $this->l('Layout [default]'));
     $this->pathTemp = dirname(__FILE__) . '/images/temps/';
     $this->pathBanner = dirname(__FILE__) . '/images/banners/';
     $this->pathIcon = dirname(__FILE__) . '/images/icons/';
     if (Configuration::get('PS_SSL_ENABLED')) {
         $this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
     } else {
         $this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
     }
     $this->tab = 'front_office_features';
     $this->version = '1.0';
     $this->author = 'OvicSoft';
     $this->bootstrap = true;
     parent::__construct();
     $this->displayName = $this->l('Supershop - Group Category Module');
     $this->description = $this->l('Group Category Module');
     $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
 }
Example #11
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 #12
0
 public function image()
 {
     $image = new Image('http://sinastorage.com/sandbox/test.jpg');
     $image->rotate(50);
     $s3 = new S3();
     $result = $s3->plainWrite('test.jpg', $image->getContent(), $image->getSize(), $image->getMimeType());
     Common::debug($result);
 }
 function hookRightColumn($params)
 {
     global $smarty;
     if ($special = Product::getRandomSpecial(intval($params['cookie']->id_lang))) {
         $smarty->assign(array('special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'] / (1 + $special['rate'] / 100), 2), 'oldPrice' => $special['price'] + $special['reduction'], 'mediumSize' => Image::getSize('medium')));
     }
     return $this->display(__FILE__, 'blockspecials.tpl');
 }
 public function process()
 {
     parent::process();
     $this->productSort();
     $nbProducts = Product::getPricesDrop((int) self::$cookie->id_lang, NULL, NULL, true);
     $this->pagination($nbProducts);
     self::$smarty->assign(array('products' => Product::getPricesDrop((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
 }
 public function hookDisplayHome($params)
 {
     $categoryRoot = new Category(Configuration::get('PS_HOME_CATEGORY'), $this->context->language->id, $this->context->shop->id);
     $categoriesHome = $categoryRoot->getSubCategoriesMatrassHome($this->context->language->id);
     //функция описана в classes Category.php
     $this->smarty->assign(array('subcategories' => $categoriesHome, 'homeSize' => Image::getSize('medium_default')));
     return $this->display(__FILE__, 'blockhomecategorys.tpl');
 }
Example #16
0
 function hookRightColumn($params)
 {
     global $smarty;
     if ($special = Product::getRandomSpecial(intval($params['cookie']->id_lang))) {
         $smarty->assign(array('special' => $special, 'oldPrice' => $special['price'] + $special['reduction'], 'mediumSize' => Image::getSize('medium')));
     }
     return $this->display(__FILE__, 'blockspecials.tpl');
 }
Example #17
0
 function hookHome($params)
 {
     global $smarty;
     $category = new Category(1);
     $nb = intval(Configuration::get('HOME_FEATURED_NBR'));
     $products = $category->getProducts(intval($params['cookie']->id_lang), 1, $nb ? $nb : 10);
     $smarty->assign(array('products' => $products, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'homefeatured.tpl');
 }
Example #18
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     $original_query = Tools::getValue('q');
     $query = Tools::replaceAccentedChars(urldecode($original_query));
     if ($this->ajax_search) {
         $searchResults = Search::find((int) Tools::getValue('id_lang'), $query, 1, 10, 'position', 'desc', true);
         if (is_array($searchResults)) {
             foreach ($searchResults as &$product) {
                 $product['product_link'] = $this->context->link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']);
             }
             Hook::exec('actionSearch', array('expr' => $query, 'total' => count($searchResults)));
         }
         $this->ajaxDie(Tools::jsonEncode($searchResults));
     }
     //Only controller content initialization when the user use the normal search
     parent::initContent();
     $product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int) $this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
     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 = Search::find($this->context->language->id, $query, 1, 10, 'position', 'desc');
         Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
         $nbProducts = $search['total'];
         $this->pagination($nbProducts);
         $this->addColorsToProductList($search['result']);
         $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', $product_per_page));
         $this->p = abs((int) Tools::getValue('p', 1));
         $original_query = $query;
         $query = Tools::replaceAccentedChars(urldecode($query));
         $search = Search::find($this->context->language->id, $query, $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']);
         $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);
         $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');
 }
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = (int) ProductSale::getNbSales();
     $this->pagination($nbProducts);
     $this->context->smarty->assign(array('products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home_default'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
 }
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = (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($nbProducts);
     $this->context->smarty->assign(array('products' => Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize('home_default'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
 }
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = Product::getPricesDrop($this->context->language->id, null, null, true);
     $this->pagination($nbProducts);
     $this->context->smarty->assign(array('products' => Product::getPricesDrop($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), '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');
 }
 public function hookDisplayHit($params)
 {
     $categoryRoot = new Category(Configuration::get('PS_HOME_CATEGORY'), $this->context->language->id, $this->context->shop->id);
     $categoriesHome = $categoryRoot->getSubCategoriesHit($this->context->language->id);
     //функция описана в classes Category.php
     $this->smarty->assign(array('subcategories' => $categoriesHome, 'homeSize' => Image::getSize('medium_default')));
     //print_r($categoriesHome);Получаю массив с ключами определёнными в classes Category.php
     return $this->display(__FILE__, 'blockHitscategorys.tpl');
 }
 function hookHome($params)
 {
     global $smarty;
     $category = new Category(1);
     $nb = intval(Configuration::get('HOME_FEATURED_NBR'));
     $products = $category->getProducts(intval($params['cookie']->id_lang), 1, $nb ? $nb : 10);
     $smarty->assign(array('allow_buy_when_out_of_stock' => Configuration::get('PS_ORDER_OUT_OF_STOCK', false), 'max_quantity_to_allow_display' => Configuration::get('PS_LAST_QTIES'), 'category' => $category, 'products' => $products, 'currency' => new Currency(intval($params['cart']->id_currency)), 'lang' => Language::getIsoById(intval($params['cookie']->id_lang)), 'productNumber' => sizeof($products), 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'homefeatured.tpl');
 }
 protected function _assignSummaryInformations()
 {
     $summary = $this->context->cart->getSummaryDetails();
     $customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
     // override customization tax rate with real tax (tax rules)
     if ($customizedDatas) {
         foreach ($summary['products'] as &$productUpdate) {
             $productId = (int) isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id'];
             $productAttributeId = (int) isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id'];
             if (isset($customizedDatas[$productId][$productAttributeId])) {
                 $productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             }
         }
         Product::addCustomizationPrice($summary['products'], $customizedDatas);
     }
     $cart_product_context = Context::getContext()->cloneContext();
     foreach ($summary['products'] as $key => &$product) {
         $product['quantity'] = $product['cart_quantity'];
         // for compatibility with 1.2 themes
         if ($cart_product_context->shop->id != $product['id_shop']) {
             $cart_product_context->shop = new Shop((int) $product['id_shop']);
         }
         $product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], _PS_PRICE_COMPUTE_PRECISION_, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context);
         /**
          * ABU edit: variable is_discount set à 1 à tord, calcul foireux de presta
          * @bugfix: https://github.com/PrestaShop/PrestaShop/commit/379e28b341730ea95c0b2d6567817305ea841b23
          * @perso: soustraction de l'ecotax au price_without_specific_price @else
          */
         if (Product::getTaxCalculationMethod()) {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
         } else {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'] - $product['ecotax'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
         }
     }
     // Get available cart rules and unset the cart rules already in the cart
     $available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0, true, true, true, $this->context->cart);
     $cart_cart_rules = $this->context->cart->getCartRules();
     foreach ($available_cart_rules as $key => $available_cart_rule) {
         if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], CartRule::BO_ORDER_CODE_PREFIX) === 0) {
             unset($available_cart_rules[$key]);
             continue;
         }
         foreach ($cart_cart_rules as $cart_cart_rule) {
             if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) {
                 unset($available_cart_rules[$key]);
                 continue 2;
             }
         }
     }
     $show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
     $this->context->smarty->assign($summary);
     $this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
     $this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
 }
 public function hookDisplayHomeLine5($params)
 {
     if (!$this->isCached('blockbestsellershome.tpl', $this->getCacheId('blockbestsellershome'))) {
         $this->smarty->assign(array('best_sellers' => BlockBestSellers::$cache_best_sellers, 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
     }
     if (BlockBestSellers::$cache_best_sellers === false) {
         return false;
     }
     return $this->display(__FILE__, 'blockbestsellershome.tpl', $this->getCacheId('blockbestsellershome'));
 }
Example #26
0
 function hookhome($params)
 {
     global $smarty;
     $newProducts = Product::getNewProducts((int) $params['cookie']->id_lang, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
     if (!$newProducts and !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) {
         return;
     }
     $smarty->assign(array('new_products' => $newProducts, 'homeSize' => Image::getSize('home_default')));
     return $this->display(__FILE__, 'tdnewproducts.tpl');
 }
 function hookHomeCategory($params)
 {
     global $smarty;
     if (isset($_GET['id_category'])) {
         $categoryid = $_GET['id_category'];
     }
     $category = new Category($categoryid, Configuration::get('PS_LANG_DEFAULT'));
     $products1 = $category->getProducts((int) $params['cookie']->id_lang, 1, 3, 'date_add', 'DESC');
     $smarty->assign(array('products1' => $products1, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'blocknewproduct.tpl');
 }
Example #28
0
 public function hookRightColumn($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     if (!($special = Product::getRandomSpecial((int) $params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) {
         return;
     }
     $this->smarty->assign(array('special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium'))));
     return $this->display(__FILE__, 'blockspecials.tpl');
 }
 function hookHomeCategory($params)
 {
     global $smarty;
     if (isset($_GET['id_category'])) {
         $categoryid = $_GET['id_category'];
     }
     $productss = Product::getRandomSpecialCategory($categoryid, (int) $params['cookie']->id_lang);
     //        $category = new Category($categoryid, Configuration::get('PS_LANG_DEFAULT'));
     //        $products = $category->getProducts((int)($params['cookie']->id_lang), 1,3,'date_add','DESC');
     $smarty->assign(array('productss' => $productss, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'blockreducepriceproducts.tpl');
 }
Example #30
0
 function hookRightColumn($params)
 {
     global $smarty;
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5);
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }