@MaxKondratenko

Битрикс добавляет один и тот же товар отдельно?

Верстаю шаблон под битрикс, первый опыт. И столкнулся с непонятной мне проблемой...
в общем то есть компонент на главной странице bitrix:catalog.top со стандартными настройками,
<?$APPLICATION->IncludeComponent(
	"bitrix:catalog.top", 
	".default", 
	array(
		"IBLOCK_TYPE_ID" => "catalog",
		"IBLOCK_ID" => "5",
		"ELEMENT_SORT_FIELD" => "name",
		"ELEMENT_SORT_ORDER" => "asc",
		"ELEMENT_SORT_FIELD2" => "name",
		"ELEMENT_SORT_ORDER2" => "asc",
		"HIDE_NOT_AVAILABLE" => "N",
		"ELEMENT_COUNT" => "6",
		"LINE_ELEMENT_COUNT" => "3",
		"PROPERTY_CODE" => array(
			0 => "MINIMUM_PRICE",
			1 => "MAXIMUM_PRICE",
			2 => "",
		),
		"OFFERS_FIELD_CODE" => array(
			0 => "NAME",
			1 => "",
		),
		"OFFERS_PROPERTY_CODE" => array(
			0 => "ARTNUMBER",
			1 => "COLOR_REF",
			2 => "SIZES_SHOES",
			3 => "SIZES_CLOTHES",
			4 => "MORE_PHOTO",
			5 => "",
		),
		"OFFERS_SORT_FIELD" => "sort",
		"OFFERS_SORT_ORDER" => "asc",
		"OFFERS_SORT_FIELD2" => "id",
		"OFFERS_SORT_ORDER2" => "desc",
		"OFFERS_LIMIT" => "0",
		"VIEW_MODE" => "SLIDER",
		"TEMPLATE_THEME" => "site",
		"PRODUCT_DISPLAY_MODE" => "Y",
		"ADD_PICT_PROP" => "-",
		"LABEL_PROP" => "-",
		"OFFER_ADD_PICT_PROP" => "MORE_PHOTO",
		"OFFER_TREE_PROPS" => array(
			0 => "COLOR_REF",
			1 => "SIZES_SHOES",
			2 => "SIZES_CLOTHES",
		),
		"SHOW_DISCOUNT_PERCENT" => "Y",
		"SHOW_OLD_PRICE" => "Y",
		"ROTATE_TIMER" => "30",
		"MESS_BTN_BUY" => "Купить",
		"MESS_BTN_ADD_TO_BASKET" => "В корзину",
		"MESS_BTN_DETAIL" => "Подробнее",
		"MESS_NOT_AVAILABLE" => "Нет в наличии",
		"SECTION_URL" => "",
		"DETAIL_URL" => "",
		"BASKET_URL" => "/site_ik/personal/cart/",
		"ACTION_VARIABLE" => "action",
		"PRODUCT_ID_VARIABLE" => "id_slider",
		"PRODUCT_QUANTITY_VARIABLE" => "quantity",
		"PRODUCT_PROPS_VARIABLE" => "prop",
		"SECTION_ID_VARIABLE" => "SECTION_ID",
		"CACHE_TYPE" => "A",
		"CACHE_TIME" => "180",
		"CACHE_GROUPS" => "Y",
		"DISPLAY_COMPARE" => "Y",
		"PRICE_CODE" => array(
			0 => "BASE",
		),
		"USE_PRICE_COUNT" => "N",
		"SHOW_PRICE_COUNT" => "1",
		"PRICE_VAT_INCLUDE" => "Y",
		"PRODUCT_PROPERTIES" => array(
		),
		"USE_PRODUCT_QUANTITY" => "N",
		"CONVERT_CURRENCY" => "N",
		"OFFERS_CART_PROPERTIES" => array(
			0 => "ARTNUMBER",
			1 => "COLOR_REF",
			2 => "SIZES_SHOES",
			3 => "SIZES_CLOTHES",
		),
		"IBLOCK_TYPE" => "catalog",
		"FILTER_NAME" => "",
		"SHOW_CLOSE_POPUP" => "Y",
		"SHOW_PAGINATION" => "Y",
		"MESS_BTN_COMPARE" => "Сравнить",
		"CACHE_FILTER" => "N",
		"ADD_PROPERTIES_TO_BASKET" => "Y",
		"PARTIAL_PRODUCT_PROPERTIES" => "N",
		"ADD_TO_BASKET_ACTION" => "ADD",
		"COMPARE_PATH" => ""
	),
	false
);?>


Когда добавляю товар он добавляется в корзину, а когда перехожу на детальную страницу этого же товара и снова нажимаю добавить в корзину, он добавляется, но почему то добавляется отдельной позицией, т.е. получается два раза один и тот же товар, а должно увеличиваться количество.
Ковырял ковырял и взял стандартный шаблон интернет магазина битрикс и выяснил, что если на старнице находится ещё один компонент bitrix.catalog.top (стандартный из интернет магазина с демо данными), вот с такими настройками
<?
$APPLICATION->IncludeComponent("bitrix:catalog.top", "slider", array(
	"IBLOCK_TYPE_ID" => "catalog",
		"IBLOCK_ID" => "5",
		"ELEMENT_SORT_FIELD" => "name",
		"ELEMENT_SORT_ORDER" => "asc",
		"ELEMENT_COUNT" => "6",
		"VIEW_MODE" => "SLIDER",
		"TEMPLATE_THEME" => "site",
		"PROPERTY_CODE" => array(
			0 => "MINIMUM_PRICE",
			1 => "MAXIMUM_PRICE",
			2 => "",
		),
		"SECTION_URL" => "",
		"DETAIL_URL" => "",
		"ACTION_VARIABLE" => "action",
		"PRODUCT_ID_VARIABLE" => "id_slider",
		"PRODUCT_QUANTITY_VARIABLE" => "quantity",
		"PRODUCT_PROPS_VARIABLE" => "prop",
		"SECTION_ID_VARIABLE" => "SECTION_ID",
		"CACHE_TYPE" => "A",
		"CACHE_TIME" => "180",
		"CACHE_GROUPS" => "Y",
		"DISPLAY_COMPARE" => "Y",
		"PRICE_CODE" => array(
			0 => "BASE",
		),
		"OFFERS_FIELD_CODE" => array(
			0 => "NAME",
			1 => "",
		),
		"OFFERS_PROPERTY_CODE" => array(
			0 => "",
			1 => "COLOR",
			2 => "WIDTH",
			3 => "",
		),
		"OFFERS_CART_PROPERTIES" => "",
		"USE_PRICE_COUNT" => "N",
		"SHOW_PRICE_COUNT" => "1",
		"PRICE_VAT_INCLUDE" => "Y",
		"USE_PRODUCT_QUANTITY" => "Y",
		"IBLOCK_TYPE" => "catalog",
		"ELEMENT_SORT_FIELD2" => "id",
		"ELEMENT_SORT_ORDER2" => "desc",
		"FILTER_NAME" => "",
		"HIDE_NOT_AVAILABLE" => "N",
		"LINE_ELEMENT_COUNT" => "3",
		"OFFERS_SORT_FIELD" => "sort",
		"OFFERS_SORT_ORDER" => "asc",
		"OFFERS_SORT_FIELD2" => "id",
		"OFFERS_SORT_ORDER2" => "desc",
		"OFFERS_LIMIT" => "5",
		"PRODUCT_DISPLAY_MODE" => "Y",
		"ADD_PICT_PROP" => "-",
		"LABEL_PROP" => "-",
		"SHOW_DISCOUNT_PERCENT" => "Y",
		"SHOW_OLD_PRICE" => "Y",
		"SHOW_CLOSE_POPUP" => "Y",
		"ROTATE_TIMER" => "30",
		"SHOW_PAGINATION" => "Y",
		"MESS_BTN_BUY" => "Купить",
		"MESS_BTN_ADD_TO_BASKET" => "В корзину",
		"MESS_BTN_COMPARE" => "Сравнить",
		"MESS_BTN_DETAIL" => "Подробнее",
		"MESS_NOT_AVAILABLE" => "Нет в наличии",
		"CACHE_FILTER" => "N",
		"CONVERT_CURRENCY" => "N",
		"BASKET_URL" => "/site_ik/personal/cart/",
		"ADD_PROPERTIES_TO_BASKET" => "Y",
		"PARTIAL_PRODUCT_PROPERTIES" => "N",
		"ADD_TO_BASKET_ACTION" => "ADD",
		"COMPARE_PATH" => "",
		"OFFER_ADD_PICT_PROP" => "-",
		"OFFER_TREE_PROPS" => array(
			0 => "-",
		),
		"PRODUCT_PROPERTIES" => ""
	),
	false,
	array(
	"ACTIVE_COMPONENT" => "Y"
	)
);
?>

То всё работает прекрасно... Какую настройку пропустил... что не так делаю... ничего не могу понять...

Вот сам header
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
IncludeTemplateLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/templates/".SITE_TEMPLATE_ID."/header.php");
//$wizTemplateId = COption::GetOptionString("main", "wizard_template_id", "eshop_adapt_horizontal", SITE_ID);
//CUtil::InitJSCore();
//CJSCore::Init(array("fx"));
//$curPage = $APPLICATION->GetCurPage(true);
?>
<!DOCTYPE html>
<!--[if IE 7 ]><html class="ie ie7 lte9 lte8 lte7" lang="ru-RU"><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8" lang="ru-RU">	<![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9" lang="ru-RU"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=LANGUAGE_ID?>" lang="<?=LANGUAGE_ID?>">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
	<!из старого шаблона<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width">
	<!из старого шаблона<link rel="shortcut icon" type="image/x-icon" href="<?=SITE_DIR?>/favicon.ico" />
	<?//$APPLICATION->ShowHead();
	echo '<meta http-equiv="Content-Type" content="text/html; charset='.LANG_CHARSET.'"'.(true ? ' /':'').'>'."\n";
	$APPLICATION->ShowMeta("robots", false, true);
	$APPLICATION->ShowMeta("keywords", false, true);
	$APPLICATION->ShowMeta("description", false, true);
	$APPLICATION->ShowCSS(true, true);
	?>
	<!из старого шаблона<link rel="stylesheet" type="text/css" href="<?//=CUtil::GetAdditionalFileURL(SITE_TEMPLATE_PATH."/colors.css")?>" />
	<?
	$APPLICATION->ShowHeadStrings();
	$APPLICATION->ShowHeadScripts();
	//$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/script.js");
	
	
	/*Reset CSS*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/normalize.css'); 
	/*Bootstrap core CSS*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/bootstrap.css'); 
	/*Iview Slider*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/iview.css'); 
	/*Responsive 3D Menu*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/menu3d.css'); 
	/*Animations*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/animate.css'); 
	/*Custom styles for this template*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/custom.css'); 
	/*Style Switcher*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/style-switch.css'); 
	/*Color*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/css/skin/color.css'); 
	/*Importing Fonts and Icons*/
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/fonts/fontawesome/font-awesome.css'); 
	$APPLICATION->SetAdditionalCSS(SITE_TEMPLATE_PATH.'/fonts/lato/stylesheet.css'); 
	
	
	/*Bootstrap core JavaScript*/
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/jquery-1.10.2.min.js"); 
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/bootstrap.min.js"); 
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/bootstrap-select.js"); 
	/*Custom Scripts*/
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/scripts.js"); 
	/*MegaMenu*/
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/menu3d.js"); 
	/*iView Slider*/
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/raphael-min.js"); 
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/jquery.easing.js"); 
	$APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH."/js/iview.js");

	?>
	<title><?$APPLICATION->ShowTitle()?></title>
</head>
<body>
<div id="panel"><?$APPLICATION->ShowPanel();?></div>

футер
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
	IncludeTemplateLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/templates/".SITE_TEMPLATE_ID."/header.php");

?>
</body>
</html>


пустой лишь для экспериментов
  • Вопрос задан
  • 1156 просмотров
Решения вопроса 1
Вы используете торговые предложения из компонента catalog.top вы кладете в корзину одно торговое предложение, из карточки товара другое.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы