当前位置: 首页>>代码示例>>PHP>>正文


PHP AResource类代码示例

本文整理汇总了PHP中AResource的典型用法代码示例。如果您正苦于以下问题:PHP AResource类的具体用法?PHP AResource怎么用?PHP AResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AResource类的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();
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:60,代码来源:wishlist.php

示例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__);
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:60,代码来源:cart.php

示例3: 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));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:30,代码来源:manufacturer.php

示例4: 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));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:31,代码来源:review.php

示例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__);
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:60,代码来源:special.php

示例6: getBlockContent

 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;
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:34,代码来源:banner_block.php

示例7: 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__);
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:25,代码来源:product_summary.php

示例8: 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 ? '&nbsp;<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));
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:59,代码来源:category.php

示例9: 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__);
 }
开发者ID:vglide,项目名称:abantecart-src,代码行数:58,代码来源:latest.php

示例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);
     $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));
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:57,代码来源:product.php

示例11: 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__);
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:53,代码来源:manufacturer.php

示例12: 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;
 }
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:13,代码来源:category.php

示例13: buildStoreFrontMenuTree

function buildStoreFrontMenuTree($menu_array, $level = 0)
{
    $menu_array = (array) $menu_array;
    if (!$menu_array) {
        return '';
    }
    $result = '';
    //for submenus build new UL node
    if ($level > 0) {
        $result .= "<ul class='sub_menu dropdown-menu'>\r\n";
    }
    $registry = Registry::getInstance();
    $logged = $registry->get('customer')->isLogged();
    $ar = new AResource('image');
    foreach ($menu_array as $item) {
        if ($logged && $item['id'] == 'login' || !$logged && $item['id'] == 'logout') {
            continue;
        }
        //build appropriate menu id and classes for css controll
        $id = empty($item['id']) ? '' : ' data-id="menu_' . $item['id'] . '" ';
        // li ID
        if ($level != 0) {
            if (empty($item['children'])) {
                $class = $item['icon'] ? ' class="top nobackground"' : ' class="sub menu_' . $item['id'] . '" ';
            } else {
                $class = $item['icon'] ? ' class="parent nobackground" ' : ' class="parent menu_' . $item['id'] . '" ';
            }
        } else {
            $class = $item['icon'] ? ' class="top nobackground"' : ' class="top menu_' . $item['id'] . '" ';
        }
        $href = empty($item['href']) ? '' : ' href="' . $item['href'] . '" ';
        //construct HTML
        $current = '';
        if ($item['current']) {
            $current = 'current';
        }
        $result .= '<li ' . $id . ' class="dropdown ' . $current . '">';
        $result .= '<a ' . $class . $href . '>';
        //check icon rl type html, image or none.
        $rl_id = $item['icon_rl_id'];
        if ($rl_id) {
            $resource = $ar->getResource($rl_id);
            if ($resource['resource_path'] && is_file(DIR_RESOURCE . 'image/' . $resource['resource_path'])) {
                $result .= '<img class="menu_image" src="' . HTTPS_DIR_RESOURCE . 'image/' . $resource['resource_path'] . '" alt="" />';
            } elseif ($resource['resource_code']) {
                $result .= $resource['resource_code'];
            }
        }
        $result .= '<span class="menu_text">' . $item['text'] . '</span></a>';
        //if children build inner clild tree
        if (!empty($item['children'])) {
            $result .= "\r\n" . buildStoreFrontMenuTree($item['children'], $level + 1);
        }
        $result .= "</li>\r\n";
    }
    if ($level > 0) {
        $result .= "</ul>\r\n";
    }
    return $result;
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:60,代码来源:html.php

示例14: get

 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);
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:45,代码来源:related.php

示例15: 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__);
 }
开发者ID:siddht1,项目名称:abantecart-src,代码行数:43,代码来源:category.php


注:本文中的AResource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。