function yml_init() { infra_require('*cart/catalog.inc.php'); $data = cat_init(); xls_runGroups($data, function (&$group, $i, &$parent) { $group['data'] = array_filter($group['data'], function (&$pos) { //Убираем позиции у которых не указана цена if ($pos['Синхронизация'] != 'Да') { return false; } if (!$pos['Цена']) { return false; } return true; }); $group['data'] = array_values($group['data']); }); xls_runGroups($data, function (&$group, $i, &$parent) { if ($group['childs']) { $group['childs'] = array_filter($group['childs'], function (&$g) { if (!$g['data'] && !$g['childs']) { return false; } return true; }); $group['childs'] = array_values($group['childs']); } }, array(), true); xls_runPoss($data, function (&$pos) { $conf = infra_config(); xls_preparePosFiles($pos, $conf['cart']['dir'], array('Производитель', 'article')); foreach ($pos['images'] as $k => $v) { $src = $pos['images'][$k]; $p = explode('/', $src); foreach ($p as $i => $n) { $p[$i] = urlencode($n); $p[$i] = preg_replace('/\\+/', '%20', $p[$i]); } $pos['images'][$k] = implode('/', $p); } }); return yml_parse($data); }
public static function &runPoss(&$data, $callback, $back = false) { return xls_runPoss($data, $callback, $back); }