I just noticed while manually importing feeds that products_import table isn't created (use phpmyadmin), so while import is speedy on small feeds, the few large ones can cause shops section to go offline for a short while. No mods on the import.php script. What should I check or do?
Hi David,
Made the changes, but no joy. I'm running this from the terminal, always use import.php @ALL. Still no products_import temp table created.
Hi,
The `pt_products_import` table will only exist whilst import.php @ALL (from the command line) is running - it will disappear at the end of the process by way of lines 88-90 of scripts/import.php after `pt_products` table dropped and `pt_products_import` renamed to `products`:
$sql = "RENAME TABLE `".$config_databaseTablePrefix."products_import` TO `".$config_databaseTablePrefix."products`";
database_queryModify($sql,$result);
If that code isn't present in the scripts/import.php that you are running, I know that you have been running the script for several years in which case, since it is fully forward compatible ( I know you are running latest version primarily ) if you make sure that scripts/import.php is as per the 15/09A distribution then full import (import.php @ALL from the command line) should be using the temporary `pt_products_import` table) - let me know if you're still not sure of course...
Cheers,
David.
--
PriceTapestry.com
Hi,
As it stands, `products_import` table is only created by scripts/cron.php and scripts/import.php @ALL. This isn't something I would want to include in the distribution because of possible timeout issues, but I just tried an experiment modifying the manual import process (from /admin/ home page) for an individual feed into a temporary table and it works really well, resulting in the merchant only being offline for a fraction of the total import time taken (because INSERT INTO ... SELECT * FROM ... is very fast).
To give this a go, edit admin/feeds_import.php and look for the following code beginning at line 23:
if ($filename)
{
admin_import($filename,$limit);
}
...and REPLACE with:
if ($filename && !$limit)
{
$admin_importAll = TRUE;
$sql = "DROP TABLE IF EXISTS `".$config_databaseTablePrefix."products_import`";
database_queryModify($sql,$result);
$sql = "SELECT MAX(id) AS maxId FROM `".$config_databaseTablePrefix."products`";
database_querySelect($sql,$rows);
$nextId = $rows[0]["maxId"]+1;
$sql = "CREATE TABLE `".$config_databaseTablePrefix."products_import` LIKE `".$config_databaseTablePrefix."products`";
database_queryModify($sql,$result);
$sql = "ALTER TABLE `".$config_databaseTablePrefix."products_import` AUTO_INCREMENT = ".$nextId;
database_queryModify($sql,$result);
$sql = "ALTER TABLE `".$config_databaseTablePrefix."products_import` DISABLE KEYS";
database_queryModify($sql,$result);
admin_import($filename,$limit);
$sql = "ALTER TABLE `".$config_databaseTablePrefix."products_import` ENABLE KEYS";
database_queryModify($sql,$result);
$sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE filename='".database_safe($filename)."'";
database_queryModify($sql,$result);
$sql = "INSERT INTO `".$config_databaseTablePrefix."products` SELECT * FROM `".$config_databaseTablePrefix."products_import`";
database_queryModify($sql,$result);
$sql = "DROP TABLE `".$config_databaseTablePrefix."products_import`";
database_queryModify($sql,$result);
}
elseif ($filename)
{
admin_import($filename,$limit);
}
Hope this helps!
Cheers,
David.
--
PriceTapestry.com