本文整理汇总了PHP中AResource::getMainThumb方法的典型用法代码示例。如果您正苦于以下问题:PHP AResource::getMainThumb方法的具体用法?PHP AResource::getMainThumb怎么用?PHP AResource::getMainThumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AResource
的用法示例。
在下文中一共展示了AResource::getMainThumb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
$products = array();
$resource = new AResource('image');
foreach ($whishlist as $product_id => $timestamp) {
$product_info = $this->model_catalog_product->getProduct($product_id);
$thumbnail = $resource->getMainThumb('products', $product_id, (int) $this->config->get('config_image_cart_width'), (int) $this->config->get('config_image_cart_height'), true);
$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();
}
示例2: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('tool/seo_url');
$this->loadLanguage('total/total');
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_subtotal'] = $this->language->get('text_subtotal');
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['text_remove'] = $this->language->get('text_remove');
$this->data['text_confirm'] = $this->language->get('text_confirm');
$this->data['text_view'] = $this->language->get('text_view');
$this->data['text_checkout'] = $this->language->get('text_checkout');
$this->data['text_items'] = $this->language->get('text_items');
$this->data['text_total'] = $this->language->get('text_total');
$this->data['view'] = $this->html->getURL('checkout/cart');
$this->data['remove'] = $this->html->getURL('r/checkout/cart');
$this->data['checkout'] = $this->html->getURL('checkout/shipping');
$products = array();
$qty = 0;
$resource = new AResource('image');
foreach ($this->cart->getProducts() as $result) {
$option_data = array();
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_width'), true);
foreach ($result['option'] as $option) {
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);
}
$qty += $result['quantity'];
$products[] = array('key' => $result['key'], 'name' => $result['name'], 'option' => $option_data, 'quantity' => $result['quantity'], 'stock' => $result['stock'], 'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], true), 'thumb' => $thumbnail);
}
$this->data['products'] = $products;
$this->data['total_qty'] = $qty;
$display_totals = $this->cart->buildTotalDisplay();
$this->data['totals'] = $display_totals['total_data'];
$this->data['subtotal'] = $this->currency->format($display_totals['total']);
$this->data['taxes'] = $display_totals['taxes'];
$this->data['ajax'] = $this->config->get('cart_ajax');
$this->view->batchAssign($this->data);
$this->processTemplate();
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例3: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/product');
$this->loadModel('catalog/product');
$this->data['product'] = $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
$this->data['product']['product_id'] = '#' . $this->data['product']['product_id'];
$this->data['product']['price'] = $this->currency->format($this->data['product']['price']);
$this->data['product']['condition'] = $this->model_catalog_product->getProductCondition($this->request->get['product_id']);
$this->data['text_product_condition'] = $this->language->get('text_product_condition');
$this->data['text_product_available'] = $this->language->get('text_product_available');
$resource = new AResource('image');
$thumbnail = $resource->getMainThumb('products', $this->request->get['product_id'], $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'), true);
$this->data['product']['image'] = $thumbnail;
$this->data['product']['preview'] = $this->html->getCatalogURL('product/product', '&product_id=' . $product_info['product_id']);
$this->loadModel('sale/order');
$this->data['product']['orders'] = $this->model_sale_order->getOrderTotalWithProduct($product_info['product_id']);
$this->data['product']['orders_url'] = $this->html->getSecureURL('sale/order', '&product_id=' . $product_info['product_id']);
$this->view->assign('help_url', $this->gen_help_url('product_summary'));
$this->view->batchAssign($this->data);
$this->processTemplate('pages/catalog/product_summary.tpl');
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例4: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/manufacturer');
$this->loadModel('catalog/manufacturer');
$this->loadModel('tool/image');
//Prepare filter config
$grid_filter_params = array('name');
$filter = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params));
$filter_data = $filter->getFilterData();
$total = $this->model_catalog_manufacturer->getTotalManufacturers($filter_data);
$response = new stdClass();
$response->page = $filter->getParam('page');
$response->total = $filter->calcTotalPages($total);
$response->records = $total;
$results = $this->model_catalog_manufacturer->getManufacturers($filter_data);
$resource = new AResource('image');
$i = 0;
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('manufacturers', $result['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
$response->rows[$i]['id'] = $result['manufacturer_id'];
$response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $this->html->buildInput(array('name' => 'name[' . $result['manufacturer_id'] . ']', 'value' => $result['name'])), $this->html->buildInput(array('name' => 'sort_order[' . $result['manufacturer_id'] . ']', 'value' => $result['sort_order'])));
$i++;
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->setOutput(AJson::encode($response));
}
示例5: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->data['heading_title'] = $this->language->get('heading_title');
$this->loadModel('catalog/product');
$this->loadModel('catalog/review');
$this->loadModel('tool/seo_url');
$this->loadModel('tool/image');
$promoton = new APromotion();
$this->data['button_add_to_cart'] = $this->language->get('button_add_to_cart');
$this->data['products'] = array();
$results = $promoton->getProductSpecials('pd.name', 'ASC', 0, $this->config->get('config_special_limit'));
$resource = new AResource('image');
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), true);
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'], $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 = $promoton->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 = $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');
}
}
$this->data['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, 'thumb' => $thumbnail, 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'), 'add' => $add);
}
if ($this->config->get('config_customer_price')) {
$this->data['display_price'] = TRUE;
} elseif ($this->customer->isLogged()) {
$this->data['display_price'] = TRUE;
} else {
$this->data['display_price'] = FALSE;
}
$this->data['review_status'] = $this->config->get('enable_reviews');
// framed needs to show frames for generic block.
//If tpl used by listing block framed was set by listing block settings
$this->data['block_framed'] = true;
$this->view->batchAssign($this->data);
$this->processTemplate();
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例6: 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()));
$resource = new AResource('image');
$i = 0;
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'), true);
$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));
}
示例7: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/category');
$this->loadModel('catalog/category');
$this->loadModel('catalog/product');
$this->loadModel('tool/image');
//Prepare filter config
$grid_filter_params = array('name');
$filter = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params));
$filter_data = $filter->getFilterData();
//Add custom params
$filter_data['parent_id'] = isset($this->request->get['parent_id']) ? $this->request->get['parent_id'] : 0;
$new_level = 0;
//get all leave categories
$leafnodes = $this->model_catalog_category->getLeafCategories();
if ($this->request->post['nodeid']) {
$sort = $filter_data['sort'];
$order = $filter_data['order'];
//reset filter to get only parent category
$filter_data = array();
$filter_data['sort'] = $sort;
$filter_data['order'] = $order;
$filter_data['parent_id'] = (int) $this->request->post['nodeid'];
$new_level = (int) $this->request->post["n_level"] + 1;
}
$total = $this->model_catalog_category->getTotalCategories($filter_data);
$response = new stdClass();
$response->page = $filter->getParam('page');
$response->total = $filter->calcTotalPages($total);
$response->records = $total;
$response->userdata = new stdClass();
$results = $this->model_catalog_category->getCategoriesData($filter_data);
$i = 0;
$resource = new AResource('image');
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('categories', $result['category_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
$response->rows[$i]['id'] = $result['category_id'];
$cnt = $this->model_catalog_category->getCategoriesData(array('parent_id' => $result['category_id']), 'total_only');
if (!$result['products_count']) {
$products_count = $result['products_count'];
} else {
$products_count = $this->html->buildButton(array('name' => 'view products', 'text' => $result['products_count'], 'style' => 'button2', 'href' => $this->html->getSecureURL('catalog/product', '&category=' . $result['category_id']), 'title' => $this->language->get('text_view') . ' ' . $this->language->get('tab_product'), 'target' => '_blank'));
}
//tree grid structure
if ($this->config->get('config_show_tree_data')) {
$name_lable = '<label style="white-space: nowrap;">' . $result['basename'] . '</label>';
} else {
$name_lable = '<label style="white-space: nowrap;">' . str_replace($result['basename'], '', $result['name']) . '</label>' . $this->html->buildInput(array('name' => 'category_description[' . $result['category_id'] . '][' . $this->session->data['content_language_id'] . '][name]', 'value' => $result['basename'], 'attr' => ' maxlength="32" '));
}
$response->rows[$i]['cell'] = array($thumbnail['thumb_html'], $name_lable, $this->html->buildInput(array('name' => 'sort_order[' . $result['category_id'] . ']', 'value' => $result['sort_order'])), $this->html->buildCheckbox(array('name' => 'status[' . $result['category_id'] . ']', 'value' => $result['status'], 'style' => 'btn_switch')), $products_count, $cnt . ($cnt ? ' <a class="btn_action btn_grid grid_action_expand" href="#" rel="parent_id=' . $result['category_id'] . '" title="' . $this->language->get('text_view') . '">' . '<img src="' . RDIR_TEMPLATE . 'image/icons/icon_grid_expand.png" alt="' . $this->language->get('text_view') . '" /></a>' : ''), 'action', $new_level, $filter_data['parent_id'] ? $filter_data['parent_id'] : NULL, $result['category_id'] == $leafnodes[$result['category_id']] ? true : false, false);
$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__);
$this->loadLanguage('blocks/latest');
$this->view->assign('heading_title', $this->language->get('heading_title'));
$this->loadModel('catalog/product');
$this->loadModel('catalog/review');
$this->loadModel('tool/image');
$this->view->assign('button_add_to_cart', $this->language->get('button_add_to_cart'));
$this->data['products'] = array();
$results = $this->model_catalog_product->getLatestProducts($this->config->get('config_latest_limit'));
foreach ($results as $result) {
$product_ids[] = $result['product_id'];
}
$products_info = $this->model_catalog_product->getProductsAllInfo($product_ids);
$resource = new AResource('image');
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), true);
$rating = $products_info[$result['product_id']]['rating'];
$special = FALSE;
$discount = $products_info[$result['product_id']]['discount'];
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 = $products_info[$result['product_id']]['special'];
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
$options = $products_info[$result['product_id']]['options'];
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');
}
}
$this->data['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, 'thumb' => $thumbnail, 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode'), 'add' => $add);
}
$this->view->assign('products', $this->data['products']);
if ($this->config->get('config_customer_price')) {
$display_price = TRUE;
} elseif ($this->customer->isLogged()) {
$display_price = TRUE;
} else {
$display_price = FALSE;
}
$this->view->assign('block_framed', true);
$this->view->assign('display_price', $display_price);
$this->view->assign('review_status', $this->config->get('enable_reviews'));
$this->processTemplate();
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例9: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('blocks/manufacturer');
$this->view->assign('heading_title', $this->language->get('heading_title'));
$this->view->assign('text_select', $this->language->get('text_select'));
//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];
$resource = new AResource('image');
$thumbnail = $resource->getMainThumb('manufacturers', $manuf_detls['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
$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 = array();
$results = $this->model_catalog_manufacturer->getManufacturers();
$thumbnail_list = $this->cache->get('manufacturer.block.thumbnals', '', (int) $this->config->get('config_store_id'));
$is_cache_exists = $this->cache->exists('manufacturer.block.thumbnals', '', (int) $this->config->get('config_store_id'));
$resource = new AResource('image');
foreach ($results as $result) {
if (!$is_cache_exists) {
$thumbnail = $resource->getMainThumb('manufacturers', $result['manufacturer_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
$thumbnails_cache[$result['manufacturer_id']] = $thumbnail;
} else {
if (has_value($thumbnail_list[$result['manufacturer_id']])) {
$thumbnail = $thumbnail_list[$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);
}
if (!$is_cache_exists) {
$this->cache->set('manufacturer.block.thumbnals', $thumbnails_cache, '', (int) $this->config->get('config_store_id'));
}
$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__);
}
示例10: 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);
$resource = new AResource('image');
$i = 0;
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('products', $result['product_id'], (int) $this->config->get('config_image_grid_width'), (int) $this->config->get('config_image_grid_height'), true);
$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));
}
示例11: getCategories
public function getCategories($parent_categ_id = 0)
{
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('catalog/category');
$resource = new AResource('image');
$results = $this->model_catalog_category->getCategories($parent_categ_id);
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('categories', $result['category_id'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'), true);
$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;
}
示例12: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('tool/seo_url');
$this->loadLanguage('total/total');
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_subtotal'] = $this->language->get('text_subtotal');
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['text_remove'] = $this->language->get('text_remove');
$this->data['text_confirm'] = $this->language->get('text_confirm');
$this->data['text_view'] = $this->language->get('text_view');
$this->data['text_checkout'] = $this->language->get('text_checkout');
$this->data['text_items'] = $this->language->get('text_items');
$this->data['text_total'] = $this->language->get('text_total');
$this->data['view'] = $this->html->getURL('checkout/cart');
$this->data['remove'] = $this->html->getURL('r/checkout/cart');
$this->data['checkout'] = $this->html->getURL('checkout/shipping');
$products = array();
$qty = 0;
$resource = new AResource('image');
foreach ($this->cart->getProducts() as $result) {
$option_data = array();
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), true);
foreach ($result['option'] as $option) {
$option_data[] = array('name' => $option['name'], 'value' => $option['value']);
}
$qty += $result['quantity'];
$products[] = array('key' => $result['key'], 'name' => $result['name'], 'option' => $option_data, 'quantity' => $result['quantity'], 'stock' => $result['stock'], 'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], true), 'thumb' => $thumbnail);
}
$this->data['products'] = $products;
$this->data['total_qty'] = $qty;
$display_totals = $this->cart->buildTotalDisplay();
$this->data['totals'] = $display_totals['total_data'];
$this->data['subtotal'] = $this->currency->format($this->tax->calculate($display_totals['total'], $result['tax_class_id'], $this->config->get('config_tax')));
$this->data['taxes'] = $display_totals['taxes'];
$this->data['ajax'] = $this->config->get('cart_ajax');
$this->view->batchAssign($this->data);
$this->processTemplate();
//init controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例13: getCategoryDetails
public function getCategoryDetails($category_id)
{
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadModel('catalog/category');
$this->loadModel('catalog/product');
$this->loadModel('tool/image');
$category_info = $this->model_catalog_category->getCategory($category_id);
if (!$category_info) {
return array('message' => 'category not found');
}
$resource = new AResource('image');
$thumbnail = $resource->getMainThumb('categories', $category_id, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
$category_info['thumbnail'] = $category_info['tumbnail'] = $thumbnail['thumb_url'];
//Process data for category
$category_info['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$category_info['total_products'] = $this->model_catalog_product->getTotalProductsByCategoryId($category_id);
$category_info['total_subcategories'] = $this->model_catalog_category->getTotalCategoriesByCategoryId($category_id);
if ($category_info['total_products']) {
$category_info['subcategories'] = $this->getCategories($category_id);
}
$this->extensions->hk_UpdateData($this, __FUNCTION__);
return $category_info;
}
示例14: 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) {
$resource = new AResource('image');
foreach ($results as $result) {
$thumbnail = $resource->getMainThumb('products', $result['product_id'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'), true);
$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);
}
示例15: main
//.........这里部分代码省略.........
foreach (array_keys($this->request->post['remove']) as $key) {
$this->cart->remove($key);
}
}
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('checkout/cart'));
}
}
}
$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');
$products = array();
$resource = new AResource('image');
$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('checkout/cart')));
$cart_products = $this->cart->getProducts();
foreach ($cart_products as $result) {
$option_data = array();
$thumbnail = $resource->getMainThumb('products', $result['product_id'], (int) $this->config->get('config_image_cart_width'), (int) $this->config->get('config_image_cart_height'), true);
foreach ($result['option'] as $option) {
$option_data[] = array('name' => $option['name'], 'value' => $option['value']);
}
$products[] = array('remove' => $form->getFieldHtml(array('type' => 'checkbox', 'name' => '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/product', '&product_id=' . $result['product_id'], 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')) {
$this->data['weight'] = $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class'));
} else {
$this->data['weight'] = FALSE;
}
$display_totals = $this->cart->buildTotalDisplay();
$this->data['totals'] = $display_totals['total_data'];
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->data['form']['continue_shopping'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'continue_shopping', 'text' => $this->language->get('button_shopping'), 'style' => 'button', 'href' => $this->data['continue']));
$this->data['checkout'] = $this->html->getSecureURL('checkout/shipping');
#Check if order total max/min is set and met
$cf_total_min = $this->config->get('total_order_minimum');
$cf_total_max = $this->config->get('total_order_maximum');
if (!$this->cart->hasMinRequirement()) {
$this->data['form']['checkout'] = '';
$error_msg[] = sprintf($this->language->get('error_order_minimum'), $this->currency->format($cf_total_min));
}
if (!$this->cart->hasMaxRequirement()) {
$this->data['form']['checkout'] = '';