p_s = './static/csv_s/as_is/'
path_start = os.path.dirname(p_s)
p_f = './static/csv_s/to_be/'
path_finish = os.path.dirname(p_f)
cur_dir = os.path.dirname(os.path.abspath(__file__))
path_start = '{}/static/csv_s/as_is/'.format(cur_dir)
path_finish = '{}/static/csv_s/to_be/'.format(cur_dir)
<?
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate","changeElementFieldsOnUpdateImport1C");
function changeIblockSectionsOnImportUpdate(&$arFields)
{
if ($_REQUEST['mode']=='import')
{
// тут смотрите $arFields товара и заменяете нужные значения
}
}
AddEventHandler("iblock", "OnBeforeIBlockElementAdd","changeElementFieldsOnAddImport1C");
function changeElementFieldsOnAddImport1C(&$arFields)
{
if ($_REQUEST['mode']=='import')
{
// тут смотрите $arFields товара и заменяете нужные значения
}
}
?>
import ast
str_number = '58'
print(ast.literal_eval(str_number))
# output: 58 - <type 'int'>
str_dict = '{"name": "vasya", "age": 30}'
print(type(ast.literal_eval(str_dict)))
# output: {"name": "vasya", "age": 30} - <type 'dict'>
$flowers = array(
array("розы", 100 , 15),
array("тюльпаны", 60 , 25),
array("орхидеи", 180 , 7)
);
$newArr = [];
foreach($flowers as $arFlower){
[$flower, $price, $quantity] = $arFlower;
$flowerItem['Название'] = $flower;
$flowerItem['Цена'] = $price;
$flowerItem['Количество'] = $quantity;
$newArr[] = $flowerItem;
}
array (
'CONDITION' => '#^\/([a-z0-9-])+$#',
'RULE' => 'CITY_NAME=$1',
'ID' => '',
'PATH' => '/goroda/index.php',
'SORT' => 100,
);