You are here:  » import_slow.php

Support Forum



import_slow.php

Submitted by karolisgo on Thu, 2011-12-22 08:17 in

Hi,

I have multiple currencies site with pricetapestry.com, that means, I created currency_converter.php that re-counts all prices in database in multiple currency and updates all curreny fields.

I would like to automate this script, inserting it into import_slow.php. It would be great to solve this in the way, that after each csv file import, currency_converter.php would be initiated for the products of this .csv.

I need your help to find the place to insert my currency converting php code into slow import php file.
And what best variable could be for CSV identification. I think I should use "Update price usd,eur,gbp WHERE csv=$csv_that_is_being_imported"

Thanks,
K.

Submitted by support on Thu, 2011-12-22 09:48

Hello Karolis,

The point within scripts/import_slow.php where you know that everything has completed is where the backfill reviews process is invoked at line 351 with:

      admin_importReviews();

At this point, you could call your script using:

      require("currency_converter.php");

(assuming that currency_converter.php is in the /scripts/ folder)

Within scripts/import_slow.php the filename being imported if called per file will be in the $filename variable but you would need to check whether this is @ALL or @MODIFIED; in which case it would be best to apply the conversion to all products rather than per feed...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by karolisgo on Thu, 2011-12-22 12:42

Hi again,

I tried in this way:

else
{
admin_importReviews();
require("price_converter.php");
}

But seems it is not working. price_converter.php is hosted in /scripts/ folder too..

maybe fix should be done in admin/admin_import_slow.php ?

Submitted by support on Thu, 2011-12-22 12:48

Hello Karolis,

Perhaps the best place to include the script would be within includes/admin.php within the function that is called to import per file. In that file, look for the following code at the end of the admin_import() function, around line 525:

    return "";

...and REPLACE with;

    require("../scripts/price_converter.php");
    return "";

...and again, the filename of the feed will be in scope as $filename in your script...

Cheers,
David.
--
PriceTapestry.com

Submitted by karolisgo on Thu, 2011-12-22 13:00

Tried it in admin.php

require ("../scripts/price_converter.php");
return "";
}

During slow import function, price_converter.php is still not initiated...

K.

Submitted by support on Thu, 2011-12-22 13:44

Hello Karolis,

Sorry about that it's actually a standalone equivalent function within admin/feeds_import_slow.php. In that file; look for the following code at line 165:

database_queryModify($sql,$insertId);

...and REPLACE with:

database_queryModify($sql,$insertId);
require ("../scripts/price_converter.php");

However, in this instance the filename of the feed just been imported will be in $admin_importFeed["filename"]

If still no joy, i'd really need to see what your price_converter.php file is doing so if you could email it to me that would help if you're still not able to make it work using the above...

Cheers,
David.
--
PriceTapestry.com

Submitted by karolisgo on Thu, 2011-12-22 13:50

Now works great!

Thank you for greatest support!