); 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*/
/** * The function select delivery and paysystem * * @param array $arFilter - array to filter * @return object $dbRes - object result */ function GetDelivery2PaySystem($arFilter = array()) { return CSaleDelivery2PaySystem::GetList( $arFilter, array("DELIVERY_ID", "PAYSYSTEM_ID"), array("DELIVERY_ID", "PAYSYSTEM_ID") ); }
/** * The function select delivery and paysystem * * @param array $arFilter - array to filter * @return object $dbRes - object result * @deprecated */ public static function GetDelivery2PaySystem($arFilter = array()) { if (isset($arFilter["DELIVERY_ID"])) { $arFilter["DELIVERY_ID"] = \Bitrix\Sale\Delivery\Services\Table::getIdByCode($arFilter["DELIVERY_ID"]); } return CSaleDelivery2PaySystem::GetList($arFilter, array("DELIVERY_ID", "PAYSYSTEM_ID"), array("DELIVERY_ID", "PAYSYSTEM_ID")); }
$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" /> <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" /> <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" /> <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" /> <input type="text" name="HANDLER[PROFILES][<?php echo htmlspecialcharsbx($profileId); ?> ][RESTRICTIONS_DIMENSIONS][1]" value="<?php echo intval($arProfile['RESTRICTIONS_DIMENSIONS'][1]); ?> " size="8" /> <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 }
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']); } } } }