M
M
MaxKondratenko2015-06-12 09:32:14
1C-Bitrix
MaxKondratenko, 2015-06-12 09:32:14

How to make the component correctly determine the SITE_ID when multi-site on Bitrix?

There is a "buy in one click" component from a third-party developer (I'll clarify right away that you can write to them, but they are still sleeping, but I want to resolve the issue earlier) everything works fine on the main site, on the site of another city the component does not work, there is a piece in which it determines if there is something in the cart:

<? require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); ?>
<?
global $APPLICATION;
$APPLICATION->IncludeFile("/bitrix/modules/wl.buyinoneclick/lang/" . LANGUAGE_ID . "/classes/general/errors.php"); 
if(!CModule::IncludeModule("wl.buyinoneclick"))
  die();
 
$obBuy = new CBuyInOneClick;
  
  if($obBuy->GetBasketItems())
    $obBuy->WlDie("SUCCESS", "success");
  else
    $obBuy->WlDie(GetMessage("ERR_EMPTY_BASKET").SITE_ID);
?>
<? require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); ?>

Added SITE_ID and found that no matter what site the component is on, SITE_ID is the same. I’m just getting acquainted with Bitrix ... tell me which way to dig, or how to pass this ID in general, here is a piece of spript that makes a request to what is indicated above
$.ajax({
      type:'POST',
      url:'/bitrix/components/wlcomponents/buyinoneclick/ajax_basket.php',
      data:$('#bocModal #boc-form').serialize(),
      error: function(){
        alert('Connection error.');
      },
      success: function(data){
        var obj = jQuery.parseJSON(BocSubData(data));
        if(obj.error)
          BocMessage(obj.error, 'show', 'Error');
        else if(obj.success)
            $('#bocModal').modal();
          else alert('Connection error.');
      }
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Express777, 2015-06-13
@Express777

У вас многосайтовость настроено через разные поддомены или другой сайт это просто подпапка на основном. Например, mysite.com/m/.
Рекомендую начать с Настройки-Настройки продукта - Сайты - список сайтов. Посмотреть, какие условия стоят у вас при подключении шаблонов. Действительно ли у вас несколько сайтов, а не несколько шаблонов.
Про порядок подключение скриптов почитайте здесь Страница и порядок ее подключения
Там как раз написано, на каком этапе определяется SITE_ID

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question