max1985 Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Здравствуйте! Подскажите как скрыть один товар не авторизованным пользователям? Надіслати Поділитися на інших сайтах More sharing options... splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 if ($product_id == id) break; Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 1 час назад, max1985 сказал: Здравствуйте! Подскажите как скрыть один товар не авторизованным пользователям? только один? 34 минуты назад, splka сказал: if ($product_id == id) break; куда брейкать-то? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 1 минуту назад, chukcha сказал: только один? Да! Надіслати Поділитися на інших сайтах More sharing options... splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 (змінено) 37 минут назад, chukcha сказал: только один? куда брейкать-то? Окей, if ($product_id == id) {} else {} Или if ($product_id != id) {} Как причесать этот код? Змінено 4 лютого 2019 користувачем splka Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 if ($product_id == id) break; Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 1 час назад, max1985 сказал: Здравствуйте! Подскажите как скрыть один товар не авторизованным пользователям? только один? 34 минуты назад, splka сказал: if ($product_id == id) break; куда брейкать-то? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 1 минуту назад, chukcha сказал: только один? Да! Надіслати Поділитися на інших сайтах More sharing options... splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 (змінено) 37 минут назад, chukcha сказал: только один? куда брейкать-то? Окей, if ($product_id == id) {} else {} Или if ($product_id != id) {} Как причесать этот код? Змінено 4 лютого 2019 користувачем splka Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 1 час назад, max1985 сказал: Здравствуйте! Подскажите как скрыть один товар не авторизованным пользователям? только один? 34 минуты назад, splka сказал: if ($product_id == id) break; куда брейкать-то? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 1 минуту назад, chukcha сказал: только один? Да! Надіслати Поділитися на інших сайтах More sharing options... splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 (змінено) 37 минут назад, chukcha сказал: только один? куда брейкать-то? Окей, if ($product_id == id) {} else {} Или if ($product_id != id) {} Как причесать этот код? Змінено 4 лютого 2019 користувачем splka Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 1 минуту назад, chukcha сказал: только один? Да! Надіслати Поділитися на інших сайтах More sharing options... splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 (змінено) 37 минут назад, chukcha сказал: только один? куда брейкать-то? Окей, if ($product_id == id) {} else {} Или if ($product_id != id) {} Как причесать этот код? Змінено 4 лютого 2019 користувачем splka Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
splka Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 (змінено) 37 минут назад, chukcha сказал: только один? куда брейкать-то? Окей, if ($product_id == id) {} else {} Или if ($product_id != id) {} Как причесать этот код? Змінено 4 лютого 2019 користувачем splka Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 спрошу еще, а что отдавать? Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 2 часа назад, max1985 сказал: как скрыть один товар не авторизованным пользователям? везде? Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 8 минут назад, fanatic сказал: везде? Желательно! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 4 лютого 2019 Автор Share Опубліковано: 4 лютого 2019 5 минут назад, chukcha сказал: Я имею модуль restrict entity Позволяет установить доступ к категориям или товарам из доступной группы. Если сегодня речь идет об одном товаре, то завтра о 10-ти Там только один такой товар, который лучше не светить... Больше подобных не будет. Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 в лбом случае, нудно делать комплекс мероприяттий Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } 1 Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 а по прямой ссылке, редирект или сообщение Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 32 минуты назад, fanatic сказал: как вариант foreach ($results as $result) { if(!$this->customer->isLogged() && $result['product_id'] == 'идентификатор товара'){ continue; } // тут код контроллера } и вместо 20 получить 19 в сортировке + можно зайти по прямой ссылке.. + если вдруг какие нибудь акции, последние, etc .. то и туда может попасть Надіслати Поділитися на інших сайтах More sharing options... fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
fanatic Опубліковано: 4 лютого 2019 Share Опубліковано: 4 лютого 2019 35 минут назад, chukcha сказал: и вместо 20 получить 19 в сортировке if(!$this->customer->isLogged()){ $sql .= " AND p.product_id != 'id' "; } Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Нашел готовый ocmod для opencart, немного пришлось его переделать пол ocstor... теперь через админку в КТ можно указывать в каких группах отображать. Всем спасибо за помощь! Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 3 минуты назад, max1985 сказал: Нашел готовый ocmod для opencart, Ну так поделитесь.. или нашел на просторах вареза? 20 часов назад, chukcha сказал: Я имею модуль restrict entity Но вы сказали что товар один, что вам админка не нужна Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 4 часа назад, chukcha сказал: Ну так поделитесь.. или нашел на просторах вареза? Но вы сказали что товар один, что вам админка не нужна Да, но так будет правильней. Выкладываю как у меня для ocstor 2.1. Может не подойти... Смотрим логи и правим. Спойлер <modification> <name>Товары для группы клиентов</name> <code>product-customer-group</code> <version>2.1</version> <author>max_1985</author> <link>https://opencartforum.ru</link> <file path="system/library/user.php"> <operation error="log" info="create a new table product_to_customer_groups if not exists"> <search><![CDATA[$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");]]></search> <add position="after"><![CDATA[$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> </operation> </file> <file path="admin/language/english/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword'] = 'SEO keyword already in use!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model'] = 'Product Model must be greater than 1 and less than 64 characters!';]]></search> <add position="after"><![CDATA[$_['entry_customer_group'] = 'Customer Groups'; $_['help_product_to_customer_group'] = 'Select Customer Groups for this product. By default its available to all.';]]></add> </operation> </file> <file path="admin/language/russian/catalog/product.php"> <operation error="skip" info="Set language for customer group in product page"> <search><![CDATA[$_['error_keyword']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> <operation error="skip" info="Set language for customer group in product page v2.0.0.0"> <search><![CDATA[$_['error_model']]]></search> <add position="before"><![CDATA[$_['entry_customer_group'] = 'Группы клиентов'; $_['help_product_to_customer_group'] = 'По умолчанию товар будет доступен для всех.';]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation error="log" info="Create a new function to get product_id from table product to customer group"> <search><![CDATA[public function getProductStores($product_id) {]]></search> <add position="before"><![CDATA[public function getProductCustomerGroups($product_id) { $product_customer_group_data = array(); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $product_customer_group_data[] = $result['p2cg_customer_group_id']; } return $product_customer_group_data; }]]></add> </operation> <operation error="log" info="Edit addProduct() to add data to table product to customer group"> <search><![CDATA[$product_id = $this->db->getLastId();]]></search> <add position="after"><![CDATA[if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'"); } }]]></add> </operation> <operation error="log" info="Edit editProduct() to update table product to customer group"> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'"); if (isset($data['p2cg_product_customer_groups'])) { foreach ($data['p2cg_product_customer_groups'] as $customer_group_id) { $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_customer_groups SET p2cg_product_id = '" . (int)$product_id . "', p2cg_customer_group_id = '" . (int)$customer_group_id . "'"); } }]]></add> </operation> <operation error="log" info="Edit deleteProduct() to update table product to customer group"> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="after"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_customer_groups WHERE p2cg_product_id = '" . (int)$product_id . "'");]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation error="log" info="Load language of customer groups in product page"> <search><![CDATA[$data['entry_store'] = $this->language->get('entry_store');]]></search> <add position="after"><![CDATA[$data['entry_customer_group'] = $this->language->get('entry_customer_group'); $data['help_product_to_customer_group'] = $this->language->get('help_product_to_customer_group');]]></add> </operation> <operation error="log" info="Fetch data of customer groups"> <search><![CDATA[$this->load->model('setting/store');]]></search> <add position="before"><![CDATA[ if(VERSION == '2.1.0.1' || VERSION == '2.1.0.2'){ $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } else { $this->load->model('customer/customer_group'); $data['p2cg_customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); } if (isset($this->request->post['p2cg_product_customer_groups'])) { $data['p2cg_product_customer_groups'] = $this->request->post['p2cg_product_customer_groups']; } elseif (isset($this->request->get['product_id'])) { $data['p2cg_product_customer_groups'] = $this->model_catalog_product->getProductCustomerGroups($this->request->get['product_id']); } else { $data['p2cg_product_customer_groups'] = array(0); }]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation error="log" info="Display customer groups on product page"> <search><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search> <add position="before" offset="1"><![CDATA[<div class="form-group"> <label class="col-sm-2 control-label" for="input-p2cg_product_customer_groups"><span data-toggle="tooltip" title="<?php echo $help_product_to_customer_group; ?>"><?php echo $entry_customer_group; ?></span></label> <div class="col-sm-10"> <div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="checkbox"> <?php foreach ($p2cg_customer_groups as $customer_group) { ?> <div class="col-sm-10"> <label> <?php if (in_array($customer_group['customer_group_id'], $p2cg_product_customer_groups)) { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" /> <?php echo $customer_group['name']; ?> <?php } else { ?> <input type="checkbox" name="p2cg_product_customer_groups[]" value="<?php echo $customer_group['customer_group_id']; ?>" /> <?php echo $customer_group['name']; ?> <?php } ?> </label> </div> <?php } ?> </div> </div> </div> </div>]]></add> </operation> </file> <!--////////////////////////////////////////////////////////////////////////////////////////--> <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip" info="Disable fetch cache product and product.latest"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="skip" info="Disable fetch cache product.bestseller "> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[$product_data = "";]]></add> </operation> <operation error="log" info="Create Function getProductToCustomer() to get product data including table product_to_customer_groups"> <search><![CDATA[public function getTotalProductSpecials() {]]></search> <add position="before"><![CDATA[public function getProductToCustomer($productID) { $sql = " SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.product_id = '".$productID."' "; if($this->customer->isLogged()){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } if (!$this->customer->isLogged()) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } $sql .= " GROUP BY p.product_id "; $query = $this->db->query($sql); if($query->num_rows){return true;}else{return false;} }]]></add> </operation> <operation error="log" info="Change Function getTotalProducts() to get product data including table product_to_customer_groups"> <search index="1"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";]]></search> <add position="replace"><![CDATA[$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2cc ON (p.product_id = p2cc.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2s.product_id = p2cg.p2cg_product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"; ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' ";} if (!$this->customer->isLogged()) {$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' ";} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if (!$this->customer->isLogged()) {$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."'";} ]]></add> </operation> <operation error="log" info="Change getProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";]]></search> <add position="replace" offset="16"><![CDATA[$sql = "SELECT p.product_id, p2c.category_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) ";]]></add> </operation> <operation error="log"> <search><![CDATA[$sql .= " GROUP BY p.product_id";]]></search> <add position="before"><![CDATA[ if($this->customer->isLogged()){ if (!empty($data['filter_category_id'])) { if (!empty($data['filter_sub_category'])) { $sql .= " AND p2cg.p2cg_product_id IS NULL OR cp.path_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' "; }}} if(!$this->customer->isLogged()){ if(!empty($data['filter_name'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } elseif(!empty($data['filter_category_id'])){ $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2c.category_id = '" . (int)$data['filter_category_id'] . "' AND p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; } else { $sql .= " AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' "; }} ]]></add> </operation> <operation error="log"> <search index="1"><![CDATA[$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."'";} if(!$this->customer->isLogged()){$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'";} ]]></add> </operation> <operation error="log" info="Change getProduct() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->customer->getGroupId(). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, (SELECT md.name FROM " . DB_PREFIX . "manufacturer_description md WHERE md.manufacturer_id = p.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order 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_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p.product_id = p2cg.p2cg_product_id) WHERE (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '" .(int)$this->config->get('config_customer_group_id'). "') AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");} ]]></add> </operation> <operation error="log" info="Change getBestSellerProducts() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); } ]]></add> </operation> <operation error="log" info="Change getProductSpecials() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id";]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR (ps.customer_group_id = p2cg.p2cg_customer_group_id AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } if(!$this->customer->isLogged()){ $sql = "SELECT DISTINCT ps.product_id, (SELECT AVG(rating) FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = ps.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM " . DB_PREFIX . "product_special ps LEFT JOIN " . DB_PREFIX . "product p ON (ps.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND (ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND p2cg.p2cg_product_id IS NULL) OR p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) GROUP BY ps.product_id"; } ]]></add> </operation> <operation error="log" info="Change getProductRelated() MySql Query to get product data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') "); } if(!$this->customer->isLogged()){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2cg.p2cg_product_id IS NULL OR (pr.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') "); } ]]></add> </operation> <operation error="log" info="Change getCategories() MySql Query to get product category data including table product_to_customer_groups"> <search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ if($this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->customer->getGroupId()."') GROUP BY p2c.category_id");} if(!$this->customer->isLogged()){$query = $this->db->query("SELECT p2c.* FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product_to_customer_groups p2cg ON (p2c.product_id = p2cg.p2cg_product_id) WHERE (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_product_id IS NULL) OR (p2c.product_id = '" . (int)$product_id . "' AND p2cg.p2cg_customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') GROUP BY p2c.category_id");} ]]></add> </operation> </file> <file path="catalog/controller/product/product.php"> <operation error="log" info="Check if the product is in restricted product"> <search><![CDATA[$product_info = $this->model_catalog_product->getProduct($product_id);]]></search> <add position="after"><![CDATA[$product_prod2cust = $this->model_catalog_product->getProductToCustomer($product_id); if(!$product_prod2cust){$product_info = "";}]]></add> </operation> </file> <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> <file path="catalog/controller/module/featured.php"> <operation error="skip" info="Check if the featured product is in restricted product"> <search><![CDATA[$products = array_slice($setting['product'], 0, (int)$setting['limit']);]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> <operation error="skip" info="Check if the featured product is in restricted product v2.0.0.0"> <search><![CDATA[$products = explode(',', $this->config->get('featured_product'));]]></search> <add position="after"><![CDATA[foreach($products as $key => $value){$product_prod2cust = $this->model_catalog_product->getProductToCustomer($value); if(!$product_prod2cust){unset($products[$key]);}}]]></add> </operation> </file> <file path="catalog/controller/product/search.php"> <operation error="log" info="Get searched product detail "> <search><![CDATA[foreach ($results as $result) {]]></search> <add position="after"><![CDATA[$categories = $this->model_catalog_product->getCategories($result['product_id']); if(sizeof($categories)>0){]]></add> </operation> <operation error="log"> <search><![CDATA['href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search> <add position="after" offset="2"><![CDATA[}]]></add> </operation> </file> </modification> Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 5 минут назад, max1985 сказал: $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_to_customer_groups` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `p2cg_product_id` int( 11 ) NOT NULL , `p2cg_customer_group_id` int( 11 ) NOT NULL )ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin");]]></add> О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются :) Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989 × Уже зареєстровані? Ввійти Реєстрація Ваші замовлення Назад Придбані модулі та шаблони Ваші рахунки Лист очікувань Альтернативні контакти Форум Новини ocStore Назад Офіційний сайт Демо ocStore 3.0.3.2 Демо ocStore 2.3.0.2.4 Завантажити ocStore Документація Історія версій ocStore Блоги Модулі Шаблони Назад Безкоштовні шаблони Платні шаблони Де купувати модулі? Послуги FAQ OpenCart.Pro Назад Демо Купити Порівняння × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 2 минуты назад, chukcha сказал: О мАмАдАрАгАя - каждый раз при логине Не знаю где вы это взяли, но это код из ПЛАТНОГО модуля (мне так кажется) окмоды сделаные на коленке не комментируются Знаете как сделать лучше? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям Покупцям Оплата розширень фізичними особами Оплата розширень юридичними особами Політика повернень Розробникам Регламент розміщення розширень Регламент продажу та підтримки розширень Віртуальний обліковий запис автора Політика просування оголошень API каталогу розширень Вирішення спорів щодо авторських прав Корисна інформація Публічна оферта Політика повернень Політика конфіденційності Платіжна політика Політика передачі особистих даних Політика прозорості Останні розширення SameSite Session Fix Opencart 3 Автор: web_bond SP Telegram повідомлення FREE Автор: spectre Відключити порожні категорії Автор: spectre SEO Автор тексту категорії / фільтра / блогу з датою оновлення контенту + мікророзмітка Автор: radaevich Промо банери в категоріях товарів Автор: IHOR1989
chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 <file path="catalog/view/theme/*/template/common/header.tpl"> <operation error="log" info="Stop Errors "> <search><![CDATA[<title><?php echo $title; ?></title>]]></search> <add position="after"><![CDATA[<?php error_reporting(0);?>]]></add> </operation> </file> Это полный ППЦ Disable fetch cache ЗАчем? <file path="catalog/controller/product/manufacturer.php"> <operation error="log" info="Remove empty array"> <search><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search> <add position="after"><![CDATA[$results = array_filter($results);]]></add> </operation> </file> ЗАЧЕМ? И еще куча мусора 1 Надіслати Поділитися на інших сайтах More sharing options... max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Opencart 2.x Opencart 2.x: Загальні питання Скрыть один товар не авторизованным пользователям
max1985 Опубліковано: 5 лютого 2019 Автор Share Опубліковано: 5 лютого 2019 Можете подправить и выложить ocmod без лишнего мусора? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку
chukcha Опубліковано: 5 лютого 2019 Share Опубліковано: 5 лютого 2019 39 минут назад, max1985 сказал: Можете подправить и выложить ocmod без лишнего мусора? зачем? В 04.02.2019 в 14:32, chukcha сказал: Я имею модуль restrict entity Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 0
Recommended Posts