public function get_option_resources() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $attribute_value_id = (int) $this->request->get['attribute_value_id']; $output = array(); if ($attribute_value_id) { $resource = new AResource('image'); // main product image $sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height'))); $output['main'] = $resource->getResourceAllObjects('product_option_value', $attribute_value_id, $sizes, 1, false); if (!$output['main']) { unset($output['main']); } // additional images $sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_additional_width'), 'height' => $this->config->get('config_image_additional_height')), 'thumb2' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height'))); $output['images'] = $resource->getResourceAllObjects('product_option_value', $attribute_value_id, $sizes, 0, false); if (!$output['images']) { unset($output['images']); } } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->load->library('json'); $this->response->addJSONHeader(); $this->response->setOutput(AJson::encode($output)); }
protected function getBlockContent($instance_id) { $block_info = $this->layout->getBlockDetails($instance_id); $custom_block_id = $block_info['custom_block_id']; $descriptions = $this->layout->getBlockDescriptions($custom_block_id); if ($descriptions[$this->config->get('storefront_language_id')]) { $key = $this->config->get('storefront_language_id'); } else { $key = $descriptions ? key($descriptions) : null; } $this->loadModel('extension/banner_manager'); $results = $this->model_extension_banner_manager->getBanners($custom_block_id); $banners = array(); if ($results) { $rl = new AResource('image'); foreach ($results as $row) { if ($row['banner_type'] == 1) { // if graphic type /** * @var array */ $row['images'] = $rl->getResourceAllObjects('banners', $row['banner_id']); //add click registration wrapper to each URL //NOTE: You can remove below line to use tracking javascript instead. Javascript tracks HTML banner clicks $row['target_url'] = $this->html->getURL('r/extension/banner_manager/click', '&banner_id=' . $row['banner_id'], true); } else { $row['description'] = html_entity_decode($row['description']); } $banners[] = $row; } } $output = array('title' => $key ? $descriptions[$key]['title'] : '', 'content' => $banners, 'block_wrapper' => $key ? $descriptions[$key]['block_wrapper'] : 0, 'block_framed' => $key ? (int) $descriptions[$key]['block_framed'] : 0); return $output; }
public function get() { $this->extensions->hk_InitData($this, __FUNCTION__); $product_id = $this->request->get['product_id']; if (!$product_id) { $this->rest->setResponseData(array('Error' => 'Missing product ID as a required parameter')); $this->rest->sendResponse(200); return null; } $products = array(); $this->loadModel('catalog/review'); $this->loadModel('catalog/product'); $results = $this->model_catalog_product->getProductRelated($product_id); foreach ($results as $result) { $resource = new AResource('image'); $sizes = array('main' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height'))); $image = $resource->getResourceAllObjects('products', $result['product_id'], $sizes, 1); if ($this->config->get('enable_reviews')) { $rating = $this->model_catalog_review->getAverageRating($result['product_id']); } else { $rating = false; } $special = FALSE; $discount = $this->model_catalog_product->getProductDiscount($result['product_id']); if ($discount) { $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax'))); } else { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))); $special = $this->model_catalog_product->getProductSpecial($result['product_id']); if ($special) { $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax'))); } } $options = $this->model_catalog_product->getProductOptions($result['product_id']); if ($options) { $add = 'a/product/product'; } else { $add = 'a/checkout/cart'; } $products[] = array('product_id' => $result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'price' => $price, 'options' => $options, 'special' => $special, 'image' => $image['main_url'], 'thumb' => $image['thumb_url'], 'cart_add_rt' => $add); } $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->rest->setResponseData(array('total' => count($products), 'related_products' => $products)); $this->rest->sendResponse(200); }
public function getListing() { if (!$this->data['custom_block_id'] || !$this->data['descriptions']) { return false; } //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $listing = new AListing($this->data['custom_block_id']); $content = unserialize($this->data['descriptions'][$this->config->get('storefront_language_id')]['content']); if (!$content && $this->data['descriptions']) { $content = current($this->data['descriptions']); $content = unserialize($content['content']); } $this->data['controller'] = $content['block_appearance']; $this->data['listing_datasource'] = $content['listing_datasource']; $data_sources = $listing->getListingDataSources(); $data_source = $data_sources[$content['listing_datasource']]; if (strpos($content['listing_datasource'], 'custom_') === FALSE) { // for auto listings $route = $content['listing_datasource']; $limit = $content['limit']; // for resource library if ($route == 'media') { $rl = new AResource($content['resource_type']); if (isset($this->request->get['product_id'])) { $object_name = 'products'; $object_id = $this->request->get['product_id']; } elseif (isset($this->request->get['category_id']) || isset($this->request->get['path'])) { $object_name = 'categories'; if (isset($this->request->get['category_id'])) { $object_id = $this->request->get['product_id']; } else { $temp = explode("_", $this->request->get['path']); end($temp); $object_id = current($temp); } } elseif (isset($this->request->get['manufacturer_id'])) { $object_name = 'manufacturers'; $object_id = $this->request->get['manufacturer_id']; } $resources = $rl->getResourceAllObjects($object_name, $object_id, array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_product_width'), 'height' => $this->config->get('config_image_product_height'))), $limit, false); if (!$resources) { return null; } if ($limit == 1) { $resources = array($resources); } foreach ($resources as $k => $resource) { if ($resource['origin'] == 'external') { $result[$k]['resource_code'] = $resource['thumb_html']; } else { if ($content['resource_type'] != 'image') { $title = $resource['title'] ? $resource['title'] : 'dowload'; } else { $title = $resource['title']; } $result[$k]['image'] = array('main_url' => $resource['main_url'], 'main_html' => $resource['main_html'], 'thumb_url' => $resource['thumb_url'], 'thumb_html' => $resource['thumb_html'], 'title' => $title, 'resource_type' => $content['resource_type']); } } } else { // otherwise - select list from method if ($route) { $this->loadModel($data_source['storefront_model']); $result = call_user_func_array(array($this->{'model_' . str_replace('/', '_', $data_source['storefront_model'])}, $data_source['storefront_method']), $listing->getlistingArguments($data_source['storefront_model'], $data_source['storefront_method'], array('limit' => $limit))); if ($result) { $desc = $listing->getListingDataSources(); foreach ($desc as $d) { if ($d['storefront_method'] == $data_source['storefront_method']) { $data_source = $d; break; } } //add thumbnails to custom list of items. 1 thumbnail per item $result = $this->_prepareCustomItems($data_source, $result); } } } } else { // for custom listings $list = $listing->getCustomList(); if (!$list) { return null; } $this->load->model($data_source['storefront_model']); foreach ($list as $item) { $result[] = call_user_func_array(array($this->{'model_' . str_replace('/', '_', $data_source['storefront_model'])}, $data_source['storefront_method']), array($item['id'])); } } /*if($data_source['rl_object_name'] ){ $resource = new AResource('image'); }*/ if ($result) { //add thumbnails to custom list of items. 1 thumbnail per item $result = $this->_prepareCustomItems($data_source, $result); } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); return $result; }
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->document->resetBreadcrumbs(); $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE)); $this->loadModel('tool/seo_url'); $this->loadModel('catalog/category'); if (isset($this->request->get['path'])) { $path = ''; foreach (explode('_', $this->request->get['path']) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if (!$path) { $path = $path_id; } else { $path .= '_' . $path_id; } if ($category_info) { $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('product/category', '&path=' . $path, '&encode'), 'text' => $category_info['name'], 'separator' => $this->language->get('text_separator'))); } } } $this->loadModel('catalog/manufacturer'); if (isset($this->request->get['manufacturer_id'])) { $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($this->request->get['manufacturer_id']); if ($manufacturer_info) { $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $this->request->get['manufacturer_id'], '&encode'), 'text' => $manufacturer_info['name'], 'separator' => $this->language->get('text_separator'))); } } if (isset($this->request->get['keyword'])) { $url = ''; if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } $this->document->addBreadcrumb(array('href' => $this->html->getURL('product/search', '&keyword=' . $this->request->get['keyword'] . $url, '&encode'), 'text' => $this->language->get('text_search'), 'separator' => $this->language->get('text_separator'))); } $key = array(); //key of product from cart if (has_value($this->request->get['key'])) { $key = explode(':', $this->request->get['key']); $product_id = (int) $key[0]; } elseif (has_value($this->request->get['product_id'])) { $product_id = (int) $this->request->get['product_id']; } else { $product_id = 0; } $urls = array('is_group_option' => $this->html->getURL('r/product/product/is_group_option', '&product_id=' . $product_id, '&encode')); $this->view->assign('urls', $urls); $this->loadModel('catalog/product'); $promoton = new APromotion(); $product_info = $this->model_catalog_product->getProduct($product_id); //can not locate product? get out if (!$product_info) { $this->_product_not_found($product_id); return null; } $url = $this->_build_url(); $this->view->assign('error', ''); if (isset($this->session->data['error'])) { $this->view->assign('error', $this->session->data['error']); unset($this->session->data['error']); } $this->document->addBreadcrumb(array('href' => $this->html->getSEOURL('product/product', $url . '&product_id=' . $product_id, '&encode'), 'text' => $product_info['name'], 'separator' => $this->language->get('text_separator'))); $this->document->setTitle($product_info['name']); $this->document->setKeywords($product_info['meta_keywords']); $this->document->setDescription($product_info['meta_description']); $this->document->addLink(array('href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, '&encode'), 'rel' => 'canonical')); $this->data['heading_title'] = $product_info['name']; $this->data['minimum'] = $product_info['minimum']; $this->data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']); $this->data['maximum'] = $product_info['maximum']; $this->data['text_maximum'] = sprintf($this->language->get('text_maximum'), $product_info['maximum']); $this->data['option_resources_url'] = $this->html->getURL('r/product/product/get_option_resources'); $this->data['calc_total_url'] = $this->html->getURL('r/product/product/calculateTotal'); $this->data['product_review_url'] = $this->html->getURL('product/review/review', '&product_id=' . $product_id); $this->data['product_review_write_url'] = $this->html->getURL('product/review/write', '&product_id=' . $product_id); $this->data['product_wishlist_add_url'] = $this->html->getURL('product/wishlist/add', '&product_id=' . $product_id); $this->data['product_wishlist_remove_url'] = $this->html->getURL('product/wishlist/remove', '&product_id=' . $product_id); $this->data['captcha_url'] = $this->html->getURL('common/captcha'); $this->loadModel('catalog/review'); $this->data['tab_review'] = sprintf($this->language->get('tab_review'), $this->model_catalog_review->getTotalReviewsByProductId($product_id)); if ($this->config->get('enable_reviews')) { $average = $this->model_catalog_review->getAverageRating($product_id); } else { $average = false; } $this->data['review_status'] = $this->config->get('enable_reviews'); $this->data['text_stars'] = sprintf($this->language->get('text_stars'), $average); $this->data['rating_element'] = HtmlElementFactory::create(array('type' => 'rating', 'name' => 'rating', 'value' => '', 'options' => array(1 => 1, 2, 3, 4, 5), 'pack' => true)); $this->data['review_name'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'name')); $this->data['review_text'] = HtmlElementFactory::create(array('type' => 'textarea', 'name' => 'text', 'attr' => ' rows="8" cols="50" ')); $this->data['review_captcha'] = HtmlElementFactory::create(array('type' => 'input', 'name' => 'captcha', 'attr' => '')); $this->data['review_button'] = HtmlElementFactory::create(array('type' => 'button', 'name' => 'review_submit', 'text' => $this->language->get('button_submit'), 'style' => 'btn-primary', 'icon' => 'fa fa-comment')); $this->data['product_info'] = $product_info; $form = new AForm(); $form->setForm(array('form_name' => 'product')); $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'product', 'action' => $this->html->getSecureURL('checkout/cart'))); $product_price = $product_info['price']; $discount = $promoton->getProductDiscount($product_id); if ($discount) { $product_price = $discount; $this->data['price_num'] = $this->tax->calculate($discount, $product_info['tax_class_id'], (bool) $this->config->get('config_tax')); $this->data['special'] = FALSE; } else { $this->data['price_num'] = $this->tax->calculate($product_info['price'], $product_info['tax_class_id'], (bool) $this->config->get('config_tax')); $special = $promoton->getProductSpecial($product_id); if ($special) { $product_price = $special; $this->data['special_num'] = $this->tax->calculate($special, $product_info['tax_class_id'], (bool) $this->config->get('config_tax')); } else { $this->data['special'] = FALSE; } } $this->data['price'] = $this->currency->format($this->data['price_num']); if (isset($this->data['special_num'])) { $this->data['special'] = $this->currency->format($this->data['special_num']); } $product_discounts = $promoton->getProductDiscounts($product_id); $discounts = array(); foreach ($product_discounts as $discount) { $discounts[] = array('quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], (bool) $this->config->get('config_tax')))); } $this->data['discounts'] = $discounts; $this->data['product_price'] = $product_price; $this->data['tax_class_id'] = $product_info['tax_class_id']; if (!$product_info['call_to_order']) { $this->data['form']['minimum'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'quantity', 'value' => $product_info['minimum'] ? (int) $product_info['minimum'] : 1, 'style' => 'short', 'attr' => ' size="3" ')); $this->data['form']['add_to_cart'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'add_to_cart', 'text' => $this->language->get('button_add_to_cart'), 'style' => 'button1')); } $this->data['form']['product_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'product_id', 'value' => $product_id)); $this->data['form']['redirect'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'redirect', 'value' => $this->html->getURL('product/product', $url . '&product_id=' . $product_id, '&encode'))); $this->data['model'] = $product_info['model']; $this->data['manufacturer'] = $product_info['manufacturer']; $this->data['manufacturers'] = $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $product_info['manufacturer_id'], '&encode'); $this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8'); $this->data['product_id'] = $product_id; $this->data['average'] = $average; $resource = new AResource('image'); $thumbnail = $resource->getMainThumb('manufacturers', $product_info['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true); if (!preg_match('/no_image/', $thumbnail['thumb_url'])) { $this->data['manufacturer_icon'] = $thumbnail['thumb_url']; } // Preapare options and values for display $elements_with_options = HtmlElementFactory::getElementsWithOptions(); $options = array(); $product_options = $this->model_catalog_product->getProductOptions($product_id); //get info from cart if key presents $cart_product_info = array(); if ($key) { $cart_product_info = $this->cart->getProduct($this->request->get['key']); } foreach ($product_options as $option) { $values = array(); $name = $price = ''; $default_value = $cart_product_info['options'][$option['product_option_id']]; if ($option['element_type'] == 'R') { $default_value = is_array($default_value) ? current($default_value) : (string) $default_value; } $preset_value = $default_value; foreach ($option['option_value'] as $option_value) { $default_value = $option_value['default'] && !$default_value ? $option_value['product_option_value_id'] : $default_value; // for case when trying to add to cart withot required options. we get option-array back inside _GET if (has_value($this->request->get['option'][$option['product_option_id']])) { $default_value = $this->request->get['option'][$option['product_option_id']]; } $name = $option_value['name']; //check if we disable options based on out of stock setting if ($option_value['subtract'] && $this->config->get('config_nostock_autodisable') && $option_value['quantity'] <= 0) { continue; } //Apply option price modifier if ($option_value['prefix'] == '%') { $price = $this->tax->calculate($product_price * $option_value['price'] / 100, $product_info['tax_class_id'], (bool) $this->config->get('config_tax')); if ($price != 0) { $price = $this->currency->format($price); } else { $price = ''; } } else { $price = $this->tax->calculate($option_value['price'], $product_info['tax_class_id'], (bool) $this->config->get('config_tax')); if ($price != 0) { $price = $this->currency->format($price); } else { $price = ''; } } //Check stock and status $opt_stock_message = ''; if ($option_value['subtract']) { if ($option_value['quantity'] <= 0) { //show out of stock message $opt_stock_message = $product_info['stock_status']; } else { if ($this->config->get('config_stock_display')) { $opt_stock_message = $option_value['quantity'] . " " . $this->language->get('text_instock'); } } } $values[$option_value['product_option_value_id']] = $option_value['name'] . ' ' . $price . ' ' . $opt_stock_message; } //if not values are build, nothing to show if (count($values)) { $value = ''; //add price to option name if it is not element with options if (!in_array($option['element_type'], $elements_with_options)) { $option['name'] .= ' <small>' . $price . '</small>'; if ($opt_stock_message) { $option['name'] .= '<br />' . $opt_stock_message; } $value = $default_value ? $default_value : $name; } //set default selection is nothing selected if (!has_value($value)) { if (has_value($default_value)) { $value = $default_value; } else { if (in_array($option['element_type'], $elements_with_options) && $option['element_type'] != 'S') { //set first from the list to default reset($values); $value = key($values); } } } //for checkbox with empty value if ($value == '' && $option['element_type'] == 'C') { $value = 1; } $option_data = array('type' => $option['html_type'], 'name' => !in_array($option['element_type'], HtmlElementFactory::getMultivalueElements()) ? 'option[' . $option['product_option_id'] . ']' : 'option[' . $option['product_option_id'] . '][]', 'value' => $value, 'options' => $values, 'required' => $option['required'], 'placeholder' => $option['option_placeholder'], 'regexp_pattern' => $option['regexp_pattern'], 'error_text' => $option['error_text']); if ($option['element_type'] == 'C') { if (!in_array($value, array('0', '1'))) { $option_data['label_text'] = $value; } $option_data['checked'] = $preset_value ? true : false; } $options[] = array('name' => $option['name'], 'html' => $this->html->buildElement($option_data)); } } $this->data['options'] = $options; //handle stock messages // if track stock is off. no messages needed. if ($this->model_catalog_product->isStockTrackable($product_id)) { $total_quantity = $this->model_catalog_product->hasAnyStock($product_id); $this->data['track_stock'] = true; //out of stock if no quantity and no stick checkout is disabled if ($total_quantity <= 0 && !$this->config->get('config_stock_checkout')) { $this->data['in_stock'] = false; //show out of stock message $this->data['stock'] = $product_info['stock_status']; } else { $this->data['in_stock'] = true; if ($this->config->get('config_stock_display')) { $this->data['stock'] = $product_info['quantity']; } else { $this->data['stock'] = $this->language->get('text_instock'); } } //check if we need to disable product for no stock if ($this->config->get('config_nostock_autodisable') && $total_quantity <= 0) { //set available data $pd_identifiers = "ID: " . $product_id; $pd_identifiers .= empty($product_info['model']) ? '' : " Model: " . $product_info['model']; $pd_identifiers .= empty($product_info['sku']) ? '' : " SKU: " . $product_info['sku']; $message_ttl = sprintf($this->language->get('notice_out_of_stock_ttl'), $product_info['name']); $message_txt = sprintf($this->language->get('notice_out_of_stock_body'), $product_info['name'], $pd_identifiers); //record to message box $msg = new AMessage(); $msg->saveNotice($message_ttl, $message_txt); $this->model_catalog_product->updateStatus($product_id, 0); $this->redirect($this->html->getSEOURL('product/product', '&product_id=' . $product_info['product_id'], '&encode')); } } // main product image $sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height'))); $this->data['image_main'] = $resource->getResourceAllObjects('products', $product_id, $sizes, 1, false); if ($this->data['image_main']) { $this->data['image_main']['sizes'] = $sizes; } // additional images $sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_additional_width'), 'height' => $this->config->get('config_image_additional_height'))); $this->data['images'] = $resource->getResourceAllObjects('products', $product_id, $sizes, 0, false); $products = array(); $results = $this->model_catalog_product->getProductRelated($product_id); foreach ($results as $result) { // related product image $sizes = array('main' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height')), 'thumb' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height'))); $image = $resource->getResourceAllObjects('products', $result['product_id'], $sizes, 1); if ($this->config->get('enable_reviews')) { $rating = $this->model_catalog_review->getAverageRating($result['product_id']); } else { $rating = false; } $special = FALSE; $discount = $promoton->getProductDiscount($result['product_id']); if ($discount) { $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], (bool) $this->config->get('config_tax'))); } else { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], (bool) $this->config->get('config_tax'))); $special = $promoton->getProductSpecial($result['product_id']); if ($special) { $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], (bool) $this->config->get('config_tax'))); } } $options = $this->model_catalog_product->getProductOptions($result['product_id']); if ($options) { $add = $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'); } else { if ($this->config->get('config_cart_ajax')) { $add = '#'; } else { $add = $this->html->getSecureURL('checkout/cart', '&product_id=' . $result['product_id'], '&encode'); } } $products[] = array('product_id' => $result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'price' => $price, 'call_to_order' => $result['call_to_order'], 'options' => $options, 'special' => $special, 'image' => $image, 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'), 'add' => $add); } $this->data['related_products'] = $products; if ($this->config->get('config_customer_price')) { $display_price = TRUE; } elseif ($this->customer->isLogged()) { $display_price = TRUE; } else { $display_price = FALSE; } $this->data['display_price'] = $display_price; $this->model_catalog_product->updateViewed($product_id); $tags = array(); $results = $this->model_catalog_product->getProductTags($product_id); foreach ($results as $result) { if ($result['tag']) { $tags[] = array('tag' => $result['tag'], 'href' => $this->html->getURL('product/search', '&keyword=' . $result['tag'], '&encode')); } } $this->data['tags'] = $tags; //downloads before order if allowed if ($this->config->get('config_download')) { $dwn = new ADownload(); $download_list = $dwn->getDownloadsBeforeOrder($product_id); if ($download_list) { foreach ($download_list as $download) { $href = $this->html->getURL('account/download/startdownload', '&download_id=' . $download['download_id']); $download['attributes'] = $this->download->getDownloadAttributesValuesForCustomer($download['download_id']); $download['button'] = $form->getFieldHtml(array('type' => 'button', 'id' => 'download_' . $download['download_id'], 'href' => $href, 'title' => $this->language->get('text_start_download'), 'text' => $this->language->get('text_start_download'))); $downloads[] = $download; } $this->data['downloads'] = $downloads; } } #check if product is in a wishlist $this->data['is_customer'] = false; if ($this->customer->isLogged() || $this->customer->isUnauthCustomer()) { $this->data['is_customer'] = true; $whishlist = $this->customer->getWishList(); if ($whishlist[$product_id]) { $this->data['in_wishlist'] = true; } } $this->view->setTemplate('pages/product/product.tpl'); $this->view->batchAssign($this->data); $this->processTemplate(); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }