[Помогите] Конфликт модулей: currency plus и OptionsBoostOCv156.3

Тема в разделе "OpenCart", создана пользователем moonstyles, 6 дек 2014.

  1. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    Как вылечить конфликт модулей currency plus и OptionsBoostOCv156.3 ? В админке ерор -
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ........................./vqmod/vqcache/vq2-admin_model_catalog_product.php on line 64
     
  2. AnOcToJI

    AnOcToJI

    Регистрация:
    28 дек 2012
    Сообщения:
    309
    Симпатии:
    188
    ну вы хоть код дайте /vqmod/vqcache/vq2-admin_model_catalog_product.php, а то мы же откуда знаем что у вас там насобранно, да и до кучи файлы vqmod этих 2 модулей
     
  3. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    Код:
    <?php
    class ControllerCatalogProduct extends Controller {
        private $error = array();
      
    
                    // Options Boost
                    public function ob_category() {
                        $this->load->model('catalog/product');
    
                        if (isset($this->request->get['category_id'])) {
                            $category_id = $this->request->get['category_id'];
                        } else {
                            $category_id = 0;
                        }
    
                        $product_data = array();
    
                        $results = $this->model_catalog_product->getProductsByCategoryId($category_id);
    
                        foreach ($results as $result) {
                            $product_data[] = array(
                                'product_id' => $result['product_id'],
                                'name'       => $result['name'],
                                'model'      => $result['model']
                            );
                        }
    
                        if (version_compare(VERSION, '1.5.1.3', '<')) { //v1.5.1.2 or earlier
                            $this->load->library('json');
                            $this->response->setOutput(Json::encode($product_data));
                        } else {
                            $this->response->setOutput(json_encode($product_data));
                        }
    
                    }//
             
          public function index() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
             
            $this->document->setTitle($this->language->get('heading_title'));
         
            $this->load->model('catalog/product');
         
            $this->getList();
          }
        public function filter() {
    
            $json = array();
    
            if (isset($this->request->get['filter_name'])) {
                $filter_name = $this->request->get['filter_name'];
            } else {
                $filter_name = null;
            }
    
            if (isset($this->request->get['filter_category_id'])) {
                $filter_category_id = $this->request->get['filter_category_id'];
            } else {
                $filter_category_id = null;
            }
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $filter_manufacturer_id = $this->request->get['filter_manufacturer_id'];
            } else {
                $filter_manufacturer_id = null;
            }
    
            if (isset($this->request->get['filter_model'])) {
                $filter_model = $this->request->get['filter_model'];
            } else {
                $filter_model = null;
            }
         
            if (isset($this->request->get['filter_price'])) {
                $filter_price = $this->request->get['filter_price'];
            } else {
                $filter_price = null;
            }
    
            if (isset($this->request->get['filter_quantity'])) {
                $filter_quantity = $this->request->get['filter_quantity'];
            } else {
                $filter_quantity = null;
            }
    
            if (isset($this->request->get['filter_status'])) {
                $filter_status = $this->request->get['filter_status'];
            } else {
                $filter_status = null;
            }
    
            if (isset($this->request->get['sort'])) {
                $sort = $this->request->get['sort'];
            } else {
                $sort = 'pd.name';
            }
         
            if (isset($this->request->get['order'])) {
                $order = $this->request->get['order'];
            } else {
                $order = 'ASC';
            }
         
            if (isset($this->request->get['page'])) {
                $page = $this->request->get['page'];
            } else {
                $page = 1;
            }
                         
            $url = '';
                         
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
         
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
            }
         
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
            }
         
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
         
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
         
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
         
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }     
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                         
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
         
            $data = array(
                'filter_name'      => $filter_name,
                'filter_category_id'      => $filter_category_id,
                'filter_manufacturer_id'      => $filter_manufacturer_id,
                'filter_model'      => $filter_model,
                'filter_price'      => $filter_price,
                'filter_quantity' => $filter_quantity,
                'filter_status'   => $filter_status,
                'sort'            => $sort,
                'order'           => $order,
                'start'           => ($page - 1) * $this->config->get('config_admin_limit'),
                'limit'           => $this->config->get('config_admin_limit')
            );
         
            $this->load->model('tool/image');
            $this->load->model('catalog/product');
         
            $product_total = $this->model_catalog_product->getTotalProducts($data);
             
            $results = $this->model_catalog_product->getProducts($data);
    
            $json['products'] = array();                     
            foreach ($results as $result) {
                $action = array();
             
                $action[] = array(
                    'text' => $this->language->get('text_edit'),
                    'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, 'SSL')
                );
             
                if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
                    $image = $this->model_tool_image->resize($result['image'], 40, 40);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
                }
     
                $special = false;
             
                $product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']);
             
                foreach ($product_specials  as $product_special) {
                    if (($product_special['date_start'] == '0000-00-00' || $product_special['date_start'] > date('Y-m-d')) && ($product_special['date_end'] == '0000-00-00' || $product_special['date_end'] < date('Y-m-d'))) {
                        $special = $product_special['price'];
             
                        break;
                    }                 
                }
     
                $json['products'][] = array(
                    'product_id'     => $result['product_id'],
                    'name'           => $result['name'],
                    'category'       => $this->model_catalog_product->getProductCatNames($result['product_id']),
                    'manufacturer'    => $result['m_name'],
                    'model'          => $result['model'],
                    'price'          => $result['price'],
                    'special'        => $special,
                    'image'        => $image,
                    'quantity'       => $result['quantity'],
                    'status'         => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
                    'selected'       => isset($this->request->post['selected']) && in_array($result['product_id'], $this->request->post['selected']),
                    'action'         => $action
                );
            }
            $pagination = new Pagination();
            $pagination->total = $product_total;
            $pagination->page = $page;
            $pagination->limit = $this->config->get('config_admin_limit');
            $pagination->text = $this->language->get('text_pagination');
            $pagination->url = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
             
            $json['pagination'] = $pagination->render();
    
            $this->response->setOutput(json_encode($json));
        }
    
    
        //Q: Options Boost
        private function checkdb_ob() {
    
            $fields = array();
    
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku` VARCHAR(64) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_info',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_info` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_image',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_image` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku_override',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku_override` int(1) NOT NULL DEFAULT '0'"
            );
    
            foreach ($fields as $field) {
                $sql = "DESC `" . DB_PREFIX . "$field[table]` $field[column]";
                $query = $this->db->query($sql);
                if (!$query->num_rows) {
                    $this->db->query($field['sql']);
                }
            }
        }//
             
          public function insert() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
             
    
            $this->document->setTitle($this->language->get('heading_title'));
         
            $this->load->model('catalog/product');
         
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
    
             
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->create_fields();
             
             
                $this->model_catalog_product->addProduct($this->request->post);
               
                $this->session->data['success'] = $this->language->get('text_success');
       
                $url = '';
    
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
         
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
             
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
             
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                }
             
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                     
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
             
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
     
            $this->getForm();
          }
    
          public function update() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
             
    
            $this->document->setTitle($this->language->get('heading_title'));
         
            $this->load->model('catalog/product');
     
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
    
             
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->create_fields();
             
             
    
                    $this->load->model('tool/nitro');
                    $nitroSettings = $this->model_tool_nitro->getPersistence();
                    if ($nitroSettings['Nitro']['PageCache']['ClearCacheOnProductEdit'] == 'yes') {
                        $this->model_tool_nitro->clearPageCache();
                        $this->model_tool_nitro->clearDBCache();
                        $this->model_tool_nitro->clearCSSCache();
                        $this->model_tool_nitro->clearJSCache();
                    }
             
                $this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
             
                $this->session->data['success'] = $this->language->get('text_success');
             
                $url = '';
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
         
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
             
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
             
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                } 
         
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                     
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
             
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getForm();
          }
    
          public function delete() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
             
    
            $this->document->setTitle($this->language->get('heading_title'));
         
            $this->load->model('catalog/product');
         
            if (isset($this->request->post['selected']) && $this->validateDelete()) {
                foreach ($this->request->post['selected'] as $product_id) {
                    $this->model_catalog_product->deleteProduct($product_id);
                  }
    
                $this->session->data['success'] = $this->language->get('text_success');
             
                $url = '';
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
         
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
             
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
             
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                } 
         
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                     
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
             
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getList();
          }
    
          public function copy() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
             
    
            $this->document->setTitle($this->language->get('heading_title'));
         
            $this->load->model('catalog/product');
         
            if (isset($this->request->post['selected']) && $this->validateCopy()) {
                foreach ($this->request->post['selected'] as $product_id) {
                    $this->model_catalog_product->copyProduct($product_id);
                  }
    
                $this->session->data['success'] = $this->language->get('text_success');
             
                $url = '';
             
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
           
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
             
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
             
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                } 
         
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                     
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
             
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getList();
          }
     
          private function getList() {             
            if (isset($this->request->get['filter_name'])) {
                $filter_name = $this->request->get['filter_name'];
            } else {
                $filter_name = null;
            }
            if (isset($this->request->get['filter_category_id'])) {
                $filter_category_id = $this->request->get['filter_category_id'];
            } else {
                $filter_category_id = null;
            }
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $filter_manufacturer_id = $this->request->get['filter_manufacturer_id'];
            } else {
                $filter_manufacturer_id = null;
            }
    
            if (isset($this->request->get['filter_model'])) {
                $filter_model = $this->request->get['filter_model'];
            } else {
                $filter_model = null;
            }
         
            if (isset($this->request->get['filter_price'])) {
                $filter_price = $this->request->get['filter_price'];
            } else {
                $filter_price = null;
            }
    
            if (isset($this->request->get['filter_quantity'])) {
                $filter_quantity = $this->request->get['filter_quantity'];
            } else {
                $filter_quantity = null;
            }
    
            if (isset($this->request->get['filter_status'])) {
                $filter_status = $this->request->get['filter_status'];
            } else {
                $filter_status = null;
            }
    
            if (isset($this->request->get['sort'])) {
                $sort = $this->request->get['sort'];
            } else {
                $sort = 'pd.name';
            }
         
            if (isset($this->request->get['order'])) {
                $order = $this->request->get['order'];
            } else {
                $order = 'ASC';
            }
         
            if (isset($this->request->get['page'])) {
                $page = $this->request->get['page'];
            } else {
                $page = 1;
            }
    
            $this->data['sort'] = $sort;
            $this->data['order'] = $order;
            $this->data['page'] = $page;
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
         
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
         
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
         
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }     
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                         
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
         
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
    
              $this->data['breadcrumbs'] = array();
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
                  'separator' => false
               );
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'),            
                  'separator' => ' :: '
               );
         
            $this->data['insert'] = $this->url->link('catalog/product/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
            $this->data['copy'] = $this->url->link('catalog/product/copy', 'token=' . $this->session->data['token'] . $url, 'SSL'); 
            $this->data['delete'] = $this->url->link('catalog/product/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
         
            $this->data['products'] = array();
    
            $data = array(
                'filter_name'      => $filter_name,
                'filter_manufacturer_id'  => $filter_manufacturer_id,
                'filter_category_id'      => $filter_category_id,
                'filter_model'      => $filter_model,
                'filter_price'      => $filter_price,
                'filter_quantity' => $filter_quantity,
                'filter_status'   => $filter_status,
                'sort'            => $sort,
                'order'           => $order,
                'start'           => ($page - 1) * $this->config->get('config_admin_limit'),
                'limit'           => $this->config->get('config_admin_limit')
            );
         
            $this->load->model('tool/image');
         
            $product_total = $this->model_catalog_product->getTotalProducts($data);
             
            $results = $this->model_catalog_product->getProducts($data);
                         
            foreach ($results as $result) {
                $action = array();
             
                $action[] = array(
                    'text' => $this->language->get('text_edit'),
                    'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, 'SSL')
                );
             
                if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
                    $image = $this->model_tool_image->resize($result['image'], 40, 40);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
                }
     
                $special = false;
             
                $product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']);
             
                foreach ($product_specials  as $product_special) {
                    if (($product_special['date_start'] == '0000-00-00' || $product_special['date_start'] > date('Y-m-d')) && ($product_special['date_end'] == '0000-00-00' || $product_special['date_end'] < date('Y-m-d'))) {
                        $special = $product_special['price'];
             
                        break;
                    }                 
                }
     
                  $this->data['products'][] = array(
                    'product_id' => $result['product_id'],
                    'category'   => $this->model_catalog_product->getProductCatNames($result['product_id']),
                    'manufacturer'    => $result['m_name'],
                    'name'       => $result['name'],
                    'model'      => $result['model'],
                    'price'      => $result['price'],
                    'special'    => $special,
                    'image'      => $image,
                    'quantity'   => $result['quantity'],
                    'status'     => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
                    'selected'   => isset($this->request->post['selected']) && in_array($result['product_id'], $this->request->post['selected']),
                    'action'     => $action
                );
            }
         
            $this->data['heading_title'] = $this->language->get('heading_title');     
                 
            $this->data['text_enabled'] = $this->language->get('text_enabled');     
            $this->data['text_disabled'] = $this->language->get('text_disabled');     
            $this->data['text_no_results'] = $this->language->get('text_no_results');     
            $this->data['text_image_manager'] = $this->language->get('text_image_manager');     
             
    
            $this->data['column_category'] = $this->language->get('column_category');
            $this->data['column_manufacturer'] = $this->language->get('column_manufacturer');
            $this->data['column_image'] = $this->language->get('column_image');     
            $this->data['column_name'] = $this->language->get('column_name');     
            $this->data['column_model'] = $this->language->get('column_model');     
            $this->data['column_price'] = $this->language->get('column_price');     
            $this->data['column_quantity'] = $this->language->get('column_quantity');     
            $this->data['column_status'] = $this->language->get('column_status');     
            $this->data['column_action'] = $this->language->get('column_action');     
                 
            $this->data['button_copy'] = $this->language->get('button_copy');     
            $this->data['button_insert'] = $this->language->get('button_insert');     
            $this->data['button_delete'] = $this->language->get('button_delete');     
            $this->data['button_clear'] = $this->language->get('button_clear');
          
             $this->data['token'] = $this->session->data['token'];
         
             if (isset($this->error['warning'])) {
                $this->data['error_warning'] = $this->error['warning'];
            } else {
                $this->data['error_warning'] = '';
            }
    
            if (isset($this->session->data['success'])) {
                $this->data['success'] = $this->session->data['success'];
         
                unset($this->session->data['success']);
            } else {
                $this->data['success'] = '';
            }
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
         
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
         
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
         
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }
         
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                                 
            if ($order == 'ASC') {
                $url .= '&order=DESC';
            } else {
                $url .= '&order=ASC';
            }
    
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
                     
            $this->data['sort_name'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, 'SSL');
            $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
            $this->data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, 'SSL');
            $this->data['sort_quantity'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.quantity' . $url, 'SSL');
            $this->data['sort_status'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.status' . $url, 'SSL');
            $this->data['sort_order'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sort_order' . $url, 'SSL');
         
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
         
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
         
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
         
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
    
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
                                                 
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
                 
            $pagination = new Pagination();
            $pagination->total = $product_total;
            $pagination->page = $page;
            $pagination->limit = $this->config->get('config_admin_limit');
            $pagination->text = $this->language->get('text_pagination');
            $pagination->url = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
             
            $this->data['pagination'] = $pagination->render();
     
            $this->data['filter_category_id'] = $filter_category_id;
            $this->data['filter_manufacturer_id'] = $filter_manufacturer_id;
            $this->data['filter_name'] = $filter_name;
            $this->data['filter_model'] = $filter_model;
            $this->data['filter_price'] = $filter_price;
            $this->data['filter_quantity'] = $filter_quantity;
            $this->data['filter_status'] = $filter_status;
         
            $this->data['sort'] = $sort;
            $this->data['order'] = $order;
    
            $this->load->model('catalog/category');
            $this->load->model('catalog/manufacturer');
    
            $this->data['categories'] = $this->model_catalog_category->getCategories(0);
    
    
            $this->data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers();
    
    
            $this->template = 'catalog/product_list.tpl';
            $this->children = array(
                'common/header',
                'common/footer'
            );
                 
            $this->response->setOutput($this->render());
          }
    
          protected function getForm() {
    
            $this->checkdb_ob(); //Q: Options Boost
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
             
            $this->data['heading_title'] = $this->language->get('heading_title');
            $this->data['text_enabled'] = $this->language->get('text_enabled');
            $this->data['text_disabled'] = $this->language->get('text_disabled');
            $this->data['text_none'] = $this->language->get('text_none');
            $this->data['text_yes'] = $this->language->get('text_yes');
            $this->data['text_no'] = $this->language->get('text_no');
            $this->data['text_select_all'] = $this->language->get('text_select_all');
            $this->data['text_unselect_all'] = $this->language->get('text_unselect_all');
            $this->data['text_plus'] = $this->language->get('text_plus');
            $this->data['text_minus'] = $this->language->get('text_minus');
            $this->data['text_default'] = $this->language->get('text_default');
            $this->data['text_image_manager'] = $this->language->get('text_image_manager');
            $this->data['text_browse'] = $this->language->get('text_browse');
            $this->data['text_clear'] = $this->language->get('text_clear');
            $this->data['text_option'] = $this->language->get('text_option');
            $this->data['text_option_value'] = $this->language->get('text_option_value');
            $this->data['text_select'] = $this->language->get('text_select');
            $this->data['text_none'] = $this->language->get('text_none');
            $this->data['text_percent'] = $this->language->get('text_percent');
            $this->data['text_amount'] = $this->language->get('text_amount');
            $this->data['text_hidelink'] = $this->language->get('text_hidelink');
    
            $this->data['entry_name'] = $this->language->get('entry_name');
            $this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
            $this->data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword');
            $this->data['entry_description'] = $this->language->get('entry_description');
            $this->data['entry_store'] = $this->language->get('entry_store');
            $this->data['entry_keyword'] = $this->language->get('entry_keyword');
            $this->data['entry_model'] = $this->language->get('entry_model');
            $this->data['entry_sku'] = $this->language->get('entry_sku');
            $this->data['entry_upc'] = $this->language->get('entry_upc');
            $this->data['entry_ean'] = $this->language->get('entry_ean');
            $this->data['entry_jan'] = $this->language->get('entry_jan');
            $this->data['entry_isbn'] = $this->language->get('entry_isbn');
            $this->data['entry_mpn'] = $this->language->get('entry_mpn');
            $this->data['entry_location'] = $this->language->get('entry_location');
            $this->data['entry_minimum'] = $this->language->get('entry_minimum');
            $this->data['entry_manufacturer'] = $this->language->get('entry_manufacturer');
            $this->data['entry_shipping'] = $this->language->get('entry_shipping');
            $this->data['entry_date_available'] = $this->language->get('entry_date_available');
            $this->data['entry_quantity'] = $this->language->get('entry_quantity');
            $this->data['entry_stock_status'] = $this->language->get('entry_stock_status');
    
             
                    $this->data['entry_base_price'] = $this->language->get('entry_base_price');
                    $this->data['entry_base_currency'] = $this->language->get('entry_base_currency');
             
             
    
             
                    $this->data['entry_extra_charge'] = $this->language->get('entry_extra_charge');
             
             
            $this->data['entry_price'] = $this->language->get('entry_price');
            $this->data['entry_tax_class'] = $this->language->get('entry_tax_class');
            $this->data['entry_points'] = $this->language->get('entry_points');
            $this->data['entry_option_points'] = $this->language->get('entry_option_points');
            $this->data['entry_subtract'] = $this->language->get('entry_subtract');
            $this->data['entry_weight_class'] = $this->language->get('entry_weight_class');
            $this->data['entry_weight'] = $this->language->get('entry_weight');
            $this->data['entry_dimension'] = $this->language->get('entry_dimension');
            $this->data['entry_length'] = $this->language->get('entry_length');
            $this->data['entry_image'] = $this->language->get('entry_image');
            $this->data['entry_download'] = $this->language->get('entry_download');
            $this->data['entry_category'] = $this->language->get('entry_category');
            $this->data['entry_filter'] = $this->language->get('entry_filter');
            $this->data['entry_related'] = $this->language->get('entry_related');
            $this->data['entry_attribute'] = $this->language->get('entry_attribute');
            $this->data['entry_text'] = $this->language->get('entry_text');
            $this->data['entry_option'] = $this->language->get('entry_option');
            $this->data['entry_option_value'] = $this->language->get('entry_option_value');
            $this->data['entry_required'] = $this->language->get('entry_required');
            $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
            $this->data['entry_status'] = $this->language->get('entry_status');
            $this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
            $this->data['entry_date_start'] = $this->language->get('entry_date_start');
            $this->data['entry_date_end'] = $this->language->get('entry_date_end');
            $this->data['entry_priority'] = $this->language->get('entry_priority');
            $this->data['entry_tag'] = $this->language->get('entry_tag');
            $this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
            $this->data['entry_reward'] = $this->language->get('entry_reward');
            $this->data['entry_layout'] = $this->language->get('entry_layout');
            $this->data['entry_main_category'] = $this->language->get('entry_main_category');
            $this->data['entry_seo_title'] = $this->language->get('entry_seo_title');
            $this->data['entry_seo_h1'] = $this->language->get('entry_seo_h1');
                 
            $this->data['button_save'] = $this->language->get('button_save');
            $this->data['button_cancel'] = $this->language->get('button_cancel');
            $this->data['button_add_attribute'] = $this->language->get('button_add_attribute');
            $this->data['button_add_option'] = $this->language->get('button_add_option');
            $this->data['button_add_option_value'] = $this->language->get('button_add_option_value');
            $this->data['button_add_discount'] = $this->language->get('button_add_discount');
            $this->data['button_add_special'] = $this->language->get('button_add_special');
            $this->data['button_add_image'] = $this->language->get('button_add_image');
            $this->data['button_remove'] = $this->language->get('button_remove');
         
            $this->data['tab_general'] = $this->language->get('tab_general');
            $this->data['tab_data'] = $this->language->get('tab_data');
            $this->data['tab_attribute'] = $this->language->get('tab_attribute');
            $this->data['tab_option'] = $this->language->get('tab_option');     
            $this->data['tab_discount'] = $this->language->get('tab_discount');
            $this->data['tab_special'] = $this->language->get('tab_special');
            $this->data['tab_image'] = $this->language->get('tab_image');     
            $this->data['tab_links'] = $this->language->get('tab_links');
            $this->data['tab_reward'] = $this->language->get('tab_reward');
            $this->data['tab_design'] = $this->language->get('tab_design');
          
             if (isset($this->error['warning'])) {
                $this->data['error_warning'] = $this->error['warning'];
            } else {
                $this->data['error_warning'] = '';
            }
    
             if (isset($this->error['name'])) {
                $this->data['error_name'] = $this->error['name'];
            } else {
                $this->data['error_name'] = array();
            }
    
             if (isset($this->error['meta_description'])) {
                $this->data['error_meta_description'] = $this->error['meta_description'];
            } else {
                $this->data['error_meta_description'] = array();
            }     
    
               if (isset($this->error['description'])) {
                $this->data['error_description'] = $this->error['description'];
            } else {
                $this->data['error_description'] = array();
            } 
         
               if (isset($this->error['model'])) {
                $this->data['error_model'] = $this->error['model'];
            } else {
                $this->data['error_model'] = '';
            }     
          
            if (isset($this->error['date_available'])) {
                $this->data['error_date_available'] = $this->error['date_available'];
            } else {
                $this->data['error_date_available'] = '';
            } 
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
            }
         
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
            }
         
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
         
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            } 
         
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                                 
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
         
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
    
              $this->data['breadcrumbs'] = array();
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
                'separator' => false
               );
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'),
                  'separator' => ' :: '
               );
                                     
            if (!isset($this->request->get['product_id'])) {
                $this->data['action'] = $this->url->link('catalog/product/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
            } else {
                $this->data['action'] = $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $this->request->get['product_id'] . $url, 'SSL');
            }
         
            $this->data['cancel'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL');
    
            if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
                  $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
            }
    
            $this->data['token'] = $this->session->data['token'];
         
            $this->load->model('localisation/language');
         
            $this->data['languages'] = $this->model_localisation_language->getLanguages();
         
            if (isset($this->request->post['product_description'])) {
                $this->data['product_description'] = $this->request->post['product_description'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
            } else {
                $this->data['product_description'] = array();
            }
         
            $language_id = $this->config->get('config_language_id');
            if (isset($this->data['product_description'][$language_id]['name'])) {
            $this->data['heading_title'] = $this->data['product_description'][$language_id]['name'];
            }
         
            if (isset($this->request->post['model'])) {
                  $this->data['model'] = $this->request->post['model'];
            } elseif (!empty($product_info)) {
                $this->data['model'] = $product_info['model'];
            } else {
                  $this->data['model'] = '';
            }
    
            if (isset($this->request->post['sku'])) {
                  $this->data['sku'] = $this->request->post['sku'];
            } elseif (!empty($product_info)) {
                $this->data['sku'] = $product_info['sku'];
            } else {
                  $this->data['sku'] = '';
            }
         
            if (isset($this->request->post['upc'])) {
                  $this->data['upc'] = $this->request->post['upc'];
            } elseif (!empty($product_info)) {
                $this->data['upc'] = $product_info['upc'];
            } else {
                  $this->data['upc'] = '';
            }
         
            if (isset($this->request->post['ean'])) {
                  $this->data['ean'] = $this->request->post['ean'];
            } elseif (!empty($product_info)) {
                $this->data['ean'] = $product_info['ean'];
            } else {
                  $this->data['ean'] = '';
            }
         
            if (isset($this->request->post['jan'])) {
                  $this->data['jan'] = $this->request->post['jan'];
            } elseif (!empty($product_info)) {
                $this->data['jan'] = $product_info['jan'];
            } else {
                  $this->data['jan'] = '';
            }
         
            if (isset($this->request->post['isbn'])) {
                  $this->data['isbn'] = $this->request->post['isbn'];
            } elseif (!empty($product_info)) {
                $this->data['isbn'] = $product_info['isbn'];
            } else {
                  $this->data['isbn'] = '';
            }
         
            if (isset($this->request->post['mpn'])) {
                  $this->data['mpn'] = $this->request->post['mpn'];
            } elseif (!empty($product_info)) {
                $this->data['mpn'] = $product_info['mpn'];
            } else {
                  $this->data['mpn'] = '';
            }                             
                 
            if (isset($this->request->post['location'])) {
                  $this->data['location'] = $this->request->post['location'];
            } elseif (!empty($product_info)) {
                $this->data['location'] = $product_info['location'];
            } else {
                  $this->data['location'] = '';
            }
    
            $this->load->model('setting/store');
         
            $this->data['stores'] = $this->model_setting_store->getStores();
         
            if (isset($this->request->post['product_store'])) {
                $this->data['product_store'] = $this->request->post['product_store'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
            } else {
                $this->data['product_store'] = array(0);
            } 
         
            if (isset($this->request->post['keyword'])) {
                $this->data['keyword'] = $this->request->post['keyword'];
            } elseif (!empty($product_info)) {
                $this->data['keyword'] = $product_info['keyword'];
            } else {
                $this->data['keyword'] = '';
            }
         
            if (isset($this->request->post['image'])) {
                $this->data['image'] = $this->request->post['image'];
            } elseif (!empty($product_info)) {
                $this->data['image'] = $product_info['image'];
            } else {
                $this->data['image'] = '';
            }
         
            $this->load->model('tool/image');
         
            if (isset($this->request->post['image']) && file_exists(DIR_IMAGE . $this->request->post['image'])) {
                $this->data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
            } elseif (!empty($product_info) && $product_info['image'] && file_exists(DIR_IMAGE . $product_info['image'])) {
                $this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], 100, 100);
            } else {
                $this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
                $this->data['image'] = 'no_image.jpg';
            }
            $this->load->model('catalog/manufacturer');
         
            $this->data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers();
         
            if (isset($this->request->post['shipping'])) {
                  $this->data['shipping'] = $this->request->post['shipping'];
            } elseif (!empty($product_info)) {
                  $this->data['shipping'] = $product_info['shipping'];
            } else {
                $this->data['shipping'] = 1;
            }
         
            if (isset($this->request->post['price'])) {
                  $this->data['price'] = $this->request->post['price'];
            } elseif (!empty($product_info)) {
                $this->data['price'] = $product_info['price'];
            } else {
                  $this->data['price'] = '';
            }
         
            $this->load->model('localisation/tax_class');
         
            $this->data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
         
            if (isset($this->request->post['tax_class_id'])) {
                  $this->data['tax_class_id'] = $this->request->post['tax_class_id'];
            } elseif (!empty($product_info)) {
                $this->data['tax_class_id'] = $product_info['tax_class_id'];
            } else {
                  $this->data['tax_class_id'] = 0;
            }
                   
            if (isset($this->request->post['date_available'])) {
                   $this->data['date_available'] = $this->request->post['date_available'];
            } elseif (!empty($product_info)) {
                $this->data['date_available'] = date('Y-m-d', strtotime($product_info['date_available']));
            } else {
                $this->data['date_available'] = date('Y-m-d', time() - 86400);
            }
                                             
            if (isset($this->request->post['quantity'])) {
                  $this->data['quantity'] = $this->request->post['quantity'];
            } elseif (!empty($product_info)) {
                  $this->data['quantity'] = $product_info['quantity'];
            } else {
                $this->data['quantity'] = 1;
            }
         
            if (isset($this->request->post['minimum'])) {
                  $this->data['minimum'] = $this->request->post['minimum'];
            } elseif (!empty($product_info)) {
                  $this->data['minimum'] = $product_info['minimum'];
            } else {
                $this->data['minimum'] = 1;
            }
         
            if (isset($this->request->post['subtract'])) {
                  $this->data['subtract'] = $this->request->post['subtract'];
            } elseif (!empty($product_info)) {
                  $this->data['subtract'] = $product_info['subtract'];
            } else {
                $this->data['subtract'] = 1;
            }
         
            if (isset($this->request->post['sort_order'])) {
                  $this->data['sort_order'] = $this->request->post['sort_order'];
            } elseif (!empty($product_info)) {
                  $this->data['sort_order'] = $product_info['sort_order'];
            } else {
                $this->data['sort_order'] = 1;
            }
    
            $this->load->model('localisation/stock_status');
         
            $this->data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses();
         
            if (isset($this->request->post['stock_status_id'])) {
                  $this->data['stock_status_id'] = $this->request->post['stock_status_id'];
            } elseif (!empty($product_info)) {
                  $this->data['stock_status_id'] = $product_info['stock_status_id'];
            } else {
                $this->data['stock_status_id'] = $this->config->get('config_stock_status_id');
            }
                 
    
             
                    if (isset($this->request->post['base_price'])) {
                        $this->data['base_price'] = $this->request->post['base_price'];
                    } else if (isset($product_info['base_price'])) {
                        $this->data['base_price'] = $product_info['base_price'];
                    } else {
                        $this->data['base_price'] = '';
                    }
    
                    if (isset($this->request->post['base_currency_code'])) {
                        $this->data['base_currency_code'] = $this->request->post['base_currency_code'];
                    } else if (isset($product_info['base_currency_code']) and $product_info['base_currency_code'] != '') {
                        $this->data['base_currency_code'] = $product_info['base_currency_code'];
                    } else {
                        $this->data['base_currency_code'] = $this->config->get('config_currency');
                    }
    
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->getCurrencies();
             
             
    
             
                    if (isset($this->request->post['extra_charge'])) {
                        $this->data['extra_charge'] = $this->request->post['extra_charge'];
                    } else if (isset($product_info['extra_charge'])) {
                        $this->data['extra_charge'] = $product_info['extra_charge'];
                    } else {
                        $this->data['extra_charge'] = '';
                    }
             
             
            if (isset($this->request->post['status'])) {
                  $this->data['status'] = $this->request->post['status'];
            } elseif (!empty($product_info)) {
                $this->data['status'] = $product_info['status'];
            } else {
                  $this->data['status'] = 1;
            }
    
            if (isset($this->request->post['weight'])) {
                  $this->data['weight'] = $this->request->post['weight'];
            } elseif (!empty($product_info)) {
                $this->data['weight'] = $product_info['weight'];
            } else {
                  $this->data['weight'] = '';
            }
         
            $this->load->model('localisation/weight_class');
         
            $this->data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
         
            if (isset($this->request->post['weight_class_id'])) {
                  $this->data['weight_class_id'] = $this->request->post['weight_class_id'];
            } elseif (!empty($product_info)) {
                  $this->data['weight_class_id'] = $product_info['weight_class_id'];
            } else {
                  $this->data['weight_class_id'] = $this->config->get('config_weight_class_id');
            }
         
            if (isset($this->request->post['length'])) {
                  $this->data['length'] = $this->request->post['length'];
            } elseif (!empty($product_info)) {
                $this->data['length'] = $product_info['length'];
            } else {
                  $this->data['length'] = '';
            }
         
            if (isset($this->request->post['width'])) {
                  $this->data['width'] = $this->request->post['width'];
            } elseif (!empty($product_info)) { 
                $this->data['width'] = $product_info['width'];
            } else {
                  $this->data['width'] = '';
            }
         
            if (isset($this->request->post['height'])) {
                  $this->data['height'] = $this->request->post['height'];
            } elseif (!empty($product_info)) {
                $this->data['height'] = $product_info['height'];
            } else {
                  $this->data['height'] = '';
            }
    
            $this->load->model('localisation/length_class');
         
            $this->data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
         
            if (isset($this->request->post['length_class_id'])) {
                  $this->data['length_class_id'] = $this->request->post['length_class_id'];
            } elseif (!empty($product_info)) {
                  $this->data['length_class_id'] = $product_info['length_class_id'];
            } else {
                  $this->data['length_class_id'] = $this->config->get('config_length_class_id');
            }
    
            $this->load->model('catalog/manufacturer');
         
            if (isset($this->request->post['manufacturer_id'])) {
                  $this->data['manufacturer_id'] = $this->request->post['manufacturer_id'];
            } elseif (!empty($product_info)) {
                $this->data['manufacturer_id'] = $product_info['manufacturer_id'];
            } else {
                  $this->data['manufacturer_id'] = 0;
            }      
         
            if (isset($this->request->post['manufacturer'])) {
                  $this->data['manufacturer'] = $this->request->post['manufacturer'];
            } elseif (!empty($product_info)) {
                $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
             
                if ($manufacturer_info) {     
                    $this->data['manufacturer'] = $manufacturer_info['name'];
                } else {
                    $this->data['manufacturer'] = '';
                } 
            } else {
                  $this->data['manufacturer'] = '';
            }
         
            // Categories
            $this->load->model('catalog/category');
         
            if (isset($this->request->post['product_category'])) {
                $categories = $this->request->post['product_category'];
            } elseif (isset($this->request->get['product_id'])) {     
                $categories = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
            } else {
                $categories = array();
            }
            $this->data['categories'] = $this->model_catalog_category->getCategories(0);
            $this->data['product_categories'] = array();
         
            foreach ($categories as $category_id) {
                $category_info = $this->model_catalog_category->getCategory($category_id);
             
                if ($category_info) {
                    $this->data['product_categories'][] = array(
                        'category_id' => $category_info['category_id'],
                        'name'        => ($category_info['path'] ? $category_info['path'] . ' &gt; ' : '') . $category_info['name']
                    );
                }
            }
         
            // Filters
            $this->load->model('catalog/filter');
         
            if (isset($this->request->post['product_filter'])) {
                $filters = $this->request->post['product_filter'];
            } elseif (isset($this->request->get['product_id'])) {
                $filters = $this->model_catalog_product->getProductFilters($this->request->get['product_id']);
            } else {
                $filters = array();
            }
         
            $this->data['product_filters'] = array();
         
            foreach ($filters as $filter_id) {
                $filter_info = $this->model_catalog_filter->getFilter($filter_id);
             
                if ($filter_info) {
                    $this->data['product_filters'][] = array(
                        'filter_id' => $filter_info['filter_id'],
                        'name'      => $filter_info['group'] . ' &gt; ' . $filter_info['name']
                    );
                }
            }     
         
            // Attributes
            $this->load->model('catalog/attribute');
         
            if (isset($this->request->post['product_attribute'])) {
                $product_attributes = $this->request->post['product_attribute'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_attributes = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
            } else {
                $product_attributes = array();
            }
         
            $this->data['product_attributes'] = array();
         
            foreach ($product_attributes as $product_attribute) {
                $attribute_info = $this->model_catalog_attribute->getAttribute($product_attribute['attribute_id']);
             
                if ($attribute_info) {
                    $this->data['product_attributes'][] = array(
                        'attribute_id'                  => $product_attribute['attribute_id'],
                        'name'                          => $attribute_info['name'],
                        'product_attribute_description' => $product_attribute['product_attribute_description']
                    );
                }
            }     
         
            // Options
            $this->load->model('catalog/option');
         
            if (isset($this->request->post['product_option'])) {
                $product_options = $this->request->post['product_option'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);         
            } else {
                $product_options = array();
            }         
         
            $this->data['product_options'] = array();
             
            foreach ($product_options as $product_option) {
                if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
                    $product_option_value_data = array();
                 
                    foreach ($product_option['product_option_value'] as $product_option_value) {
                        $product_option_value_data[] = array(
    
                        'ob_sku'                       => $product_option_value['ob_sku'], //Q: Options Boost
                        'ob_info'                    => $product_option_value['ob_info'], //Q: Options Boost
                        'ob_image'                   => $product_option_value['ob_image'], //Q: Options Boost
                        'ob_sku_override'            => isset($product_option_value['ob_sku_override']) ? $product_option_value['ob_sku_override'] : false, //Q: Options Boost
             
                            'product_option_value_id' => $product_option_value['product_option_value_id'],
                            'option_value_id'         => $product_option_value['option_value_id'],
                            'quantity'                => $product_option_value['quantity'],
                            'subtract'                => $product_option_value['subtract'],
                            'price'                   => $product_option_value['price'],
    
             
                    'base_price'         => isset($product_option_value['base_price'])? $product_option_value['base_price'] : '',
             
             
                            'price_prefix'            => $product_option_value['price_prefix'],
                            'points'                  => $product_option_value['points'],
                            'points_prefix'           => $product_option_value['points_prefix'],                     
                            'weight'                  => $product_option_value['weight'],
                            'weight_prefix'           => $product_option_value['weight_prefix'] 
                        );
                    }
                 
                    $this->data['product_options'][] = array(
                        'product_option_id'    => $product_option['product_option_id'],
                        'product_option_value' => $product_option_value_data,
                        'option_id'            => $product_option['option_id'],
                        'name'                 => $product_option['name'],
                        'type'                 => $product_option['type'],
                        'required'             => $product_option['required']
                    );             
                } else {
                    $this->data['product_options'][] = array(
                        'product_option_id' => $product_option['product_option_id'],
                        'option_id'         => $product_option['option_id'],
                        'name'              => $product_option['name'],
                        'type'              => $product_option['type'],
                        'option_value'      => $product_option['option_value'],
                        'required'          => $product_option['required']
                    );             
                }
            }
         
            $this->data['option_values'] = array();
         
            foreach ($this->data['product_options'] as $product_option) {
                if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
                    if (!isset($this->data['option_values'][$product_option['option_id']])) {
                        $this->data['option_values'][$product_option['option_id']] = $this->model_catalog_option->getOptionValues($product_option['option_id']);
                    }
                }
            }
         
    
            //Q: Options Boost
          foreach ($this->data['product_options'] as $k1 => $product_option) {
            if (isset($product_option['product_option_value'])) {
                    foreach ($product_option['product_option_value'] as $k2 => $product_option_value) {
                        if (isset($product_option_value['ob_image']) && file_exists(DIR_IMAGE . $product_option_value['ob_image']) && is_file(DIR_IMAGE . $product_option_value['ob_image'])) {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize($product_option_value['ob_image'], 38, 38);
                        } else {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize('no_image.jpg', 38, 38);
                        }
                    }
                }
            }//
             
            $this->load->model('sale/customer_group');
         
            $this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups();
         
            if (isset($this->request->post['product_discount'])) {
                $this->data['product_discounts'] = $this->request->post['product_discount'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_discounts'] = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
            } else {
                $this->data['product_discounts'] = array();
            }
    
            if (isset($this->request->post['product_special'])) {
                $this->data['product_specials'] = $this->request->post['product_special'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_specials'] = $this->model_catalog_product->getProductSpecials($this->request->get['product_id']);
            } else {
                $this->data['product_specials'] = array();
            }
         
            // Images
            if (isset($this->request->post['product_image'])) {
                $product_images = $this->request->post['product_image'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_images = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
            } else {
                $product_images = array();
            }
         
            $this->data['product_images'] = array();
         
            foreach ($product_images as $product_image) {
                if ($product_image['image'] && file_exists(DIR_IMAGE . $product_image['image'])) {
                    $image = $product_image['image'];
                } else {
                    $image = 'no_image.jpg';
                }
             
                $this->data['product_images'][] = array(
                    'image'      => $image,
                    'thumb'      => $this->model_tool_image->resize($image, 100, 100),
                    'sort_order' => $product_image['sort_order']
                );
            }
    
            $this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
    
            // Downloads
            $this->load->model('catalog/download');
         
            if (isset($this->request->post['product_download'])) {
                $product_downloads = $this->request->post['product_download'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_downloads = $this->model_catalog_product->getProductDownloads($this->request->get['product_id']);
            } else {
                $product_downloads = array();
            }
             
            $this->data['product_downloads'] = array();
         
            foreach ($product_downloads as $download_id) {
                $download_info = $this->model_catalog_download->getDownload($download_id);
             
                if ($download_info) {
                    $this->data['product_downloads'][] = array(
                        'download_id' => $download_info['download_id'],
                        'name'        => $download_info['name']
                    );
                }
            }
     
            if (isset($this->request->post['main_category_id'])) {
                $this->data['main_category_id'] = $this->request->post['main_category_id'];
            } elseif (isset($product_info)) {
                $this->data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']);
            } else {
                $this->data['main_category_id'] = 0;
            }
         
            if (isset($this->request->post['product_category'])) {
                $this->data['product_category'] = $this->request->post['product_category'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
            } else {
                $this->data['product_category'] = array();
            }     
         
            if (isset($this->request->post['product_related'])) {
                $products = $this->request->post['product_related'];
            } elseif (isset($this->request->get['product_id'])) {     
                $products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
            } else {
                $products = array();
            }
     
            $this->data['product_related'] = array();
         
            foreach ($products as $product_id) {
                $related_info = $this->model_catalog_product->getProduct($product_id);
             
                if ($related_info) {
                    $this->data['product_related'][] = array(
                        'product_id' => $related_info['product_id'],
                        'name'       => $related_info['name']
                    );
                }
            }
    
            if (isset($this->request->post['points'])) {
                  $this->data['points'] = $this->request->post['points'];
            } elseif (!empty($product_info)) {
                $this->data['points'] = $product_info['points'];
            } else {
                  $this->data['points'] = '';
            }
                         
            if (isset($this->request->post['product_reward'])) {
                $this->data['product_reward'] = $this->request->post['product_reward'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']);
            } else {
                $this->data['product_reward'] = array();
            }
         
            if (isset($this->request->post['product_layout'])) {
                $this->data['product_layout'] = $this->request->post['product_layout'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_layout'] = $this->model_catalog_product->getProductLayouts($this->request->get['product_id']);
            } else {
                $this->data['product_layout'] = array();
            }
    
            $this->load->model('design/layout');
    
                $this->load->model('catalog/category');
                $this->data['categories'] = $this->model_catalog_category->getCategories(0);
             
         
            $this->data['layouts'] = $this->model_design_layout->getLayouts();
                                         
            $this->template = 'catalog/product_form.tpl';
            $this->children = array(
                'common/header',
                'common/footer'
            );
                 
            $this->response->setOutput($this->render());
          }
     
          protected function validateForm() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission');
            }
    
            foreach ($this->request->post['product_description'] as $language_id => $value) {
                  if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 255)) {
                    $this->error['name'][$language_id] = $this->language->get('error_name');
                  }
            }
         
            if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
                  $this->error['model'] = $this->language->get('error_model');
            }
         
            if ($this->error && !isset($this->error['warning'])) {
                $this->error['warning'] = $this->language->get('error_warning');
            }
                     
            if (!$this->error) {
                return true;
            } else {
                  return false;
            }
          }
     
          protected function validateDelete() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission');
            }
         
            if (!$this->error) {
                  return true;
            } else {
                  return false;
            }
          }
       
          protected function validateCopy() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission');
            }
         
            if (!$this->error) {
                  return true;
            } else {
                  return false;
            }
          }
         
        public function autocomplete() {
            $json = array();
         
            if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_category_id'])) {
                $this->load->model('catalog/product');
                $this->load->model('catalog/option');
             
                if (isset($this->request->get['filter_name'])) {
                    $filter_name = $this->request->get['filter_name'];
                } else {
                    $filter_name = '';
                }
             
                if (isset($this->request->get['filter_model'])) {
                    $filter_model = $this->request->get['filter_model'];
                } else {
                    $filter_model = '';
                }
             
                if (isset($this->request->get['limit'])) {
                    $limit = $this->request->get['limit']; 
                } else {
                    $limit = 20; 
                }         
                         
                $data = array(
                    'filter_name'  => $filter_name,
                    'filter_model' => $filter_model,
                    'start'        => 0,
                    'limit'        => $limit
                );
             
                if (isset($this->request->get['filter_category_id'])) {
                    $data['filter_category_id'] = $this->request->get['filter_category_id'];
                }
             
                $results = $this->model_catalog_product->getProducts($data);
             
                foreach ($results as $result) {
                    $option_data = array();
                 
                    $product_options = $this->model_catalog_product->getProductOptions($result['product_id']); 
                 
                    foreach ($product_options as $product_option) {
                        $option_info = $this->model_catalog_option->getOption($product_option['option_id']);
                     
                        if ($option_info) {             
                            if ($option_info['type'] == 'select' || $option_info['type'] == 'radio' || $option_info['type'] == 'checkbox' || $option_info['type'] == 'image') {
                                $option_value_data = array();
                             
                                foreach ($product_option['product_option_value'] as $product_option_value) {
                                    $option_value_info = $this->model_catalog_option->getOptionValue($product_option_value['option_value_id']);
                         
                                    if ($option_value_info) {
                                        $option_value_data[] = array(
                                            'product_option_value_id' => $product_option_value['product_option_value_id'],
                                            'option_value_id'         => $product_option_value['option_value_id'],
                                            'name'                    => $option_value_info['name'],
                                            'price'                   => (float)$product_option_value['price'] ? $this->currency->format($product_option_value['price'], $this->config->get('config_currency')) : false,
                                            'price_prefix'            => $product_option_value['price_prefix']
                                        );
                                    }
                                }
                         
                                $option_data[] = array(
                                    'product_option_id' => $product_option['product_option_id'],
                                    'option_id'         => $product_option['option_id'],
                                    'name'              => $option_info['name'],
                                    'type'              => $option_info['type'],
                                    'option_value'      => $option_value_data,
                                    'required'          => $product_option['required']
                                ); 
                            } else {
                                $option_data[] = array(
                                    'product_option_id' => $product_option['product_option_id'],
                                    'option_id'         => $product_option['option_id'],
                                    'name'              => $option_info['name'],
                                    'type'              => $option_info['type'],
                                    'option_value'      => $product_option['option_value'],
                                    'required'          => $product_option['required']
                                );             
                            }
                        }
                    }
                     
                    $json[] = array(
                        'product_id' => $result['product_id'],
                        'name'       => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')), 
                        'model'      => $result['model'],
                        'option'     => $option_data,
                        'price'      => $result['price']
                    ); 
                }
            }
    
            $this->response->setOutput(json_encode($json));
        }
    }
    ?>
    
    Вот не знаю по правилам ли выложить файлы модулей :(
     
    Последнее редактирование: 6 дек 2014
  4. AnOcToJI

    AnOcToJI

    Регистрация:
    28 дек 2012
    Сообщения:
    309
    Симпатии:
    188
    да сами файлы не нужны, только код файлов vqmoda и не более
     
  5. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    options_boost_vqmod
    Код:
    <modification>
    
        <id>Options Boost</id>
        <version>v156.1</version>
        <vqmver>2.3.2</vqmver>
        <author>qphoria</author>
    
    
        <file name="admin/controller/catalog/product.php">
    
            <!-- This adds the new checkdb function for the database tables 1.5.5+ -->
            <operation  info="1.5.5 change for load-language to language-load" error="skip">
                <search position="after"><![CDATA[
                $this->language->load('catalog/product');
                ]]></search>
                <add><![CDATA[
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
                ]]></add>
            </operation>
    
            <operation info="1.5.5 change for categories loading since it was replaced by autocomplete --shudders--">
                <search position="after"><![CDATA[
                $this->load->model('design/layout');
                ]]></search>
                <add><![CDATA[
                $this->load->model('catalog/category');
                $this->data['categories'] = $this->model_catalog_category->getCategories(0);
                ]]></add>
            </operation>
    
            <!-- This adds the new checkdb function for the database tables 1.5.0-to-1.5.4-->
            <operation error="skip">
                <search position="after"><![CDATA[
                $this->load->language('catalog/product');
                ]]></search>
                <add><![CDATA[
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                function getForm()
                ]]></search>
                <add><![CDATA[
            $this->checkdb_ob(); //Q: Options Boost
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
                ]]></add>
            </operation>
    
            <!-- This is the check that adds the new fields to the database -->
            <operation>
                <search position="before"><![CDATA[
                public function insert()
                ]]></search>
                <add><![CDATA[
        //Q: Options Boost
        private function checkdb_ob() {
    
            $fields = array();
    
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku` VARCHAR(64) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_info',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_info` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_image',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_image` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku_override',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku_override` int(1) NOT NULL DEFAULT '0'"
            );
    
            foreach ($fields as $field) {
                $sql = "DESC `" . DB_PREFIX . "$field[table]` $field[column]";
                $query = $this->db->query($sql);
                if (!$query->num_rows) {
                    $this->db->query($field['sql']);
                }
            }
        }//
                ]]></add>
            </operation>
    
            <!-- This part handles the option image preview in the admin -->
            <operation>
               <search position="before"><![CDATA[
               $this->load->model('sale/customer_group');
              ]]></search>
                <add><![CDATA[
            //Q: Options Boost
          foreach ($this->data['product_options'] as $k1 => $product_option) {
            if (isset($product_option['product_option_value'])) {
                    foreach ($product_option['product_option_value'] as $k2 => $product_option_value) {
                        if (isset($product_option_value['ob_image']) && file_exists(DIR_IMAGE . $product_option_value['ob_image']) && is_file(DIR_IMAGE . $product_option_value['ob_image'])) {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize($product_option_value['ob_image'], 38, 38);
                        } else {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize('no_image.jpg', 38, 38);
                        }
                    }
                }
            }//
                ]]></add>
            </operation>
    
            <!-- This part adds the new array elements to the view variable -->
            <operation>
                <search position="after"><![CDATA[
                $product_option_value_data[] = array(
                ]]></search>
                <add><![CDATA[
                        'ob_sku'                       => $product_option_value['ob_sku'], //Q: Options Boost
                        'ob_info'                    => $product_option_value['ob_info'], //Q: Options Boost
                        'ob_image'                   => $product_option_value['ob_image'], //Q: Options Boost
                        'ob_sku_override'            => isset($product_option_value['ob_sku_override']) ? $product_option_value['ob_sku_override'] : false, //Q: Options Boost
                ]]></add>
            </operation>
    
            <!-- This is the callback for the batch options category dropdown ajax call to load the products for that category -->
            <operation>
                <search position="before"><![CDATA[
                public function index()
                ]]></search>
                <add><![CDATA[
                    // Options Boost
                    public function ob_category() {
                        $this->load->model('catalog/product');
    
                        if (isset($this->request->get['category_id'])) {
                            $category_id = $this->request->get['category_id'];
                        } else {
                            $category_id = 0;
                        }
    
                        $product_data = array();
    
                        $results = $this->model_catalog_product->getProductsByCategoryId($category_id);
    
                        foreach ($results as $result) {
                            $product_data[] = array(
                                'product_id' => $result['product_id'],
                                'name'       => $result['name'],
                                'model'      => $result['model']
                            );
                        }
    
                        if (version_compare(VERSION, '1.5.1.3', '<')) { //v1.5.1.2 or earlier
                            $this->load->library('json');
                            $this->response->setOutput(Json::encode($product_data));
                        } else {
                            $this->response->setOutput(json_encode($product_data));
                        }
    
                    }//
                ]]></add>
            </operation>
    
        </file>
    
        <file name="admin/model/catalog/product.php">
    
            <operation><!-- This should match twice -->
                <search position="after"><![CDATA[
                $product_option_value_data[] = array(
                ]]></search>
                <add><![CDATA[
                        'ob_sku'                       => $product_option_value['ob_sku'], //Q: Options Boost
                        'ob_info'                    => $product_option_value['ob_info'], //Q: Options Boost
                        'ob_image'                   => $product_option_value['ob_image'], //Q: Options Boost
                        'ob_sku_override'            => $product_option_value['ob_sku_override'], //Q: Options Boost
                ]]></add>
            </operation>
    
            <operation><!-- This should match twice -->
                <search position="before"><![CDATA[
                if (isset($data['product_option']))
                ]]></search>
                <add><![CDATA[
            $this->addBatchOptions($data); //Q: Options Boost
                ]]></add>
            </operation>
    
            <operation><!-- This should match twice. Note this is a partial line match -->
                <search position="after"><![CDATA[
                $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET
                ]]></search>
                <add><![CDATA[
                            //Q: Options Boost
                            $ob_pov_id = $this->db->getLastId();
                            if(isset($product_option_value['ob_sku'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_sku = '" . $this->db->escape($product_option_value['ob_sku']) . "' WHERE product_option_value_id = '" . (int)$ob_pov_id . "'"); }
                            if(isset($product_option_value['ob_info'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_info = '" . $this->db->escape($product_option_value['ob_info']) . "' WHERE product_option_value_id = '" . (int)$ob_pov_id . "'"); }
                            if(isset($product_option_value['ob_image'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_image = '" . $this->db->escape($product_option_value['ob_image']) . "' WHERE product_option_value_id = '" . (int)$ob_pov_id . "'"); }
                            if(isset($product_option_value['ob_sku_override'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_sku_override = '" . $this->db->escape($product_option_value['ob_sku_override']) . "' WHERE product_option_value_id = '" . (int)$ob_pov_id . "'"); }
                            unset($ob_pov_id);
                            //
                ]]></add>
            </operation>
    
            <operation>
                <search position="before"><![CDATA[
                public function editProduct($product_id, $data)
                ]]></search>
                <add><![CDATA[
        public function addBatchOptions($data) {
            if (isset($data['product_batchoption'])) {
    
                  foreach ($data['product_batchoption'] as $product_id) {
    
                      // Delete all existing if delete box is checked for additional items
                      if (isset($data['batchdelete'])) {
                          $this->db->query("DELETE FROM " . DB_PREFIX . "product_option WHERE product_id = '" . (int)$product_id . "'");
                        $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'");
                    }
    
                    // Add new Options
                    if (isset($data['product_option'])) {
                        foreach ($data['product_option'] as $k1 => $product_option) {
                            //$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . $this->db->escape($product_option_value['option_value_id']) . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', price_prefix = '" . $this->db->escape($product_option_value['price_prefix']) . "', points = '" . (int)$product_option_value['points'] . "', points_prefix = '" . $this->db->escape($product_option_value['points_prefix']) . "', weight = '" . (float)$product_option_value['weight'] . "', weight_prefix = '" . $this->db->escape($product_option_value['weight_prefix']) . "'");
                            $this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', required = '" . (int)$product_option['required'] . "'");
    
                            $product_option_id = $this->db->getLastId();
    
                            if (isset($product_option['product_option_value'])) {
                                foreach ($product_option['product_option_value'] as $k2 => $product_option_value) {
                                    $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . $this->db->escape($product_option_value['option_value_id']) . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', price_prefix = '" . $this->db->escape($product_option_value['price_prefix']) . "', points = '" . (int)$product_option_value['points'] . "', points_prefix = '" . $this->db->escape($product_option_value['points_prefix']) . "', weight = '" . (float)$product_option_value['weight'] . "', weight_prefix = '" . $this->db->escape($product_option_value['weight_prefix']) . "'");
    
                                    $product_option_value_id = $this->db->getLastId();
    
                                    //Q: Options Boost
                                    if(isset($product_option_value['ob_sku'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_sku = '" . $this->db->escape($product_option_value['ob_sku']) . "' WHERE product_option_value_id = '" . (int)$product_option_value_id . "'"); }
                                    if(isset($product_option_value['ob_info'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_info = '" . $this->db->escape($product_option_value['ob_info']) . "' WHERE product_option_value_id = '" . (int)$product_option_value_id . "'"); }
                                    if(isset($product_option_value['ob_image'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_image = '" . $this->db->escape($product_option_value['ob_image']) . "' WHERE product_option_value_id = '" . (int)$product_option_value_id . "'"); }
                                    if(isset($product_option_value['ob_sku_override'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET ob_sku_override = '" . $this->db->escape($product_option_value['ob_sku_override']) . "' WHERE product_option_value_id = '" . (int)$product_option_value_id . "'"); }
                                }
                            }
                        }
                    }
                }
            }
        }
                ]]></add>
            </operation>
        </file>
    
    
        <file name="admin/view/template/catalog/product_form.tpl">
    
            <operation>
                <search position="after" index="1"><![CDATA[
                <td class="right"><?php echo $entry_weight; ?></td>
                ]]></search>
                <add><![CDATA[
                <td class="right" style="width:10%;"><?php echo $entry_sku; ?></td>
                <td class="right"><?php echo $entry_image; ?></td>
                ]]></add>
            </operation>
    
            <operation><!-- Add info tr -->
                <search position="after" offset="2"><![CDATA[
                [<?php echo $option_value_row; ?>][weight]
                ]]></search>
                <add><![CDATA[
                        <tr><td class="left"><?php echo $entry_info; ?></td><td colspan="8" class="left"><input name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][ob_info]" value="<?php echo $product_option_value['ob_info']; ?>" size="100"></td></tr>
                ]]></add>
            </operation>
    
            <operation><!-- Add info tr to add button -->
                <search position="after" offset="2"><![CDATA[
                option_value_row + '][weight]
                ]]></search>
                <add><![CDATA[
                html += '  <tr><td class="left"><?php echo $entry_info; ?></td><td colspan="8" class="left"><input name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][ob_info]" value="" size="100"></td></tr>';
                ]]></add>
            </operation>
    
    
            <operation><!-- partial match. Add sku and image fields -->
                <search position="after"><![CDATA[
                <?php echo $product_option_value['weight']; ?>
                ]]></search>
                <add><![CDATA[
                        <td class="right">
                          <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][ob_sku]" value="<?php echo $product_option_value['ob_sku']; ?>" size="4" />
                          <br/><input type="checkbox" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][ob_sku_override]" value="1" size="4" id="sku_override_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>" <?php echo (isset($product_option_value['ob_sku_override']) && $product_option_value['ob_sku_override']) ? 'checked="checked"' : ''; ?>/><lable for="sku_override_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>"><?php echo $text_sku_override; ?></label>
                        </td>
                        <td>
                          <img src="<?php echo $product_option_value['preview']; ?>" alt="<?php echo $product_option_value['ob_image']; ?>" id="preview_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>" onclick="image_upload('image_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>', 'preview_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>');"/>
                          <input type="hidden" id="image_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][ob_image]" value="<?php echo $product_option_value['ob_image']; ?>" />
                          <br/><a onclick="$('#preview_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>').attr('src', '<?php echo $this->model_tool_image->resize('no_image.jpg', 38, 38); ?>'); $('#image_<?php echo $option_row; ?>_<?php echo $option_value_row; ?>').attr('value', '');">Clear</a>
                        </td>
                ]]></add>
            </operation>
    
            <operation>
                <search position="replace" offset="9"><![CDATA[
                <?php if ($product_option_value['price_prefix'] == '+') { ?>
                ]]></search>
                <add><![CDATA[
                <option value="+" <?php echo ($product_option_value['price_prefix'] == '+') ? 'selected="selected"' : '' ?>>+</option>
                <option value="-" <?php echo ($product_option_value['price_prefix'] == '-') ? 'selected="selected"' : '' ?>>-</option>
                <option value="*" <?php echo ($product_option_value['price_prefix'] == '*') ? 'selected="selected"' : '' ?>>*</option>
                <option value="%" <?php echo ($product_option_value['price_prefix'] == '%') ? 'selected="selected"' : '' ?>>%</option>
                <option value="=" <?php echo ($product_option_value['price_prefix'] == '=') ? 'selected="selected"' : '' ?>>=</option>
                <option value="1" <?php echo ($product_option_value['price_prefix'] == '1') ? 'selected="selected"' : '' ?>>1</option>
                ]]></add>
            </operation>
    
            <operation>
                <search position="after" offset="1" index="2"><![CDATA[
                <?php $option_row++; ?>
                ]]></search>
                <add><![CDATA[
              <?php //Q: Options Boost ?>
              <?php $this->load->language('catalog/options_boost'); ?>
              <div style="padding-left:210px;"><?php echo $this->language->get('entry_batch'); ?>
                  <table border="0">
                    <tr>
                      <td style="padding: 0;"><select id="category_batchoption" style="margin-bottom: 5px;" onchange="getProductsBatchOption();">
                          <?php foreach ($categories as $category) { ?>
                          <option value="<?php echo $category['category_id']; ?>"><?php echo addslashes($category['name']); ?></option>
                          <?php } ?>
                        </select></td>
                        <td></td>
                      <td><input type="checkbox" name="batchdelete" value="1" /><label for="batchdelete"><?php echo $this->language->get('entry_batchdelete');?></label></td>
                    </tr>
                    <tr>
                      <td style="padding: 0;">
                        <select multiple="multiple" id="batchoption_product" size="6" style="width: 300px;">
                        </select>
                      </td>
                      <td style="vertical-align: middle;">
                        <input type="button" value="--&gt;" onclick="addBatchOption();" />
                        <br />
                        <input type="button" value="&lt;--" onclick="removeBatchOption();" />
                      </td>
                      <td style="padding: 0;">
                        <select multiple="multiple" id="batchoption" size="6" style="width: 300px;">
                        </select>
                      </td>
                    </tr>
                  </table>
                  <div id="product_batchoption"></div>
                </div>
                ]]></add>
            </operation>
    
            <operation error="skip"><!-- partial match -->
                <search position="replace" index="1"><![CDATA[
                <td colspan="6"></td>
                ]]></search>
                <add><![CDATA[
                <td colspan="8"></td>
                ]]></add>
            </operation>
    
            <operation error="skip"><!-- partial match -->
                <search position="replace"><![CDATA[
                html += '        <td colspan="6"></td>';
                ]]></search>
                <add><![CDATA[
                html += '        <td colspan="8"></td>';
                ]]></add>
            </operation>
    
            <operation><!-- partial match -->
                <search position="after"><![CDATA[
                html += '        <td class="right"><?php echo $entry_weight; ?></td>';
                ]]></search>
                <add><![CDATA[
                html += '        <td class="right" style="width:10%;"><?php echo $entry_sku; ?></td>';
                html += '        <td class="right"><?php echo $entry_image; ?></td>';
                ]]></add>
            </operation>
    
            <operation>
                <search position="after" offset="2"><![CDATA[
                html += '    <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price_prefix]">';
                ]]></search>
                <add><![CDATA[
                html += '      <option value="*">*</option>';
                html += '      <option value="%">%</option>';
                html += '      <option value="=">=</option>';
                html += '      <option value="1">1</option>';
                ]]></add>
            </operation>
    
            <operation><!-- partial match -->
                <search position="after"><![CDATA[
                html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight]" value="" size="5" /></td>';
                ]]></search>
                <add><![CDATA[
                html += '    <td class="right">';
                html += '      <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][ob_sku]" value="" size="3" />';
                html += '      <br/><input type="checkbox" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][ob_sku_override]" value="1" size="4" id="sku_override_'+ option_row + '_' + option_value_row + '" /><lable for="sku_override_'+ option_row + '_' + option_value_row + '"><?php echo $text_sku_override; ?></label>';
                html += '    </td>';
                html += '    <td>';
                html += '      <img src="<?php echo HTTPS_SERVER; ?>../image/cache/no_image-38x38.jpg" alt="" id="preview_'+ option_row + '_' + option_value_row + '" onclick="image_upload(\'image_'+ option_row + '_' + option_value_row + '\', \'preview_'+ option_row + '_' + option_value_row + '\');" />';
                html += '      <input type="hidden" id="image_' + option_row + '_' + option_value_row + '" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][ob_image]" value="" />';
                html += '    </td>';
                ]]></add>
            </operation>
           
            <operation>
                <search position="replace"><![CDATA[
                <?php echo $footer; ?>
                ]]></search>
                <add><![CDATA[
    
                <script type="text/javascript"><!--
    function addBatchOption() {
        jQuery('#batchoption_product :selected').each(function() {
            jQuery(this).remove();
    
            jQuery('#batchoption option[value=\'' + jQuery(this).attr('value') + '\']').remove();
    
            jQuery('#batchoption').append('<option value="' + jQuery(this).attr('value') + '">' + jQuery(this).text() + '</option>');
    
            jQuery('#product_batchoption input[value=\'' + jQuery(this).attr('value') + '\']').remove();
    
            jQuery('#product_batchoption').append('<input type="hidden" name="product_batchoption[]" value="' + jQuery(this).attr('value') + '" />');
        });
    }
    
    function removeBatchOption() {
        jQuery('#batchoption :selected').each(function() {
            jQuery(this).remove();
    
            jQuery('#batchoption_product').append('<option value="' + jQuery(this).attr('value') + '">' + jQuery(this).text() + '</option>');
    
            jQuery('#product_batchoption input[value=\'' + jQuery(this).attr('value') + '\']').remove();
        });
    }
    
    function getProducts() {
        jQuery('#product option').remove();
    
        <?php if (isset($this->request->get['product_id'])) {?>
        var product_id = '<?php echo $this->request->get['product_id'] ?>';
        <?php } else { ?>
        var product_id = 0;
        <?php } ?>
    
        <?php if (defined('_JEXEC')) { ?>
        var ajaxurl = 'index.php?option=com_aceshop&format=raw&tmpl=component&route=catalog/product/ob_category&token=<?php echo $token; ?>&category_id=' + jQuery('#category').attr('value');
        <?php } else { ?>
        var ajaxurl = 'index.php?route=catalog/product/ob_category&token=<?php echo $token; ?>&category_id=' + jQuery('#category').attr('value');
        <?php } ?>
    
        jQuery.ajax({
            url: ajaxurl,
            dataType: 'json',
            success: function(data) {
                for (i = 0; i < data.length; i++) {
                    if (data[i]['product_id'] == product_id) { continue; }
                     jQuery('#product').append('<option value="' + data[i]['product_id'] + '">' + data[i]['name'] + ' (' + data[i]['model'] + ') </option>');
                }
            }
        });
    }
    
    function getProductsBatchOption() {
        jQuery('#batchoption_product option').remove();
    
        <?php if (isset($this->request->get['product_id'])) {?>
        var product_id = '<?php echo $this->request->get['product_id'] ?>';
        <?php } else { ?>
        var product_id = 0;
        <?php } ?>
    
        <?php if (defined('_JEXEC')) { ?>
        var ajaxurl = 'index.php?option=com_aceshop&format=raw&tmpl=component&route=catalog/product/ob_category&token=<?php echo $token; ?>&category_id=' + jQuery('#category_batchoption').attr('value');
        <?php } else { ?>
        var ajaxurl = 'index.php?route=catalog/product/ob_category&token=<?php echo $token; ?>&category_id=' + jQuery('#category_batchoption').attr('value');
        <?php } ?>
    
        jQuery.ajax({
            url: ajaxurl,
            dataType: 'json',
            success: function(data) {
                for (i = 0; i < data.length; i++) {
                    if (data[i]['product_id'] == product_id) { continue; }
                     jQuery('#batchoption_product').append('<option value="' + data[i]['product_id'] + '">' + data[i]['name'] + ' (' + data[i]['model'] + ') </option>');
                }
            }
        });
    }
    
    
    getProductsBatchOption();
    
    //--></script>
    
    <?php echo $footer; ?>
    
                ]]></add>
            </operation>
    
        </file>
    
    
    
        <!-- START CATALOG CHANGES -->
    
    
        <!-- Replace smaller option data call with full select * to get all fields dynamically -->
        <file name="system/library/cart.php">
            <operation>
                <search position="after"><![CDATA[
                WHERE pov.product_option_value_id = '" . (int)$option_value . "'
                ]]></search>
                <add><![CDATA[
                         //Q: Options Boost - Override default query for select/radio/image
                         $option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) WHERE pov.product_option_value_id = '" . (int)$option_value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
                ]]></add>
            </operation>
            <operation>
                <search position="after"><![CDATA[
                WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "'
                ]]></search>
                <add><![CDATA[
                         //Q: Options Boost - Override default query for checkbox
                         $option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
                ]]></add>
            </operation>
    
            <operation>
                <search position="after"><![CDATA[
                $option_data = array();
                ]]></search>
                <add><![CDATA[
                    //Q: Options Boost - overwrite product image with option image for cart (pt1)
                    $option_price_only = false;
                      $prod_image = $product_query->row['image'];
    
                    //Q: Options Boost (cloned pricing code for convenience. Not best way. Should move the code below)
                    if ($this->customer->isLogged()) {
                        $customer_group_id = $this->customer->getCustomerGroupId();
                    } else {
                        $customer_group_id = $this->config->get('config_customer_group_id');
                    }
    
                    $price = $product_query->row['price'];
    
                    // Product Discounts
                    $discount_quantity = 0;
    
                    foreach ($this->session->data['cart'] as $key_2 => $quantity_2) {
                        $product_2 = explode(':', $key_2);
    
                        if ($product_2[0] == $product_id) {
                            $discount_quantity += $quantity_2;
                        }
                    }
    
                    $product_discount_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND quantity <= '" . (int)$discount_quantity . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY quantity DESC, priority ASC, price ASC LIMIT 1");
    
                    if ($product_discount_query->num_rows) {
                        $price = $product_discount_query->row['price'];
                    }
    
                    // Product Specials
                    $product_special_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");
    
                    $disc_factor = 1;
                    if ($product_special_query->num_rows) {
                        $price = $product_special_query->row['price'];
                        $disc_factor = ((float)$product_special_query->row['price'] / (float)$product_query->row['price']);
                    }
                ]]></add>
            </operation>
    
    
            <operation>
                <search position="before"><![CDATA[
                $option_data[] = array(
                ]]></search>
                <add><![CDATA[
                            //Q: Options Boost - Support additional price prefixes
                            if (!empty($option_value_query)) {
                                if ($option_value_query->row['price_prefix'] == '%') {
                                    $option_price = $option_price + ($price * ($option_value_query->row['price']/100));
                                    $option_value_query->row['price_prefix'] = '+';
                                } elseif ($option_value_query->row['price_prefix'] == '=') {
                                    $option_price = $option_value_query->row['price'];
                                    $option_value_query->row['price_prefix'] = '';
                                    $option_price_only = true;
                                } elseif ($option_value_query->row['price_prefix'] == '*') {
                                    $option_price += $option_value_query->row['price'] * $price;
                                    $option_value_query->row['price_prefix'] = '+';
                                } elseif ($option_value_query->row['price_prefix'] == '1') {
                                    $option_price += $option_value_query->row['price'];
                                    $option_value_query->row['price_prefix'] = '1';
                                }
    
                                // Add sku to to option name ONLY if not overriding the main product model
                                if (!empty($option_value_query->row['ob_sku']) && !empty($option_value_query->row['ob_sku_override']) && $option_value_query->row['ob_sku_override']) {
                                    $product_query->row['model'] = $option_value_query->row['ob_sku'];
                                } else { // leave as part of option name
                                    $option_value_query->row['name'] = ($option_value_query->row['ob_sku']) ? ($option_value_query->row['name'] . ' ['.$option_value_query->row['ob_sku'].']') : $option_value_query->row['name'];
                                }
                            }
                            //
    
                            //Q: Options Boost - overwrite product image with option image for cart (pt2)
                            if (isset($option_value_query->row['ob_image']) && $option_value_query->row['ob_image']) {
                                $prod_image = $option_value_query->row['ob_image'];
                            }//
                ]]></add>
            </operation>
    
            <operation>
                <search position="after"><![CDATA[
                => $product_query->row['image']
                ]]></search>
                <add trim="true"><![CDATA[
                'image'        => $prod_image, //Q: Options Boost - overwrite product image with option image for cart (pt3)
                ]]></add>
            </operation>
    
            <operation>
                <search position="after"><![CDATA[
                $download_data = array();
                ]]></search>
                <add trim="false"><![CDATA[
                        // Options Boost - Added support for = prefix to force the option price to override the product price.
                        if ($option_price_only) {
                            $price = 0;
                        }
                        if ($option_price) {
                            $option_price *= $disc_factor;
                        }
    
                        // Options Boost - Added support for 1 prefix to only add option price once. Corresponding part in the checkout/cart controller as well.
                        $opt1xdisc = 0;
                        foreach ($option_data as $o => $od) {
                            if ($od['price_prefix'] == '1') {
                                $option_data[$o]['price_prefix'] == '+';
                                if ($quantity > 1) {
                                    $opt1xdisc += $od['price'] * $disc_factor * ($quantity-1);
                                }
                            }
                        }
                        $prod_total = (($price + $option_price) * $quantity) - $opt1xdisc;
    
                ]]></add>
            </operation>
    
            <operation info="Add support for 1 to main product array">
                <search position="after"><![CDATA[
                ($price + $option_price) * $quantity,
                ]]></search>
                <add trim="true"><![CDATA[
                'total'           => $prod_total,
                ]]></add>
            </operation>
        </file>
    
    
        <file name="catalog/controller/checkout/cart.php">
            <operation error="skip">
                <search position="replace"><![CDATA[
                $total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']);
                ]]></search>
                <add><![CDATA[
                    //Q: Options Boost - change to use total instead of product price * qty on cart page.
                $total = $this->currency->format($this->tax->calculate($product['total'], $product['tax_class_id'], $this->config->get('config_tax')));
                ]]></add>
            </operation>
        </file>
    
    
        <file name="catalog/controller/product/product.php">
            <operation><!-- pulled from the old opr controller file to keep extra files down -->
                <search position="before"><![CDATA[
                public function index()
                ]]></search>
                <add><![CDATA[
            //Q: Options Boost - Ajax image update
            public function updateImage() {
                $json = array();
    
                file_put_contents(DIR_LOGS . 'ob_debug.txt', "updateImage() callback initialized\r\n");
    
                $this->load->model('tool/image');
    
                $product_id = $this->request->post['product_id'];
    
                // AceShop\Mijoshop Support
                if (isset($this->request->post['option_oc']) && is_array($this->request->post['option_oc'])) {
                    $post_option = $this->request->post['option_oc'];
                } elseif (isset($this->request->post['option']) && is_array($this->request->post['option'])) {
                    $post_option = $this->request->post['option'];
                }
                file_put_contents(DIR_LOGS . 'ob_debug.txt', "POST OPTION: " . print_r($post_option,1) . "\r\n", FILE_APPEND);
    
                # Get product options and add it to the current price
                if (!empty($post_option)) {
                    foreach ($post_option as $option_id => $option_value_id) {
    
                        //checkbox massaging
                        if (is_array($option_value_id)) {
                            $option_value_id = end($option_value_id);
                        }
    
                        if ($option_value_id != $this->request->post['option_value_id']) { continue; }
                        //$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value WHERE product_option_value_id = '" . (int)$option_value_id . "' AND product_id = '" . (int)$product_id . "'");
                        //$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$option_value_id . "' AND pov.product_id = '" . (int)$product_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
                        $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$option_value_id . "' AND pov.product_id = '" . (int)$product_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
                        if ($query->num_rows) {
    
                            // Allow html in misc info field
                            $query->row['ob_info'] = html_entity_decode($query->row['ob_info']);
    
                            $json = $query->row;
    
                            if ($query->row['ob_image']) {
                                $json['ob_swatch'] = $this->model_tool_image->resize($query->row['ob_image'], 40, 40);
                                $json['ob_thumb']  = $this->model_tool_image->resize($query->row['ob_image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
                                $json['ob_popup']  = $this->model_tool_image->resize($query->row['ob_image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
                            } elseif (isset($query->row['image']) && $query->row['image'] != 'no_image.jpg') {
                                $json['ob_swatch'] = $this->model_tool_image->resize($query->row['image'], 40, 40);
                                $json['ob_thumb']  = $this->model_tool_image->resize($query->row['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
                                $json['ob_popup']  = $this->model_tool_image->resize($query->row['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
                            } else {
                                $json['ob_swatch'] = '';
                                $json['ob_thumb']  = '';
                                $json['ob_popup']  = '';
                            }
                        }
                    }
                }
    
                if (!method_exists($this->tax, 'getRates')) { //v1.5.1.2 or earlier
                    $this->load->library('json');
                    $this->response->setOutput(Json::encode($json));
                } else {
                    $this->response->setOutput(json_encode($json));
                }
    
                file_put_contents(DIR_LOGS . 'ob_debug.txt', "JSON OUTPUT: " . print_r($json,1), FILE_APPEND);
    
            }
                ]]></add>
            </operation>
    
            <operation>
                <search position="before"><![CDATA[
                $this->data['products'] = array();
                ]]></search>
                <add><![CDATA[
                include(DIR_SYSTEM . '../catalog/controller/product/options_boost.inc.php'); //Q: Options Boost
                ]]></add>
            </operation>
    
            <operation>
                <search position="before"><![CDATA[
                $this->data['breadcrumbs'] = array();
                ]]></search>
                <add><![CDATA[
                if (defined('_JEXEC')) {
                $this->document->addScript('/catalog/view/javascript/options_boost.js');
                setcookie("isAceshop", 1, 0, '/', $this->request->server['HTTP_HOST']);
                } else {
                $this->document->addScript('catalog/view/javascript/options_boost.js');
                }
                ]]></add>
            </operation>
    
    
            <!-- NEW STUFF -->
    
    
            <operation info="Add additional image adjustments for options boost">
                <search position="after"><![CDATA[
                $option_value_data[] = array(
                ]]></search>
                <add><![CDATA[
                'ob_sku' => $option_value['ob_sku'],
                'ob_info' => $option_value['ob_info'],
                'ob_image' => $option_value['ob_image'],
                'ob_sku_override' => $option_value['ob_sku_override'],
                'raw_image'        => $option_value['image'],
                'raw_price'        => $option_value['price'],
                ]]></add>
            </operation>
    
    
            <!-- END NEW STUFF -->
    
        </file>
    
        <file name="catalog/view/theme/shoppica2/template/product/product.tpl" error="skip">
            <operation error="skip">
                <search position="replace" index="1"><![CDATA[
                <img src="<?php echo $thumb; ?>"
                ]]></search>
                <add><![CDATA[
                <img id="image" src="<?php echo $thumb; ?>"
                ]]></add>
            </operation>
        </file>
    
    
    
        <!-- New model adjustments using vQmod instead of override function -->
    
        <file name="catalog/model/catalog/product.php">
    
            <operation info="Add additional image adjustments for options boost">
                <search position="before"><![CDATA[
                $product_option_value_data[] = array(
                ]]></search>
                <add><![CDATA[
                    $this->load->model('tool/image');
                ]]></add>
            </operation>
    
            <operation info="Add additional db fields to the returned option value array">
                <search position="after"><![CDATA[
                $product_option_value_data[] = array(
                ]]></search>
                <add><![CDATA[
                        'ob_sku'                  => $product_option_value['ob_sku'],
                        'ob_info'                 => $product_option_value['ob_info'],
                        'ob_image'                => $product_option_value['ob_image'],
                        'ob_sku_override'         => $product_option_value['ob_sku_override'],
                ]]></add>
            </operation>
    
        </file>
    
    
    </modification>
    --- Добавлено, 6 дек 2014 ---
    currency_plus
    Код:
    <modification>
        <id>Валюта Плюс</id>
        <version>2.6</version>
        <vqmver>2.4.1</vqmver>
        <author>louise170 ([email protected])</author>
    
        <file name="admin/controller/catalog/product.php">
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    if (isset($this->request->post['status'])) {
                ]]>
                </search>
                <add>
                <![CDATA[
                    if (isset($this->request->post['base_price'])) {
                        $this->data['base_price'] = $this->request->post['base_price'];
                    } else if (isset($product_info['base_price'])) {
                        $this->data['base_price'] = $product_info['base_price'];
                    } else {
                        $this->data['base_price'] = '';
                    }
    
                    if (isset($this->request->post['base_currency_code'])) {
                        $this->data['base_currency_code'] = $this->request->post['base_currency_code'];
                    } else if (isset($product_info['base_currency_code']) and $product_info['base_currency_code'] != '') {
                        $this->data['base_currency_code'] = $product_info['base_currency_code'];
                    } else {
                        $this->data['base_currency_code'] = $this->config->get('config_currency');
                    }
    
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->getCurrencies();
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    $this->data['entry_price'] = $this->language->get('entry_price');
                ]]>
                </search>
                <add>
                <![CDATA[
                    $this->data['entry_base_price'] = $this->language->get('entry_base_price');
                    $this->data['entry_base_currency'] = $this->language->get('entry_base_currency');
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    'price'                   => $product_option_value['price'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price'         => isset($product_option_value['base_price'])? $product_option_value['base_price'] : '',
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
                ]]>
                </search>
                <add>
                <![CDATA[
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->create_fields();
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/view/template/catalog/product_form.tpl">
            <operation error="skip">
                <search position="after" offset="1">
                <![CDATA[
                    <td><input type="text" name="price" value="<?php echo $price; ?>" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <tr>
                      <td><?php echo $entry_base_price; ?></td>
                      <td><input type="text" name="base_price" value="<?php echo $base_price; ?>" /></td>
                    </tr>
                    <tr>
                      <td><?php echo $entry_base_currency; ?></td>
                      <td><select name="base_currency_code">
                          <?php foreach ($currencies as $currency) { ?>
                          <?php if ($currency['code'] == $base_currency_code) { ?>
                          <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
                          <?php } else { ?>
                          <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
                          <?php } ?>
                          <?php } ?>
                        </select></td>
                    </tr>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace" index="1,2,3">
                <![CDATA[
                    <td class="right"><?php echo $entry_price; ?></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <td class="right"><?php echo $entry_price; ?> / <?php echo $entry_base_price; ?></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace" index="1">
                <![CDATA[
                    html += '        <td class="right"><?php echo $entry_price; ?></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
                    html += '        <td class="right"><?php echo $entry_price; ?> / <?php echo $entry_base_price; ?></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" size="5" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" size="5" />
                    / <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][base_price]" value="<?php echo $product_option_value['base_price']; ?>" size="5" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" /></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
        html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" />';
        html += '    / <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][base_price]" value="" size="5" /></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <td class="right"><input type="text" name="product_discount[<?php echo $discount_row; ?>][price]" value="<?php echo $product_discount['price']; ?>" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <td class="right"><input type="text" name="product_discount[<?php echo $discount_row; ?>][price]" value="<?php echo $product_discount['price']; ?>" />
                    / <input type="text" name="product_discount[<?php echo $discount_row; ?>][base_price]" value="<?php if (isset($product_discount['base_price'])) echo $product_discount['base_price']; ?>" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_discount[' + discount_row + '][price]" value="" /></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_discount[' + discount_row + '][price]" value="" /> / <input type="text" name="product_discount[' + discount_row + '][base_price]" value="" /></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <td class="right"><input type="text" name="product_special[<?php echo $special_row; ?>][price]" value="<?php echo $product_special['price']; ?>" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <td class="right"><input type="text" name="product_special[<?php echo $special_row; ?>][price]" value="<?php echo $product_special['price']; ?>" />
                    / <input type="text" name="product_special[<?php echo $special_row; ?>][base_price]" value="<?php if (isset($product_special['base_price'])) echo $product_special['base_price']; ?>" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_special[' + special_row + '][price]" value="" /></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_special[' + special_row + '][price]" value="" /> / <input type="text" name="product_special[' + special_row + '][base_price]" value="" /></td>';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/view/template/catalog/quick_edit_product/quick_product_form.tpl">
            <operation error="skip">
                <search position="after" offset="1">
                <![CDATA[
                    <td><input type="text" name="price" value="<?php echo $price; ?>" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <tr>
                      <td><?php echo $entry_base_price; ?></td>
                      <td><input type="text" name="base_price" value="<?php echo $base_price; ?>" /></td>
                    </tr>
                    <tr>
                      <td><?php echo $entry_base_currency; ?></td>
                      <td><select name="base_currency_code">
                          <?php foreach ($currencies as $currency) { ?>
                          <?php if ($currency['code'] == $base_currency_code) { ?>
                          <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
                          <?php } else { ?>
                          <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
                          <?php } ?>
                          <?php } ?>
                        </select></td>
                    </tr>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace" index="1,2">
                <![CDATA[
                    <td class="right"><?php echo $entry_price; ?></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <td class="right"><?php echo $entry_price; ?> / <?php echo $entry_base_price; ?></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace" index="1">
                <![CDATA[
                    html += '        <td class="right"><?php echo $entry_price; ?></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
                    html += '        <td class="right"><?php echo $entry_price; ?> / <?php echo $entry_base_price; ?></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" size="5" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" size="5" />
                    / <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][base_price]" value="<?php echo $product_option_value['base_price']; ?>" size="5" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" /></td>';
                ]]>
                </search>
                <add>
                <![CDATA[
        html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" />';
        html += '    / <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][base_price]" value="" size="5" /></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <td class="right"><input type="text" name="product_discount[<?php echo $discount_row; ?>][price]" value="<?php echo $product_discount['price']; ?>" /></td>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <td class="right"><input type="text" name="product_discount[<?php echo $discount_row; ?>][price]" value="<?php echo $product_discount['price']; ?>" />
                    / <input type="text" name="product_discount[<?php echo $discount_row; ?>][base_price]" value="<?php if (isset($product_discount['base_price'])) echo $product_discount['base_price']; ?>" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                    <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_discount[' + discount_row + '][price]" value="" /></td>';
                ]]>
                </search>
                <add>
                    <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_discount[' + discount_row + '][price]" value="" /> / <input type="text" name="product_discount[' + discount_row + '][base_price]" value="" /></td>';
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                    <![CDATA[
                    <td class="right"><input type="text" name="product_special[<?php echo $special_row; ?>][price]" value="<?php echo $product_special['price']; ?>" /></td>
                ]]>
                </search>
                <add>
                    <![CDATA[
                    <td class="right"><input type="text" name="product_special[<?php echo $special_row; ?>][price]" value="<?php echo $product_special['price']; ?>" />
                    / <input type="text" name="product_special[<?php echo $special_row; ?>][base_price]" value="<?php if (isset($product_special['base_price'])) echo $product_special['base_price']; ?>" /></td>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                    <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_special[' + special_row + '][price]" value="" /></td>';
                ]]>
                </search>
                <add>
                    <![CDATA[
                    html += '    <td class="right"><input type="text" name="product_special[' + special_row + '][price]" value="" /> / <input type="text" name="product_special[' + special_row + '][base_price]" value="" /></td>';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/language/russian/catalog/product.php">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    $_['entry_price']            = 'Цена:';
                ]]>
                </search>
                <add>
                <![CDATA[
                    $_['entry_base_price']            = 'Базовая цена:';
                    $_['entry_base_currency']         = 'Базовая валюта:';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/language/english/catalog/product.php">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    $_['entry_price']            = 'Price:';
                ]]>
                </search>
                <add>
                <![CDATA[
                    $_['entry_base_price']            = 'Base Price:';
                    $_['entry_base_currency']         = 'Base Currency:';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/model/catalog/product.php">
            <operation error="skip">
            <search position="replace">
                <![CDATA[
                    model =
                ]]>
            </search>
            <add>
                <![CDATA[
                    base_price = '" . (float)$data['base_price'] . "', base_currency_code = '" . $data['base_currency_code'] . "', model =
                ]]>
            </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    price = '" . (float)$product_option_value['price'] . "',
                ]]>
                </search>
                <add>
                <![CDATA[
                    base_price = '" . (float)$product_option_value['base_price'] . "', price = '" . (float)$product_option_value['price'] . "',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    'price'                   => $product_option_value['price'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price'         => isset($product_option_value['base_price'])? $product_option_value['base_price'] : '',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    priority = '" . (int)$product_discount['priority'] . "',
                ]]>
                </search>
                <add>
                <![CDATA[
                    base_price = '" . (float)$product_discount['base_price'] . "', priority = '" . (int)$product_discount['priority'] . "',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    priority = '" . (int)$product_special['priority'] . "',
                ]]>
                </search>
                <add>
                <![CDATA[
                    base_price = '" . (float)$product_special['base_price'] . "', priority = '" . (int)$product_special['priority'] . "',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    priority = '" . (int)$value['priority'] . "',
                ]]>
                </search>
                <add>
                <![CDATA[
                    base_price = '" . (float)$value['base_price'] . "', priority = '" . (int)$value['priority'] . "',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    if (isset($data['image'])) {
                ]]>
                </search>
                <add>
                <![CDATA[
                    $this->load->model('localisation/currency');
                    $this->model_localisation_currency->updateCurrencies(true, 'product', array('product_id' => $product_id) );
                ]]>
                </add>
            </operation>
        </file>
    
    
        <file name="admin/model/localisation/currency.php">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    class ModelLocalisationCurrency extends Model {
                ]]>
                </search>
                <add>
                <![CDATA[
                    public function create_fields() {
                        $sql = "SELECT * FROM `" . DB_PREFIX . "product` LIMIT 1";
                        $query = $this->db->query($sql);
                        $result = $query->row;
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE field = 'base_price'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD COLUMN `base_price` decimal(15,4) NOT NULL AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE field = 'base_currency_code'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD COLUMN `base_currency_code` varchar(3) NOT NULL DEFAULT '".$this->config->get('config_currency')."' AFTER `base_price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product_option_value WHERE field = 'base_price'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD COLUMN `base_price` decimal(15,4) NOT NULL AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product_discount WHERE field = 'base_price'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product_discount` ADD COLUMN `base_price` decimal(15,4) NOT NULL AFTER `price`;");
                        }
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product_special WHERE field = 'base_price'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product_special` ADD COLUMN `base_price` decimal(15,4) NOT NULL AFTER `price`;");
                        }
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE field = 'extra_charge'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD COLUMN `extra_charge` int(3) NOT NULL DEFAULT 0 AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE field = 'cost'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `cost` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product_option_value WHERE field = 'cost'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `cost` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "order_product WHERE field = 'cost'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "order_product` ADD `cost` decimal(15,4) NOT NULL DEFAULT '0.0000' AFTER `price`;");
                        }
    
    
                        $query = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "order_option WHERE field = 'cost'");
                        if (count($query->rows) == 0) {
                            $this->db->query("ALTER TABLE `" . DB_PREFIX . "order_option` ADD `cost` decimal(15,4) NOT NULL DEFAULT '0.0000';");
                        }
                    }
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    public function updateCurrencies(
                ]]>
                </search>
                <add>
                <![CDATA[
                    private function updatePriceValue($result, $value) {
                        $round_val = $this->roundPriceValue('base_price', $value, $this->config->get('currency_plus_round'));
                        $round_val_for_cost = $this->roundPriceValue('base_price', $value, 'NO');
    
                        if (count($result) == 0 or (count($result) > 0 and !isset($result['cost']) and !isset($result['extra_charge']))) {
                            $update_val = " price = ".$round_val;
                        }
                        elseif (count($result) > 0) {
                            if ( isset($result['cost']) and !isset($result['extra_charge'])) {
                                $update_val = " price = ".$round_val.", cost = ".$round_val_for_cost;
                            }
                            elseif ( !isset($result['cost']) and isset($result['extra_charge'])) {
                                $update_val = " price = ".$round_val;
                            }
                            elseif ( isset($result['cost']) and isset($result['extra_charge'])) {
                                $round_val_2 = $this->roundPriceValue('base_price', $value, $this->config->get('currency_plus_round'), 'extra_charge');
    
                                $update_val = " price = ".$round_val_2.", cost = ".$round_val_for_cost;
                            }
                        }
    
                        return $update_val;
                    }
    
                    private function roundPriceValue($name, $value, $round, $extra_charge = '') {
                        if ($extra_charge != '') {
                            $name = "(".$name."+(".$name."/100*".$extra_charge."))";
                        }
    
                        if ($round == 'digit10') {
                            $round_val = "ROUND(".$name."*".$value."/10, 0)*10";
                        }
                        elseif ($round == 'digit9') {
                            $round_val = "ROUND(".$name."*".$value."/10, 0)*10" - 1;
                        }
                        elseif ($round == 'digit50') {
                            $round_val = "ROUND(".$name."*".$value."/50, 0)*50";
                        }
                        elseif ($round == 'digit100') {
                            $round_val = "ROUND(".$name."*".$value."/100, 0)*100";
                        }
                        elseif ($round == 'digit1') {
                            $round_val = "ROUND(".$name."*".$value.", 0)";
                        }
                        else {
                            $round_val = "ROUND(".$name."*".$value.", 4)";
                        }
    
                        return $round_val;
                    }
    
    
                    private function getCourse($source = 'RUB') {
                        //echo $source;
    
                        if ($source == 'RUB' or $source == 'RUR') {
                            $Request = "http://www.cbr.ru/scripts/XML_daily.asp";
    
                            $arr = array('title' => 'CharCode', 'nominal' => 'Nominal', 'value' => 'Value');
                        }
                        elseif ($source == 'KZT') {
                            $Request = "http://www.nationalbank.kz/rss/rates_all.xml";
    
                            $arr = array('title' => 'title', 'nominal' => 'quant', 'value' => 'description');
                        }
                        elseif ($source == 'UAH') {
                            $Request = "http://bank-ua.com/export/currrate.xml";
    
                            $arr = array('title' => 'char3', 'nominal' => 'size', 'value' => 'rate');
                        }
                        elseif ($source == 'BYR') {
                            $Request = "http://www.nbrb.by/Services/XmlExRates.aspx";
    
                            $arr = array('title' => 'CharCode', 'nominal' => 'Scale', 'value' => 'Rate');
                        }
    
    
                        $curl = curl_init();
    
                        curl_setopt($curl, CURLOPT_URL, $Request);
                        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    
                        $Response = curl_exec($curl);
                        //print_r($Response);
    
                        curl_close($curl);
    
                        $reader = new XMLReader();
                        //$reader->open($Request);
    
                        $arr_base_res = array();
    
                        if ($Response) {
                            $reader->xml($Response);
                            while ($reader->read()) {
                                switch ($reader->nodeType) {
                                    case (XMLREADER::ELEMENT):
                                        if ( $reader->localName == $arr['title']) {
                                            $reader->read();
                                            $local_name = $reader->value;
                                        }
                                        elseif ( $reader->localName == $arr['nominal']) {
                                            $reader->read();
                                            $local_nominal = $reader->value;
    
                                            $arr_nominal[$local_name] = $local_nominal;
                                        }
                                        elseif ( $reader->localName == $arr['value']) {
                                            $reader->read();
                                            $value = $reader->value;
    
                                            //echo $value;
    
                                            if ($source == 'RUB' or $source == 'RUR') {
                                                $value = (substr($value,0,2).'.'.substr($value,3));
                                            }
    
                                            $arr_base_res[$local_name] = $value;
                                        }
                                }
                            }
                        }
    
                        //print_r($arr_base_res);
                        //print_r($arr_nominal);
                        //echo $this->config->get('config_currency')."\n\n";
    
                        foreach ($arr_base_res as $k => $v) {
                            if ($k == $this->config->get('config_currency')) {
                                $summa = $v/$arr_nominal[$k];
                                //echo " - summa=".$summa."\n\n";
    
                                break;
                            }
                        }
    
                        foreach ($arr_base_res as $key => $value) {
                            if ($key == $this->config->get('config_currency')) {
                                $arr_new_res[$key] = 1;
                            }
                            elseif ($key != $this->config->get('config_currency') and $this->config->get('config_currency') == $source) {
                                $arr_new_res[$key] = str_replace(",", ".", (1/$value*$arr_nominal[$key]));
                            }
                            elseif ($key != $this->config->get('config_currency') and $this->config->get('config_currency') != $source
                                and isset($arr_nominal[$key]) and $arr_nominal[$key] != 0) {
                                $res1 = $value/$arr_nominal[$key];
    
                                //echo "key=".$key." value=".$value." nominal=".$arr_nominal[$key]." res1=".$res1."\n";
    
                                if (isset($summa) and $summa > 0) {
                                    $res = $res1/$summa;
                                }
                                else {
                                    $res = '0';
                                }
    
                                if (strlen($key) == 3) {
                                    $arr_new_res[$key] = str_replace(",", ".", 1/$res);
                                }
                            }
                        }
    
    
                        if ($this->config->get('config_currency') == $source) {
                            $arr_new_res[$source] = 1;
                        }
                        elseif (isset($arr_base_res[$this->config->get('config_currency')])) {
                            $arr_new_res[$source] = $arr_base_res[$this->config->get('config_currency')]/$arr_nominal[$this->config->get('config_currency')];
                        }
                        else {
                            $arr_new_res[$source] = 0;
                        }
    
                        //print_r($arr_new_res);
    
                        return $arr_new_res;
                    }
    
    
                    public function updateCurrencies($force = false, $type = 'all', $data = array() ) {
                        $this->create_fields();
    
                        $arr_res = array();
                        $arr_base_res = array();
                        $arr_nominal = array();
                        $arr_new_res = array();
    
                        if ($type == 'product' and isset($data['product_id']) and (int)$data['product_id'] > 0) {
                            $sql_where = " AND product_id = ".(int)$data['product_id'];
                        }
                        else {
                            $sql_where = "";
                        }
    
                        $sql = "SELECT code, value FROM " . DB_PREFIX . "currency";
                        $query = $this->db->query($sql);
                        foreach ($query->rows as $result) {
                            $arr_new_res[$result['code']] = $result['value'];
                        }
    
                        if ($type == 'currency' or $type == 'all') {
                            if ($this->config->get('currency_plus_charcode')) {
                                $source = $this->config->get('currency_plus_charcode');
                            }
                            else {
                                $source = 'RUB';
                            }
                            $arr_new_res = $this->getCourse($source);
                        }
    
    
                        foreach ($arr_new_res as $key => $value) {
                            $sql_1 = "UPDATE " . DB_PREFIX . "currency SET `value` = " . $value . ", date_modified=now() WHERE code='".$key."' ";
                            //echo $sql_1."\n";
    
                            if ($value) {
                                $value =  str_replace(",", ".", 1/$value);
                            }
                            else {
                                $value = 0;
                            }
    
                            if (!$force) {
                                $sql_1 .= " AND date_modified < '" .  $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "' ";
                            }
    
                            if ($type == 'all' or $type == 'currency') {
                                $this->db->query($sql_1);
                            }
    
                            if ($type == 'product' or $type == 'all') {
                                $sql = "SELECT value FROM " . DB_PREFIX . "currency WHERE code='".$key."' LIMIT 1";
                                $query = $this->db->query($sql);
                                if ($query->num_rows) {
                                    $value = $query->row['value'];
    
                                    if ($value) {
                                        $value =  str_replace(",", ".", 1/$value);
                                    }
                                    else {
                                        $value = 0;
                                    }
    
                                    $sql = "SELECT * FROM `" . DB_PREFIX . "product` LIMIT 1";
                                    $query = $this->db->query($sql);
                                    $result = $query->row;
    
                                    $update_val = $this->updatePriceValue($result, $value);
    
                                    $sql_3 = "UPDATE " . DB_PREFIX . "product SET date_modified=now(), ".$update_val."
                                    WHERE base_price > 0 AND base_currency_code='".$key."' ".$sql_where;
    
                                    if (!$force and $type == 'all') {
                                        $sql_3 .= " AND date_modified < '" .  $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "' ";
                                    }
    
                                    //echo $sql_3;
                                    $this->db->query($sql_3);
    
                                    $sql_4 = "UPDATE " . DB_PREFIX . "product SET price = 0 WHERE price < 0 ";
                                    $this->db->query($sql_4);
                                }
                            }
    
                            if ($type == 'all' or $type == 'product') {
                                $round_val = $this->roundPriceValue('base_price', $value, $this->config->get('currency_plus_round'));
    
                                $update_val = $this->updatePriceValue($result, $value);
    
                                $sql = "SELECT product_id,extra_charge FROM " . DB_PREFIX . "product WHERE base_currency_code='".$key."' ".$sql_where;
                                if (!$force) {
                                    $sql .= " AND date_modified < '" .  $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "' ";
                                }
                                $query = $this->db->query($sql);
    
    
                                foreach ($query->rows as $result) {
                                    $update = str_replace('extra_charge', $result['extra_charge'], $update_val);
    
                                    $sql_4 = "UPDATE " . DB_PREFIX . "product_option_value SET ".$update."
                                    WHERE base_price > 0 AND product_id = '".$result['product_id']."' ";
    
                                    $this->db->query($sql_4);
    
                                    $sql_5 = "UPDATE " . DB_PREFIX . "product_discount SET price = ".$round_val."
                                    WHERE base_price > 0 AND product_id = '".$result['product_id']."' ";
                                    $this->db->query($sql_5);
    
                                    $sql_6 = "UPDATE " . DB_PREFIX . "product_special SET price = ".$round_val."
                                    WHERE base_price > 0 AND product_id = '".$result['product_id']."' ";
                                    $this->db->query($sql_6);
                                }
    
                                $sql_1 = "UPDATE " . DB_PREFIX . "product_option_value SET price = 0 WHERE price < 0 ";
                                $this->db->query($sql_1);
    
                                $sql_1 = "UPDATE " . DB_PREFIX . "product_discount SET price = 0 WHERE price < 0 ";
                                $this->db->query($sql_1);
    
                                $sql_1 = "UPDATE " . DB_PREFIX . "product_special SET price = 0 WHERE price < 0 ";
                                $this->db->query($sql_1);
                            }
                        }
    
                        $this->cache->delete('product');
                        $this->cache->delete('yml');
                    }
    
                    public function updateCurrenciesOLD(
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/controller/setting/setting.php">
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    $this->model_localisation_currency->updateCurrencies();
                ]]>
                </search>
                <add>
                <![CDATA[
                    $this->model_localisation_currency->updateCurrencies(true);
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/controller/localisation/currency.php">
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    public function delete() {
                ]]>
                </search>
                <add>
                <![CDATA[
                    public function updatecurrency($type = 'all') {
                        if (isset($this->request->get['type'])) {
                            $type = $this->request->get['type'];
                        }
    
                        $this->data['token'] = $this->session->data['token'];
    
                        $this->load->model('localisation/currency');
                        $this->model_localisation_currency->updateCurrencies(true, $type);
                    }
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    $this->load->model('localisation/currency');
                ]]>
                </search>
                <add>
                <![CDATA[
                    $this->data['token'] = $this->session->data['token'];
                    $this->data['button_updatecurrency'] = $this->language->get('button_updatecurrency');
                    $this->data['button_updateproduct'] = $this->language->get('button_updateproduct');
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/view/template/localisation/currency_list.tpl">
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <div class="buttons">
                ]]>
                </search>
                <add>
                <![CDATA[
                    <div class="buttons"><a onclick="update_currency('currency');" class="button"><span><?php echo $button_updatecurrency;?></span></a><a onclick="update_currency('product');" class="button"><span><?php echo $button_updateproduct;?></span></a>
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    <?php echo $footer; ?>
                ]]>
                </search>
                <add>
                <![CDATA[
                <script type="text/javascript"><!--
                    function update_currency(type) {
                        $.ajax({
                            url: 'index.php?route=localisation/currency/updatecurrency&type='+type+'&token=<?php echo $token; ?>',
                            dataType: 'json',
                            success: function(json) {
                                window.location.href = 'index.php?route=localisation/currency&token=<?php echo $token; ?>';
                            }
                        });
                    }
                //--></script>
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/language/russian/localisation/currency.php">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    $_['entry_status']         = 'Статус:';
                ]]>
                </search>
                <add>
                <![CDATA[
                    $_['button_updatecurrency'] = 'Обновить курсы';
                    $_['button_updateproduct'] = 'Обновить цены товаров';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="admin/language/english/localisation/currency.php">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    $_['entry_status']         = 'Status:';
                ]]>
                </search>
                <add>
                <![CDATA[
                    $_['button_updatecurrency'] = 'Update currencies';
                    $_['button_updateproduct'] = 'Update product prices';
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="catalog/view/theme/*/template/product/product.tpl">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    <?php echo $price; ?>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <?php if (isset($currency_plus_show_base_price) and $currency_plus_show_base_price > 0 and isset($base_price) and !empty($base_price)) { ?>
                        <nobr>(<?php echo $base_price; ?>)</nobr>
                    <?php } ?>
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    echo $option_value['price'];
                ]]>
                </search>
                <add>
                <![CDATA[if (isset($currency_plus_show_base_price) and $currency_plus_show_base_price > 0 and isset($option_value['base_price']) and !empty($option_value['base_price'])) {
                        echo $option_value['price'].' / '.$option_value['base_price'];
                    }
                    else {
                        echo $option_value['price'];
                    }
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="replace">
                <![CDATA[
                    <?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
                ]]>
                </search>
                <add>
                <![CDATA[
                    <?php
                    $discount_base_price = '';
    
                    if (isset($discount['base_price']) and $discount['base_price'] != '') {
                        $discount_base_price = ' ('.$discount['base_price'].')';
                    };
    
                    echo sprintf($text_discount, $discount['quantity'], $discount['price'].$discount_base_price); ?><br />
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="catalog/model/catalog/product.php">
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    'special'          => $query->row['special'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price'          => $query->row['base_price'],
                    'base_currency_code'  => $query->row['base_currency_code'],
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    'price'                   => $product_option_value['price'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price' => $product_option_value['base_price'],
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="catalog/controller/product/product.php">
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    $this->data['products'] = array();
                ]]>
                </search>
                <add>
                <![CDATA[
                    if ($product_info['base_price'] > 0) {
                        $this->data['base_price'] =  $this->currency->format(1, $product_info['base_currency_code'], $product_info['base_price'], true);
                    }
                    else {
                        $this->data['base_price'] = '';
                    }
    
                    $this->data['base_currency_code'] = $product_info['base_currency_code'];
    
                    if ($this->config->get('currency_plus_show_base_price')) {
                        $this->data['currency_plus_show_base_price'] = $this->config->get('currency_plus_show_base_price');
                    }
                    else {
                        $this->data['currency_plus_show_base_price'] = 0;
                    }
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    'special'          => $query->row['special'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price'          => $query->row['base_price'],
                    'base_currency_code'  => $query->row['base_currency_code'],
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    'name'                    => $option_value['name'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price' => ($option_value['base_price'] > 0) ? $this->currency->format(1, $product_info['base_currency_code'], $option_value['base_price'], true) : '',
                ]]>
                </add>
            </operation>
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    'quantity' => $discount['quantity'],
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price' => ($discount['base_price'] > 0) ? $this->currency->format(1, $product_info['base_currency_code'], $discount['base_price'], true) : '',
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="catalog/view/theme/*/template/product/category.tpl">
            <operation error="skip">
                <search position="after">
                <![CDATA[
                    <?php echo $product['price']; ?>
                ]]>
                </search>
                <add>
                <![CDATA[
                    <?php if (isset($currency_plus_show_base_price_cat) and $currency_plus_show_base_price_cat > 0 and isset($product['base_price']) and !empty($product['base_price'])) { ?>
                        <nobr>(<?php echo $product['base_price']; ?>)</nobr>
                    <?php } ?>
                ]]>
                </add>
            </operation>
        </file>
    
        <file name="catalog/controller/product/category.php">
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    'price'       => $price,
                ]]>
                </search>
                <add>
                <![CDATA[
                    'base_price'          => ($result['base_price'] > 0 ) ? $this->currency->format(1, $result['base_currency_code'], $result['base_price'], true) : '',
                ]]>
                </add>
            </operation>
    
            <operation error="skip">
                <search position="before">
                <![CDATA[
                    $this->data['products'] = array();
                ]]>
                </search>
                <add>
                <![CDATA[
                    if ($this->config->get('currency_plus_show_base_price_cat')) {
                        $this->data['currency_plus_show_base_price_cat'] = $this->config->get('currency_plus_show_base_price_cat');
                    }
                    else {
                        $this->data['currency_plus_show_base_price_cat'] = 0;
                    }
                ]]>
                </add>
            </operation>
        </file>
    </modification>
    
     
  6. AnOcToJI

    AnOcToJI

    Регистрация:
    28 дек 2012
    Сообщения:
    309
    Симпатии:
    188
    вы выложили код /vqmod/vqcache/vq2-admin_model_catalog_product.php именно в тот момент когда была ошибка в админке с указанием на 64 строку?
     
  7. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    Вот, зашол в админку: каталог - товары. с ошыбкой Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /sata2/home/users/etehnika/www/www.bonus.if.ua/vqmod/vqcache/vq2-admin_model_catalog_product.php on line 64
    потом скопировал код файла : /vqmod/vqcache/vq2-admin_model_catalog_product.php
    Код:
    <?php
    class ControllerCatalogProduct extends Controller {
        private $error = array();
        
    
                    // Options Boost
                    public function ob_category() {
                        $this->load->model('catalog/product');
    
                        if (isset($this->request->get['category_id'])) {
                            $category_id = $this->request->get['category_id'];
                        } else {
                            //$category_id = 0;
                        }
    
                        $product_data = array();
    
                        $results = $this->model_catalog_product->getProductsByCategoryId($category_id);
    
                        foreach ($results as $result) {
                            $product_data[] = array(
                                'product_id' => $result['product_id'],
                                'name'       => $result['name'],
                                'model'      => $result['model']
                            );
                        }
    
                        if (version_compare(VERSION, '1.5.1.3', '<')) { //v1.5.1.2 or earlier
                            $this->load->library('json');
                            $this->response->setOutput(Json::encode($product_data));
                        } else {
                            $this->response->setOutput(json_encode($product_data));
                        }
    
                    }//
               
          public function index() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
               
            $this->document->setTitle($this->language->get('heading_title'));
           
            $this->load->model('catalog/product');
           
            $this->getList();
          }
        public function filter() {
    
            $json = array();
    
            if (isset($this->request->get['filter_name'])) {
                $filter_name = $this->request->get['filter_name'];
            } else {
                $filter_name = null;
            }
    
            if (isset($this->request->get['filter_category_id'])) {
                $filter_category_id = $this->request->get['filter_category_id'];
            } else {
                $filter_category_id = null;
            }
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $filter_manufacturer_id = $this->request->get['filter_manufacturer_id'];
            } else {
                $filter_manufacturer_id = null;
            }
    
            if (isset($this->request->get['filter_model'])) {
                $filter_model = $this->request->get['filter_model'];
            } else {
                $filter_model = null;
            }
           
            if (isset($this->request->get['filter_price'])) {
                $filter_price = $this->request->get['filter_price'];
            } else {
                $filter_price = null;
            }
    
            if (isset($this->request->get['filter_quantity'])) {
                $filter_quantity = $this->request->get['filter_quantity'];
            } else {
                $filter_quantity = null;
            }
    
            if (isset($this->request->get['filter_status'])) {
                $filter_status = $this->request->get['filter_status'];
            } else {
                $filter_status = null;
            }
    
            if (isset($this->request->get['sort'])) {
                $sort = $this->request->get['sort'];
            } else {
                $sort = 'pd.name';
            }
           
            if (isset($this->request->get['order'])) {
                $order = $this->request->get['order'];
            } else {
                $order = 'ASC';
            }
           
            if (isset($this->request->get['page'])) {
                $page = $this->request->get['page'];
            } else {
                $page = 1;
            }
                           
            $url = '';
                           
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
           
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
            }
           
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . $this->request->get['filter_manufacturer_id'];
            }
           
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
           
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
           
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
           
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }       
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                           
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
           
            $data = array(
                'filter_name'      => $filter_name,
                'filter_category_id'      => $filter_category_id,
                'filter_manufacturer_id'      => $filter_manufacturer_id,
                'filter_model'      => $filter_model,
                'filter_price'      => $filter_price,
                'filter_quantity' => $filter_quantity,
                'filter_status'   => $filter_status,
                'sort'            => $sort,
                'order'           => $order,
                'start'           => ($page - 1) * $this->config->get('config_admin_limit'),
                'limit'           => $this->config->get('config_admin_limit')
            );
           
            $this->load->model('tool/image');
            $this->load->model('catalog/product');
           
            $product_total = $this->model_catalog_product->getTotalProducts($data);
               
            $results = $this->model_catalog_product->getProducts($data);
    
            $json['products'] = array();                       
            foreach ($results as $result) {
                $action = array();
               
                $action[] = array(
                    'text' => $this->language->get('text_edit'),
                    'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, 'SSL')
                );
               
                if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
                    $image = $this->model_tool_image->resize($result['image'], 40, 40);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
                }
       
                $special = false;
               
                $product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']);
               
                foreach ($product_specials  as $product_special) {
                    if (($product_special['date_start'] == '0000-00-00' || $product_special['date_start'] > date('Y-m-d')) && ($product_special['date_end'] == '0000-00-00' || $product_special['date_end'] < date('Y-m-d'))) {
                        $special = $product_special['price'];
               
                        break;
                    }                   
                }
       
                $json['products'][] = array(
                    'product_id'     => $result['product_id'],
                    'name'           => $result['name'],
                    'category'       => $this->model_catalog_product->getProductCatNames($result['product_id']),
                    'manufacturer'    => $result['m_name'],
                    'model'          => $result['model'],
                    'price'          => $result['price'],
                    'special'        => $special,
                    'image'        => $image,
                    'quantity'       => $result['quantity'],
                    'status'         => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
                    'selected'       => isset($this->request->post['selected']) && in_array($result['product_id'], $this->request->post['selected']),
                    'action'         => $action
                );
            }
            $pagination = new Pagination();
            $pagination->total = $product_total;
            $pagination->page = $page;
            $pagination->limit = $this->config->get('config_admin_limit');
            $pagination->text = $this->language->get('text_pagination');
            $pagination->url = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
               
            $json['pagination'] = $pagination->render();
    
            $this->response->setOutput(json_encode($json));
        }
     
    
        //Q: Options Boost
        private function checkdb_ob() {
    
            $fields = array();
    
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku` VARCHAR(64) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_info',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_info` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_image',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_image` VARCHAR(255) NOT NULL DEFAULT ''"
            );
            $fields[] = array(
                'table'     => 'product_option_value',
                'column'    => 'ob_sku_override',
                'sql'       => "ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `ob_sku_override` int(1) NOT NULL DEFAULT '0'"
            );
    
            foreach ($fields as $field) {
                $sql = "DESC `" . DB_PREFIX . "$field[table]` $field[column]";
                $query = $this->db->query($sql);
                if (!$query->num_rows) {
                    $this->db->query($field['sql']);
                }
            }
        }//
               
          public function insert() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
               
    
            $this->document->setTitle($this->language->get('heading_title'));
           
            $this->load->model('catalog/product');
           
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
    
               
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->create_fields();
               
               
                $this->model_catalog_product->addProduct($this->request->post);
                 
                $this->session->data['success'] = $this->language->get('text_success');
         
                $url = '';
    
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
           
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
               
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
               
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                }
               
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                       
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
               
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
       
            $this->getForm();
          }
    
          public function update() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
               
    
            $this->document->setTitle($this->language->get('heading_title'));
           
            $this->load->model('catalog/product');
       
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
    
               
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->create_fields();
               
               
    
                    $this->load->model('tool/nitro');
                    $nitroSettings = $this->model_tool_nitro->getPersistence();
                    if ($nitroSettings['Nitro']['PageCache']['ClearCacheOnProductEdit'] == 'yes') {
                        $this->model_tool_nitro->clearPageCache();
                        $this->model_tool_nitro->clearDBCache();
                        $this->model_tool_nitro->clearCSSCache();
                        $this->model_tool_nitro->clearJSCache();
                    }
               
                $this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
               
                $this->session->data['success'] = $this->language->get('text_success');
               
                $url = '';
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
           
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
               
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
               
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                }   
           
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                       
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
               
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getForm();
          }
    
          public function delete() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
               
    
            $this->document->setTitle($this->language->get('heading_title'));
           
            $this->load->model('catalog/product');
           
            if (isset($this->request->post['selected']) && $this->validateDelete()) {
                foreach ($this->request->post['selected'] as $product_id) {
                    $this->model_catalog_product->deleteProduct($product_id);
                  }
    
                $this->session->data['success'] = $this->language->get('text_success');
               
                $url = '';
    
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
           
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
               
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
               
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                }   
           
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                       
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
               
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getList();
          }
    
          public function copy() {
            $this->language->load('catalog/product');
    
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
            $this->checkdb_ob(); //Q: Options Boost
               
    
            $this->document->setTitle($this->language->get('heading_title'));
           
            $this->load->model('catalog/product');
           
            if (isset($this->request->post['selected']) && $this->validateCopy()) {
                foreach ($this->request->post['selected'] as $product_id) {
                    $this->model_catalog_product->copyProduct($product_id);
                  }
    
                $this->session->data['success'] = $this->language->get('text_success');
               
                $url = '';
               
                if (isset($this->request->get['filter_category_id'])) {
                    $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
                }
    
                if (isset($this->request->get['filter_manufacturer_id'])) {
                    $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
                }
    
                if (isset($this->request->get['filter_name'])) {
                    $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
                }
             
                if (isset($this->request->get['filter_model'])) {
                    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
                }
               
                if (isset($this->request->get['filter_price'])) {
                    $url .= '&filter_price=' . $this->request->get['filter_price'];
                }
               
                if (isset($this->request->get['filter_quantity'])) {
                    $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
                }   
           
                if (isset($this->request->get['filter_status'])) {
                    $url .= '&filter_status=' . $this->request->get['filter_status'];
                }
                       
                if (isset($this->request->get['sort'])) {
                    $url .= '&sort=' . $this->request->get['sort'];
                }
    
                if (isset($this->request->get['order'])) {
                    $url .= '&order=' . $this->request->get['order'];
                }
    
                if (isset($this->request->get['page'])) {
                    $url .= '&page=' . $this->request->get['page'];
                }
               
                $this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
            }
    
            $this->getList();
          }
       
          private function getList() {               
            if (isset($this->request->get['filter_name'])) {
                $filter_name = $this->request->get['filter_name'];
            } else {
                $filter_name = null;
            }
            if (isset($this->request->get['filter_category_id'])) {
                $filter_category_id = $this->request->get['filter_category_id'];
            } else {
                $filter_category_id = null;
            }
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $filter_manufacturer_id = $this->request->get['filter_manufacturer_id'];
            } else {
                $filter_manufacturer_id = null;
            }
    
            if (isset($this->request->get['filter_model'])) {
                $filter_model = $this->request->get['filter_model'];
            } else {
                $filter_model = null;
            }
           
            if (isset($this->request->get['filter_price'])) {
                $filter_price = $this->request->get['filter_price'];
            } else {
                $filter_price = null;
            }
    
            if (isset($this->request->get['filter_quantity'])) {
                $filter_quantity = $this->request->get['filter_quantity'];
            } else {
                $filter_quantity = null;
            }
    
            if (isset($this->request->get['filter_status'])) {
                $filter_status = $this->request->get['filter_status'];
            } else {
                $filter_status = null;
            }
    
            if (isset($this->request->get['sort'])) {
                $sort = $this->request->get['sort'];
            } else {
                $sort = 'pd.name';
            }
           
            if (isset($this->request->get['order'])) {
                $order = $this->request->get['order'];
            } else {
                $order = 'ASC';
            }
           
            if (isset($this->request->get['page'])) {
                $page = $this->request->get['page'];
            } else {
                $page = 1;
            }
    
            $this->data['sort'] = $sort;
            $this->data['order'] = $order;
            $this->data['page'] = $page;
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
           
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
           
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
           
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }       
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                           
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
           
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
    
              $this->data['breadcrumbs'] = array();
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
                  'separator' => false
               );
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'),              
                  'separator' => ' :: '
               );
           
            $this->data['insert'] = $this->url->link('catalog/product/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
            $this->data['copy'] = $this->url->link('catalog/product/copy', 'token=' . $this->session->data['token'] . $url, 'SSL');   
            $this->data['delete'] = $this->url->link('catalog/product/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
           
            $this->data['products'] = array();
    
            $data = array(
                'filter_name'      => $filter_name,
                'filter_manufacturer_id'  => $filter_manufacturer_id,
                'filter_category_id'      => $filter_category_id,
                'filter_model'      => $filter_model,
                'filter_price'      => $filter_price,
                'filter_quantity' => $filter_quantity,
                'filter_status'   => $filter_status,
                'sort'            => $sort,
                'order'           => $order,
                'start'           => ($page - 1) * $this->config->get('config_admin_limit'),
                'limit'           => $this->config->get('config_admin_limit')
            );
           
            $this->load->model('tool/image');
           
            $product_total = $this->model_catalog_product->getTotalProducts($data);
               
            $results = $this->model_catalog_product->getProducts($data);
                           
            foreach ($results as $result) {
                $action = array();
               
                $action[] = array(
                    'text' => $this->language->get('text_edit'),
                    'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $result['product_id'] . $url, 'SSL')
                );
               
                if ($result['image'] && file_exists(DIR_IMAGE . $result['image'])) {
                    $image = $this->model_tool_image->resize($result['image'], 40, 40);
                } else {
                    $image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
                }
       
                $special = false;
               
                $product_specials = $this->model_catalog_product->getProductSpecials($result['product_id']);
               
                foreach ($product_specials  as $product_special) {
                    if (($product_special['date_start'] == '0000-00-00' || $product_special['date_start'] > date('Y-m-d')) && ($product_special['date_end'] == '0000-00-00' || $product_special['date_end'] < date('Y-m-d'))) {
                        $special = $product_special['price'];
               
                        break;
                    }                   
                }
       
                  $this->data['products'][] = array(
                    'product_id' => $result['product_id'],
                    'category'   => $this->model_catalog_product->getProductCatNames($result['product_id']),
                    'manufacturer'    => $result['m_name'],
                    'name'       => $result['name'],
                    'model'      => $result['model'],
                    'price'      => $result['price'],
                    'special'    => $special,
                    'image'      => $image,
                    'quantity'   => $result['quantity'],
                    'status'     => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
                    'selected'   => isset($this->request->post['selected']) && in_array($result['product_id'], $this->request->post['selected']),
                    'action'     => $action
                );
            }
           
            $this->data['heading_title'] = $this->language->get('heading_title');       
                   
            $this->data['text_enabled'] = $this->language->get('text_enabled');       
            $this->data['text_disabled'] = $this->language->get('text_disabled');       
            $this->data['text_no_results'] = $this->language->get('text_no_results');       
            $this->data['text_image_manager'] = $this->language->get('text_image_manager');       
               
    
            $this->data['column_category'] = $this->language->get('column_category');
            $this->data['column_manufacturer'] = $this->language->get('column_manufacturer');
            $this->data['column_image'] = $this->language->get('column_image');       
            $this->data['column_name'] = $this->language->get('column_name');       
            $this->data['column_model'] = $this->language->get('column_model');       
            $this->data['column_price'] = $this->language->get('column_price');       
            $this->data['column_quantity'] = $this->language->get('column_quantity');       
            $this->data['column_status'] = $this->language->get('column_status');       
            $this->data['column_action'] = $this->language->get('column_action');       
                   
            $this->data['button_copy'] = $this->language->get('button_copy');       
            $this->data['button_insert'] = $this->language->get('button_insert');       
            $this->data['button_delete'] = $this->language->get('button_delete');       
            $this->data['button_clear'] = $this->language->get('button_clear');
            
             $this->data['token'] = $this->session->data['token'];
           
             if (isset($this->error['warning'])) {
                $this->data['error_warning'] = $this->error['warning'];
            } else {
                $this->data['error_warning'] = '';
            }
    
            if (isset($this->session->data['success'])) {
                $this->data['success'] = $this->session->data['success'];
           
                unset($this->session->data['success']);
            } else {
                $this->data['success'] = '';
            }
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
           
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
           
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
           
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }
           
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                                   
            if ($order == 'ASC') {
                $url .= '&order=DESC';
            } else {
                $url .= '&order=ASC';
            }
    
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
                       
            $this->data['sort_name'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=pd.name' . $url, 'SSL');
            $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
            $this->data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, 'SSL');
            $this->data['sort_quantity'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.quantity' . $url, 'SSL');
            $this->data['sort_status'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.status' . $url, 'SSL');
            $this->data['sort_order'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sort_order' . $url, 'SSL');
           
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . $this->request->get['filter_name'];
            }
           
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . $this->request->get['filter_model'];
            }
           
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
           
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }
    
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
    
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
                                                   
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
                   
            $pagination = new Pagination();
            $pagination->total = $product_total;
            $pagination->page = $page;
            $pagination->limit = $this->config->get('config_admin_limit');
            $pagination->text = $this->language->get('text_pagination');
            $pagination->url = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
               
            $this->data['pagination'] = $pagination->render();
       
            $this->data['filter_category_id'] = $filter_category_id;
            $this->data['filter_manufacturer_id'] = $filter_manufacturer_id;
            $this->data['filter_name'] = $filter_name;
            $this->data['filter_model'] = $filter_model;
            $this->data['filter_price'] = $filter_price;
            $this->data['filter_quantity'] = $filter_quantity;
            $this->data['filter_status'] = $filter_status;
           
            $this->data['sort'] = $sort;
            $this->data['order'] = $order;
    
            $this->load->model('catalog/category');
            $this->load->model('catalog/manufacturer');
    
            $this->data['categories'] = $this->model_catalog_category->getCategories(0);
    
    
            $this->data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers();
    
    
            $this->template = 'catalog/product_list.tpl';
            $this->children = array(
                'common/header',
                'common/footer'
            );
                   
            $this->response->setOutput($this->render());
          }
    
          protected function getForm() {
    
            $this->checkdb_ob(); //Q: Options Boost
            $this->load->language('catalog/options_boost');
            $this->data['entry_info'] = $this->language->get('entry_info');
            $this->data['text_sku_override'] = $this->language->get('text_sku_override');
               
            $this->data['heading_title'] = $this->language->get('heading_title');
            $this->data['text_enabled'] = $this->language->get('text_enabled');
            $this->data['text_disabled'] = $this->language->get('text_disabled');
            $this->data['text_none'] = $this->language->get('text_none');
            $this->data['text_yes'] = $this->language->get('text_yes');
            $this->data['text_no'] = $this->language->get('text_no');
            $this->data['text_select_all'] = $this->language->get('text_select_all');
            $this->data['text_unselect_all'] = $this->language->get('text_unselect_all');
            $this->data['text_plus'] = $this->language->get('text_plus');
            $this->data['text_minus'] = $this->language->get('text_minus');
            $this->data['text_default'] = $this->language->get('text_default');
            $this->data['text_image_manager'] = $this->language->get('text_image_manager');
            $this->data['text_browse'] = $this->language->get('text_browse');
            $this->data['text_clear'] = $this->language->get('text_clear');
            $this->data['text_option'] = $this->language->get('text_option');
            $this->data['text_option_value'] = $this->language->get('text_option_value');
            $this->data['text_select'] = $this->language->get('text_select');
            $this->data['text_none'] = $this->language->get('text_none');
            $this->data['text_percent'] = $this->language->get('text_percent');
            $this->data['text_amount'] = $this->language->get('text_amount');
            $this->data['text_hidelink'] = $this->language->get('text_hidelink');
    
            $this->data['entry_name'] = $this->language->get('entry_name');
            $this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
            $this->data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword');
            $this->data['entry_description'] = $this->language->get('entry_description');
            $this->data['entry_store'] = $this->language->get('entry_store');
            $this->data['entry_keyword'] = $this->language->get('entry_keyword');
            $this->data['entry_model'] = $this->language->get('entry_model');
            $this->data['entry_sku'] = $this->language->get('entry_sku');
            $this->data['entry_upc'] = $this->language->get('entry_upc');
            $this->data['entry_ean'] = $this->language->get('entry_ean');
            $this->data['entry_jan'] = $this->language->get('entry_jan');
            $this->data['entry_isbn'] = $this->language->get('entry_isbn');
            $this->data['entry_mpn'] = $this->language->get('entry_mpn');
            $this->data['entry_location'] = $this->language->get('entry_location');
            $this->data['entry_minimum'] = $this->language->get('entry_minimum');
            $this->data['entry_manufacturer'] = $this->language->get('entry_manufacturer');
            $this->data['entry_shipping'] = $this->language->get('entry_shipping');
            $this->data['entry_date_available'] = $this->language->get('entry_date_available');
            $this->data['entry_quantity'] = $this->language->get('entry_quantity');
            $this->data['entry_stock_status'] = $this->language->get('entry_stock_status');
    
               
                    $this->data['entry_base_price'] = $this->language->get('entry_base_price');
                    $this->data['entry_base_currency'] = $this->language->get('entry_base_currency');
               
               
    
               
                    $this->data['entry_extra_charge'] = $this->language->get('entry_extra_charge');
               
               
            $this->data['entry_price'] = $this->language->get('entry_price');
            $this->data['entry_tax_class'] = $this->language->get('entry_tax_class');
            $this->data['entry_points'] = $this->language->get('entry_points');
            $this->data['entry_option_points'] = $this->language->get('entry_option_points');
            $this->data['entry_subtract'] = $this->language->get('entry_subtract');
            $this->data['entry_weight_class'] = $this->language->get('entry_weight_class');
            $this->data['entry_weight'] = $this->language->get('entry_weight');
            $this->data['entry_dimension'] = $this->language->get('entry_dimension');
            $this->data['entry_length'] = $this->language->get('entry_length');
            $this->data['entry_image'] = $this->language->get('entry_image');
            $this->data['entry_download'] = $this->language->get('entry_download');
            $this->data['entry_category'] = $this->language->get('entry_category');
            $this->data['entry_filter'] = $this->language->get('entry_filter');
            $this->data['entry_related'] = $this->language->get('entry_related');
            $this->data['entry_attribute'] = $this->language->get('entry_attribute');
            $this->data['entry_text'] = $this->language->get('entry_text');
            $this->data['entry_option'] = $this->language->get('entry_option');
            $this->data['entry_option_value'] = $this->language->get('entry_option_value');
            $this->data['entry_required'] = $this->language->get('entry_required');
            $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
            $this->data['entry_status'] = $this->language->get('entry_status');
            $this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
            $this->data['entry_date_start'] = $this->language->get('entry_date_start');
            $this->data['entry_date_end'] = $this->language->get('entry_date_end');
            $this->data['entry_priority'] = $this->language->get('entry_priority');
            $this->data['entry_tag'] = $this->language->get('entry_tag');
            $this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
            $this->data['entry_reward'] = $this->language->get('entry_reward');
            $this->data['entry_layout'] = $this->language->get('entry_layout');
            $this->data['entry_main_category'] = $this->language->get('entry_main_category');
            $this->data['entry_seo_title'] = $this->language->get('entry_seo_title');
            $this->data['entry_seo_h1'] = $this->language->get('entry_seo_h1');
                   
            $this->data['button_save'] = $this->language->get('button_save');
            $this->data['button_cancel'] = $this->language->get('button_cancel');
            $this->data['button_add_attribute'] = $this->language->get('button_add_attribute');
            $this->data['button_add_option'] = $this->language->get('button_add_option');
            $this->data['button_add_option_value'] = $this->language->get('button_add_option_value');
            $this->data['button_add_discount'] = $this->language->get('button_add_discount');
            $this->data['button_add_special'] = $this->language->get('button_add_special');
            $this->data['button_add_image'] = $this->language->get('button_add_image');
            $this->data['button_remove'] = $this->language->get('button_remove');
           
            $this->data['tab_general'] = $this->language->get('tab_general');
            $this->data['tab_data'] = $this->language->get('tab_data');
            $this->data['tab_attribute'] = $this->language->get('tab_attribute');
            $this->data['tab_option'] = $this->language->get('tab_option');       
            $this->data['tab_discount'] = $this->language->get('tab_discount');
            $this->data['tab_special'] = $this->language->get('tab_special');
            $this->data['tab_image'] = $this->language->get('tab_image');       
            $this->data['tab_links'] = $this->language->get('tab_links');
            $this->data['tab_reward'] = $this->language->get('tab_reward');
            $this->data['tab_design'] = $this->language->get('tab_design');
            
             if (isset($this->error['warning'])) {
                $this->data['error_warning'] = $this->error['warning'];
            } else {
                $this->data['error_warning'] = '';
            }
    
             if (isset($this->error['name'])) {
                $this->data['error_name'] = $this->error['name'];
            } else {
                $this->data['error_name'] = array();
            }
    
             if (isset($this->error['meta_description'])) {
                $this->data['error_meta_description'] = $this->error['meta_description'];
            } else {
                $this->data['error_meta_description'] = array();
            }       
      
               if (isset($this->error['description'])) {
                $this->data['error_description'] = $this->error['description'];
            } else {
                $this->data['error_description'] = array();
            }   
           
               if (isset($this->error['model'])) {
                $this->data['error_model'] = $this->error['model'];
            } else {
                $this->data['error_model'] = '';
            }       
            
            if (isset($this->error['date_available'])) {
                $this->data['error_date_available'] = $this->error['date_available'];
            } else {
                $this->data['error_date_available'] = '';
            }   
    
            $url = '';
    
            if (isset($this->request->get['filter_category_id'])) {
                $url .= '&filter_category_id=' . (int)$this->request->get['filter_category_id'];
            }
    
            if (isset($this->request->get['filter_manufacturer_id'])) {
                $url .= '&filter_manufacturer_id=' . (int)$this->request->get['filter_manufacturer_id'];
            }
    
            if (isset($this->request->get['filter_name'])) {
                $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
            }
           
            if (isset($this->request->get['filter_model'])) {
                $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
            }
           
            if (isset($this->request->get['filter_price'])) {
                $url .= '&filter_price=' . $this->request->get['filter_price'];
            }
           
            if (isset($this->request->get['filter_quantity'])) {
                $url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
            }   
           
            if (isset($this->request->get['filter_status'])) {
                $url .= '&filter_status=' . $this->request->get['filter_status'];
            }
                                   
            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }
    
            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }
           
            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
    
              $this->data['breadcrumbs'] = array();
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
                'separator' => false
               );
    
               $this->data['breadcrumbs'][] = array(
                   'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'),
                  'separator' => ' :: '
               );
                                       
            if (!isset($this->request->get['product_id'])) {
                $this->data['action'] = $this->url->link('catalog/product/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
            } else {
                $this->data['action'] = $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $this->request->get['product_id'] . $url, 'SSL');
            }
           
            $this->data['cancel'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL');
    
            if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
                  $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
            }
    
            $this->data['token'] = $this->session->data['token'];
           
            $this->load->model('localisation/language');
           
            $this->data['languages'] = $this->model_localisation_language->getLanguages();
           
            if (isset($this->request->post['product_description'])) {
                $this->data['product_description'] = $this->request->post['product_description'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
            } else {
                $this->data['product_description'] = array();
            }
           
            $language_id = $this->config->get('config_language_id');
            if (isset($this->data['product_description'][$language_id]['name'])) {
            $this->data['heading_title'] = $this->data['product_description'][$language_id]['name'];
            }
           
            if (isset($this->request->post['model'])) {
                  $this->data['model'] = $this->request->post['model'];
            } elseif (!empty($product_info)) {
                $this->data['model'] = $product_info['model'];
            } else {
                  $this->data['model'] = '';
            }
    
            if (isset($this->request->post['sku'])) {
                  $this->data['sku'] = $this->request->post['sku'];
            } elseif (!empty($product_info)) {
                $this->data['sku'] = $product_info['sku'];
            } else {
                  $this->data['sku'] = '';
            }
           
            if (isset($this->request->post['upc'])) {
                  $this->data['upc'] = $this->request->post['upc'];
            } elseif (!empty($product_info)) {
                $this->data['upc'] = $product_info['upc'];
            } else {
                  $this->data['upc'] = '';
            }
           
            if (isset($this->request->post['ean'])) {
                  $this->data['ean'] = $this->request->post['ean'];
            } elseif (!empty($product_info)) {
                $this->data['ean'] = $product_info['ean'];
            } else {
                  $this->data['ean'] = '';
            }
           
            if (isset($this->request->post['jan'])) {
                  $this->data['jan'] = $this->request->post['jan'];
            } elseif (!empty($product_info)) {
                $this->data['jan'] = $product_info['jan'];
            } else {
                  $this->data['jan'] = '';
            }
           
            if (isset($this->request->post['isbn'])) {
                  $this->data['isbn'] = $this->request->post['isbn'];
            } elseif (!empty($product_info)) {
                $this->data['isbn'] = $product_info['isbn'];
            } else {
                  $this->data['isbn'] = '';
            }
           
            if (isset($this->request->post['mpn'])) {
                  $this->data['mpn'] = $this->request->post['mpn'];
            } elseif (!empty($product_info)) {
                $this->data['mpn'] = $product_info['mpn'];
            } else {
                  $this->data['mpn'] = '';
            }                               
                   
            if (isset($this->request->post['location'])) {
                  $this->data['location'] = $this->request->post['location'];
            } elseif (!empty($product_info)) {
                $this->data['location'] = $product_info['location'];
            } else {
                  $this->data['location'] = '';
            }
    
            $this->load->model('setting/store');
           
            $this->data['stores'] = $this->model_setting_store->getStores();
           
            if (isset($this->request->post['product_store'])) {
                $this->data['product_store'] = $this->request->post['product_store'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
            } else {
                $this->data['product_store'] = array(0);
            }   
           
            if (isset($this->request->post['keyword'])) {
                $this->data['keyword'] = $this->request->post['keyword'];
            } elseif (!empty($product_info)) {
                $this->data['keyword'] = $product_info['keyword'];
            } else {
                $this->data['keyword'] = '';
            }
           
            if (isset($this->request->post['image'])) {
                $this->data['image'] = $this->request->post['image'];
            } elseif (!empty($product_info)) {
                $this->data['image'] = $product_info['image'];
            } else {
                $this->data['image'] = '';
            }
           
            $this->load->model('tool/image');
           
            if (isset($this->request->post['image']) && file_exists(DIR_IMAGE . $this->request->post['image'])) {
                $this->data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
            } elseif (!empty($product_info) && $product_info['image'] && file_exists(DIR_IMAGE . $product_info['image'])) {
                $this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], 100, 100);
            } else {
                $this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
                $this->data['image'] = 'no_image.jpg';
            }
            $this->load->model('catalog/manufacturer');
           
            $this->data['manufacturers'] = $this->model_catalog_manufacturer->getManufacturers();
           
            if (isset($this->request->post['shipping'])) {
                  $this->data['shipping'] = $this->request->post['shipping'];
            } elseif (!empty($product_info)) {
                  $this->data['shipping'] = $product_info['shipping'];
            } else {
                $this->data['shipping'] = 1;
            }
           
            if (isset($this->request->post['price'])) {
                  $this->data['price'] = $this->request->post['price'];
            } elseif (!empty($product_info)) {
                $this->data['price'] = $product_info['price'];
            } else {
                  $this->data['price'] = '';
            }
           
            $this->load->model('localisation/tax_class');
           
            $this->data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
           
            if (isset($this->request->post['tax_class_id'])) {
                  $this->data['tax_class_id'] = $this->request->post['tax_class_id'];
            } elseif (!empty($product_info)) {
                $this->data['tax_class_id'] = $product_info['tax_class_id'];
            } else {
                  $this->data['tax_class_id'] = 0;
            }
                     
            if (isset($this->request->post['date_available'])) {
                   $this->data['date_available'] = $this->request->post['date_available'];
            } elseif (!empty($product_info)) {
                $this->data['date_available'] = date('Y-m-d', strtotime($product_info['date_available']));
            } else {
                $this->data['date_available'] = date('Y-m-d', time() - 86400);
            }
                                               
            if (isset($this->request->post['quantity'])) {
                  $this->data['quantity'] = $this->request->post['quantity'];
            } elseif (!empty($product_info)) {
                  $this->data['quantity'] = $product_info['quantity'];
            } else {
                $this->data['quantity'] = 1;
            }
           
            if (isset($this->request->post['minimum'])) {
                  $this->data['minimum'] = $this->request->post['minimum'];
            } elseif (!empty($product_info)) {
                  $this->data['minimum'] = $product_info['minimum'];
            } else {
                $this->data['minimum'] = 1;
            }
           
            if (isset($this->request->post['subtract'])) {
                  $this->data['subtract'] = $this->request->post['subtract'];
            } elseif (!empty($product_info)) {
                  $this->data['subtract'] = $product_info['subtract'];
            } else {
                $this->data['subtract'] = 1;
            }
           
            if (isset($this->request->post['sort_order'])) {
                  $this->data['sort_order'] = $this->request->post['sort_order'];
            } elseif (!empty($product_info)) {
                  $this->data['sort_order'] = $product_info['sort_order'];
            } else {
                $this->data['sort_order'] = 1;
            }
    
            $this->load->model('localisation/stock_status');
           
            $this->data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses();
           
            if (isset($this->request->post['stock_status_id'])) {
                  $this->data['stock_status_id'] = $this->request->post['stock_status_id'];
            } elseif (!empty($product_info)) {
                  $this->data['stock_status_id'] = $product_info['stock_status_id'];
            } else {
                $this->data['stock_status_id'] = $this->config->get('config_stock_status_id');
            }
                   
    
               
                    if (isset($this->request->post['base_price'])) {
                        $this->data['base_price'] = $this->request->post['base_price'];
                    } else if (isset($product_info['base_price'])) {
                        $this->data['base_price'] = $product_info['base_price'];
                    } else {
                        $this->data['base_price'] = '';
                    }
    
                    if (isset($this->request->post['base_currency_code'])) {
                        $this->data['base_currency_code'] = $this->request->post['base_currency_code'];
                    } else if (isset($product_info['base_currency_code']) and $product_info['base_currency_code'] != '') {
                        $this->data['base_currency_code'] = $product_info['base_currency_code'];
                    } else {
                        $this->data['base_currency_code'] = $this->config->get('config_currency');
                    }
    
                    $this->load->model('localisation/currency');
    
                    $this->data['currencies'] = $this->model_localisation_currency->getCurrencies();
               
               
    
               
                    if (isset($this->request->post['extra_charge'])) {
                        $this->data['extra_charge'] = $this->request->post['extra_charge'];
                    } else if (isset($product_info['extra_charge'])) {
                        $this->data['extra_charge'] = $product_info['extra_charge'];
                    } else {
                        $this->data['extra_charge'] = '';
                    }
               
               
            if (isset($this->request->post['status'])) {
                  $this->data['status'] = $this->request->post['status'];
            } elseif (!empty($product_info)) {
                $this->data['status'] = $product_info['status'];
            } else {
                  $this->data['status'] = 1;
            }
    
            if (isset($this->request->post['weight'])) {
                  $this->data['weight'] = $this->request->post['weight'];
            } elseif (!empty($product_info)) {
                $this->data['weight'] = $product_info['weight'];
            } else {
                  $this->data['weight'] = '';
            }
           
            $this->load->model('localisation/weight_class');
           
            $this->data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
           
            if (isset($this->request->post['weight_class_id'])) {
                  $this->data['weight_class_id'] = $this->request->post['weight_class_id'];
            } elseif (!empty($product_info)) {
                  $this->data['weight_class_id'] = $product_info['weight_class_id'];
            } else {
                  $this->data['weight_class_id'] = $this->config->get('config_weight_class_id');
            }
           
            if (isset($this->request->post['length'])) {
                  $this->data['length'] = $this->request->post['length'];
            } elseif (!empty($product_info)) {
                $this->data['length'] = $product_info['length'];
            } else {
                  $this->data['length'] = '';
            }
           
            if (isset($this->request->post['width'])) {
                  $this->data['width'] = $this->request->post['width'];
            } elseif (!empty($product_info)) {   
                $this->data['width'] = $product_info['width'];
            } else {
                  $this->data['width'] = '';
            }
           
            if (isset($this->request->post['height'])) {
                  $this->data['height'] = $this->request->post['height'];
            } elseif (!empty($product_info)) {
                $this->data['height'] = $product_info['height'];
            } else {
                  $this->data['height'] = '';
            }
    
            $this->load->model('localisation/length_class');
           
            $this->data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
           
            if (isset($this->request->post['length_class_id'])) {
                  $this->data['length_class_id'] = $this->request->post['length_class_id'];
            } elseif (!empty($product_info)) {
                  $this->data['length_class_id'] = $product_info['length_class_id'];
            } else {
                  $this->data['length_class_id'] = $this->config->get('config_length_class_id');
            }
    
            $this->load->model('catalog/manufacturer');
           
            if (isset($this->request->post['manufacturer_id'])) {
                  $this->data['manufacturer_id'] = $this->request->post['manufacturer_id'];
            } elseif (!empty($product_info)) {
                $this->data['manufacturer_id'] = $product_info['manufacturer_id'];
            } else {
                  $this->data['manufacturer_id'] = 0;
            }        
           
            if (isset($this->request->post['manufacturer'])) {
                  $this->data['manufacturer'] = $this->request->post['manufacturer'];
            } elseif (!empty($product_info)) {
                $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
               
                if ($manufacturer_info) {       
                    $this->data['manufacturer'] = $manufacturer_info['name'];
                } else {
                    $this->data['manufacturer'] = '';
                }   
            } else {
                  $this->data['manufacturer'] = '';
            }
           
            // Categories
            $this->load->model('catalog/category');
           
            if (isset($this->request->post['product_category'])) {
                $categories = $this->request->post['product_category'];
            } elseif (isset($this->request->get['product_id'])) {       
                $categories = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
            } else {
                $categories = array();
            }
            $this->data['categories'] = $this->model_catalog_category->getCategories(0);
            $this->data['product_categories'] = array();
           
            foreach ($categories as $category_id) {
                $category_info = $this->model_catalog_category->getCategory($category_id);
               
                if ($category_info) {
                    $this->data['product_categories'][] = array(
                        'category_id' => $category_info['category_id'],
                        'name'        => ($category_info['path'] ? $category_info['path'] . ' &gt; ' : '') . $category_info['name']
                    );
                }
            }
           
            // Filters
            $this->load->model('catalog/filter');
           
            if (isset($this->request->post['product_filter'])) {
                $filters = $this->request->post['product_filter'];
            } elseif (isset($this->request->get['product_id'])) {
                $filters = $this->model_catalog_product->getProductFilters($this->request->get['product_id']);
            } else {
                $filters = array();
            }
           
            $this->data['product_filters'] = array();
           
            foreach ($filters as $filter_id) {
                $filter_info = $this->model_catalog_filter->getFilter($filter_id);
               
                if ($filter_info) {
                    $this->data['product_filters'][] = array(
                        'filter_id' => $filter_info['filter_id'],
                        'name'      => $filter_info['group'] . ' &gt; ' . $filter_info['name']
                    );
                }
            }       
           
            // Attributes
            $this->load->model('catalog/attribute');
           
            if (isset($this->request->post['product_attribute'])) {
                $product_attributes = $this->request->post['product_attribute'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_attributes = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
            } else {
                $product_attributes = array();
            }
           
            $this->data['product_attributes'] = array();
           
            foreach ($product_attributes as $product_attribute) {
                $attribute_info = $this->model_catalog_attribute->getAttribute($product_attribute['attribute_id']);
               
                if ($attribute_info) {
                    $this->data['product_attributes'][] = array(
                        'attribute_id'                  => $product_attribute['attribute_id'],
                        'name'                          => $attribute_info['name'],
                        'product_attribute_description' => $product_attribute['product_attribute_description']
                    );
                }
            }       
           
            // Options
            $this->load->model('catalog/option');
           
            if (isset($this->request->post['product_option'])) {
                $product_options = $this->request->post['product_option'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);           
            } else {
                $product_options = array();
            }           
           
            $this->data['product_options'] = array();
               
            foreach ($product_options as $product_option) {
                if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
                    $product_option_value_data = array();
                   
                    foreach ($product_option['product_option_value'] as $product_option_value) {
                        $product_option_value_data[] = array(
    
                        'ob_sku'                       => $product_option_value['ob_sku'], //Q: Options Boost
                        'ob_info'                    => $product_option_value['ob_info'], //Q: Options Boost
                        'ob_image'                   => $product_option_value['ob_image'], //Q: Options Boost
                        'ob_sku_override'            => isset($product_option_value['ob_sku_override']) ? $product_option_value['ob_sku_override'] : false, //Q: Options Boost
               
                            'product_option_value_id' => $product_option_value['product_option_value_id'],
                            'option_value_id'         => $product_option_value['option_value_id'],
                            'quantity'                => $product_option_value['quantity'],
                            'subtract'                => $product_option_value['subtract'],
                            'price'                   => $product_option_value['price'],
    
               
                    'base_price'         => isset($product_option_value['base_price'])? $product_option_value['base_price'] : '',
               
               
                            'price_prefix'            => $product_option_value['price_prefix'],
                            'points'                  => $product_option_value['points'],
                            'points_prefix'           => $product_option_value['points_prefix'],                       
                            'weight'                  => $product_option_value['weight'],
                            'weight_prefix'           => $product_option_value['weight_prefix']   
                        );
                    }
                   
                    $this->data['product_options'][] = array(
                        'product_option_id'    => $product_option['product_option_id'],
                        'product_option_value' => $product_option_value_data,
                        'option_id'            => $product_option['option_id'],
                        'name'                 => $product_option['name'],
                        'type'                 => $product_option['type'],
                        'required'             => $product_option['required']
                    );               
                } else {
                    $this->data['product_options'][] = array(
                        'product_option_id' => $product_option['product_option_id'],
                        'option_id'         => $product_option['option_id'],
                        'name'              => $product_option['name'],
                        'type'              => $product_option['type'],
                        'option_value'      => $product_option['option_value'],
                        'required'          => $product_option['required']
                    );               
                }
            }
           
            $this->data['option_values'] = array();
           
            foreach ($this->data['product_options'] as $product_option) {
                if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
                    if (!isset($this->data['option_values'][$product_option['option_id']])) {
                        $this->data['option_values'][$product_option['option_id']] = $this->model_catalog_option->getOptionValues($product_option['option_id']);
                    }
                }
            }
           
    
            //Q: Options Boost
          foreach ($this->data['product_options'] as $k1 => $product_option) {
            if (isset($product_option['product_option_value'])) {
                    foreach ($product_option['product_option_value'] as $k2 => $product_option_value) {
                        if (isset($product_option_value['ob_image']) && file_exists(DIR_IMAGE . $product_option_value['ob_image']) && is_file(DIR_IMAGE . $product_option_value['ob_image'])) {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize($product_option_value['ob_image'], 38, 38);
                        } else {
                            $this->data['product_options'][$k1]['product_option_value'][$k2]['preview'] = $this->model_tool_image->resize('no_image.jpg', 38, 38);
                        }
                    }
                }
            }//
               
            $this->load->model('sale/customer_group');
           
            $this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups();
           
            if (isset($this->request->post['product_discount'])) {
                $this->data['product_discounts'] = $this->request->post['product_discount'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_discounts'] = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
            } else {
                $this->data['product_discounts'] = array();
            }
    
            if (isset($this->request->post['product_special'])) {
                $this->data['product_specials'] = $this->request->post['product_special'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_specials'] = $this->model_catalog_product->getProductSpecials($this->request->get['product_id']);
            } else {
                $this->data['product_specials'] = array();
            }
           
            // Images
            if (isset($this->request->post['product_image'])) {
                $product_images = $this->request->post['product_image'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_images = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
            } else {
                $product_images = array();
            }
           
            $this->data['product_images'] = array();
           
            foreach ($product_images as $product_image) {
                if ($product_image['image'] && file_exists(DIR_IMAGE . $product_image['image'])) {
                    $image = $product_image['image'];
                } else {
                    $image = 'no_image.jpg';
                }
               
                $this->data['product_images'][] = array(
                    'image'      => $image,
                    'thumb'      => $this->model_tool_image->resize($image, 100, 100),
                    'sort_order' => $product_image['sort_order']
                );
            }
    
            $this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
    
            // Downloads
            $this->load->model('catalog/download');
           
            if (isset($this->request->post['product_download'])) {
                $product_downloads = $this->request->post['product_download'];
            } elseif (isset($this->request->get['product_id'])) {
                $product_downloads = $this->model_catalog_product->getProductDownloads($this->request->get['product_id']);
            } else {
                $product_downloads = array();
            }
               
            $this->data['product_downloads'] = array();
           
            foreach ($product_downloads as $download_id) {
                $download_info = $this->model_catalog_download->getDownload($download_id);
               
                if ($download_info) {
                    $this->data['product_downloads'][] = array(
                        'download_id' => $download_info['download_id'],
                        'name'        => $download_info['name']
                    );
                }
            }
       
            if (isset($this->request->post['main_category_id'])) {
                $this->data['main_category_id'] = $this->request->post['main_category_id'];
            } elseif (isset($product_info)) {
                $this->data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']);
            } else {
                $this->data['main_category_id'] = 0;
            }
           
            if (isset($this->request->post['product_category'])) {
                $this->data['product_category'] = $this->request->post['product_category'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
            } else {
                $this->data['product_category'] = array();
            }       
           
            if (isset($this->request->post['product_related'])) {
                $products = $this->request->post['product_related'];
            } elseif (isset($this->request->get['product_id'])) {       
                $products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
            } else {
                $products = array();
            }
       
            $this->data['product_related'] = array();
           
            foreach ($products as $product_id) {
                $related_info = $this->model_catalog_product->getProduct($product_id);
               
                if ($related_info) {
                    $this->data['product_related'][] = array(
                        'product_id' => $related_info['product_id'],
                        'name'       => $related_info['name']
                    );
                }
            }
    
            if (isset($this->request->post['points'])) {
                  $this->data['points'] = $this->request->post['points'];
            } elseif (!empty($product_info)) {
                $this->data['points'] = $product_info['points'];
            } else {
                  $this->data['points'] = '';
            }
                           
            if (isset($this->request->post['product_reward'])) {
                $this->data['product_reward'] = $this->request->post['product_reward'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']);
            } else {
                $this->data['product_reward'] = array();
            }
           
            if (isset($this->request->post['product_layout'])) {
                $this->data['product_layout'] = $this->request->post['product_layout'];
            } elseif (isset($this->request->get['product_id'])) {
                $this->data['product_layout'] = $this->model_catalog_product->getProductLayouts($this->request->get['product_id']);
            } else {
                $this->data['product_layout'] = array();
            }
    
            $this->load->model('design/layout');
    
                $this->load->model('catalog/category');
                $this->data['categories'] = $this->model_catalog_category->getCategories(0);
               
           
            $this->data['layouts'] = $this->model_design_layout->getLayouts();
                                           
            $this->template = 'catalog/product_form.tpl';
            $this->children = array(
                'common/header',
                'common/footer'
            );
                   
            $this->response->setOutput($this->render());
          }
       
          protected function validateForm() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission');
            }
    
            foreach ($this->request->post['product_description'] as $language_id => $value) {
                  if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 255)) {
                    $this->error['name'][$language_id] = $this->language->get('error_name');
                  }
            }
           
            if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
                  $this->error['model'] = $this->language->get('error_model');
            }
           
            if ($this->error && !isset($this->error['warning'])) {
                $this->error['warning'] = $this->language->get('error_warning');
            }
                       
            if (!$this->error) {
                return true;
            } else {
                  return false;
            }
          }
       
          protected function validateDelete() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission'); 
            }
           
            if (!$this->error) {
                  return true;
            } else {
                  return false;
            }
          }
         
          protected function validateCopy() {
            if (!$this->user->hasPermission('modify', 'catalog/product')) {
                  $this->error['warning'] = $this->language->get('error_permission'); 
            }
           
            if (!$this->error) {
                  return true;
            } else {
                  return false;
            }
          }
           
        public function autocomplete() {
            $json = array();
           
            if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_category_id'])) {
                $this->load->model('catalog/product');
                $this->load->model('catalog/option');
               
                if (isset($this->request->get['filter_name'])) {
                    $filter_name = $this->request->get['filter_name'];
                } else {
                    $filter_name = '';
                }
               
                if (isset($this->request->get['filter_model'])) {
                    $filter_model = $this->request->get['filter_model'];
                } else {
                    $filter_model = '';
                }
               
                if (isset($this->request->get['limit'])) {
                    $limit = $this->request->get['limit'];   
                } else {
                    $limit = 20;   
                }           
                           
                $data = array(
                    'filter_name'  => $filter_name,
                    'filter_model' => $filter_model,
                    'start'        => 0,
                    'limit'        => $limit
                );
               
                if (isset($this->request->get['filter_category_id'])) {
                    $data['filter_category_id'] = $this->request->get['filter_category_id'];
                }
               
                $results = $this->model_catalog_product->getProducts($data);
               
                foreach ($results as $result) {
                    $option_data = array();
                   
                    $product_options = $this->model_catalog_product->getProductOptions($result['product_id']);   
                   
                    foreach ($product_options as $product_option) {
                        $option_info = $this->model_catalog_option->getOption($product_option['option_id']);
                       
                        if ($option_info) {               
                            if ($option_info['type'] == 'select' || $option_info['type'] == 'radio' || $option_info['type'] == 'checkbox' || $option_info['type'] == 'image') {
                                $option_value_data = array();
                               
                                foreach ($product_option['product_option_value'] as $product_option_value) {
                                    $option_value_info = $this->model_catalog_option->getOptionValue($product_option_value['option_value_id']);
                           
                                    if ($option_value_info) {
                                        $option_value_data[] = array(
                                            'product_option_value_id' => $product_option_value['product_option_value_id'],
                                            'option_value_id'         => $product_option_value['option_value_id'],
                                            'name'                    => $option_value_info['name'],
                                            'price'                   => (float)$product_option_value['price'] ? $this->currency->format($product_option_value['price'], $this->config->get('config_currency')) : false,
                                            'price_prefix'            => $product_option_value['price_prefix']
                                        );
                                    }
                                }
                           
                                $option_data[] = array(
                                    'product_option_id' => $product_option['product_option_id'],
                                    'option_id'         => $product_option['option_id'],
                                    'name'              => $option_info['name'],
                                    'type'              => $option_info['type'],
                                    'option_value'      => $option_value_data,
                                    'required'          => $product_option['required']
                                );   
                            } else {
                                $option_data[] = array(
                                    'product_option_id' => $product_option['product_option_id'],
                                    'option_id'         => $product_option['option_id'],
                                    'name'              => $option_info['name'],
                                    'type'              => $option_info['type'],
                                    'option_value'      => $product_option['option_value'],
                                    'required'          => $product_option['required']
                                );               
                            }
                        }
                    }
                       
                    $json[] = array(
                        'product_id' => $result['product_id'],
                        'name'       => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),   
                        'model'      => $result['model'],
                        'option'     => $option_data,
                        'price'      => $result['price']
                    );   
                }
            }
    
            $this->response->setOutput(json_encode($json));
        }
    }
    ?>
    
     
  8. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    Попытался заменить модуль на - Мультивалюта. Тоже ерор....
    Notice: Error: Duplicate entry '0-2' for key 'PRIMARY'
    Error No: 1062
    INSERT INTO oc_product_option_value_price SET product_option_value_id = '0', product_id = '147', currency_id = '2', price = '0' in /sata2/home/users/etehnika/www/www.bonus.if.ua/system/database/mysql.php on line 50
     
  9. AnOcToJI

    AnOcToJI

    Регистрация:
    28 дек 2012
    Сообщения:
    309
    Симпатии:
    188
    хм, а скинте log ошибок vqmod, что-то у вас замен некоторых от оплаты плюс вообще не присутствуют.
    И скажите какая сборка и версия магазина
     
  10. moonstyles

    moonstyles

    Регистрация:
    13 апр 2013
    Сообщения:
    187
    Симпатии:
    7
    Сборка ocStore 1.5.5.1.2 Всё верно ошибок валюты плюс нету, ошыбки от модуля OptionsBoost. Но они изза конфликта xml етих модулей. Как только удалить файл валюты плюс как всё работаэт.