function content_55574d9fd07494_75530310($_smarty_tpl) { ?> <?php if (!$_smarty_tpl->tpl_vars['content_only']->value && ($_smarty_tpl->tpl_vars['nbComments']->value == 0 && $_smarty_tpl->tpl_vars['too_early']->value == false && ($_smarty_tpl->tpl_vars['is_logged']->value || $_smarty_tpl->tpl_vars['allow_guests']->value) || $_smarty_tpl->tpl_vars['nbComments']->value != 0)) { ?> <div id="product_comments_block_extra" class="no-print" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <?php $_smarty_tpl->tpl_vars["nbComments"] = new Smarty_variable(ProductComment::getCommentNumber($_smarty_tpl->tpl_vars['id_product_comment_form']->value), null, 0); $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(ProductComment::getRatings($_smarty_tpl->tpl_vars['id_product_comment_form']->value), null, 0); $_smarty_tpl->tpl_vars["average"] = new Smarty_variable(ProductComment::getAverageGrade($_smarty_tpl->tpl_vars['id_product_comment_form']->value), null, 0); $_smarty_tpl->tpl_vars["averageTotal"] = new Smarty_variable(round($_smarty_tpl->tpl_vars['average']->value['grade']), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['nbComments']->value != 0) { ?> <div class="comments_note clearfix"> <div class="star_content clearfix"> <?php if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']["i"])) { unset($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]); } $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['name'] = "i"; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] = (int) 0; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop'] = is_array($_loop = 5) ? count($_loop) : max(0, (int) $_loop); unset($_loop); $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'] = (int) 1 == 0 ? 1 : (int) 1; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['show'] = true; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop']; if ($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] < 0) { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] = max($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'] > 0 ? 0 : -1, $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop'] + $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start']); } else { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] = min($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'] > 0 ? $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop'] : $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop'] - 1); } if ($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['show']) { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['total'] = min(ceil(($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'] > 0 ? $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['loop'] - $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] : $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'] + 1) / abs($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'])), $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['max']); if ($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['total'] == 0) { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['show'] = false; } } else { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['total'] = 0; } if ($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['show']) { for ($_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['total']; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration']++) { $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration']; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step']; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['step']; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['first'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration'] == 1; $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['last'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']["i"]['total']; ?> <?php if ($_smarty_tpl->tpl_vars['averageTotal']->value <= $_smarty_tpl->getVariable('smarty')->value['section']['i']['index']) { ?> <div class="star"></div> <?php } else { ?> <div class="star star_on"></div> <?php } ?> <?php } } ?> <meta itemprop="worstRating" content = "0" /> <meta itemprop="ratingValue" content = "<?php if (isset($_smarty_tpl->tpl_vars['ratings']->value['avg'])) { echo htmlspecialchars(round($_smarty_tpl->tpl_vars['ratings']->value['avg'], 1), ENT_QUOTES, 'UTF-8', true); } else { echo htmlspecialchars(round($_smarty_tpl->tpl_vars['averageTotal']->value, 1), ENT_QUOTES, 'UTF-8', true); } ?> " /> <meta itemprop="bestRating" content = "5" /> </div> </div> <!-- .comments_note --> <?php } ?> <ul class="comments_advices"> <?php if ($_smarty_tpl->tpl_vars['nbComments']->value != 0) { ?> <li> <a href="#idTab5" class="reviews"> <?php echo smartyTranslate(array('s' => 'Based on', 'mod' => 'productcomments'), $_smarty_tpl); ?> <span itemprop="reviewCount"><?php echo $_smarty_tpl->tpl_vars['nbComments']->value; ?> </span> <?php echo smartyTranslate(array('s' => 'ratings', 'mod' => 'productcomments'), $_smarty_tpl); ?> </a> </li> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['too_early']->value == false && ($_smarty_tpl->tpl_vars['is_logged']->value || $_smarty_tpl->tpl_vars['allow_guests']->value)) { ?> <li> <a class="open-comment-form" href="#new_comment_form"> <?php echo smartyTranslate(array('s' => 'Write a review', 'mod' => 'productcomments'), $_smarty_tpl); ?> </a> </li> <?php } ?> </ul> </div> <?php } ?> <!-- /Module ProductComments --> <?php }
public function displayTop() { //if (!$this->isCached('blocktopmenu2.tpl', $this->getCacheId())) //{ $this->user_groups = $this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')); $categoryMain = current(Category::getNestedCategories(146, $this->context->language->id, true, $this->user_groups)); //$this->loadCategories(146); // $categoryComplects = new Category(129, $this->context->language->id); // $categoryWholesale = new Category(148, $this->context->language->id); // $cmsopt = new CMS(11, $this->context->language->id); $categoryComplects = current(Category::getNestedCategories(129, $this->context->language->id, true, $this->user_groups)); $categoryComplectsDecor = current(Category::getNestedCategories(198, $this->context->language->id, true, $this->user_groups)); $categoryFurniture = current(Category::getNestedCategories(7, $this->context->language->id, true, $this->user_groups)); //$this->loadCategories(7); $shop_id = (int) $this->context->shop->id; $shop_group_id = Shop::getGroupFromShop($shop_id); $item_day_id = Db::getInstance()->getValue("SELECT id_product FROM " . _DB_PREFIX_ . "product WHERE item_for_day=1 AND active=1 ORDER BY RAND()"); if ($item_day_id) { require_once dirname(dirname(__FILE__)) . '/productcomments/ProductComment.php'; $prodict_day = new Product($item_day_id, true, $this->context->language->id, $this->context->shop->id); $average = ProductComment::getAverageGrade($prodict_day->id); $cover = Product::getCover((int) $prodict_day->id, $this->context); $this->context->smarty->assign(array('priceDisplayPrecisionDay' => _PS_PRICE_DISPLAY_PRECISION_, 'have_image_day' => isset($cover['id_image']) && (int) $cover['id_image'] ? true : false, 'cover_day' => $cover, 'categoryComplects' => $categoryComplects, 'categoryComplectsDecor' => $categoryComplectsDecor, 'averageTotalDay' => round($average['grade']), 'ratingsDay' => ProductComment::getRatings((int) $prodict_day->id), 'nbCommentsDay' => (int) ProductComment::getCommentNumber((int) $prodict_day->id))); } else { $prodict_day = null; } $this->context->smarty->assign(array('prodict_day' => $prodict_day, 'prodict_day_url' => is_object($prodict_day) ? $this->context->link->getProductLink($prodict_day) : null, 'search' => Configuration::get('MOD_blocktopmenu2_SEARCH', null, $shop_group_id, $shop_id), 'categoryMain' => $categoryMain, 'categoryComplects' => $categoryComplects, 'categoryComplectsDecor' => $categoryComplectsDecor, 'categoryWholesale' => new Category(148, $this->context->language->id), 'cmsopt' => new CMS(11, $this->context->language->id), 'categoryFurniture' => $categoryFurniture)); // echo '<pre>'; var_dump($this->context->smarty->getTemplateVars('categoryMain')); echo '</pre>'; die(); //} return $this->display(__FILE__, 'blocktopmenu2.tpl', $this->getCacheId()); }
public function hookDisplayRightColumnProduct($params) { require_once dirname(__FILE__) . '/ProductComment.php'; require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; $id_guest = !($id_customer = (int) $this->context->cookie->id_customer) ? (int) $this->context->cookie->id_guest : false; $customerComment = ProductComment::getByCustomer((int) Tools::getValue('id_product'), (int) $this->context->cookie->id_customer, true, (int) $id_guest); $average = ProductComment::getAverageGrade((int) Tools::getValue('id_product')); $product = $this->context->controller->getProduct(); $image = Product::getCover((int) Tools::getValue('id_product')); $cover_image = $this->context->link->getImageLink($product->link_rewrite, $image['id_image'], 'medium_default'); $this->context->smarty->assign(array('id_product_comment_form' => (int) Tools::getValue('id_product'), 'product' => $product, 'secure_key' => $this->secure_key, 'logged' => $this->context->customer->isLogged(true), 'allow_guests' => (int) Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'productcomment_cover' => (int) Tools::getValue('id_product') . '-' . (int) $image['id_image'], 'productcomment_cover_image' => $cover_image, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'criterions' => ProductCommentCriterion::getByProduct((int) Tools::getValue('id_product'), $this->context->language->id), 'action_url' => '', 'averageTotal' => round($average['grade']), 'ratings' => ProductComment::getRatings((int) Tools::getValue('id_product')), 'too_early' => $customerComment && strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME') > time(), 'nbComments' => (int) ProductComment::getCommentNumber((int) Tools::getValue('id_product')))); return $this->display(__FILE__, '/productcomments-extra.tpl'); }
/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $flag_pack = true; if (!$this->errors) { // if(!isset($_GET['quick_view'])) // if (Pack::isPack((int)$this->product->id) && !Pack::isInStock((int)$this->product->id)) // if (Pack::isPack((int)$this->product->id)) // $this->product->quantity = 0; // else // $flag_pack = false; // else // $flag_pack = false; if (!Pack::isPack((int) $this->product->id)) { $flag_pack = false; } $this->product->description = $this->transformDescriptionWithImg($this->product->description); // Assign to the template the id of the virtual product. "0" if the product is not downloadable. $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id)); $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI']))); if (Tools::isSubmit('submitCustomizedDatas')) { // If cart has not been saved, we need to do it so that customization fields can have an id_cart // We check that the cookie exists first to avoid ghost carts if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) { $this->context->cart->add(); $this->context->cookie->id_cart = (int) $this->context->cart->id; } $this->pictureUpload(); $this->textRecord(); $this->formTargetFormat(); } else { if (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) { $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture.'); } } $pictures = array(); $text_fields = array(); if ($this->product->customizable) { $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true); foreach ($files as $file) { $pictures['pictures_' . $this->product->id . '_' . $file['index']] = $file['value']; } $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true); foreach ($texts as $text_field) { $text_fields['textFields_' . $this->product->id . '_' . $text_field['index']] = str_replace('<br />', "\n", $text_field['value']); } } $this->context->smarty->assign(array('pictures' => $pictures, 'textFields' => $text_fields)); // Assign template vars related to the category + execute hooks related to the category $this->assignCategory(); // Assign template vars related to the price and tax $this->assignPriceAndTax(); // Assign template vars related to the images $this->assignImages(); $this->assign3dImages(); // Assign attribute groups to the template $this->assignAttributesGroups(); // Assign attributes combinations to the template $this->assignAttributesCombinations(); // Pack management $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array(); if (is_array($pack_items) && count($pack_items)) { foreach ($pack_items as &$pack_item) { $pack_item['features'] = Product::getFrontFeaturesStatic($this->context->language->id, $pack_item['id_product']); } } $this->context->smarty->assign('packItems', $pack_items); $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1)); if (isset($this->category->id) && $this->category->id) { $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category)); } else { $return_link = 'javascript: history.back();'; } //reviews // $average = ProductComment::getAverageGrade((int)Tools::getValue('id_product')); $nbComments = (int) ProductComment::getCommentNumber((int) Tools::getValue('id_product')); $act_pack = 0; //паки if (!$flag_pack) { $sql = "SELECT DISTINCT(id_product_pack) FROM " . _DB_PREFIX_ . "pack WHERE id_product_item={$this->product->id}"; $pack_products = array(); $result_packs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if (is_array($result_packs) && count($result_packs)) { foreach ($result_packs as $k => $id_product_pack) { $prod = new Product($id_product_pack['id_product_pack'], $this->context->language->id, true); $cover = $prod->getCover((int) $prod->id); if ($cover) { $pack_products[$k]['id_image'] = $cover['id_image']; } else { $pack_products[$k]['id_image'] = null; } $price = $prod->getPrice(true, null, 2); $price_old = $prod->getPriceWithoutReduct(false, null, 2); if (isset($prod->specificPrice) && is_array($prod->specificPrice)) { $pack_products[$k]['sale_percentage'] = $prod->specificPrice['reduction_type'] == 'percentage' ? $prod->specificPrice['reduction'] * 100 : $prod->specificPrice['reduction'] / $price_old * 100; } $pack_products[$k]['active'] = $prod->active; if ($prod->active) { $act_pack = 1; } $pack_products[$k]['count_reviews'] = (int) ProductComment::getCommentNumber((int) $prod->id); $pack_products[$k]['star_reviews'] = ProductComment::getRatings((int) $prod->id); $pack_products[$k]['price'] = $price; $pack_products[$k]['price_old'] = $price_old; $pack_products[$k]['on_sale'] = (bool) ($price != $price_old); $pack_products[$k]['id_product_pack'] = $prod->id; $pack_products[$k]['link'] = $this->context->link->getProductLink($prod); $pack_products[$k]['name'] = $prod->name; $pack_products[$k]['link_rewrite'] = $prod->link_rewrite; $pack_products[$k]['items'] = Pack::getItemTable($prod->id, $this->context->language->id, true); unset($prod); } } } else { $pack_products = null; } //var_dump($pack_products);exit(); //текстовой блок доставка $cms_block = ''; $cms = new CMS($this->block_cms_id, $this->context->language->id); if (is_object($cms)) { $cms_block = $cms->content; } $sql = "SELECT id_category FROM ps_category_product WHERE id_product={$this->product->id}"; $result_cats = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $params_image = null; foreach ($result_cats as $cat) { $params_image = file_exists(_PS_IMG_DIR_ . '/c_icon/' . $cat['id_category'] . '.png') ? '/img/c_icon/' . $cat['id_category'] . '.png' : null; if (!$params_image) { $params_image = file_exists(_PS_IMG_DIR_ . '/c_icon/' . $cat['id_category'] . '.jpg') ? '/img/c_icon/' . $cat['id_category'] . '.jpg' : null; } if ($params_image) { break; } } //{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if} $this->context->smarty->assign(array('is_bestsaler' => ProductSale::isBestsaler($this->product->id), 'og_type' => 'product', 'params_image' => $params_image, 'cms_block' => $cms_block, 'pack_products' => $pack_products, 'act_pack' => $act_pack, 'url' => $this->context->link->getProductLink($this->product), 'minimal_quantity' => $this->product->minimal_quantity > 1 ? $this->product->minimal_quantity : 1, 'nbComments' => $nbComments, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, $this->context->language->id), 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => $this->product->cache_has_attachments ? $this->product->getAttachments($this->context->language->id) : array(), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'HOOK_PRODUCT_CONTENT' => Hook::exec('displayProductContent', array('product' => $this->product)), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'body_classes' => array($this->php_self . '-' . $this->product->id, $this->php_self . '-' . $this->product->link_rewrite, 'category-' . (isset($this->category) ? $this->category->id : ''), 'category-' . (isset($this->category) ? $this->category->getFieldByLang('link_rewrite') : '')), 'display_discount_price' => Configuration::get('PS_DISPLAY_DISCOUNT_PRICE'))); } if (isset($_GET['quick_view'])) { $this->ajax = true; if ($flag_pack) { $this->setTemplate(_PS_THEME_DIR_ . 'preview_pack.tpl'); } else { $this->setTemplate(_PS_THEME_DIR_ . 'preview.tpl'); } } else { if ($flag_pack) { $this->setTemplate(_PS_THEME_DIR_ . 'product-pack.tpl'); } else { $this->setTemplate(_PS_THEME_DIR_ . 'product.tpl'); } } }