-
Публікації
25 -
З нами
-
Відвідування
Тип публікації
Профілі
Форум
Маркетплейс
Статті
FAQ
Наші новини
Магазин
Блоги
module__dplus_manager
Повідомлення, опубліковані користувачем madfoxes
-
-
Какие ошибки выдает или ничего не меняеться?
да, просто не выводит.
-
оба способа пробовал и руками и vqmod.
-
странно, все по аналогии менял, а выход ноль. может где что и пропустил. Может кто подскажет, в каком месте не идет.
-
Всем привет! Еще раз, product_tab воткнул все руками, побыстрее работают. Но вот теперь, не могу вывести в модуле Вы смотрели.
viewed.tpl
<?php if (count($products) > 0) { ?> <div class="box"> <div class="box-heading"><?php echo $heading_title; ?></div> <div class="box-content"> <div class="box-product"> <?php foreach ($products as $product) { ?> <div> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> <?php } ?> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> </div> <?php } ?> <div class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?> <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div> <div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div> </div> <?php } ?> </div> </div> </div> <?php } ?>
viewed.php
<?php class ControllerModuleViewed extends Controller { protected function index($setting) { $viewed_products = array(); if (isset($this->request->cookie['viewed'])) { $viewed_products = explode(',', $this->request->cookie['viewed']); } else if (isset($this->session->data['viewed'])) { $viewed_products = $this->session->data['viewed']; } if (isset($this->request->get['route']) && isset($this->request->get['product_id']) && $this->request->get['route'] == 'product/product') { $product_id = $this->request->get['product_id']; $viewed_products = array_diff($viewed_products, array($product_id)); array_unshift($viewed_products, $product_id); setcookie('viewed', implode(',',$viewed_products), time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']); if (!isset($this->session->data['viewed']) || $this->session->data['viewed'] != $viewed_products) { $this->session->data['viewed'] = $viewed_products; } } $show_on_product = $this->config->get('show_on_product'); if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/product' && (!isset($show_on_product) || !$show_on_product)) { return; } $viewed_count = $this->config->get('viewed_count'); $products = array(); if (isset($viewed_count) && $viewed_count > 0) { for ($i = 0; $i < $viewed_count; $i++) { $key = isset($product_id) ? $i + 1 : $i; if (isset($viewed_products[$key])) { $products[] = $viewed_products[$key]; } } } $this->language->load('module/viewed'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['button_cart'] = $this->language->get('button_cart'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $this->data['products'] = array(); foreach ($products as $product_id) { $product_info = $this->model_catalog_product->getProduct($product_id); if ($product_info) { if ($product_info['image']) { $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((float)$product_info['special']) { $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $product_info['rating']; } else { $rating = false; } $this->data['products'][] = array( 'product_id' => $product_info['product_id'], 'thumb' => $image, 'name' => $product_info['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']), ); } } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/viewed.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/viewed.tpl'; } else { $this->template = 'default/template/module/viewed.tpl'; } $this->render(); } } ?>
сборка ocshop
Пробовал и VqMOD и ручную установку, не идет.
-
спасибо!!! Ketty83, обязательно воспользуюсь Вашим предложением!
-
как очистить Новинки кто-нибудь может подсказать или лучше выводить последние 10 товаров только или как вариант за последние N-дней?
-
сходу не въехал, примерчик не большой можно? Как думаете, на счет нагрузки из-за такой конструкции?
-
Автору модуля, огромнейшее спасибо! :-)
-
Всем привет! Кто подскажет, как дописать в XML под такой модуль.
product_tab.tpl
<div id="tabs-<?php echo $module; ?>" class="htabs"> <?php if($latest_products){ ?> <a href="#tab-latest-<?php echo $module; ?>"><?php echo $tab_latest; ?></a> <?php } ?> <?php if($featured_products){ ?> <a href="#tab-featured-<?php echo $module; ?>"><?php echo $tab_featured; ?></a> <?php } ?> <?php if($bestseller_products){ ?> <a href="#tab-bestseller-<?php echo $module; ?>"><?php echo $tab_bestseller; ?></a> <?php } ?> <?php if($special_products){ ?> <a href="#tab-special-<?php echo $module; ?>"><?php echo $tab_special; ?></a> <?php } ?> </div> <?php if($latest_products){ ?> <div id="tab-latest-<?php echo $module; ?>" class="tab-content"> <div class="box-product"> <?php foreach ($latest_products as $product) { ?> <div> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> <?php } ?> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> </div> <?php } ?> <div class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?> <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div> <div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> </div> <?php } ?> </div> </div> <?php } ?> <?php if($featured_products){ ?> <div id="tab-featured-<?php echo $module; ?>" class="tab-content"> <div class="box-product"> <?php foreach ($featured_products as $product) { ?> <div> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> <?php } ?> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> </div> <?php } ?> <div class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?> <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div> <div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> </div> <?php } ?> </div> </div> <?php } ?> <?php if($bestseller_products){ ?> <div id="tab-bestseller-<?php echo $module; ?>" class="tab-content"> <div class="box-product"> <?php foreach ($bestseller_products as $product) { ?> <div> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> <?php } ?> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> </div> <?php } ?> <div class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?> <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div> <div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> </div> <?php } ?> </div> </div> <?php } ?> <?php if($special_products){ ?> <div id="tab-special-<?php echo $module; ?>" class="tab-content"> <div class="box-product"> <?php foreach ($special_products as $product) { ?> <div> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> <?php } ?> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span><br /><span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> </div> <?php } ?> <div class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?> <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div> <div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> </div> <?php } ?> </div> </div> <?php } ?> <script type="text/javascript"> $('#tabs-<?php echo $module; ?> a').tabs(); </script>
product_tab.php
<?php class ControllerModuleProductTab extends Controller { protected function index($setting) { static $module = 0; $this->language->load('module/product_tab'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->document->addScript('catalog/view/javascript/jquery/tabs.js'); $this->data['tab_latest'] = $this->language->get('tab_latest'); $this->data['tab_featured'] = $this->language->get('tab_featured'); $this->data['tab_bestseller'] = $this->language->get('tab_bestseller'); $this->data['tab_special'] = $this->language->get('tab_special'); $this->data['button_cart'] = $this->language->get('button_cart'); $this->load->model('catalog/product'); $this->load->model('tool/image'); //Latest Products $this->data['latest_products'] = array(); $latest_results = $this->model_catalog_product->getLatestProducts($setting['limit']); foreach ($latest_results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $result['rating']; } else { $rating = false; } $this->data['latest_products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']), ); } //Specials product $this->data['special_products'] = array(); $special_data = array( 'sort' => 'pd.name', 'order' => 'ASC', 'start' => 0, 'limit' => $setting['limit'] ); $special_results = $this->model_catalog_product->getProductSpecials($special_data); foreach ($special_results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $result['rating']; } else { $rating = false; } $this->data['special_products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']), ); } //BestSeller $this->data['bestseller_products'] = array(); $bestseller_results = $this->model_catalog_product->getBestSellerProducts($setting['limit']); foreach ($bestseller_results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $result['rating']; } else { $rating = false; } $this->data['bestseller_products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']), ); } //Featured $this->data['featured_products'] = array(); $products = explode(',', $this->config->get('featured_product')); if (empty($setting['limit'])) { $setting['limit'] = 5; } $products = array_slice($products, 0, (int)$setting['limit']); foreach ($products as $product_id) { $product_info = $this->model_catalog_product->getProduct($product_id); if ($product_info) { if ($product_info['image']) { $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']); } else { $image = false; } if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $price = false; } if ((float)$product_info['special']) { $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_review_status')) { $rating = $product_info['rating']; } else { $rating = false;
В ручную, все шуршит без проблем, но хотелось бы с VQmod реализовать.
Как обработать в XML строки, которые повторяются несколько раз?
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
и эта
'special' => $special,
-
VikLavrenko какую версию используешь?
-
RGB в чем причина, что стикеры не работает на 1.5.6???
-
cherkas на какую версию ставил? opencart-1.5.6 или другой?
-
Интересно... но подсунул файл product tpl от opencart 1.5.4.1 и он показывает... пойду курить... в чем отличие и причина???
-
В общем, форум перечитал уже много раз. Пробовал вручную вставлять.
не выводятся стикеры только в карточке товара . шаблон дефолтный версия opencart-1.5.6
Только в моем случае я использую поле *ean*
В чем может быть проблема?
product tpl
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>
<h1><?php echo $heading_title; ?></h1>
<div class="product-info"><?php if ($thumb || $images) { ?>
<div class="left">
<?php if ($thumb) { ?>
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a></div>
<?php } ?>
<?php if ($images) { ?>
<div class="image-additional">
<?php foreach ($images as $image) { ?>
<a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="right">
<div class="description">
<?php if ($manufacturer) { ?>
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
<?php } ?>
<span><?php echo $text_model; ?></span> <?php echo $model; ?><br />
<?php if ($reward) { ?>
<span><?php echo $text_reward; ?></span> <?php echo $reward; ?><br />
<?php } ?>
<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
<?php if ($price) { ?>
<div class="price"><?php echo $text_price; ?>
<?php if (!$special) { ?>
<?php echo $price; ?>
<?php } else { ?>
<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
<?php } ?>
<br />
<?php if ($tax) { ?>
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $tax; ?></span><br />
<?php } ?>
<?php if ($points) { ?>
<span class="reward"><small><?php echo $text_points; ?> <?php echo $points; ?></small></span><br />
<?php } ?>
<?php if ($discounts) { ?>
<br />
<div class="discount">
<?php foreach ($discounts as $discount) { ?>
<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>
<?php if ($profiles): ?>
<div class="option">
<h2><span class="required">*</span><?php echo $text_payment_profile ?></h2>
<br />
<select name="profile_id">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($profiles as $profile): ?>
<option value="<?php echo $profile['profile_id'] ?>"><?php echo $profile['name'] ?></option>
<?php endforeach; ?>
</select>
<br />
<br />
<span id="profile-description"></span>
<br />
<br />
</div>
<?php endif; ?>
<?php if ($options) { ?>
<div class="options">
<h2><?php echo $text_option; ?></h2>
<br />
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'select') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'radio') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<?php foreach ($option['option_value'] as $option_value) { ?>
<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
<br />
<?php } ?>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'checkbox') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<?php foreach ($option['option_value'] as $option_value) { ?>
<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
<br />
<?php } ?>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'image') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<table class="option-image">
<?php foreach ($option['option_value'] as $option_value) { ?>
<tr>
<td style="width: 1px;"><input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" /></td>
<td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><img src="<?php echo $option_value['image']; ?>" alt="<?php echo $option_value['name'] . ($option_value['price'] ? ' ' . $option_value['price_prefix'] . $option_value['price'] : ''); ?>" /></label></td>
<td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label></td>
</tr>
<?php } ?>
</table>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'text') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'textarea') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<textarea name="option[<?php echo $option['product_option_id']; ?>]" cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'file') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="button" value="<?php echo $button_upload; ?>" id="button-option-<?php echo $option['product_option_id']; ?>" class="button">
<input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'date') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="date" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'datetime') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="datetime" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'time') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="time" />
</div>
<br />
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<div class="cart">
<div><?php echo $text_qty; ?>
<input type="text" name="quantity" size="2" value="<?php echo $minimum; ?>" />
<input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
<span> <?php echo $text_or; ?> </span>
<span class="links"><a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a><br />
<a onclick="addToCompare('<?php echo $product_id; ?>');"><?php echo $button_compare; ?></a></span>
</div>
<?php if ($minimum > 1) { ?>
<div class="minimum"><?php echo $text_minimum; ?></div>
<?php } ?>
</div>
<?php if ($review_status) { ?>
<div class="review">
<div><img src="catalog/view/theme/default/image/stars-<?php echo $rating; ?>.png" alt="<?php echo $reviews; ?>" /> <a onclick="$('a[href=\'#tab-review\']').trigger('click');"><?php echo $reviews; ?></a> | <a onclick="$('a[href=\'#tab-review\']').trigger('click');"><?php echo $text_write; ?></a></div>
<div class="share"><!-- AddThis Button BEGIN -->
<div class="addthis_default_style"><a class="addthis_button_compact"><?php echo $text_share; ?></a> <a class="addthis_button_email"></a><a class="addthis_button_print"></a> <a class="addthis_button_facebook"></a> <a class="addthis_button_twitter"></a></div>
<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
<!-- AddThis Button END -->
</div>
</div>
<?php } ?>
</div>
</div>
<div id="tabs" class="htabs"><a href="#tab-description"><?php echo $tab_description; ?></a>
<?php if ($attribute_groups) { ?>
<a href="#tab-attribute"><?php echo $tab_attribute; ?></a>
<?php } ?>
<?php if ($review_status) { ?>
<a href="#tab-review"><?php echo $tab_review; ?></a>
<?php } ?>
<?php if ($products) { ?>
<a href="#tab-related"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
<?php } ?>
</div>
<div id="tab-description" class="tab-content"><?php echo $description; ?></div>
<?php if ($attribute_groups) { ?>
<div id="tab-attribute" class="tab-content">
<table class="attribute">
<?php foreach ($attribute_groups as $attribute_group) { ?>
<thead>
<tr>
<td colspan="2"><?php echo $attribute_group['name']; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<tr>
<td><?php echo $attribute['name']; ?></td>
<td><?php echo $attribute['text']; ?></td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
</table>
</div>
<?php } ?>
<?php if ($review_status) { ?>
<div id="tab-review" class="tab-content">
<div id="review"></div>
<h2 id="review-title"><?php echo $text_write; ?></h2>
<b><?php echo $entry_name; ?></b><br />
<input type="text" name="name" value="" />
<br />
<br />
<b><?php echo $entry_review; ?></b>
<textarea name="text" cols="40" rows="8" style="width: 98%;"></textarea>
<span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
<br />
<b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>
<input type="radio" name="rating" value="1" />
<input type="radio" name="rating" value="2" />
<input type="radio" name="rating" value="3" />
<input type="radio" name="rating" value="4" />
<input type="radio" name="rating" value="5" />
<span><?php echo $entry_good; ?></span><br />
<br />
<b><?php echo $entry_captcha; ?></b><br />
<input type="text" name="captcha" value="" />
<br />
<img src="index.php?route=product/product/captcha" alt="" id="captcha" /><br />
<br />
<div class="buttons">
<div class="right"><a id="button-review" class="button"><?php echo $button_continue; ?></a></div>
</div>
</div>
<?php } ?>
<?php if ($products) { ?>
<div id="tab-related" class="tab-content">
<div class="box-product">
<?php foreach ($products as $product) { ?>
<div>
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<!-- Stickers -->
<!-- <div class="image"><a href="<?php echo $product['href']; ?>"><?php if ($product['ean']) { ?><i style="background: url('catalog/view/theme/default/image/sticker_<?php echo $product['ean']; ?>.png');"></i><?php } ?><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<!-- Stickers -->
<?php } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><?php echo $button_cart; ?></a></div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php if ($tags) { ?>
<div class="tags"><b><?php echo $text_tags; ?></b>
<?php for ($i = 0; $i < count($tags); $i++) { ?>
<?php if ($i < (count($tags) - 1)) { ?>
<a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>,
<?php } else { ?>
<a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$(document).ready(function() {
$('.colorbox').colorbox({
overlayClose: true,
opacity: 0.5,
rel: "colorbox"
});
});
//--></script>
<script type="text/javascript"><!--$('select[name=profile_id], input[name=quantity]').change(function(){
$.ajax({
url: 'index.php?route=product/product/getRecurringDescription',
type: 'post',
data: $('input[name=product_id], input[name=quantity], select[name=profile_id]'),
dataType: 'json',
beforeSend: function() {
$('#profile-description').html('');
},
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['success']) {
$('#profile-description').html(json['success']);
}
}
});
});
$('#button-cart').bind('click', function() {
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
$('#option-' + i).after('<span class="error">' + json['error']['option'] + '</span>');
}
}
if (json['error']['profile']) {
$('select[name=profile_id]').after('<span class="error">' + json['error']['profile'] + '</span>');
}
}
if (json['success']) {
$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.success').fadeIn('slow');
$('#cart-total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
}
});
});
//--></script>
<?php if ($options) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'file') { ?>
<script type="text/javascript"><!--
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
action: 'index.php?route=product/product/upload',
name: 'file',
autoSubmit: true,
responseType: 'json',
onSubmit: function(file, extension) {
$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/default/image/loading.gif" class="loading" style="padding-left: 5px;" />');
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', true);
},
onComplete: function(file, json) {
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', false);
$('.error').remove();
if (json['success']) {
alert(json['success']);
$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json['file']);
}
if (json['error']) {
$('#option-<?php echo $option['product_option_id']; ?>').after('<span class="error">' + json['error'] + '</span>');
}
$('.loading').remove();
}
});
//--></script>
<?php } ?>
<?php } ?>
<?php } ?>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
$('#review').fadeOut('slow');
$('#review').load(this.href);
$('#review').fadeIn('slow');
return false;
});$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
$('#button-review').bind('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
type: 'post',
dataType: 'json',
data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
beforeSend: function() {
$('.success, .warning').remove();
$('#button-review').attr('disabled', true);
$('#review-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
complete: function() {
$('#button-review').attr('disabled', false);
$('.attention').remove();
},
success: function(data) {
if (data['error']) {
$('#review-title').after('<div class="warning">' + data['error'] + '</div>');
}
if (data['success']) {
$('#review-title').after('<div class="success">' + data['success'] + '</div>');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').attr('checked', '');
$('input[name=\'captcha\']').val('');
}
}
});
});
//--></script>
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {
if ($.browser.msie && $.browser.version == 6) {
$('.date, .datetime, .time').bgIframe();
}$('.date').datepicker({dateFormat: 'yy-mm-dd'});
$('.datetime').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'h:m'
});
$('.time').timepicker({timeFormat: 'h:m'});
});
//--></script>
<?php echo $footer; ?>product php
class ControllerProductProduct extends Controller {
private $error = array();
public function index() {
$this->language->load('product/product');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
);
$this->load->model('catalog/category');
if (isset($this->request->get['path'])) {
$path = '';
$parts = explode('_', (string)$this->request->get['path']);
$category_id = (int)array_pop($parts);
foreach ($parts as $path_id) {
if (!$path) {
$path = $path_id;
} else {
$path .= '_' . $path_id;
}
$category_info = $this->model_catalog_category->getCategory($path_id);
if ($category_info) {
$this->data['breadcrumbs'][] = array(
'text' => $category_info['name'],
'href' => $this->url->link('product/category', 'path=' . $path),
'separator' => $this->language->get('text_separator')
);
}
}
// Set the last category breadcrumb
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$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['breadcrumbs'][] = array(
'text' => $category_info['name'],
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path']),
'separator' => $this->language->get('text_separator')
);
}
}
$this->load->model('catalog/manufacturer');
if (isset($this->request->get['manufacturer_id'])) {
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_brand'),
'href' => $this->url->link('product/manufacturer'),
'separator' => $this->language->get('text_separator')
);
$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'];
}
$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($this->request->get['manufacturer_id']);
if ($manufacturer_info) {
$this->data['breadcrumbs'][] = array(
'text' => $manufacturer_info['name'],
'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url),
'separator' => $this->language->get('text_separator')
);
}
}
if (isset($this->request->get['search']) || isset($this->request->get['tag'])) {
$url = '';
if (isset($this->request->get['search'])) {
$url .= '&search=' . $this->request->get['search'];
}
if (isset($this->request->get['tag'])) {
$url .= '&tag=' . $this->request->get['tag'];
}
if (isset($this->request->get['description'])) {
$url .= '&description=' . $this->request->get['description'];
}
if (isset($this->request->get['category_id'])) {
$url .= '&category_id=' . $this->request->get['category_id'];
}
if (isset($this->request->get['sub_category'])) {
$url .= '&sub_category=' . $this->request->get['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['breadcrumbs'][] = array(
'text' => $this->language->get('text_search'),
'href' => $this->url->link('product/search', $url),
'separator' => $this->language->get('text_separator')
);
}
if (isset($this->request->get['product_id'])) {
$product_id = (int)$this->request->get['product_id'];
} else {
$product_id = 0;
}
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
$url = '';
if (isset($this->request->get['path'])) {
$url .= '&path=' . $this->request->get['path'];
}
if (isset($this->request->get['filter'])) {
$url .= '&filter=' . $this->request->get['filter'];
}
if (isset($this->request->get['manufacturer_id'])) {
$url .= '&manufacturer_id=' . $this->request->get['manufacturer_id'];
}
if (isset($this->request->get['search'])) {
$url .= '&search=' . $this->request->get['search'];
}
if (isset($this->request->get['tag'])) {
$url .= '&tag=' . $this->request->get['tag'];
}
if (isset($this->request->get['description'])) {
$url .= '&description=' . $this->request->get['description'];
}
if (isset($this->request->get['category_id'])) {
$url .= '&category_id=' . $this->request->get['category_id'];
}
if (isset($this->request->get['sub_category'])) {
$url .= '&sub_category=' . $this->request->get['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['breadcrumbs'][] = array(
'text' => $product_info['name'],
'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id']),
'separator' => $this->language->get('text_separator')
);
$this->document->setTitle($product_info['name']);
$this->document->setDescription($product_info['meta_description']);
$this->document->setKeywords($product_info['meta_keyword']);
$this->document->addLink($this->url->link('product/product', 'product_id=' . $this->request->get['product_id']), 'canonical');
$this->document->addScript('catalog/view/javascript/jquery/tabs.js');
$this->document->addScript('catalog/view/javascript/jquery/colorbox/jquery.colorbox-min.js');
$this->document->addStyle('catalog/view/javascript/jquery/colorbox/colorbox.css');
$this->data['heading_title'] = $product_info['name'];
$this->data['text_select'] = $this->language->get('text_select');
$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
$this->data['text_model'] = $this->language->get('text_model');
$this->data['text_reward'] = $this->language->get('text_reward');
$this->data['text_points'] = $this->language->get('text_points');
$this->data['text_discount'] = $this->language->get('text_discount');
$this->data['text_stock'] = $this->language->get('text_stock');
$this->data['text_price'] = $this->language->get('text_price');
$this->data['text_tax'] = $this->language->get('text_tax');
$this->data['text_discount'] = $this->language->get('text_discount');
$this->data['text_option'] = $this->language->get('text_option');
$this->data['text_qty'] = $this->language->get('text_qty');
$this->data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']);
$this->data['text_or'] = $this->language->get('text_or');
$this->data['text_write'] = $this->language->get('text_write');
$this->data['text_note'] = $this->language->get('text_note');
$this->data['text_share'] = $this->language->get('text_share');
$this->data['text_wait'] = $this->language->get('text_wait');
$this->data['text_tags'] = $this->language->get('text_tags');
$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_review'] = $this->language->get('entry_review');
$this->data['entry_rating'] = $this->language->get('entry_rating');
$this->data['entry_good'] = $this->language->get('entry_good');
$this->data['entry_bad'] = $this->language->get('entry_bad');
$this->data['entry_captcha'] = $this->language->get('entry_captcha');
$this->data['button_cart'] = $this->language->get('button_cart');
$this->data['button_wishlist'] = $this->language->get('button_wishlist');
$this->data['button_compare'] = $this->language->get('button_compare');
$this->data['button_upload'] = $this->language->get('button_upload');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->load->model('catalog/review');
$this->data['tab_description'] = $this->language->get('tab_description');
$this->data['tab_attribute'] = $this->language->get('tab_attribute');
$this->data['tab_review'] = sprintf($this->language->get('tab_review'), $product_info['reviews']);
$this->data['tab_related'] = $this->language->get('tab_related');
$this->data['product_id'] = $this->request->get['product_id'];
$this->data['manufacturer'] = $product_info['manufacturer'];
$this->data['manufacturers'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
$this->data['model'] = $product_info['model'];
$this->data['reward'] = $product_info['reward'];
$this->data['points'] = $product_info['points'];
if ($product_info['quantity'] <= 0) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = $this->language->get('text_instock');
}
$this->load->model('tool/image');
if ($product_info['image']) {
$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
} else {
$this->data['popup'] = '';
}
if ($product_info['image']) {
$this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
} else {
$this->data['thumb'] = '';
}
$this->data['images'] = array();
$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
foreach ($results as $result) {
$this->data['images'][] = array(
'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')),
'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
);
}
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['price'] = false;
}
if ((float)$product_info['special']) {
$this->data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['special'] = false;
}
if ($this->config->get('config_tax')) {
$this->data['tax'] = $this->currency->format((float)$product_info['special'] ? $product_info['special'] : $product_info['price']);
} else {
$this->data['tax'] = false;
}
$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
$this->data['discounts'] = array();
foreach ($discounts as $discount) {
$this->data['discounts'][] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')))
);
}
$this->data['options'] = array();
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
$option_value_data[] = array(
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
'image' => $this->model_tool_image->resize($option_value['image'], 50, 50),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
}
}
$this->data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option_value_data,
'required' => $option['required']
);
} elseif ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'file' || $option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
$this->data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option['option_value'],
'required' => $option['required']
);
}
}
if ($product_info['minimum']) {
$this->data['minimum'] = $product_info['minimum'];
} else {
$this->data['minimum'] = 1;
}
$this->data['review_status'] = $this->config->get('config_review_status');
$this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']);
$this->data['rating'] = (int)$product_info['rating'];
$this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
$this->data['products'] = array();
$results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'));
} else {
$image = false;
}
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((float)$result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int)$result['rating'];
} else {
$rating = false;
}
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
);
}
$this->data['tags'] = array();
if ($product_info['tag']) {
$tags = explode(',', $product_info['tag']);
foreach ($tags as $tag) {
$this->data['tags'][] = array(
'tag' => trim($tag),
'href' => $this->url->link('product/search', 'tag=' . trim($tag))
);
}
}
$this->data['text_payment_profile'] = $this->language->get('text_payment_profile');
$this->data['profiles'] = $this->model_catalog_product->getProfiles($product_info['product_id']);
$this->model_catalog_product->updateViewed($this->request->get['product_id']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/product.tpl';
} else {
$this->template = 'default/template/product/product.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
} else {
$url = '';
if (isset($this->request->get['path'])) {
$url .= '&path=' . $this->request->get['path'];
}
if (isset($this->request->get['filter'])) {
$url .= '&filter=' . $this->request->get['filter'];
}
if (isset($this->request->get['manufacturer_id'])) {
$url .= '&manufacturer_id=' . $this->request->get['manufacturer_id'];
}
if (isset($this->request->get['search'])) {
$url .= '&search=' . $this->request->get['search'];
}
if (isset($this->request->get['tag'])) {
$url .= '&tag=' . $this->request->get['tag'];
}
if (isset($this->request->get['description'])) {
$url .= '&description=' . $this->request->get['description'];
}
if (isset($this->request->get['category_id'])) {
$url .= '&category_id=' . $this->request->get['category_id'];
}
if (isset($this->request->get['sub_category'])) {
$url .= '&sub_category=' . $this->request->get['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['breadcrumbs'][] = array(
'text' => $this->language->get('text_error'),
'href' => $this->url->link('product/product', $url . '&product_id=' . $product_id),
'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->url->link('common/home');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
}
}
public function review() {
$this->language->load('product/product');
$this->load->model('catalog/review');
$this->data['text_on'] = $this->language->get('text_on');
$this->data['text_no_reviews'] = $this->language->get('text_no_reviews');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['reviews'] = array();
$review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']);
$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5);
foreach ($results as $result) {
$this->data['reviews'][] = array(
'author' => $result['author'],
'text' => $result['text'],
'rating' => (int)$result['rating'],
'reviews' => sprintf($this->language->get('text_reviews'), (int)$review_total),
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
);
}
$pagination = new Pagination();
$pagination->total = $review_total;
$pagination->page = $page;
$pagination->limit = 5;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}');
$this->data['pagination'] = $pagination->render();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/review.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/review.tpl';
} else {
$this->template = 'default/template/product/review.tpl';
}
$this->response->setOutput($this->render());
}
public function getRecurringDescription() {
$this->language->load('product/product');
$this->load->model('catalog/product');
if (isset($this->request->post['product_id'])) {
$product_id = $this->request->post['product_id'];
} else {
$product_id = 0;
}
if (isset($this->request->post['profile_id'])) {
$profile_id = $this->request->post['profile_id'];
} else {
$profile_id = 0;
}
if (isset($this->request->post['quantity'])) {
$quantity = $this->request->post['quantity'];
} else {
$quantity = 1;
}
$product_info = $this->model_catalog_product->getProduct($product_id);
$profile_info = $this->model_catalog_product->getProfile($product_id, $profile_id);
$json = array();
if ($product_info && $profile_info) {
if (!$json) {
$frequencies = array(
'day' => $this->language->get('text_day'),
'week' => $this->language->get('text_week'),
'semi_month' => $this->language->get('text_semi_month'),
'month' => $this->language->get('text_month'),
'year' => $this->language->get('text_year'),
);
if ($profile_info['trial_status'] == 1) {
$price = $this->currency->format($this->tax->calculate($profile_info['trial_price'] * $quantity, $product_info['tax_class_id'], $this->config->get('config_tax')));
$trial_text = sprintf($this->language->get('text_trial_description'), $price, $profile_info['trial_cycle'], $frequencies[$profile_info['trial_frequency']], $profile_info['trial_duration']) . ' ';
} else {
$trial_text = '';
}
$price = $this->currency->format($this->tax->calculate($profile_info['price'] * $quantity, $product_info['tax_class_id'], $this->config->get('config_tax')));
if ($profile_info['duration']) {
$text = $trial_text . sprintf($this->language->get('text_payment_description'), $price, $profile_info['cycle'], $frequencies[$profile_info['frequency']], $profile_info['duration']);
} else {
$text = $trial_text . sprintf($this->language->get('text_payment_until_canceled_description'), $price, $profile_info['cycle'], $frequencies[$profile_info['frequency']], $profile_info['duration']);
}
$json['success'] = $text;
}
}
$this->response->setOutput(json_encode($json));
}
public function write() {
$this->language->load('product/product');
$this->load->model('catalog/review');
$json = array();
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 25)) {
$json['error'] = $this->language->get('error_name');
}
if ((utf8_strlen($this->request->post['text']) < 25) || (utf8_strlen($this->request->post['text']) > 1000)) {
$json['error'] = $this->language->get('error_text');
}
if (empty($this->request->post['rating'])) {
$json['error'] = $this->language->get('error_rating');
}
if (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {
$json['error'] = $this->language->get('error_captcha');
}
if (!isset($json['error'])) {
$this->model_catalog_review->addReview($this->request->get['product_id'], $this->request->post);
$json['success'] = $this->language->get('text_success');
}
}
$this->response->setOutput(json_encode($json));
}
public function captcha() {
$this->load->library('captcha');
$captcha = new Captcha();
$this->session->data['captcha'] = $captcha->getCode();
$captcha->showImage();
}
public function upload() {
$this->language->load('product/product');
$json = array();
if (!empty($this->request->files['file']['name'])) {
$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 64)) {
$json['error'] = $this->language->get('error_filename');
}
// Allowed file extension types
$allowed = array();
$filetypes = explode("\n", $this->config->get('config_file_extension_allowed'));
foreach ($filetypes as $filetype) {
$allowed[] = trim($filetype);
}
if (!in_array(substr(strrchr($filename, '.'), 1), $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
// Allowed file mime types
$allowed = array();
$filetypes = explode("\n", $this->config->get('config_file_mime_allowed'));
foreach ($filetypes as $filetype) {
$allowed[] = trim($filetype);
}
if (!in_array($this->request->files['file']['type'], $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
}
} else {
$json['error'] = $this->language->get('error_upload');
}
if (!$json && is_uploaded_file($this->request->files['file']['tmp_name']) && file_exists($this->request->files['file']['tmp_name'])) {
$file = basename($filename) . '.' . md5(mt_rand());
// Hide the uploaded file name so people can not link to it directly.
$json['file'] = $this->encryption->encrypt($file);
move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file);
$json['success'] = $this->language->get('text_upload');
}
$this->response->setOutput(json_encode($json));
}
}
?>xml file
<file name="catalog/view/theme/*/template/product/product.tpl">
<operation>
<search position="replace">
<![CDATA[
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a></div>
]]>
</search>
<add>
<![CDATA[
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox" rel="colorbox"><?php if ($ean) { ?> <i style="
background: url('catalog/view/theme/default/image/sticker_<?php echo $ean; ?>.png');"></i><?php } ?><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a></div>
]]>
</add>
</operation>
<operation>
<search position="replace">
<![CDATA[
<div class=image"><a href="<?php echo $product['href]; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
]]>
</search>
<add>
<![CDATA[
<div class=image"><a href="<?php echo $product['href]; ?>"><?php if ($product['ean']) { ?><i style="background: url('catalog/view/theme/default/image/sticker_<?php echo $product['ean']; ?>.png');"></i><?php } ?><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
]]>
</add>
</operation>
</file>
<file name="catalog/controller/product/product.php">
<operation>
<search position="after">
<![CDATA[
$this->data['model'] = $product_info['model'];
]]>
</search>
<add>
<![CDATA[
$this->data['ean'] = $product_info['ean'];
]]>
</add>
</operation>
<operation>
<search position="after">
<![CDATA[
'special' => $special,
]]>
</search>
<add>
<![CDATA[
'ean' => $result['ean'],
]]>
</add>
</operation>
</file>Может кто скажет, опытным взглядом. Что не так?! :?
-
Все гуд, поправил вручную! Еще раз спасибо
у меня такая же проблема, везде выводит, а в карточке товара нет. В каком месте поправил вручную?
Платно. Быстрый заказ для opencart 2.0
в Opencart 2.x: Пошук модулів
Опубліковано:
Присоединяюсь, тоже в поиске.