Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Не выводится товар в категории


0808web

Recommended Posts

Не выводится товар в категории выдает:

2014-07-20 12:58:14 - PHP Warning:  Invalid argument supplied for foreach() in /var/www/marinamarc2014/data/www/king-sites.ru/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 163
2014-07-20 12:58:15 - PHP Notice:  Undefined variable: filter_category_id in /var/www/marinamarc2014/data/www/king-sites.ru/catalog/view/theme/maximus/template/module/categoryse.tpl on line 11
 
Ребят пожалуйста помогите разобраться. Все вроде работает но товар не показывается. Перекрутил все что только мог, ничего в голову не лезет
 
categoryse.tpl
<div id="searc" class="searc" >
    <?php if ($filter_name) { ?>
    <input class="salas" type="text" name="filter_name" value="<?php echo $filter_name; ?>" />
    <?php } else { ?>
    <input class="salas"  type="text" name="filter_name" value="<?php if($filter_name){echo $filter_name;}else{echo 'Поиск по каталогу';} ?>" onFocus="if(this.value=='Поиск по каталогу'){this.value='';}" onBlur="if(this.value==''){this.value='Поиск по каталогу';}"  onkeydown="this.style.color = '000000'" style="color: #999;" />
    <?php } ?>
    <select class="styled"  name="filter_category_id">
        <option value="0"><?php echo $text_category; ?></option>
        <?php foreach ($categories as $category_1) { ?>

        <?php if ($category_1['category_id'] == $filter_category_id) { ?>
        <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option>
        <?php } ?>

        <?php } ?>
    </select>

    <input type="button" value="<?php echo $button_search; ?>" id="button-search1" class="buttonse"  />
</div>

<script type="text/javascript">
        $('#searc input[name=\'filter_name\']').keydown(function(e) {
            if (e.keyCode == 13) {
                $('#button-search1').trigger('click');
            }
        });

        $('#button-search1').bind('click', function() {
            url = 'index.php?route=product/search_advanced';

            var filter_name = $('#searc input[name=\'filter_name\']').attr('value');

            if (filter_name) {
                url += '&filter_name=' + encodeURIComponent(filter_name);
            }

            var filter_category_id = $('#searc select[name=\'filter_category_id\']').attr('value');

            if (filter_category_id > 0) {
                url += '&filter_category_id=' + encodeURIComponent(filter_category_id);
            }

//            var filter_sub_category = $('#searc input[name=\'filter_sub_category\']:checked').attr('value');

//            if (filter_sub_category) {
                url += '&filter_sub_category=true';
//            }

            var filter_description = $('#searc input[name=\'filter_description\']:checked').attr('value');

            if (filter_description) {
                url += '&filter_description=true';
            }

            location = url;
        });

//--></script> 

vq2-catalog_controller_product_category

<?php

class ControllerProductCategory extends Controller {

	public function index() {
		$this->language->load('product/category');

		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$this->load->model('tool/image');

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.sort_order';
		}

		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;
		}

		if (isset($this->request->get['limit'])) {
			$limit = $this->request->get['limit'];
		} else {
			$limit = $this->config->get('config_catalog_limit');
		}

		$this->data['breadcrumbs'] = array();

		$this->data['breadcrumbs'][] = array(
		    'text' => $this->language->get('text_home'),
		    'href' => $this->url->link('common/home'),
		    'separator' => false
		);

		if (isset($this->request->get['path'])) {
			$path = '';

			$parts = explode('_', (string) $this->request->get['path']);

			foreach ($parts as $path_id) {
				if (!$path) {
					$path = $path_id;
				} else {
					$path .= '_' . $path_id;
				}

				$category_info = $this->model_catalog_category->getCategory($path_id);

				if ($category_info) {
					$this->data['breadcrumbs'][] = array(
					    'text' => $category_info['name'],
					    'href' => $this->url->link('product/category', 'path=' . $path),
					    'separator' => $this->language->get('text_separator')
					);
				}
			}

			$category_id = array_pop($parts);
		} else {
			$category_id = 0;
		}

		$category_info = $this->model_catalog_category->getCategory($category_id);

		if ($category_info) {
			if ($category_info['seo_title']) {
				$this->document->setTitle($category_info['seo_title']);
			} else {
				$this->document->setTitle($category_info['name']);
			}

			$this->document->setDescription($category_info['meta_description']);
			$this->document->setKeywords($category_info['meta_keyword']);

			$this->data['seo_h1'] = $category_info['seo_h1'];

			$this->data['heading_title'] = $category_info['name'];

			$this->data['text_refine'] = $this->language->get('text_refine');
			$this->data['text_empty'] = $this->language->get('text_empty');
			$this->data['text_quantity'] = $this->language->get('text_quantity');
			$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
			$this->data['text_model'] = $this->language->get('text_model');
			$this->data['text_price'] = $this->language->get('text_price');
			$this->data['text_tax'] = $this->language->get('text_tax');
			$this->data['text_points'] = $this->language->get('text_points');
			$this->data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
			$this->data['text_display'] = $this->language->get('text_display');
			$this->data['text_list'] = $this->language->get('text_list');
			$this->data['text_grid'] = $this->language->get('text_grid');
			$this->data['text_sort'] = $this->language->get('text_sort');
			$this->data['text_limit'] = $this->language->get('text_limit');

			$this->data['button_cart'] = $this->language->get('button_cart');
			$this->data['button_wishlist'] = $this->language->get('button_wishlist');
			$this->data['button_compare'] = $this->language->get('button_compare');
			$this->data['button_continue'] = $this->language->get('button_continue');

			if ($category_info['image']) {
				$this->data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
			} else {
				$this->data['thumb'] = '';
			}

			$this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
			$this->data['compare'] = $this->url->link('product/compare');

			$url = '';

			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['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$this->data['categories'] = array();

			$results = $this->model_catalog_category->getCategories($category_id);

			foreach ($results as $result) {
				$data = array(
				    'filter_category_id' => $result['category_id'],
				    'filter_sub_category' => true
				);

				$this->data['categories'][] = array(
				    'name' => $result['name'],
				    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}

			$this->data['products'] = array();

			$data = array(
			    'filter_category_id' => $category_id,
			    'sort' => $sort,
			    'order' => $order,
			    'start' => ($page - 1) * $limit,
			    'limit' => $limit
			);

			$product_total = $this->model_catalog_product->getTotalProducts($data);

			$results = $this->model_catalog_product->getProducts($data);

			foreach ($results as $result) {
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
				} else {
					
            $image = $this->model_tool_image->resize('no_image.jpg', $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
            
				}

				if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
				} else {
					$price = false;
				}

				if ((float) $result['special']) {
					$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
				} else {
					$special = false;
				}

				if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float) $result['special'] ? $result['special'] : $result['price']);
				} else {
					$tax = false;
				}

				if ($this->config->get('config_review_status')) {
					$rating = (int) $result['rating'];
				} else {
					$rating = false;
				}

				$this->data['products'][] = array(
				    'product_id' => $result['product_id'],
				    'thumb' => $image,
				    'name' => $result['name'],
				    'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
				    'price' => $price,
				    'special' => $special,
				    'tax' => $tax,
				    'rating' => $result['rating'],
				    'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']),
				    'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
				);
			}

			$url = '';

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$this->data['sorts'] = array();

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_default'),
			    'value' => 'p.sort_order-ASC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
			);

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_name_asc'),
			    'value' => 'pd.name-ASC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url)
			);

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_name_desc'),
			    'value' => 'pd.name-DESC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url)
			);

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_price_asc'),
			    'value' => 'p.price-ASC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url)
			);

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_price_desc'),
			    'value' => 'p.price-DESC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url)
			);

			if ($this->config->get('config_review_status')) {
				$this->data['sorts'][] = array(
				    'text' => $this->language->get('text_rating_desc'),
				    'value' => 'rating-DESC',
				    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url)
				);

				$this->data['sorts'][] = array(
				    'text' => $this->language->get('text_rating_asc'),
				    'value' => 'rating-ASC',
				    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url)
				);
			}

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_model_asc'),
			    'value' => 'p.model-ASC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
			);

			$this->data['sorts'][] = array(
			    'text' => $this->language->get('text_model_desc'),
			    'value' => 'p.model-DESC',
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url)
			);

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			$this->data['limits'] = array();

			$this->data['limits'][] = array(
			    'text' => $this->config->get('config_catalog_limit'),
			    'value' => $this->config->get('config_catalog_limit'),
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $this->config->get('config_catalog_limit'))
			);

			$this->data['limits'][] = array(
			    'text' => 25,
			    'value' => 25,
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=25')
			);

			$this->data['limits'][] = array(
			    'text' => 50,
			    'value' => 50,
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=50')
			);

			$this->data['limits'][] = array(
			    'text' => 75,
			    'value' => 75,
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=75')
			);

			$this->data['limits'][] = array(
			    'text' => 100,
			    'value' => 100,
			    'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=100')
			);

			$url = '';

			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['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$pagination = new Pagination();
			$pagination->total = $product_total;
			$pagination->page = $page;
			$pagination->limit = $limit;
			$pagination->text = $this->language->get('text_pagination');
			$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');

			$this->data['pagination'] = $pagination->render();

			$this->data['sort'] = $sort;
			$this->data['order'] = $order;
			$this->data['limit'] = $limit;

			$this->data['continue'] = $this->url->link('common/home');

			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
				$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
			} else {
				$this->template = 'default/template/product/category.tpl';
			}

			$this->children = array(
			    'common/column_left',
			    'common/column_right',
			    'common/content_top',
			    'common/content_bottom',
			    'common/footer',

'module/category_featured',
                        
			    'common/header'
			);

			$this->response->setOutput($this->render());
		} else {
			$url = '';

			if (isset($this->request->get['path'])) {
				$url .= '&path=' . $this->request->get['path'];
			}

			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'];
			}

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

			$this->data['breadcrumbs'][] = array(
			    'text' => $this->language->get('text_error'),
			    'href' => $this->url->link('product/category', $url),
			    'separator' => $this->language->get('text_separator')
			);

			$this->document->setTitle($this->language->get('text_error'));

			$this->data['heading_title'] = $this->language->get('text_error');

			$this->data['text_error'] = $this->language->get('text_error');

			$this->data['button_continue'] = $this->language->get('button_continue');

			$this->data['continue'] = $this->url->link('common/home');

			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
				$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
			} else {
				$this->template = 'default/template/error/not_found.tpl';
			}

			$this->children = array(
			    'common/column_left',
			    'common/column_right',
			    'common/content_top',
			    'common/content_bottom',
			    'common/footer',

'module/category_featured',
                        
			    'common/header'
			);

			$this->response->setOutput($this->render());
		}
	}

}

?>
Надіслати
Поділитися на інших сайтах



<?php

class ModelCatalogProduct extends Model {

public function addProduct($data) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");

$product_id = $this->db->getLastId();

if (isset($data['image'])) {

$this->db->query("UPDATE " . DB_PREFIX . "product SET image = '" . $this->db->escape(html_entity_decode($data['image'], ENT_QUOTES, 'UTF-8')) . "' WHERE product_id = '" . (int)$product_id . "'");

}

foreach ($data['product_description'] as $language_id => $value) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");

}

if (isset($data['product_store'])) {

foreach ($data['product_store'] as $store_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "'");

}

}

if (isset($data['product_attribute'])) {

foreach ($data['product_attribute'] as $product_attribute) {

if ($product_attribute['attribute_id']) {

$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");

foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");

}

}

}

}

if (isset($data['product_option'])) {

foreach ($data['product_option'] as $product_option) {

if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {

$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 $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 = '" . (int)$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']) . "'");

}

}

} else {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value = '" . $this->db->escape($product_option['option_value']) . "', required = '" . (int)$product_option['required'] . "'");

}

}

}

if (isset($data['product_discount'])) {

foreach ($data['product_discount'] as $product_discount) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'");

}

}

if (isset($data['product_special'])) {

foreach ($data['product_special'] as $product_special) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'");

}

}

if (isset($data['product_image'])) {

foreach ($data['product_image'] as $product_image) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape(html_entity_decode($product_image['image'], ENT_QUOTES, 'UTF-8')) . "', sort_order = '" . (int)$product_image['sort_order'] . "'");

}

}

if (isset($data['product_download'])) {

foreach ($data['product_download'] as $download_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_download SET product_id = '" . (int)$product_id . "', download_id = '" . (int)$download_id . "'");

}

}

if (isset($data['product_category'])) {

foreach ($data['product_category'] as $category_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");

}

}

if (isset($data['product_related'])) {

foreach ($data['product_related'] as $related_id) {

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");

$this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");

$this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");

}

}

if (isset($data['product_reward'])) {

foreach ($data['product_reward'] as $customer_group_id => $product_reward) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_reward SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', points = '" . (int)$product_reward['points'] . "'");

}

}

if (isset($data['product_layout'])) {

foreach ($data['product_layout'] as $store_id => $layout) {

if ($layout['layout_id']) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_layout SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout['layout_id'] . "'");

}

}

}

foreach ($data['product_tag'] as $language_id => $value) {

if ($value) {

$tags = explode(',', $value);

foreach ($tags as $tag) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_tag SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', tag = '" . $this->db->escape(trim($tag)) . "'");

}

}

}

if ($data['keyword']) {

$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'product_id=" . (int)$product_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'");

}

$this->cache->delete('product');

}

public function editProduct($product_id, $data) {

$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['image'])) {

$this->db->query("UPDATE " . DB_PREFIX . "product SET image = '" . $this->db->escape(html_entity_decode($data['image'], ENT_QUOTES, 'UTF-8')) . "' WHERE product_id = '" . (int)$product_id . "'");

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");

foreach ($data['product_description'] as $language_id => $value) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_store'])) {

foreach ($data['product_store'] as $store_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "'");

if (!empty($data['product_attribute'])) {

foreach ($data['product_attribute'] as $product_attribute) {

if ($product_attribute['attribute_id']) {

$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");

foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");

}

}

}

}

$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 . "'");

if (isset($data['product_option'])) {

foreach ($data['product_option'] as $product_option) {

if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', 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 $product_option_value) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_value_id = '" . (int)$product_option_value['product_option_value_id'] . "', product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . (int)$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']) . "'");

}

}

} else {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value = '" . $this->db->escape($product_option['option_value']) . "', required = '" . (int)$product_option['required'] . "'");

}

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_discount'])) {

foreach ($data['product_discount'] as $product_discount) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_special'])) {

foreach ($data['product_special'] as $product_special) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_image'])) {

foreach ($data['product_image'] as $product_image) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape(html_entity_decode($product_image['image'], ENT_QUOTES, 'UTF-8')) . "', sort_order = '" . (int)$product_image['sort_order'] . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_download'])) {

foreach ($data['product_download'] as $download_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_download SET product_id = '" . (int)$product_id . "', download_id = '" . (int)$download_id . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_category'])) {

foreach ($data['product_category'] as $category_id) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE related_id = '" . (int)$product_id . "'");

if (isset($data['product_related'])) {

foreach ($data['product_related'] as $related_id) {

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");

$this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");

$this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_reward'])) {

foreach ($data['product_reward'] as $customer_group_id => $value) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_reward SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', points = '" . (int)$value['points'] . "'");

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_layout'])) {

foreach ($data['product_layout'] as $store_id => $layout) {

if ($layout['layout_id']) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_layout SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout['layout_id'] . "'");

}

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "product_tag WHERE product_id = '" . (int)$product_id. "'");

foreach ($data['product_tag'] as $language_id => $value) {

if ($value) {

$tags = explode(',', $value);

foreach ($tags as $tag) {

$this->db->query("INSERT INTO " . DB_PREFIX . "product_tag SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', tag = '" . $this->db->escape(trim($tag)) . "'");

}

}

}

$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id. "'");

if ($data['keyword']) {

$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'product_id=" . (int)$product_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'");

}

$this->cache->delete('product');

}

public function copyProduct($product_id) {

$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

if ($query->num_rows) {

$data = array();

$data = $query->row;

$data['keyword'] = '';

$data['status'] = '0';

$data = array_merge($data, array('product_attribute' => $this->getProductAttributes($product_id)));

$data = array_merge($data, array('product_description' => $this->getProductDescriptions($product_id)));

$data = array_merge($data, array('product_discount' => $this->getProductDiscounts($product_id)));

$data = array_merge($data, array('product_image' => $this->getProductImages($product_id)));

$data = array_merge($data, array('product_option' => $this->getProductOptions($product_id)));

$data = array_merge($data, array('product_related' => $this->getProductRelated($product_id)));

$data = array_merge($data, array('product_reward' => $this->getProductRewards($product_id)));

$data = array_merge($data, array('product_special' => $this->getProductSpecials($product_id)));

$data = array_merge($data, array('product_tag' => $this->getProductTags($product_id)));

$data = array_merge($data, array('product_category' => $this->getProductCategories($product_id)));

$data = array_merge($data, array('product_download' => $this->getProductDownloads($product_id)));

$data = array_merge($data, array('product_layout' => $this->getProductLayouts($product_id)));

$data = array_merge($data, array('product_store' => $this->getProductStores($product_id)));

$this->addProduct($data);

}

}

public function deleteProduct($product_id) {

$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");

$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 . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE related_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_tag WHERE product_id='" . (int)$product_id. "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "review WHERE product_id = '" . (int)$product_id . "'");

$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id. "'");

$this->cache->delete('product');

}

public function getProduct($product_id) {

$query = $this->db->query("SELECT DISTINCT *, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "') AS keyword FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

return $query->row;

}

public function getProducts($data = array()) {

if ($data) {

$sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";

// renamed filter_category_id to filter_category

if (!empty($data['filter_category'])) {

$sql .= " LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id)";

}

$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";

if (!empty($data['filter_name'])) {

$sql .= " AND LCASE(pd.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";

}

if (!empty($data['filter_model'])) {

$sql .= " AND LCASE(p.model) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_model'])) . "%'";

}

if (!empty($data['filter_price'])) {

$sql .= " AND p.price LIKE '" . $this->db->escape($data['filter_price']) . "%'";

}

if (isset($data['filter_quantity']) && !is_null($data['filter_quantity'])) {

$sql .= " AND p.quantity = '" . $this->db->escape($data['filter_quantity']) . "'";

}

if (isset($data['filter_status']) && !is_null($data['filter_status'])) {

$sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";

}

// renamed filter_category_id to filter_category

if (!empty($data['filter_category'])) {

if (!empty($data['filter_sub_category'])) {

$implode_data = array();

$implode_data[] = "category_id = '" . (int)$data['filter_category'] . "'";

$this->load->model('catalog/category');

$categories = $this->model_catalog_category->getCategories($data['filter_category']);

foreach ($categories as $category) {

$implode_data[] = "p2c.category_id = '" . (int)$category['category_id'] . "'";

}

$sql .= " AND (" . implode(' OR ', $implode_data) . ")";

} else {

$sql .= " AND p2c.category_id = '" . (int)$data['filter_category'] . "'";

}

}

$sql .= " GROUP BY p.product_id";

$sort_data = array(

'pd.name',

'p.model',

'p.price',

// add

'p2c.category_id',

// end

'p.quantity',

'p.status',

'p.sort_order'

);

if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {

$sql .= " ORDER BY " . $data['sort'];

} else {

$sql .= " ORDER BY pd.name";

}

if (isset($data['order']) && ($data['order'] == 'DESC')) {

$sql .= " DESC";

} else {

$sql .= " ASC";

}

if (isset($data['start']) || isset($data['limit'])) {

if ($data['start'] < 0) {

$data['start'] = 0;

}

if ($data['limit'] < 1) {

$data['limit'] = 20;

}

$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];

}

$query = $this->db->query($sql);

return $query->rows;

} else {

$product_data = $this->cache->get('product.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));

if (!$product_data) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY pd.name ASC");

$product_data = $query->rows;

$this->cache->set('product.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $product_data);

}

return $product_data;

}

}

public function getProductsByCategoryId($category_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2c.category_id = '" . (int)$category_id . "' ORDER BY pd.name ASC");

return $query->rows;

}

public function getProductDescriptions($product_id) {

$product_description_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");

foreach ($query->rows as $result) {

$product_description_data[$result['language_id']] = array(

'name' => $result['name'],

'description' => $result['description'],

'meta_keyword' => $result['meta_keyword'],

'meta_description' => $result['meta_description']

);

}

return $product_description_data;

}

public function getProductAttributes($product_id) {

$product_attribute_data = array();

$product_attribute_query = $this->db->query("SELECT pa.attribute_id, ad.name FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE pa.product_id = '" . (int)$product_id . "' AND ad.language_id = '" . (int)$this->config->get('config_language_id') . "' GROUP BY pa.attribute_id");

foreach ($product_attribute_query->rows as $product_attribute) {

$product_attribute_description_data = array();

$product_attribute_description_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");

foreach ($product_attribute_description_query->rows as $product_attribute_description) {

$product_attribute_description_data[$product_attribute_description['language_id']] = array('text' => $product_attribute_description['text']);

}

$product_attribute_data[] = array(

'attribute_id' => $product_attribute['attribute_id'],

'name' => $product_attribute['name'],

'product_attribute_description' => $product_attribute_description_data

);

}

return $product_attribute_data;

}

public function getProductOptions($product_id) {

$product_option_data = array();

$product_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order");

foreach ($product_option_query->rows 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();

$product_option_value_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 (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order");

foreach ($product_option_value_query->rows as $product_option_value) {

$product_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' => $product_option_value['name'],

'image' => $product_option_value['image'],

'quantity' => $product_option_value['quantity'],

'subtract' => $product_option_value['subtract'],

'price' => $product_option_value['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']

);

}

$product_option_data[] = array(

'product_option_id' => $product_option['product_option_id'],

'option_id' => $product_option['option_id'],

'name' => $product_option['name'],

'type' => $product_option['type'],

'product_option_value' => $product_option_value_data,

'required' => $product_option['required']

);

} else {

$product_option_data[] = 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']

);

}

}

return $product_option_data;

}

public function getProductImages($product_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");

return $query->rows;

}

public function getProductDiscounts($product_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' ORDER BY quantity, priority, price");

return $query->rows;

}

public function getProductSpecials($product_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' ORDER BY priority, price");

return $query->rows;

}

public function getProductRewards($product_id) {

$product_reward_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_reward WHERE product_id = '" . (int)$product_id . "'");

foreach ($query->rows as $result) {

$product_reward_data[$result['customer_group_id']] = array('points' => $result['points']);

}

return $product_reward_data;

}

public function getProductDownloads($product_id) {

$product_download_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");

foreach ($query->rows as $result) {

$product_download_data[] = $result['download_id'];

}

return $product_download_data;

}

public function getProductStores($product_id) {

$product_store_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");

foreach ($query->rows as $result) {

$product_store_data[] = $result['store_id'];

}

return $product_store_data;

}

public function getProductLayouts($product_id) {

$product_layout_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "'");

foreach ($query->rows as $result) {

$product_layout_data[$result['store_id']] = $result['layout_id'];

}

return $product_layout_data;

}

Надіслати
Поділитися на інших сайтах


Спасибо.

Скажите, а у вас в магазине, вообще, товары и категории показываются ?

Номер магазина установлен 0 (основной магазин) ?

Надіслати
Поділитися на інших сайтах

Спасибо.

Скажите, а у вас в магазине, вообще, товары и категории показываются ?

Номер магазина установлен 0 (основной магазин) ?

http://king-sites.ru/

да категории  показываются и карточки товара работают только товар не выводится в категории хотя в админ панели каждая карточка прикрепляется к категории

Надіслати
Поділитися на інших сайтах


Толку от этих файлов никакого, фильтр то цепляется через vqmod!

 

И какой фильтр?

 

Что и где меняли?

 

А так информации - ноль!

Надіслати
Поділитися на інших сайтах

filterpro

Ну так обратитесь к freelancer -у , он всегда помогает!

К тому же это его модуль, ни кто не знает лучше работу модуля, чем его разработчик.

Мы можем гадать еще уйму времени, а для него это может быть 5 минутной работой, с проблемой, которой он сталкивался много раз.

Надіслати
Поділитися на інших сайтах

Ну так обратитесь к freelancer -у , он всегда помогает!

К тому же это его модуль, ни кто не знает лучше работу модуля, чем его разработчик.

Мы можем гадать еще уйму времени, а для него это может быть 5 минутной работой, с проблемой, которой он сталкивался много раз.

врятли тут проблема в модуле так как ошибки то вот куда кидают

 

var/www/marinamarc2014/data/www/king-sites.ru/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 163
2014-07-20 12:58:15 - PHP Notice:  Undefined variable: filter_category_id in /var/www/marinamarc2014/data/www/king-sites.ru/catalog/view/theme/maximus/template/module/categoryse.tpl on line 11
Надіслати
Поділитися на інших сайтах


 

врятли тут проблема в модуле так как ошибки то вот куда кидают

 

var/www/marinamarc2014/data/www/king-sites.ru/vqmod/vqcache/vq2-catalog_controller_product_category.php on line 163
2014-07-20 12:58:15 - PHP Notice:  Undefined variable: filter_category_id in /var/www/marinamarc2014/data/www/king-sites.ru/catalog/view/theme/maximus/template/module/categoryse.tpl on line 11

 

Ну, а это чей notice?!

filter_category_id

module/categoryse.tpl

 

Никто и не говорит что проблема в модуле, может это проблема в настройках и т.п., но то что это касается модуля - факт

 

Так что обращайтесь к freelancer - у, быстрее и дешевле будет

Змінено користувачем markimax
Надіслати
Поділитися на інших сайтах

Ну, а это чей notice?!

filter_category_id

module/categoryse.tpl

 

Никто и не говорит что проблема в модуле, может это проблема в настройках и т.п., но то что это касается модуля - факт

 

Так что обращайтесь к freelancer - у, быстрее и дешевле будет

я пробовала отключать все модули но безуспешно ток же не выводится товар

Надіслати
Поділитися на інших сайтах


я пробовала отключать все модули но безуспешно ток же не выводится товар

Поставьте оригинальный файл контроллера category.php и шаблона к нему, и отключите всё что связано с модулями в vqmod.

Надіслати
Поділитися на інших сайтах

1. портянки кода прячьте под спойлер

2. тех поддержка оказывается только легальным покупателям

здравствуйте я покупал ваш модуль мне просто дали тут бан моя почта [email protected], а так давно не заходила

Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.