| Категории [FAQ] Часто задаваемые вопросы и ответы Проблемы и решения Ошибки и исправления Общие вопросы   Расширения Установка и обновление   Модули Шаблоны   Локализация интерфейса Коммерческие предложения Учимся бизнесу Бизнес книги Поисковая оптимизация (SEO) Магазины на ShopOS Хостинг для ShopOS Предложения и пожелания Курилка   | Как запретить добавление товаров с ценой = 0Как запретить добавление товаров с ценой = 0
 в файле includes\classes\shopping_cart.php
 
 заменить
 
 function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)
 {
 
 global $new_products_id_in_cart;
 
 
 
 $products_id = os_get_uprid($products_id, $attributes);
 if ($notify == true) {
 $_SESSION['new_products_id_in_cart'] = $products_id;
 }
 
 if ($this->in_cart($products_id)) {
 $this->update_quantity($products_id, $qty, $attributes);
 } else {
 $this->contents[] = array ($products_id);
 $this->contents = array ('qty' => $qty);
 if (isset ($_SESSION['customer_id']))
 os_db_query("insert into ".TABLE_CUSTOMERS_BASKET." (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('".$_SESSION['customer_id']."', '".$products_id."', '".$qty."', '".date('Ymd')."')");
 
 if (is_array($attributes)) {
 reset($attributes);
 while (list ($option, $value) = each($attributes)) {
 
 $attr_value = NULL;
 $blank_value = FALSE;
 if (strstr($option, 'txt_')) {
 if (trim($value) == NULL)
 {
 $blank_value = TRUE;
 } else {
 $option_1 = substr($option, strlen('txt_'));
 $option_2 = preg_split('/_/', $option_1);
 $option = $option_2;
 $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
 $value = $option_2;
 $this->contents['attributes_values'] = $attr_value;
 }
 }
 
 if (!$blank_value)
 {
 $this->contents['attributes'] = $value;
 if (isset ($_SESSION['customer_id']))
 os_db_query("insert into ".TABLE_CUSTOMERS_BASKET_ATTRIBUTES." (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('".$_SESSION['customer_id']."', '".$products_id."', '".$option."', '".$value."', '" . os_db_input($attr_value) . "')");
 }
 }
 }
 }
 $this->cleanup();
 
 $this->cartID = $this->generate_cart_id();
 
 }
 
 на
 
 function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)
 {
 global $osPrice;
 global $new_products_id_in_cart;
 
 
 if (!empty($products_id))
 {
 $_product = os_db_query('select products_id, products_price from '.DB_PREFIX.'products where products_id="'.$products_id.'"');
 $_product  = os_db_fetch_array($_product, true);
 }
 
 if (isset($_product['products_price']) && $_product['products_price']==0)
 {
 //
 }
 else
 {
 
 
 $products_id = os_get_uprid($products_id, $attributes);
 if ($notify == true) {
 $_SESSION['new_products_id_in_cart'] = $products_id;
 }
 
 if ($this->in_cart($products_id)) {
 $this->update_quantity($products_id, $qty, $attributes);
 } else {
 $this->contents[] = array ($products_id);
 $this->contents = array ('qty' => $qty);
 if (isset ($_SESSION['customer_id']))
 os_db_query("insert into ".TABLE_CUSTOMERS_BASKET." (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('".$_SESSION['customer_id']."', '".$products_id."', '".$qty."', '".date('Ymd')."')");
 
 if (is_array($attributes)) {
 reset($attributes);
 while (list ($option, $value) = each($attributes)) {
 
 $attr_value = NULL;
 $blank_value = FALSE;
 if (strstr($option, 'txt_')) {
 if (trim($value) == NULL)
 {
 $blank_value = TRUE;
 } else {
 $option_1 = substr($option, strlen('txt_'));
 $option_2 = preg_split('/_/', $option_1);
 $option = $option_2;
 $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
 $value = $option_2;
 $this->contents['attributes_values'] = $attr_value;
 }
 }
 
 if (!$blank_value)
 {
 $this->contents['attributes'] = $value;
 if (isset ($_SESSION['customer_id']))
 os_db_query("insert into ".TABLE_CUSTOMERS_BASKET_ATTRIBUTES." (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('".$_SESSION['customer_id']."', '".$products_id."', '".$option."', '".$value."', '" . os_db_input($attr_value) . "')");
 }
 }
 }
 }
 $this->cleanup();
 
 $this->cartID = $this->generate_cart_id();
 }
 }
 
 А если в одной из категорий товаров необходимо сделать товар с ценой 0? Можно ли исключить эту категорию? 
 А если в одной из категорий товаров необходимо сделать товар с ценой 0? Можно ли исключить эту категорию?
 
 
 тоесть?
 
 в одной из категорий есть товар, у которого цена =0
 
 нужно не показывать эту категорию?
 
 Смешно. Гы. 
 Источник 
 
 |