Answer the question
In order to leave comments, you need to log in
1c and Bitrix exchange?
Hello.
There is a need to unload orders in 1s. 1s sawing by 4 people and the standard exchange module is no longer there.
There is a script that should save orders to folder 1c on the server.
He is a worker. Works on the old site.
The trouble is that we are setting up a new site, and the script does not work on the new one, maybe someone can tell me what I'm doing wrong.
<?
define("CATALOG_EXPORT_FILE", $_SERVER["DOCUMENT_ROOT"]."/1c/price.dat");
define("ORDERS_EXPORT_DIR", $_SERVER["DOCUMENT_ROOT"]."/1c/orders/");
function GetCatalogToExport(){
if(CModule::IncludeModule("iblock")&&
CModule::IncludeModule("catalog")){
$arFilter = array(
"IBLOCK_ID" => CATALOG_IBLOCK_ID,
"ACTIVE" => "Y"
);
$dbElement = CIBlockElement::GetList(array("ID"=>"ASC"), $arFilter);
while($arElement = $dbElement->GetNext()){
//$arList[$arList["
array("CATALOG_GROUP_ID"=>"ASC"),
array("PRODUCT_ID" => $arElement["ID"])
);
while($arPrice = $dbPrice->GetNext()){
$arElement["PRICE"][] = $arPrice;
}
$arReturn[] = $arElement;
}
return $arReturn;
}
}
function StrCatalogExport(){
$str = "";
$arCatalog = GetCatalogToExport();
foreach($arCatalog as $arElement){
$name = str_replace("\t", "", $arElement["NAME"]);
foreach($arElement["PRICE"] as $arPrice){
$str .= "\t".$arPrice["CATALOG_GROUP_NAME"]."/".$arPrice["PRICE"];
}
$str .= "\n";
}
return $str;
}
function SaveCatalogToFile(){
$strCatalog = StrCatalogExport();
file_put_contents(CATALOG_EXPORT_FILE, $strCatalog);
}
//orders
function SaveOrderToFile($ID){
if(CModule::IncludeModule("sale")){
$arOrder = CSaleOrder::GetByID($ID);
$dbProp = CSaleOrderPropsValue::GetList(
array("SORT" => "ASC"),
array("
$arReturn["ORDER"] = $arOrder;
while($arProp = $dbProp->GetNext()){
$arReturn["PROP"][$arProp["CODE"]] = $arProp;
}
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(
array("DATE_INSERT" => "DESC"),
array("LID" => SITE_ID, "ORDER_ID" => $ID),
false,
false,
array("ID",
"MODULE ",
"PRODUCT_ID",
"QUANTITY",
"PRICE",
"WEIGHT")
);
while($arItem = $dbBasketItems->Fetch()){
$arReturn["BASKET"][] = $arItem;
}
$str = $arOrder["ID"]."\t".$arOrder["PRICE"]."\t".$arOrder["DATE_INSERT"]."\n";
$str .= $arReturn["PROP"]["LAST_NAME"]["VALUE"]."\t".$arReturn["PROP"]["NAME"]["VALUE"]."\t". $arReturn["PROP"]["SECOND_NAME"]["VALUE"]."\n";
$str .= $arReturn["PROP"]["PHONE"]["VALUE"]."\n";
$str .= $arReturn["PROP"]["CITY"]["VALUE"].", p. ".$arReturn["PROP"]["AREA"]["VALUE"].", st. ".$arReturn["PROP"][" DELIVERY_STREET"]["VALUE"].", d. ".$arReturn["PROP"]["DELIVERY_DOM"]["VALUE"].", sq./of. ".$arReturn["PROP"]["DELIVERY_KV"]["VALUE"].", floor ".$arReturn["PROP"]["DELIVERY_ET"]["VALUE"].", under. ".$arReturn["PROP"]["DELIVERY_PD"]["VALUE"].", person ".$arReturn["PROP"]["DELIVERY_PERS"]["VALUE"]."\n";
$str .= $arReturn["PROP"]["COMMENT"]["VALUE"]."\n";
$str .= "@@@";
foreach($arReturn["BASKET"] as $arProduct){
$str .= "\n".$arProduct["PRODUCT_ID"]."\t".$arProduct["QUANTITY"]."\t".$ arProduct["PRICE"];
}
file_put_contents(ORDERS_EXPORT_DIR.$arOrder["ID"].".ord", $str);
//return $arReturn;
}
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question