Beispiel #1
0
                     }
                     $product_record['cat_id'] = $primary_category;
                 }
                 if (is_array($images)) {
                     $primary = 1;
                     foreach ($images as $file_id) {
                         $image_record = array('product_id' => $product_id, 'file_id' => $file_id, 'main_img' => $primary);
                         $GLOBALS['db']->insert('CubeCart_image_index', $image_record);
                         $primary = 0;
                     }
                 }
                 // Insert SEO custom URL
                 if (empty($product_record['seo_path'])) {
                     $product_record['seo_path'] = $GLOBALS['seo']->generatePath($product_id, 'prod');
                 }
                 $GLOBALS['db']->insert('CubeCart_seo_urls', array('path' => SEO::sanitizeSEOPath($product_record['seo_path']), 'item_id' => $product_id, 'type' => 'prod'));
             }
             unset($product_record, $category_record, $image_record, $image, $images);
         }
         fclose($fp);
     }
     unlink($this_import);
 }
 $next_cycle = $cycle + 1;
 if (file_exists(sprintf($import_source, $next_cycle))) {
     $data = array('next_cycle' => $next_cycle, 'total' => $has_header ? $GLOBALS['session']->get('columns', 'import') - 1 : $GLOBALS['session']->get('columns', 'import'), 'imported' => $cycle * $splitSize);
     $GLOBALS['smarty']->assign('DATA', $data);
     $page_content = $GLOBALS['smarty']->fetch('templates/products.importing.php');
 } else {
     $GLOBALS['main']->setACPNotify($lang['catalogue']['notify_import_complete']);
     $GLOBALS['session']->delete('', 'import');
Beispiel #2
0
        }
        $db->update('CubeCart_order_summary', $record, array('cart_order_id' => $order_name['cart_order_id']));
        unset($record, $name_parts);
    }
}
## Get SEO paths from seo_custom_url into new SEO DB
if ($products = $db->select('CubeCart_inventory', array('product_id', 'seo_custom_url'))) {
    foreach ($products as $item) {
        if (empty($item['seo_custom_url'])) {
            continue;
        }
        $db->insert('CubeCart_seo_urls', array('path' => SEO::sanitizeSEOPath($item['seo_custom_url']), 'item_id' => $item['product_id'], 'type' => 'prod'));
    }
}
if ($categories = $db->select('CubeCart_category', array('cat_id', 'seo_custom_url'))) {
    foreach ($categories as $item) {
        if (empty($item['seo_custom_url'])) {
            continue;
        }
        $db->insert('CubeCart_seo_urls', array('path' => SEO::sanitizeSEOPath($item['seo_custom_url']), 'item_id' => $item['cat_id'], 'type' => 'cat'));
    }
}
## Sort out taxes
if ($tax_rates = $db->select('CubeCart_tax_rates', array('country_id', 'id'))) {
    foreach ($tax_rates as $tax_rate) {
        $country = $db->select('CubeCart_geo_country', array('numcode'), array('id' => $tax_rate['country_id']));
        if ($country[0]['numcode'] > 0) {
            $db->update('CubeCart_tax_rates', array('country_id' => $country[0]['numcode']), array('id' => $tax_rate['id']));
        }
    }
}
Beispiel #3
0
/**
 * Sanitize SEO allowed path (Depreciated since 6.0.7)
 * Use static function SEO::sanitizeSEOPath instead
 *
 * @return string
 */
function sanitizeSEOPath($url)
{
    if (method_exists('SEO', 'sanitizeSEOPath')) {
        return SEO::sanitizeSEOPath($seo_path['path']);
    }
    $url = preg_replace("/\\.\\w{2,4}\$/", '', $url);
    ## Remove extention
    $url = trim($url);
    $url = str_replace(' ', '-', html_entity_decode($url, ENT_QUOTES));
    $url = preg_replace('#[^\\w\\-_/]#iuU', '-', str_replace('/', '/', $url));
    return preg_replace(array('#/{2,}#iu', '#-{2,}#'), array('/', '-'), $url);
}
Beispiel #4
0
<?php

## fix any broken SEO paths
if ($seo_paths = $db->select('CubeCart_seo_urls', array('id', 'path'))) {
    foreach ($seo_paths as $seo_path) {
        $db->update('CubeCart_seo_urls', array('path' => SEO::sanitizeSEOPath($seo_path['path'])), array('id' => $seo_path['id']));
    }
}