本文整理汇总了PHP中AResource::getMainThumbList方法的典型用法代码示例。如果您正苦于以下问题:PHP AResource::getMainThumbList方法的具体用法?PHP AResource::getMainThumbList怎么用?PHP AResource::getMainThumbList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AResource
的用法示例。
在下文中一共展示了AResource::getMainThumbList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/product');
$this->loadModel('catalog/product');
$this->loadModel('tool/image');
//Clean up parametres if needed
if (isset($this->request->get['keyword']) && $this->request->get['keyword'] == $this->language->get('filter_product')) {
unset($this->request->get['keyword']);
}
if (isset($this->request->get['pfrom']) && $this->request->get['pfrom'] == 0) {
unset($this->request->get['pfrom']);
}
if (isset($this->request->get['pto']) && $this->request->get['pto'] == $this->language->get('filter_price_max')) {
unset($this->request->get['pto']);
}
//Prepare filter config
$filter_params = array('category', 'status', 'keyword', 'match', 'pfrom', 'pto');
$grid_filter_params = array('name', 'sort_order', 'model');
$filter_form = new AFilter(array('method' => 'get', 'filter_params' => $filter_params));
$filter_grid = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params));
$data = array_merge($filter_form->getFilterData(), $filter_grid->getFilterData());
$total = $this->model_catalog_product->getTotalProducts($data);
$response = new stdClass();
$response->page = $filter_grid->getParam('page');
$response->total = $filter_grid->calcTotalPages($total);
$response->records = $total;
$response->userdata = new stdClass();
$response->userdata->classes = array();
$results = $this->model_catalog_product->getProducts($data);
$product_ids = array();
foreach ($results as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
$i = 0;
foreach ($results as $result) {
$thumbnail = $thumbnails[$result['product_id']];
$response->rows[$i]['id'] = $result['product_id'];
if (dateISO2Int($result['date_available']) > time()) {
$response->userdata->classes[$result['product_id']] = 'warning';
}
if ($result['call_to_order'] > 0) {
$price = $this->language->get('text_call_to_order');
} else {
$price = $this->html->buildInput(array('name' => 'price[' . $result['product_id'] . ']', 'value' => moneyDisplayFormat($result['price'])));
}
$response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $this->html->buildInput(array('name' => 'product_description[' . $result['product_id'] . '][name]', 'value' => $result['name'])), $this->html->buildInput(array('name' => 'model[' . $result['product_id'] . ']', 'value' => $result['model'])), $price, $this->html->buildInput(array('name' => 'quantity[' . $result['product_id'] . ']', 'value' => $result['quantity'])), $this->html->buildCheckbox(array('name' => 'status[' . $result['product_id'] . ']', 'value' => $result['status'], 'style' => 'btn_switch')));
$i++;
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->setOutput(AJson::encode($response));
}
示例2: main
public function main()
{
if ($this->html_cache()) {
return;
}
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('blocks/manufacturer');
$this->view->assign('heading_title', $this->language->get('heading_title', 'blocks/manufacturer'));
$this->view->assign('text_select', $this->language->get('text_select'));
$resource = new AResource('image');
//For product page show only brand icon
if (isset($this->request->get['product_id']) && is_int($this->request->get['product_id'])) {
$product_id = $this->request->get['product_id'];
$this->view->assign('product_id', $product_id);
$result = $this->model_catalog_manufacturer->getManufacturerByProductId($product_id);
$manuf_detls = $result[0];
$thumbnail = $resource->getMainThumb('manufacturers', $manuf_detls['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'));
$manufacturer = array('manufacturer_id' => $manuf_detls['manufacturer_id'], 'name' => $manuf_detls['name'], 'href' => $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $manuf_detls['manufacturer_id'], '&encode'), 'icon' => $thumbnail['thumb_url']);
$this->view->assign('manufacturer', $manufacturer);
} else {
if (isset($this->request->get['manufacturer_id']) && is_int($this->request->get['manufacturer_id'])) {
$manufacturer_id = $this->request->get['manufacturer_id'];
} else {
$manufacturer_id = 0;
}
$this->view->assign('manufacturer_id', $manufacturer_id);
$this->loadModel('catalog/manufacturer');
$manufacturers = $manufacturer_ids = array();
$results = $this->model_catalog_manufacturer->getManufacturers();
foreach ($results as $result) {
$manufacturer_ids[] = (int) $result['manufacturer_id'];
}
$thumbnails = $resource->getMainThumbList('manufacturers', $manufacturer_ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
foreach ($results as $result) {
$thumbnail = $thumbnails[$result['manufacturer_id']];
$manufacturers[] = array('manufacturer_id' => $result['manufacturer_id'], 'name' => $result['name'], 'href' => $this->html->getSEOURL('product/manufacturer', '&manufacturer_id=' . $result['manufacturer_id'], '&encode'), 'icon' => $thumbnail);
}
$this->view->assign('manufacturers', $manufacturers);
}
// framed needs to show frames for generic block.
//If tpl used by listing block framed was set by listing block settings
$this->view->assign('block_framed', true);
$this->processTemplate('blocks/manufacturer.tpl');
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例3: main
public function main()
{
$request = $this->request->get;
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
//HTML cache only for non-customer
if (!$this->customer->isLogged() && !$this->customer->isUnauthCustomer()) {
$allowed_cache_keys = array('path');
$cache_val = array('path' => $request['path']);
$this->buildHTMLCacheKey($allowed_cache_keys, $cache_val);
if ($this->html_cache()) {
return;
}
}
$this->view->assign('heading_title', $this->language->get('heading_title', 'blocks/category'));
$this->loadModel('catalog/category');
if (isset($request['path'])) {
$this->path = explode('_', $request['path']);
$this->category_id = end($this->path);
}
$this->view->assign('selected_category_id', $this->category_id);
$this->view->assign('path', $request['path']);
//load main lavel categories
$all_categories = $this->model_catalog_category->getAllCategories();
//build thumbnails list
$category_ids = array();
foreach ($all_categories as $category) {
$category_ids[] = $category['category_id'];
}
$resource = new AResource('image');
$this->thumbnails = $resource->getMainThumbList('categories', $category_ids, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
//Build category tree
$this->_buildCategoryTree($all_categories);
$categories = $this->_buildNestedCategoryList();
$this->view->assign('categories', $categories);
//Framed needs to show frames for generic block.
//If tpl used by listing block framed was set by listing block settings
$this->view->assign('block_framed', true);
$this->view->assign('home_href', $this->html->getSEOURL('index/home'));
$this->processTemplate();
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例4: products
public function products()
{
$products = array();
$products_data = array();
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('catalog/product');
if (isset($this->request->post['coupon_product'])) {
$products = $this->request->post['coupon_product'];
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
$products_data[] = array('id' => $product_info['product_id'], 'name' => $product_info['name'], 'meta' => $product_info['model'], 'sort_order' => (int) $product_info['sort_order']);
}
}
} else {
if (isset($this->request->post['term'])) {
$filter = array('limit' => 20, 'content_language_id' => $this->session->data['content_language_id'], 'filter' => array('keyword' => $this->request->post['term'], 'match' => 'all'));
$products = $this->model_catalog_product->getProducts($filter);
$product_ids = array();
foreach ($products as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
foreach ($products as $pdata) {
$thumbnail = $thumbnails[$pdata['product_id']];
if ($this->request->get['currency_code']) {
$price = round($this->currency->convert($pdata['price'], $this->config->get('config_currency'), $this->request->get['currency_code']), 2);
} else {
$price = $pdata['price'];
}
$frmt_price = $this->currency->format($pdata['price'], $this->request->get['currency_code'] ? $this->request->get['currency_code'] : $this->config->get('config_currency'));
$products_data[] = array('image' => $thumbnail['thumb_html'], 'id' => $pdata['product_id'], 'name' => $pdata['name'] . ' - ' . $frmt_price, 'price' => $price, 'meta' => $pdata['model'], 'sort_order' => (int) $pdata['sort_order']);
}
}
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($products_data));
}
示例5: getCategories
public function getCategories($parent_categ_id = 0)
{
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('catalog/category');
$results = $this->model_catalog_category->getCategories($parent_categ_id);
$category_ids = array();
foreach ($results as $result) {
$category_ids[] = (int) $result['category_id'];
}
//get thumbnails by one pass
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('categories', $category_ids, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
foreach ($results as $result) {
$thumbnail = $thumbnails[$result['category_id']];
$categories[] = array('name' => $result['name'], 'category_id' => $result['category_id'], 'sort_order' => $result['sort_order'], 'thumb' => $thumbnail['thumb_url']);
}
$this->extensions->hk_UpdateData($this, __FUNCTION__);
return $categories;
}
示例6: get
public function get()
{
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('catalog/product');
$filter_data = array('method' => 'get');
$filter = new AFilter($filter_data);
$filters = $filter->getFilterData();
$results = $this->model_catalog_product->getLatestProducts($filters['limit']);
$response = new stdClass();
$response->page = $filter->getParam('page');
$response->total = $total_pages;
$response->records = $filters['limit'];
$response->limit = $filters['limit'];
$response->sidx = $filters['sort'];
$response->sord = $filters['order'];
$response->params = $filters;
$i = 0;
if ($results) {
$product_ids = array();
foreach ($results as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
foreach ($results as $result) {
$thumbnail = $thumbnails[$result['product_id']];
$response->rows[$i]['id'] = $result['product_id'];
$response->rows[$i]['cell']['thumb'] = $thumbnail['thumb_url'];
$response->rows[$i]['cell']['name'] = $result['name'];
$response->rows[$i]['cell']['description'] = $result['description'];
$response->rows[$i]['cell']['model'] = $result['model'];
$response->rows[$i]['cell']['price'] = $this->currency->convert($result['final_price'], $this->config->get('config_currency'), $this->currency->getCode());
$response->rows[$i]['cell']['currency_code'] = $this->currency->getCode();
$response->rows[$i]['cell']['rating'] = $result['rating'];
$i++;
}
}
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->rest->setResponseData($response);
$this->rest->sendResponse(200);
}
示例7: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/review');
$this->loadModel('catalog/review');
$this->loadModel('tool/image');
//Prepare filter config
$filter_params = array('product_id', 'status');
$grid_filter_params = array('name', 'author');
$filter_form = new AFilter(array('method' => 'get', 'filter_params' => $filter_params));
$filter_grid = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params));
$total = $this->model_catalog_review->getTotalReviews(array_merge($filter_form->getFilterData(), $filter_grid->getFilterData()));
$response = new stdClass();
$response->page = $filter_grid->getParam('page');
$response->total = $filter_grid->calcTotalPages($total);
$response->records = $total;
$results = $this->model_catalog_review->getReviews(array_merge($filter_form->getFilterData(), $filter_grid->getFilterData()));
$product_ids = array();
foreach ($results as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
$i = 0;
foreach ($results as $result) {
$thumbnail = $thumbnails[$result['product_id']];
$response->rows[$i]['id'] = $result['review_id'];
$response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $result['name'], $result['author'], $result['rating'], $this->html->buildCheckbox(array('name' => 'status[' . $result['review_id'] . ']', 'value' => $result['status'], 'style' => 'btn_switch')), dateISO2Display($result['date_added'], $this->language->get('date_format_short')));
$i++;
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->setOutput(AJson::encode($response));
}
示例8: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (isset($this->request->get['order_id'])) {
$order_id = (int) $this->request->get['order_id'];
} else {
$order_id = 0;
}
$this->loadModel('account/order');
$guest = false;
if (isset($this->request->get['ot']) && $this->config->get('config_guest_checkout')) {
//try to decrypt order token
$ot = $this->request->get['ot'];
$decrypted = AEncryption::mcrypt_decode($ot);
list($order_id, $email) = explode('~~~', $decrypted);
$order_id = (int) $order_id;
if (!$decrypted || !$order_id || !$email) {
if ($order_id) {
$this->session->data['redirect'] = $this->html->getSecureURL('account/invoice', '&order_id=' . $order_id);
}
$this->redirect($this->html->getSecureURL('account/login'));
}
$order_info = $this->model_account_order->getOrder($order_id, '', 'view');
//compare emails
if ($order_info['email'] != $email) {
$this->redirect($this->html->getSecureURL('account/login'));
}
$guest = true;
}
if ($this->request->is_POST() && $this->_validate()) {
$guest = true;
$order_id = $this->request->post['order_id'];
$email = $this->request->post['email'];
$ot = AEncryption::mcrypt_encode($order_id . '~~~' . $email);
$order_info = $this->model_account_order->getOrder($order_id, '', 'view');
//compare emails
if ($order_info['email'] != $email) {
unset($order_info, $order_id, $email);
}
}
$this->view->assign('error', $this->error);
if (!$this->customer->isLogged() && !$guest) {
$this->session->data['redirect'] = $this->html->getSecureURL('account/invoice', '&order_id=' . $order_id);
$this->getForm();
return null;
}
if (!$order_id && $this->customer->isLogged()) {
$this->redirect($this->html->getSecureURL('account/history'));
}
//get info for registered customers
if (!$order_info) {
$order_info = $this->model_account_order->getOrder($order_id);
}
$this->document->setTitle($this->language->get('heading_title'));
$this->document->resetBreadcrumbs();
$this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => false));
$this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator')));
if (!$guest) {
$this->document->addBreadcrumb(array('href' => $this->html->getURL('account/history'), 'text' => $this->language->get('text_history'), 'separator' => $this->language->get('text_separator')));
}
$this->document->addBreadcrumb(array('href' => $this->html->getURL('account/invoice', '&order_id=' . $order_id), 'text' => $this->language->get('text_invoice'), 'separator' => $this->language->get('text_separator')));
$this->data['success'] = '';
if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
}
if ($order_info) {
$this->data['order_id'] = $order_id;
$this->data['invoice_id'] = $order_info['invoice_id'] ? $order_info['invoice_prefix'] . $order_info['invoice_id'] : '';
$this->data['email'] = $order_info['email'];
$this->data['telephone'] = $order_info['telephone'];
$this->data['fax'] = $order_info['fax'];
$this->data['status'] = $this->model_account_order->getOrderStatus($order_id);
$shipping_data = array('firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country']);
$this->data['shipping_address'] = $this->customer->getFormattedAddress($shipping_data, $order_info['shipping_address_format']);
$this->data['shipping_method'] = $order_info['shipping_method'];
$payment_data = array('firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country']);
$this->data['payment_address'] = $this->customer->getFormattedAddress($payment_data, $order_info['payment_address_format']);
$this->data['payment_method'] = $order_info['payment_method'];
$products = array();
$order_products = $this->model_account_order->getOrderProducts($order_id);
$product_ids = array();
foreach ($order_products as $product) {
$product_ids[] = (int) $product['product_id'];
}
//get thumbnails by one pass
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_width'), false);
foreach ($order_products as $product) {
$options = $this->model_account_order->getOrderOptions($order_id, $product['order_product_id']);
$thumbnail = $thumbnails[$product['product_id']];
$option_data = array();
foreach ($options as $option) {
if ($option['element_type'] == 'H') {
continue;
}
//hide hidden options
$value = $option['value'];
$title = '';
//.........这里部分代码省略.........
示例9: getCustomListingSubForm
public function getCustomListingSubForm()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->load->library('json');
$lm = new ALayoutManager();
$form_name = has_value($this->request->get['form_name']) ? $this->request->get['form_name'] : 'BlockFrm';
$custom_block_id = (int) $this->request->get['custom_block_id'];
$listing_datasource = $this->request->post_or_get('listing_datasource');
// need to get data of custom listing
if ($custom_block_id) {
$content = $lm->getBlockDescriptions($custom_block_id);
$content = $content[$this->language->getContentLanguageID()]['content'];
$content = unserialize($content);
if ($content['listing_datasource'] == $listing_datasource) {
$lm = new AListingManager($custom_block_id);
$list = $lm->getCustomList();
$options_list = array();
if ($list) {
foreach ($list as $row) {
$options_list[(int) $row['id']] = array();
}
$ids = array_keys($options_list);
switch ($listing_datasource) {
case 'custom_products':
$this->loadModel('catalog/product');
$filter = array('subsql_filter' => 'p.product_id in (' . implode(',', $ids) . ')');
$results = $this->model_catalog_product->getProducts($filter);
$id_name = 'product_id';
$rl_object_name = 'products';
break;
case 'custom_categories':
$this->loadModel('catalog/category');
$filter = array('subsql_filter' => 'c.category_id in (' . implode(',', $ids) . ')');
$results = $this->model_catalog_category->getCategoriesData($filter);
$id_name = 'category_id';
$rl_object_name = 'categories';
break;
case 'custom_manufacturers':
$this->loadModel('catalog/manufacturer');
$filter = array('subsql_filter' => 'm.manufacturer_id in (' . implode(',', $ids) . ')');
$results = $this->model_catalog_manufacturer->getManufacturers($filter);
$id_name = 'manufacturer_id';
$rl_object_name = 'manufacturers';
break;
}
//get thumbnails by one pass
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList($rl_object_name, $ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'), false);
foreach ($results as $item) {
$id = $item[$id_name];
if (in_array($id, $ids)) {
$thumbnail = $thumbnails[$id];
$icon = $thumbnail['thumb_html'] ? $thumbnail['thumb_html'] : '<i class="fa fa-code fa-4x"></i> ';
$options_list[$id] = array('image' => $icon, 'id' => $id, 'name' => $item['name'], 'meta' => $item['model'], 'sort_order' => (int) $item['sort_order']);
}
}
}
}
}
switch ($listing_datasource) {
case 'custom_products':
$ajax_url = $this->html->getSecureURL('r/product/product/products');
break;
case 'custom_categories':
$ajax_url = $this->html->getSecureURL('r/listing_grid/category/categories');
break;
case 'custom_manufacturers':
$ajax_url = $this->html->getSecureURL('r/listing_grid/manufacturer/manufacturers');
break;
}
$form = new AForm('ST');
$form->setForm(array('form_name' => $form_name));
$multivalue_html = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'selected[]', 'value' => $ids, 'options' => $options_list, 'style' => 'chosen', 'ajax_url' => $ajax_url, 'placeholder' => $this->language->get('text_select_from_lookup')));
$this->view->assign('multivalue_html', $multivalue_html);
$this->view->assign('form_name', $form_name);
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->processTemplate('responses/design/block_custom_listing_subform.tpl');
}
示例10: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
//is this an embed mode
$cart_rt = 'checkout/cart';
if ($this->config->get('embed_mode') == true) {
$cart_rt = 'r/checkout/cart/embed';
}
if (!$this->cart->hasProducts() || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
$this->redirect($this->html->getSecureURL($cart_rt));
}
//validate if order min/max are met
if (!$this->cart->hasMinRequirement() || !$this->cart->hasMaxRequirement()) {
$this->redirect($this->html->getSecureURL($cart_rt));
}
if ($this->customer->isLogged()) {
$this->redirect($this->html->getSecureURL('checkout/shipping'));
}
if (!isset($this->session->data['guest'])) {
$this->redirect($this->html->getSecureURL('checkout/guest_step_1'));
}
if ($this->cart->hasShipping()) {
if (!isset($this->session->data['shipping_method'])) {
$this->redirect($this->html->getSecureURL('checkout/guest_step_2'));
}
} else {
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
//$this->tax->setZone($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
$this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
}
if (!isset($this->session->data['payment_method'])) {
$this->redirect($this->html->getSecureURL('checkout/guest_step_2'));
}
$this->loadLanguage('checkout/confirm');
$this->document->setTitle($this->language->get('heading_title'));
//build and save order
$this->data = array();
$order = new AOrder($this->registry);
$this->data = $order->buildOrderData($this->session->data);
$this->session->data['order_id'] = $order->saveOrder();
$this->document->resetBreadcrumbs();
$this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getURL($cart_rt), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator')));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_1'), 'text' => $this->language->get('text_guest_step_1'), 'separator' => $this->language->get('text_separator')));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_2'), 'text' => $this->language->get('text_guest_step_2'), 'separator' => $this->language->get('text_separator')));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_3'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')));
$this->view->assign('error_warning', $this->error['warning']);
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
if ($this->cart->hasShipping()) {
if (isset($this->session->data['guest']['shipping'])) {
$shipping_address = $this->session->data['guest']['shipping'];
} else {
$shipping_address = $this->session->data['guest'];
}
$this->data['shipping_address'] = $this->customer->getFormattedAddress($shipping_address, $shipping_address['address_format']);
} else {
$this->data['shipping_address'] = '';
}
if (isset($this->session->data['shipping_method']['title'])) {
$this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
} else {
$this->data['shipping_method'] = '';
}
$this->data['checkout_shipping'] = $this->html->getSecureURL('checkout/guest_step_2');
$this->data['checkout_shipping_edit'] = $this->html->getSecureURL('checkout/guest_step_2', '&mode=edit', true);
$this->data['checkout_shipping_address'] = $this->html->getSecureURL('checkout/guest_step_1');
$payment_address = $this->session->data['guest'];
if ($payment_address) {
$this->data['payment_address'] = $this->customer->getFormattedAddress($payment_address, $payment_address['address_format']);
} else {
$this->data['payment_address'] = '';
}
if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
$this->data['payment_method'] = $this->session->data['payment_method']['title'];
} else {
$this->data['payment_method'] = '';
}
$this->data['checkout_payment'] = $this->html->getSecureURL('checkout/guest_step_2');
$this->data['checkout_payment_edit'] = $this->html->getSecureURL('checkout/guest_step_2', '&mode=edit', true);
$this->data['cart'] = $this->html->getSecureURL($cart_rt);
$this->data['checkout_payment_address'] = $this->html->getSecureURL('checkout/guest_step_1');
$this->loadModel('tool/seo_url');
$product_ids = array();
foreach ($this->data['products'] as $result) {
$product_ids[] = (int) $result['product_id'];
}
//Format product data specific for confirmation page
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
for ($i = 0; $i < sizeof($this->data['products']); $i++) {
$product_id = $this->data['products'][$i]['product_id'];
$thumbnail = $thumbnails[$product_id];
$tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
$this->data['products'][$i] = array_merge($this->data['products'][$i], array('thumb' => $thumbnail, 'tax' => $this->currency->format($tax), 'price' => $this->currency->format($this->data['products'][$i]['price']), 'total' => $this->currency->format($this->data['products'][$i]['total']), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, true)));
}
//.........这里部分代码省略.........
示例11: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/product');
$this->document->setTitle($this->language->get('heading_title'));
$this->loadModel('catalog/product');
if (isset($this->request->get['product_id']) && $this->request->is_GET()) {
$product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
if (!$product_info) {
$this->session->data['warning'] = $this->language->get('error_product_not_found');
$this->redirect($this->html->getSecureURL('catalog/product'));
}
}
if ($this->request->is_POST()) {
$this->model_catalog_product->updateProductLinks($this->request->get['product_id'], $this->request->post);
$this->session->data['success'] = $this->language->get('text_success');
$this->redirect($this->html->getSecureURL('catalog/product_relations', '&product_id=' . $this->request->get['product_id']));
}
$this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
$this->view->assign('error_warning', $this->error['warning']);
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('text_edit') . ' ' . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name'], 'separator' => ' :: '));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product_relations', '&product_id=' . $this->request->get['product_id']), 'text' => $this->language->get('tab_relations'), 'separator' => ' :: ', 'current' => true));
$this->loadModel('catalog/category');
$this->data['categories'] = array();
$results = $this->model_catalog_category->getCategories(0);
foreach ($results as $r) {
$this->data['categories'][$r['category_id']] = $r['name'];
}
$this->loadModel('setting/store');
$this->data['stores'] = array(0 => $this->language->get('text_default'));
$results = $this->model_setting_store->getStores();
foreach ($results as $r) {
$this->data['stores'][$r['store_id']] = $r['name'];
}
$this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
$this->data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
$this->data['product_related'] = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
$this->data['active'] = 'relations';
//load tabs controller
$tabs_obj = $this->dispatch('pages/catalog/product_tabs', array($this->data));
$this->data['product_tabs'] = $tabs_obj->dispatchGetOutput();
unset($tabs_obj);
$this->data['category_products'] = $this->html->getSecureURL('product/product/category');
$this->data['related_products'] = $this->html->getSecureURL('product/product/related');
$this->data['action'] = $this->html->getSecureURL('catalog/product_relations', '&product_id=' . $this->request->get['product_id']);
$this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_product');
$this->data['update'] = $this->html->getSecureURL('listing_grid/product/update_relations_field', '&id=' . $this->request->get['product_id']);
$form = new AForm('HS');
$form->setForm(array('form_name' => 'productFrm', 'update' => $this->data['update']));
$this->data['form']['id'] = 'productFrm';
$this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'productFrm', 'action' => $this->data['action'], 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"'));
$this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1'));
$this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $this->request->get['product_id']), 'name' => 'cancel', 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
$this->data['cancel'] = $this->html->getSecureURL('catalog/product');
$this->loadModel('catalog/category');
$this->data['categories'] = array();
$results = $this->model_catalog_category->getCategories(0);
foreach ($results as $r) {
$this->data['categories'][$r['category_id']] = $r['name'];
}
$this->data['form']['fields']['category'] = $form->getFieldHtml(array('type' => 'checkboxgroup', 'name' => 'product_category[]', 'value' => $this->data['product_category'], 'options' => $this->data['categories'], 'style' => 'chosen', 'placeholder' => $this->language->get('text_select_category')));
//load only prior saved products
$resource = new AResource('image');
$this->data['products'] = array();
if (count($this->data['product_related'])) {
$this->loadModel('catalog/product');
$filter = array('subsql_filter' => 'p.product_id in (' . implode(',', $this->data['product_related']) . ')');
$results = $this->model_catalog_product->getProducts($filter);
$product_ids = array();
foreach ($results as $result) {
$product_ids[] = (int) $result['product_id'];
}
//get thumbnails by one pass
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
foreach ($results as $r) {
$thumbnail = $thumbnails[$r['product_id']];
$this->data['products'][$r['product_id']]['name'] = $r['name'] . " (" . $r['model'] . ")";
$this->data['products'][$r['product_id']]['image'] = $thumbnail['thumb_html'];
}
}
$this->data['form']['fields']['related'] = $form->getFieldHtml(array('type' => 'multiselectbox', 'name' => 'product_related[]', 'value' => $this->data['product_related'], 'options' => $this->data['products'], 'style' => 'chosen', 'ajax_url' => $this->html->getSecureURL('r/product/product/products'), 'placeholder' => $this->language->get('text_select_from_lookup')));
$this->data['form']['fields']['store'] = $form->getFieldHtml(array('type' => 'checkboxgroup', 'name' => 'product_store[]', 'value' => $this->data['product_store'], 'options' => $this->data['stores'], 'style' => 'chosen'));
if ($this->config->get('config_embed_status')) {
$this->data['embed_url'] = $this->html->getSecureURL('common/do_embed/product', '&product_id=' . $this->request->get['product_id']);
}
$this->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
$this->view->assign('help_url', $this->gen_help_url('product_relations'));
$this->view->batchAssign($this->data);
$this->processTemplate('pages/catalog/product_relations.tpl');
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例12: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->html->getSecureURL('account/download');
$this->redirect($this->html->getSecureURL('account/login'));
}
//if disabled downloads redirect to
if (!$this->config->get('config_download')) {
$this->redirect($this->html->getSecureURL('account/account'));
}
$this->document->setTitle($this->language->get('heading_title'));
$this->document->resetBreadcrumbs();
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator')));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('account/download'), 'text' => $this->language->get('text_downloads'), 'separator' => $this->language->get('text_separator')));
if (isset($this->request->get['limit'])) {
$limit = (int) $this->request->get['limit'];
$limit = $limit > 50 ? 50 : $limit;
} else {
$limit = $this->config->get('config_catalog_limit');
}
if ($this->config->get('config_download')) {
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$downloads = array();
//get only enabled, not expired, which have remaining count > 0 and available
$customer_downloads = $this->download->getCustomerDownloads(($page - 1) * $limit, $limit);
$product_ids = array();
foreach ($customer_downloads as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'), false);
foreach ($customer_downloads as $download_info) {
$text_status = $this->download->getTextStatusForOrderDownload($download_info);
$size = filesize(DIR_RESOURCE . $download_info['filename']);
$i = 0;
$suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
while ($size / 1024 > 1) {
$size = $size / 1024;
$i++;
}
if (!$text_status) {
$download_button = $this->html->buildElement(array('type' => 'button', 'name' => 'download_button_' . $download_info['order_download_id'], 'title' => $this->language->get('text_download'), 'text' => $this->language->get('text_download'), 'style' => 'button', 'href' => $this->html->getSecureURL('account/download/startdownload', '&order_download_id=' . $download_info['order_download_id']), 'icon' => 'fa fa-download-alt'));
} else {
$download_text = $text_status;
}
$thumbnail = $thumbnails[$download_info['product_id']];
$attributes = $this->download->getDownloadAttributesValuesForCustomer($download_info['download_id']);
$downloads[] = array('thumbnail' => $thumbnail, 'attributes' => $attributes, 'order_id' => $download_info['order_id'], 'date_added' => dateISO2Display($download_info['date_added'], $this->language->get('date_format_short')), 'name' => $download_info['name'], 'remaining' => $download_info['remaining_count'], 'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i], 'button' => $download_button, 'text' => $download_text, 'expire_date' => dateISO2Display($download_info['expire_date'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format_short')));
}
$this->data['downloads'] = $downloads;
$this->data['pagination_bootstrap'] = HtmlElementFactory::create(array('type' => 'Pagination', 'name' => 'pagination', 'text' => $this->language->get('text_pagination'), 'text_limit' => $this->language->get('text_per_page'), 'total' => sizeof($downloads), 'page' => $page, 'limit' => $limit, 'url' => $this->html->getURL('account/download&page={page}', '&encode'), 'style' => 'pagination'));
if ($downloads) {
$template = 'pages/account/download.tpl';
} else {
$template = 'pages/error/not_found.tpl';
}
} else {
$template = 'pages/error/not_found.tpl';
}
$continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button', 'icon' => 'fa fa-arrow-right', 'href' => $this->html->getSecureURL('account/account')));
$this->data['button_continue'] = $continue;
$this->view->batchAssign($this->data);
$this->processTemplate($template);
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例13: main
//.........这里部分代码省略.........
$this->redirect($this->html->getSecureURL($this->request->post['next_step']));
}
if (isset($this->request->post['redirect'])) {
$this->session->data['redirect'] = $this->request->post['redirect'];
}
if (isset($this->request->post['quantity']) || isset($this->request->post['remove'])) {
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
$this->redirect($this->html->getSecureURL($cart_rt));
}
}
}
}
$this->document->setTitle($this->language->get('heading_title'));
$this->document->resetBreadcrumbs();
$this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => false));
$this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/cart'), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator')));
if ($this->cart->hasProducts()) {
if (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
$error_msg[] = $this->language->get('error_stock');
}
$this->loadModel('tool/seo_url', 'storefront');
$form = new AForm();
$form->setForm(array('form_name' => 'cart'));
$this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'cart', 'action' => $this->html->getSecureURL($cart_rt)));
$cart_products = $this->cart->getProducts();
$product_ids = array();
foreach ($cart_products as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
$products = array();
foreach ($cart_products as $result) {
$option_data = array();
$thumbnail = $thumbnails[$result['product_id']];
foreach ($result['option'] as $option) {
$title = '';
if ($option['element_type'] == 'H') {
continue;
}
//hide hidden options
$value = $option['value'];
// hide binary value for checkbox
if ($option['element_type'] == 'C' && in_array($value, array(0, 1))) {
$value = '';
}
// strip long textarea value
if ($option['element_type'] == 'T') {
$title = strip_tags($value);
$title = str_replace('\\r\\n', "\n", $title);
$value = str_replace('\\r\\n', "\n", $value);
if (mb_strlen($value) > 64) {
$value = mb_substr($value, 0, 64) . '...';
}
}
$option_data[] = array('name' => $option['name'], 'value' => $value, 'title' => $title);
}
$products[] = array('remove' => $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'remove[' . $result['key'] . ']')), 'remove_url' => $this->html->getSecureURL($cart_rt, '&remove=' . $result['key']), 'key' => $result['key'], 'name' => $result['name'], 'model' => $result['model'], 'thumb' => $thumbnail, 'option' => $option_data, 'quantity' => $form->getFieldHtml(array('type' => 'input', 'name' => 'quantity[' . $result['key'] . ']', 'value' => $result['quantity'], 'attr' => ' size="3" ', 'style' => 'short')), 'stock' => $result['stock'], 'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))), 'total' => $this->currency->format($this->tax->calculate($result['total'], $result['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL($product_rt, '&key=' . $result['key'], true));
}
$this->data['products'] = $products;
$this->data['form']['update'] = $form->getFieldHtml(array('type' => 'submit', 'name' => $this->language->get('button_update')));
$this->data['form']['checkout'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'checkout', 'text' => $this->language->get('button_checkout'), 'style' => 'button'));
if ($this->config->get('config_cart_weight')) {
示例14: post
public function post()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$request = $this->rest->getRequestParams();
if (!$this->customer->isLoggedWithToken($request['token'])) {
$this->rest->sendResponse(401, array('error' => 'Not logged in or Login attempt failed!'));
return null;
}
if (!$this->cart->hasProducts()) {
//No products in the cart.
$this->rest->sendResponse(200, array('status' => 2, 'error' => 'Nothing in the cart!'));
return null;
}
if (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
//No stock for products in the cart if tracked.
$this->rest->sendResponse(200, array('status' => 3, 'error' => 'No stock for product!'));
return null;
}
if ($this->cart->hasShipping()) {
if (!isset($this->session->data['shipping_address_id']) || !$this->session->data['shipping_address_id']) {
//Problem. Missing shipping address
$this->rest->sendResponse(200, array('status' => 4, 'error' => 'Missing shipping address!'));
return null;
}
if (!isset($this->session->data['shipping_method'])) {
//Problem. Missing shipping address
$this->rest->sendResponse(200, array('status' => 5, 'error' => 'Missing shipping method!'));
return null;
}
} else {
unset($this->session->data['shipping_address_id']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
$this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
}
if (!isset($this->session->data['payment_address_id']) || !$this->session->data['payment_address_id']) {
$this->rest->sendResponse(200, array('status' => 6, 'error' => 'Missing payment (billing) address!'));
return null;
}
if (!isset($this->session->data['payment_method'])) {
$this->rest->sendResponse(200, array('status' => 5, 'error' => 'Missing payment (billing) method!'));
return null;
}
//build order and pre-save
$order = new AOrder($this->registry);
$this->data = $order->buildOrderData($this->session->data);
$this->session->data['order_id'] = $order->saveOrder();
//build confirmation data
$this->loadModel('account/address');
$shipping_address = $this->model_account_address->getAddress($this->session->data['shipping_address_id']);
if ($this->cart->hasShipping()) {
$this->data['shipping_address'] = $this->customer->getFormattedAddress($shipping_address, $shipping_address['address_format']);
} else {
$this->data['shipping_address'] = '';
}
$this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
$payment_address = $this->model_account_address->getAddress($this->session->data['payment_address_id']);
if ($payment_address) {
$this->data['payment_address'] = $this->customer->getFormattedAddress($payment_address, $payment_address['address_format']);
} else {
$this->data['payment_address'] = '';
}
if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
$this->data['payment_method'] = $this->session->data['payment_method']['title'];
} else {
$this->data['payment_method'] = '';
}
$this->loadModel('tool/seo_url');
$this->loadModel('tool/image');
$product_ids = array();
foreach ($this->data['products'] as $result) {
$product_ids[] = (int) $result['product_id'];
}
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
//Format product data specific for confirmation response
for ($i = 0; $i < sizeof($this->data['products']); $i++) {
$product_id = $this->data['products'][$i]['product_id'];
$thumbnail = $thumbnails[$product_id];
$tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
$this->data['products'][$i] = array_merge($this->data['products'][$i], array('thumb' => $thumbnail['thumb_url'], 'tax' => $this->currency->format($tax), 'price' => $this->currency->format($this->data['products'][$i]['price']), 'total' => $this->currency->format($this->data['products'][$i]['total'])));
}
if ($this->config->get('config_checkout_id')) {
$this->loadModel('catalog/content');
$content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
if ($content_info) {
$this->data['text_accept_agree'] = sprintf($this->language->get('text_accept_agree'), '', $content_info['title']);
} else {
$this->data['text_accept_agree'] = '';
}
} else {
$this->data['text_accept_agree'] = '';
}
// Load selected paymnet required data from payment extension
if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
$payment_controller = $this->dispatch('responses/extension/' . $this->session->data['payment_method']['id'] . '/api');
} else {
$payment_controller = $this->dispatch('responses/checkout/no_payment/api');
}
//.........这里部分代码省略.........
示例15: getWishList
private function getWishList()
{
$cart_rt = 'checkout/cart';
//is this an embed mode
if ($this->config->get('embed_mode') == true) {
$cart_rt = 'r/checkout/cart/embed';
}
$this->document->setTitle($this->language->get('heading_title'));
$this->document->resetBreadcrumbs();
$this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getURL('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator')));
$this->document->addBreadcrumb(array('href' => $this->html->getURL('account/wishlist'), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator')));
$whishlist = $this->customer->getWishList();
if ($whishlist) {
$this->loadModel('tool/seo_url');
$this->loadModel('catalog/product');
//get thumbnails by one pass
$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList('products', array_keys($whishlist), $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_width'));
$products = array();
foreach ($whishlist as $product_id => $timestamp) {
$product_info = $this->model_catalog_product->getProduct($product_id);
$thumbnail = $thumbnails[$product_id];
$options = $this->model_catalog_product->getProductOptions($product_id);
if ($options) {
$add = $this->html->getSEOURL('product/product', '&product_id=' . $product_id, '&encode');
} else {
$add = $this->html->getSecureURL($cart_rt, '&product_id=' . $product_id, '&encode');
}
$products[] = array('product_id' => $product_id, 'name' => $product_info['name'], 'model' => $product_info['model'], 'thumb' => $thumbnail, 'added' => dateInt2Display($timestamp), 'price' => $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, true), 'call_to_order' => $product_info['call_to_order'], 'add' => $add);
}
$this->data['products'] = $products;
if (isset($this->session->data['redirect'])) {
$this->data['continue'] = str_replace('&', '&', $this->session->data['redirect']);
unset($this->session->data['redirect']);
} else {
$this->data['continue'] = $this->html->getURL('index/home');
}
$this->view->assign('error', '');
if ($this->session->data['error']) {
$this->view->assign('error', $this->session->data['error']);
unset($this->session->data['error']);
}
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->view->setTemplate('pages/account/wishlist.tpl');
} else {
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_error'] = $this->language->get('text_empty_wishlist');
$this->data['button_continue'] = HtmlElementFactory::create(array('name' => 'continue', 'type' => 'button', 'text' => $this->language->get('button_continue'), 'href' => $this->html->getURL('index/home'), 'style' => 'button'));
$this->view->setTemplate('pages/error/not_found.tpl');
}
$this->data['cart'] = $this->html->getSecureURL($cart_rt);
$this->view->batchAssign($this->data);
$this->processTemplate();
}