Example #1
0
 public function getMore()
 {
     $this->language->load('studio/template');
     $this->data['template_text_empty'] = $this->language->get('template_text_empty');
     $this->data['template_text_show_more'] = $this->language->get('template_text_show_more');
     $filters['sort'] = "RAND()";
     $filters['order'] = "ASC";
     $filters['filter_id_author'] = 0;
     $filters['filter_status'] = 1;
     //keyword
     if (!empty($this->request->request['template_keyword'])) {
         $filters['filter_keyword'] = $this->request->request['template_keyword'];
         $filters['sort'] = "c.date_added";
     }
     //category
     $categories = array();
     if (!empty($this->request->request['template_category'])) {
         $filters['filter_id_category'] = $this->request->request['template_category'];
         $filters['sort'] = "c.date_added";
     }
     $this->load->model('opentshirts/composition');
     $templates = array();
     ///get all template matching filters for pagination with no limits
     $total = $this->model_opentshirts_composition->getTotalCompositions($filters);
     $template_page = 1;
     if (isset($this->request->request['template_page'])) {
         $template_page = $this->request->request['template_page'];
     }
     $this->data['template_page'] = $template_page;
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $template_page;
     $pagination->limit = 10;
     $filters['start'] = $pagination->getStart();
     $filters['limit'] = $pagination->limit;
     $results = $this->model_opentshirts_composition->getCompositions($filters);
     $this->load->model('opentshirts/design');
     $this->load->model('tool/image');
     $this->data['templates'] = array();
     foreach ($results as $result) {
         $design_results = $this->model_opentshirts_design->getDesigns(array("filter_id_composition" => $result['id_composition']));
         foreach ($design_results as $design_result) {
             if (file_exists(DIR_IMAGE . 'data/designs/design_' . $design_result['id_design'] . '/snapshot.png')) {
                 $image = $this->model_tool_image->resize('data/designs/design_' . $design_result['id_design'] . '/snapshot.png', 140, 140);
             } else {
                 $image = $this->model_tool_image->resize('no_image.jpg', 140, 140);
             }
             $this->data['templates'][] = array('id_template' => $design_result['id_design'], 'name' => $result['name'], 'image' => $image);
         }
     }
     $this->data['show_more'] = (bool) ($pagination->getEnd() < $pagination->getTotal());
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/studio/more_template.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/studio/more_template.tpl';
     } else {
         $this->template = 'default/template/studio/more_template.tpl';
     }
     $this->response->setOutput($this->render());
 }
Example #2
0
 public function getMore()
 {
     $this->language->load('studio/product');
     $this->data['product_text_empty'] = $this->language->get('product_text_empty');
     $this->data['product_text_show_more'] = $this->language->get('product_text_show_more');
     $filters = array();
     //$filters['sort'] = "RAND()";
     $filters['order'] = "ASC";
     $filters['filter_printable'] = "1";
     //keyword
     if (!empty($this->request->request['product_keyword'])) {
         $filters['filter_name'] = $this->request->request['product_keyword'];
         $filters['filter_tag'] = $this->request->request['product_keyword'];
         $this->data['product_keyword'] = $this->request->request['product_keyword'];
     } else {
         $this->data['product_keyword'] = '';
     }
     //filter category
     if (!empty($this->request->request['product_category'])) {
         $filters['filter_category_id'] = $this->request->request['product_category'];
         $this->data['product_category'] = $this->request->request['product_category'];
     } else {
         $this->data['product_category'] = '';
     }
     $this->load->model('opentshirts/product');
     $this->load->model('catalog/manufacturer');
     $this->load->model('opentshirts/product_color');
     $this->load->model('tool/image');
     $this->data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers();
     $this->data['colors'] = $this->model_opentshirts_product_color->getColors();
     $total = $this->model_opentshirts_product->getTotalProducts($filters);
     if (isset($this->request->request['product_page'])) {
         $this->data['product_page'] = $this->request->request['product_page'];
     } else {
         $this->data['product_page'] = 1;
     }
     $page = $this->data['product_page'];
     $limit = 10;
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $filters['start'] = ($page - 1) * $limit;
     $filters['limit'] = $limit;
     $this->data['products'] = array();
     $results = $this->model_opentshirts_product->getProducts($filters);
     foreach ($results as $result) {
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], 200, 200);
         } else {
             $image = false;
         }
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $price = false;
         }
         if ((double) $result['special']) {
             $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $special = false;
         }
         if ($this->config->get('config_tax')) {
             $tax = $this->currency->format((double) $result['special'] ? $result['special'] : $result['price']);
         } else {
             $tax = false;
         }
         if ($this->config->get('config_review_status')) {
             $rating = (int) $result['rating'];
         } else {
             $rating = false;
         }
         $colors = $this->model_opentshirts_product->getColors($result['product_id']);
         /*$this->data['products'][] = array(
         			'id_product'    => $result['product_id'],
         			'name'      	=> $result['name'],
         			'weight'      	=> $result['weight'],
         			'description'   => $result['description'],
         			'id_manufacturer'   => $result['id_manufacturer'],
         			'colors'   => $colors,
         			'thumb'      	=> $thumb
         		);*/
         $this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 250) . '..', 'weight' => $result['weight'], 'weight_unit' => $this->weight->getUnit($result['weight_class_id']), 'manufacturer' => $result['manufacturer'], 'price' => $price, 'colors' => $colors, 'special' => $special, 'tax' => $tax, 'rating' => $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
     }
     $this->data['show_more'] = (bool) ($pagination->getEnd() < $pagination->getTotal());
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/studio/more_product.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/studio/more_product.tpl';
     } else {
         $this->template = 'default/template/studio/more_product.tpl';
     }
     $this->response->setOutput($this->render());
 }
Example #3
0
 public function getMore()
 {
     $this->language->load('studio/clipart');
     $this->data['clipart_text_empty'] = $this->language->get('clipart_text_empty');
     $this->data['clipart_text_show_more'] = $this->language->get('clipart_text_show_more');
     $filters = array();
     $filters['filter_status'] = 1;
     $filters['sort'] = 'RAND()';
     $filters['order'] = 'ASC';
     $filters_b = array();
     $filters_b['filter_status'] = 1;
     $filters_b['sort'] = 'RAND()';
     $filters_b['order'] = 'ASC';
     $filters_b['filter_from_customer'] = '0';
     //keyword
     if (!empty($this->request->request['clipart_keyword'])) {
         $this->data['clipart_keyword'] = $this->request->request['clipart_keyword'];
         $filters['filter_keyword'] = $this->request->request['clipart_keyword'];
         $filters['sort'] = 'c.date_added';
         $filters_b['filter_keyword'] = $this->request->request['clipart_keyword'];
         $filters_b['sort'] = 'b.date_added';
     } else {
         $this->data['clipart_keyword'] = '';
     }
     //category
     $this->load->model('opentshirts/clipart_category');
     if (!empty($this->request->request['clipart_category'])) {
         $this->data['clipart_category'] = $this->request->request['clipart_category'];
         $filters['filter_category'] = $this->request->request['clipart_category'];
         $filters['sort'] = 'c.date_added';
         $filters_b['filter_category'] = $this->request->request['clipart_category'];
         $filters_b['sort'] = 'b.date_added';
     } else {
         $this->data['clipart_category'] = '';
     }
     $this->data['categories'] = $this->model_opentshirts_clipart_category->getCategoriesByParentId();
     $this->load->model('opentshirts/clipart');
     $this->load->model('opentshirts/bitmap');
     $total = $this->model_opentshirts_clipart->getTotalcliparts($filters);
     $total += $this->model_opentshirts_bitmap->getTotalbitmaps($filters_b);
     if (isset($this->request->request['clipart_page'])) {
         $this->data['clipart_page'] = $this->request->request['clipart_page'];
     } else {
         $this->data['clipart_page'] = 1;
     }
     $page = $this->data['clipart_page'];
     $limit = 21;
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $filters['start'] = ($page - 1) * $limit;
     $filters['limit'] = $limit;
     $results = $this->model_opentshirts_clipart->getCliparts($filters);
     $this->load->model('tool/image');
     $this->data['cliparts'] = array();
     foreach ($results as $result) {
         if ($result['image_file'] && file_exists(DIR_IMAGE . 'data/cliparts/' . $result['image_file'])) {
             $thumb = $this->model_tool_image->resize('data/cliparts/' . $result['image_file'], 100, 100);
         } else {
             $thumb = $this->model_tool_image->resize('no_image.jpg', 100, 100);
         }
         $this->data['cliparts'][] = array('id_clipart' => $result['id_clipart'], 'name' => $result['name'], 'thumb' => $thumb);
     }
     $results_b = $this->model_opentshirts_bitmap->getBitmaps($filters_b);
     foreach ($results_b as $result) {
         if ($result['image_file'] && file_exists(DIR_IMAGE . 'data/bitmaps/' . $result['image_file'])) {
             $thumb = $this->model_tool_image->resize('data/bitmaps/' . $result['image_file'], 100, 100);
         } else {
             continue;
         }
         foreach ($result['colors'] as &$color) {
             $color = "'" . $color . "'";
         }
         $this->data['cliparts'][] = array('id_bitmap' => $result['id_bitmap'], 'source' => 'image/data/bitmaps/' . $result['image_file'], 'name' => $result['name'], 'colors' => implode(",", $result['colors']), 'thumb' => $thumb);
     }
     shuffle($this->data['cliparts']);
     $this->data['show_more'] = (bool) ($pagination->getEnd() < $pagination->getTotal());
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/studio/more_clipart.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/studio/more_clipart.tpl';
     } else {
         $this->template = 'default/template/studio/more_clipart.tpl';
     }
     $this->response->setOutput($this->render());
 }