Ejemplo n.º 1
0
        }
    }
    foreach ($cats as $item) {
        $item['title'] = mysql_real_escape_string($item['title']);
        importTerm($item);
    }
}
/* Обработка товаров */
while (true) {
    $content = loadFilePart($f, '</offer>');
    $psp = mb_strpos($content, '<offer ', 0, 'utf-8');
    $pep = mb_strpos($content, '</offer>', 0, 'utf-8');
    if ($psp !== false && $pep !== false) {
        $product = mb_substr($content, $psp + mb_strlen('<offer', 'utf-8'), $pep - $psp - mb_strlen('<offer ', 'utf-8'), 'utf-8');
        $matches = array();
        if (!GdeSlonImport::filterImport($product)) {
            continue;
        }
        preg_match('/ id="(.+?)"/', $product, $matches);
        $id = @$matches[1];
        preg_match('|\\<url\\>(.+)\\</url\\>|', $product, $matches);
        $url = @$matches[1];
        preg_match('|\\<price\\>(.+)\\</price\\>|', $product, $matches);
        $price = @$matches[1];
        preg_match('|\\<currencyId\\>(.+)\\</currencyId\\>|', $product, $matches);
        $currency = @$matches[1];
        preg_match('|\\<picture\\>(.+)\\</picture\\>|', $product, $matches);
        $image = @$matches[1];
        preg_match('|\\<name\\>(.+)\\</name\\>|', $product, $matches);
        $title = @$matches[1];
        $title = str_replace('<![CDATA[', '', $title);