示例#1
0
 function SetPPZone($zoneID, $arFields)
 {
     global $DB;
     if (!empty($arFields) && intval($zoneID) > 0) {
         //printr(CAddon::GetOrderBills($iOrderID));
         $obZone = CPickpoint::SelectZoneByID($zoneID);
         //
         if (!$obZone->SelectedRowsCount()) {
             $arFields["ZONE_ID"] = $zoneID;
             $sQuery = "INSERT INTO `b_pp_zone` (" . implode(",", array_keys($arFields)) . ")\n\t\t\t\t\tVALUES('" . implode("','", $arFields) . "')";
         } else {
             $arSet = array();
             unset($arFields["PP_ID"]);
             foreach ($arFields as $sKey => $sValue) {
                 $arSet[] = $sKey . " = '{$sValue}'";
             }
             $sQuery = "UPDATE `b_pp_zone` SET " . implode(",", $arSet) . " WHERE ZONE_ID = {$zoneID}";
         }
         $DB->Query($sQuery);
     }
 }
示例#2
0
 function Calculate($arOrder)
 {
     $MODULE_ID = "epages.pickpoint";
     $ppzoneID = intval($_SESSION["PICKPOINT"]["PP_ZONE"]) + 2;
     $obZone = CPickpoint::SelectZoneByID($ppzoneID);
     $price = 0;
     if ($arZone = $obZone->Fetch()) {
         $price = $arZone["PRICE"];
     }
     if (COption::GetOptionString($MODULE_ID, "pp_use_coeff", "")) {
         if (doubleval($_SESSION["PICKPOINT"]["PP_COEFF"]) > 1) {
             if (!($coeff = COption::GetOptionString($MODULE_ID, "pp_custom_coeff", ""))) {
                 $coeff = doubleval($_SESSION["PICKPOINT"]["PP_COEFF"]);
             }
             $price *= $coeff;
         }
     }
     return $price;
 }