示例#1
1
             $arFilter["ID"][] = $val[$arUserResult["DELIVERY_ID"]];
         }
     }
 }
 if ($arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d") {
     $arD2P = array();
 }
 if ($arUserResult["PREPAYMENT_MODE"] && IntVal($arUserResult["PAY_SYSTEM_ID"]) > 0) {
     $arFilter["ID"] = $arUserResult["PAY_SYSTEM_ID"];
 }
 $bFirst = True;
 $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC", "PSA_NAME" => "ASC"), $arFilter);
 while ($arPaySystem = $dbPaySystem->Fetch()) {
     //if (count($arD2P[$delivery]) <= 0 || in_array($arPaySystem["ID"], $arD2P[$delivery]))
     //{
     if (strlen($arUserResult["DELIVERY_ID"]) <= 0 || $arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d" || CSaleDelivery2PaySystem::isPaySystemApplicable($arPaySystem["ID"], $arUserResult["DELIVERY_ID"])) {
         if (!CSalePaySystemsHelper::checkPSCompability($arPaySystem["PSA_ACTION_FILE"], $arOrder, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"])) {
             continue;
         }
         if ($arPaySystem["PSA_LOGOTIP"] > 0) {
             $arPaySystem["PSA_LOGOTIP"] = CFile::GetFileArray($arPaySystem["PSA_LOGOTIP"]);
         }
         $arPaySystem["PSA_NAME"] = htmlspecialcharsEx($arPaySystem["PSA_NAME"]);
         $arResult["PAY_SYSTEM"][$arPaySystem["ID"]] = $arPaySystem;
         $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["PRICE"] = CSalePaySystemsHelper::getPSPrice($arPaySystem, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"]);
         if (IntVal($arUserResult["PAY_SYSTEM_ID"]) == IntVal($arPaySystem["ID"]) || IntVal($arUserResult["PAY_SYSTEM_ID"]) <= 0 && $bFirst) {
             //$arPaySystem["CHECKED"] = "Y";
             $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["CHECKED"] = "Y";
             $arUserResult["PAY_SYSTEM_ID"] = $arPaySystem["ID"];
         }
         $bFirst = false;
示例#2
0
    );
	foreach ($gp_prop_list as $gp_prop) {
	    $prop_value = COption::GetOptionString($module_id, 'selector_id_'.$person_type_id.'_'.$gp_prop);
        if($prop_value != '' && strlen($prop_value) > 1){
            $arResult['PROPERTIES'][$gp_prop] = $prop_value;
        }
		/*if (!($arResult['PROPERTIES'][$gp_prop] = COption::GetOptionString($module_id, 'selector_id_'.$person_type_id.'_'.$gp_prop))) {
			throw new Exception(GetMessage("EXCEPTION_NOT_SET_OPTION", array("#OPTION#" => 'selector_id_'.$person_type_id.'_'.$gp_prop)));
		}*/
	}
	//$arResult['PROPERTIES']['comments'] = 'ORDER_DESCRIPTION';
	//$arResult['PROPERTIES']['system_choosen'] = 'ID_DELIVERY_goparcel_simple';
	
	$arResult['PAYSYSTEMS_BY_PAYMENT_TYPES'] = array();
	$delivery_names = CGPWidget::GetDeliveryNames();
	$paysystem_id_res = CSaleDelivery2PaySystem::GetList(array('DELIVERY_ID' => $delivery_names['SID'], 'DELIVERY_PROFILE_ID' => $delivery_names['PROFILE']));
	while ($paysystem_id_ar = $paysystem_id_res->GetNext()) {
		$paysystem_id_list[] = $paysystem_id_ar['PAYSYSTEM_ID'];
	}
	if (is_array($paysystem_id_list) && !empty($paysystem_id_list)) {
		$paysystem_res = CSalePaySystem::GetList(array(), array("ID" => $paysystem_id_list));
		while ($paysystem_ar = $paysystem_res->GetNext()) {
			$name = "paysystem_match_".$paysystem_ar['ID'];
			$val = COption::GetOptionString($module_id, $name);
			$arResult['PAYSYSTEMS_BY_PAYMENT_TYPES'][$val][] = $paysystem_ar['ID'];
		}
	} else {
		throw new Exception(GetMessage("EXCEPTION_NO_PAYSYSTEMS_FOR_GP_DELIVERY"));
	}
    
    /*position widget*/
示例#3
0
	/**
	* The function updates delivery and paysystem
	*
	* @param int $ID - code delivery
	* @param array $arFields - paysytem
	* @return int $ID - code delivery
	*/
	function UpdateDeliveryPay($ID, $arFields)
	{
		$ID = trim($ID);

		if (strlen($ID) <= 0 || !is_array($arFields) || empty($arFields))
			return false;

		if ($arFields[0] == "")
			unset($arFields[0]);

		return CSaleDelivery2PaySystem::UpdateDelivery($ID, array("PAYSYSTEM_ID" => $arFields));
	}
示例#4
0
		if($arUserResult["PREPAYMENT_MODE"] && IntVal($arUserResult["PAY_SYSTEM_ID"]) > 0)
			$arFilter["ID"] = $arUserResult["PAY_SYSTEM_ID"];

		$bFirst = True;
		$dbPaySystem = CSalePaySystem::GetList(
					array("SORT" => "ASC", "PSA_NAME" => "ASC"),
					$arFilter
			);

		while ($arPaySystem = $dbPaySystem->Fetch())
		{
			//if (count($arD2P[$delivery]) <= 0 || in_array($arPaySystem["ID"], $arD2P[$delivery]))
			//{
			if(strlen($arUserResult["DELIVERY_ID"]) <= 0
					|| $arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d"
					|| CSaleDelivery2PaySystem::isPaySystemApplicable($arPaySystem["ID"], $arUserResult["DELIVERY_ID"])
					)
			{

				if(!CSalePaySystemsHelper::checkPSCompability(
																$arPaySystem["PSA_ACTION_FILE"],
																$arOrder,
																$arResult["ORDER_PRICE"],
																$arResult["DELIVERY_PRICE"],
																$arUserResult["DELIVERY_LOCATION"]
															))
				{
					continue;
				}

				if ($arPaySystem["PSA_LOGOTIP"] > 0)
示例#5
0
 public function getPaysystems($deliveryId = null)
 {
     if (empty($deliveryId)) {
         $deliveryId = $this->deliveryId;
     }
     if (empty($deliveryId)) {
         throw new \Exception('Для получения способов оплаты нужно указать службу доставки');
     }
     $paySystems = array();
     $paySystemFilter = array('ACTIVE' => 'Y', 'PERSON_TYPE_ID' => 1, 'PSA_HAVE_PAYMENT' => 'Y');
     $res = \CSalePaySystem::GetList(array("SORT" => "ASC", "PSA_NAME" => "ASC"), $paySystemFilter);
     while ($paySystem = $res->Fetch()) {
         if (!\CSaleDelivery2PaySystem::isPaySystemApplicable($paySystem['ID'], $deliveryId)) {
             continue;
         }
         $check = \CSalePaySystemsHelper::checkPSCompability($paySystem['PSA_ACTION_FILE'], $this->getItemsRaw(), $this->getTotal(), $this->deliveryPrice, $this->location);
         if (!$check) {
             continue;
         }
         $paySystem['PRICE'] = \CSalePaySystemsHelper::getPSPrice($paySystem, $this->getTotal(), $this->deliveryPrice, $this->location);
         $paySystems[] = $paySystem;
     }
     return $paySystems;
 }
示例#6
0
$tabControl->EndTab();
$tabControl->BeginNextTab();
?>
			<tr>
				<td width="40%">
					<?php 
echo GetMessage('SPS_DELIVERY_HANDLERS');
?>
:
				</td>
				<td width="60%">
					<select multiple="multiple" size="5" name="DELIVERY_HANDLERS[]">
						<?php 
$arDeliveryId = array();
$arDeliverySid = array();
$dbRes = CSaleDelivery2PaySystem::GetList(array("PAYSYSTEM_ID" => $ID));
while ($arRes = $dbRes->Fetch()) {
    $deliveryId = $arRes["DELIVERY_ID"];
    if (isset($arRes["DELIVERY_PROFILE_ID"]) && strlen($arRes["DELIVERY_PROFILE_ID"]) > 0) {
        $deliveryId .= ":" . $arRes["DELIVERY_PROFILE_ID"];
    }
    $arDeliveryId[] = $deliveryId;
}
$rsDeliveryServicesList = CSaleDeliveryHandler::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array());
$arDeliveryServicesList = array();
while ($arDeliveryService = $rsDeliveryServicesList->Fetch()) {
    if (!is_array($arDeliveryService) || !is_array($arDeliveryService["PROFILES"])) {
        continue;
    }
    foreach ($arDeliveryService["PROFILES"] as $profile_id => $arDeliveryProfile) {
        $delivery_id = $arDeliveryService["SID"] . ":" . $profile_id;
function printProfileInfo($SID, $profileId, $arProfile, $baseCurrency)
{
    $weight_unit = COption::GetOptionString('catalog', 'weight_unit', GetMessage('SALE_DH_WEIGHT_UNIT_DEFAULT'));
    $weight_koef = COption::GetOptionString('catalog', 'weight_koef', 1);
    ?>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SALE_DH_PROFILE_ACTIVE');
    ?>
</td>
			<td valign="top" width="60%"><input type="checkbox" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][ACTIVE]" value="Y" <?php 
    if ($arProfile['ACTIVE'] == 'Y') {
        ?>
checked="checked"<?php 
    }
    ?>
 /></td>
		</tr>
		<tr>
			<td align="right"><?php 
    echo GetMessage('SALE_DH_PROFILE_TITLE');
    ?>
</td>
			<td valign="top" width="60%"><input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][TITLE]" value="<?php 
    echo htmlspecialcharsbx($arProfile["TITLE"]);
    ?>
" size="25" /></td>
		</tr>
		<tr>
			<td align="right" valign="top"><?php 
    echo GetMessage('SALE_DH_PROFILE_DESCRIPTION');
    ?>
</td>
			<td valign="top" width="60%">
			<?php 
    echo wrapDescrLHE('HANDLER[PROFILES][' . htmlspecialcharsbx($profileId) . '][DESCRIPTION]', isset($arProfile["DESCRIPTION"]) ? $arProfile["DESCRIPTION"] : '', 'hndl_dscr_' . $profileId);
    ?>
				<script language="JavaScript">setLHEClass('bxlhe_frame_hndl_dscr_<?php 
    echo $profileId;
    ?>
'); </script>
			</td>
		</tr>
		<tr>
			<td align="right"><?php 
    echo GetMessage('SALE_DH_HANDLER_TAX_RATE');
    ?>
 %:</td>
			<td valign="top" width="60%"><input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][TAX_RATE]" value="<?php 
    echo floatval($arProfile["TAX_RATE"]);
    ?>
" size="3" /></td>
		</tr>
		<tr>
			<td align="right"><?php 
    echo GetMessage('SDEN_PAY_NAME');
    ?>
:</td>
			<td valign="top" width="60%">
				<select multiple="multiple" size="5" name="PAY_SYSTEM[<?php 
    echo $profileId;
    ?>
][]">
				<?php 
    $arPaySystemIdSID = array();
    $arPaySystemIdProfile = array();
    $dbRes = CSaleDelivery2PaySystem::GetList(array("DELIVERY_ID" => $SID));
    while ($arRes = $dbRes->Fetch()) {
        if ($arRes["DELIVERY_PROFILE_ID"] == $profileId || is_null($arRes["DELIVERY_PROFILE_ID"])) {
            $arPaySystemIdProfile[] = $arRes["PAYSYSTEM_ID"];
        } else {
            $arPaySystemIdSID[] = $arRes["PAYSYSTEM_ID"];
        }
    }
    $dbResultList = CSalePaySystem::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME", "ACTIVE", "SORT", "LID"));
    while ($arPayType = $dbResultList->Fetch()) {
        ?>
					<option value="<?php 
        echo intval($arPayType["ID"]);
        ?>
" <?php 
        echo in_array($arPayType["ID"], $arPaySystemIdProfile) || empty($arPaySystemIdProfile) ? " selected" : "";
        ?>
>
						<?php 
        echo htmlspecialcharsbx($arPayType["NAME"] . (!is_null($arPayType["LID"]) ? " (" . $arPayType["LID"] . ")" : ""));
        ?>
					</option>
				<?php 
    }
    ?>
				</select>
			</td>
		</tr>

		<tr class="heading">
			<td colspan="2"><?php 
    echo GetMessage('SDEN_ORDER_RESTRICT');
    ?>
</td>
		</tr>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SALE_DH_PROFILE_WEIGHT_RESTRICTIONS');
    ?>
 <?php 
    echo htmlspecialcharsbx($weight_unit);
    ?>
:</td>
			<td valign="top" width="60%">
				<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_WEIGHT][0]" value="<?php 
    echo number_format($arProfile['RESTRICTIONS_WEIGHT'][0] / $weight_koef, 2, '.', '');
    ?>
" size="8" />&nbsp;
				<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_WEIGHT][1]" value="<?php 
    echo number_format($arProfile['RESTRICTIONS_WEIGHT'][1] / $weight_koef, 2, '.', '');
    ?>
" size="8" />
			</td>
		</tr>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SALE_DH_PROFILE_SUM_RESTRICTIONS');
    ?>
</td>
			<td valign="top" width="60%">
				<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_SUM][1]" value="<?php 
    echo number_format(floatval($arProfile['RESTRICTIONS_SUM'][1]), 2, '.', '');
    ?>
" size="8" />&nbsp;
				<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_SUM][2]" value="<?php 
    echo number_format(floatval($arProfile['RESTRICTIONS_SUM'][2]), 2, '.', '');
    ?>
" size="8" />&nbsp;
				<input type="hidden" name='HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_SUM][0]' value="<?php 
    echo $baseCurrency;
    ?>
">
			</td>
		</tr>
		<tr class="heading">
			<td colspan="2"><?php 
    echo GetMessage('SDEN_PACKAGE_RESTRICT');
    ?>
</td>
		</tr>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SDEN_PACKAGE_MAX_DIM');
    ?>
:</td>
			<td valign="top" width="60%">
					<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_DIMENSIONS][0]" value="<?php 
    echo intval($arProfile['RESTRICTIONS_DIMENSIONS'][0]);
    ?>
" size="8" />&nbsp;
					<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_DIMENSIONS][1]" value="<?php 
    echo intval($arProfile['RESTRICTIONS_DIMENSIONS'][1]);
    ?>
" size="8" />&nbsp;
					<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_DIMENSIONS][2]" value="<?php 
    echo intval($arProfile['RESTRICTIONS_DIMENSIONS'][2]);
    ?>
" size="8" />
			</td>
		</tr>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SDEN_PACKAGE_MAX_SIZE');
    ?>
:</td>
			<td valign="top" width="60%">
					<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_MAX_SIZE]" value="<?php 
    echo intval($arProfile['RESTRICTIONS_MAX_SIZE']);
    ?>
" size="8" />
			</td>
		</tr>
		<tr>
			<td class="field-name"><?php 
    echo GetMessage('SDEN_PACKAGE_MAX_DSUM');
    ?>
:</td>
			<td valign="top" width="60%">
					<input type="text" name="HANDLER[PROFILES][<?php 
    echo htmlspecialcharsbx($profileId);
    ?>
][RESTRICTIONS_DIMENSIONS_SUM]" value="<?php 
    echo intval($arProfile['RESTRICTIONS_DIMENSIONS_SUM']);
    ?>
" size="8" />
			</td>
		</tr>
	<?php 
}
示例#8
0
	public function filterDeliveryAndPaySystems(&$arResult, &$arUserResult, $arParams) {
		if (CModule::IncludeModule(self::$MODULE_ID)) {
			if ($person_type_id = COption::GetOptionString(self::$MODULE_ID, 'person_type_id')) {
				if ($arUserResult['PERSON_TYPE_ID'] == $person_type_id) {
					// $filename1 = $_SERVER['DOCUMENT_ROOT'] . '/templogfilter.log';
					// $data1 = array('FLAG' => $_POST['gp_delivery_option_disabled_flag'], /*'arResult' => $arResult,*/'arUserResult' => $arUserResult, 'arParams' => $arParams);
					// file_put_contents($filename1, var_export($data1, true), FILE_APPEND | LOCK_EX);
					if (CModule::IncludeModule('sale')) {
						if (!empty($arResult['DELIVERY']['goparcel']) && !empty($_POST['gp_delivery_description'])) {
							$arResult['DELIVERY']['goparcel']['PROFILES']['simple']['DESCRIPTION'] = htmlspecialchars($_POST['gp_delivery_description']);
						}
						if ($arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d") {
							if ($arUserResult['DELIVERY_ID'] == 'goparcel:simple') {
								foreach ($arResult['PAY_SYSTEM'] as $cell => $val) {
									$is_applicable = CSaleDelivery2PaySystem::isPaySystemApplicable($val['ID'], $arUserResult['DELIVERY_ID']);
									if (!$is_applicable) {
										unset($arResult['PAY_SYSTEM'][$cell]);
									}
								}
							}
						} else {
							$delivery = array();
							$d2psRes = CSaleDelivery2PaySystem::GetList();
							while ($d2psAr = $d2psRes->Fetch())
							{
								if (!($d2psAr['DELIVERY_ID'] == 'goparcel' && $d2psAr['DELIVERY_PROFILE_ID'] == 'simple') ||
									$d2psAr['PAYSYSTEM_ID'] == $arUserResult['PAY_SYSTEM_ID']) {
									if ($d2psAr['DELIVERY_PROFILE_ID']) {
										$delivery[$d2psAr['DELIVERY_ID']]["PROFILES"][$d2psAr['DELIVERY_PROFILE_ID']] = $d2psAr['PAYSYSTEM_ID'];
									} else {
										$delivery[$d2psAr['DELIVERY_ID']] = $d2psAr['PAYSYSTEM_ID'];
									}
								}
							}
							foreach ($arResult['DELIVERY'] as $cell => $val) {
								if ($val['ID'] && (!isset($delivery[$val['ID']]) || empty($delivery[$val['ID']]))) {
									unset($arResult['DELIVERY'][$cell]);
								} elseif ($val['SID'] && array_key_exists("PROFILES", $val)) {
									if (is_array($delivery[$val['SID']]) && array_key_exists("PROFILES", $delivery[$val['SID']])) {
										foreach ($val["PROFILES"] as $subcell => $profile) {
											if (!isset($delivery[$val['SID']]["PROFILES"][$profile['SID']]) || empty($delivery[$val['SID']]["PROFILES"][$profile['SID']])) {
												unset($arResult['DELIVERY'][$cell]["PROFILES"][$subcell]);
											}
										}
										if (count($arResult['DELIVERY'][$cell]["PROFILES"]) == 0) {
											unset($arResult['DELIVERY'][$cell]);
										}
									} else {
										unset($arResult['DELIVERY'][$cell]);
									}
								}
							}
						}
					}
				} else {
					if ($arUserResult['DELIVERY_ID'] == 'goparcel:simple') {
						$arUserResult['DELIVERY_ID'] = '';
					}
					unset($arResult['DELIVERY']['goparcel']);
				}
			}
		}
	}