X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   Importing Products Automatically (https://forum.x-cart.com/showthread.php?t=74240)

garys 07-24-2016 04:36 PM

Importing Products Automatically
 
I would like to import product information automatically (v5.2.15) but I must be missing a step here.

Creating the correct .csv file is no problem. I uploaded that file using FTP to the /var/import folder. When I run the Import function from within the administration section after uploading, it doesn't even prompt me to browse for a file name, presumably because a valid file is already sitting there waiting to be processed. It just goes ahead and processes the uploaded file. This tells me that the file is in the correct location and the format is also correct.

I have read the "Configuring your server to run scheduled X-Cart tasks" page (http://kb.x-cart.com/pages/viewpage.action?pageId=7504112) and this seems to be what I want to do.

When I ran the "php console.php --target=cron" command in my SSH console, it looked like it successfully processed 2 steps. One of them was "Event listener (DB)" and the other one had to do with creating the XML sitemap.

When I looked at my catalog, the product that I was trying to import was not there.

I then tried the Import function again and it processed the file successfully.

Now, I also ran across some information about the TASKS table in the database. Do I have to add a record to that table to tell it that I want to import the data automatically? If not, what could I be doing wrong here?

Any help would be appreciated.

Thank you.

totaltec 07-25-2016 08:43 AM

Re: Importing Products Automatically
 
Gary,
You are not doing anything wrong. X-Cart just doesn't automatically import products when cron is run. So to do this you need to write a custom module that registers the task and triggers the import.

garys 07-25-2016 06:19 PM

Re: Importing Products Automatically
 
Thanks, Mike.

The documentation on the cron page led me to believe that importing products was part of the tasks to be run.

I will look into creating a custom module. If I run into any difficulty, I know where to find you. :wink:

qualiteam 07-27-2016 04:45 AM

Re: Importing Products Automatically
 
What documentation article do you refer to? I believe the import/export function uses the cron task, but it is for splitting the process into multiple steps (in order to avoid the memory limit or the PHP time limit issues), not for starting the process automatically.

garys 07-27-2016 08:15 AM

Re: Importing Products Automatically
 
In the "Configuring your server to run scheduled X-Cart tasks" page (http://kb.x-cart.com/pages/viewpage....pageId=7504112), it says:

Some X-Cart's features require periodic execution of the script console.php located in the X-Cart root. Running this script is used to trigger the execution of miscellaneous service and maintenance tasks, including, but not limited to:
  • the periodic execution of event tasks (i.e. tasks that are launched on event; examples of such tasks are exporting and importing of data from/into X-Cart);
This led me to believe that importing data was already part of the cron task. When I ran php console.php --target=cron, it did not automatically import my products.csv file. When I did the import function manually, it processed the file. I did not have to upload the file using the Browse button.

According to Mike, importing products is not done automatically as part of the cron task.

I believe that I have solved my problem by writing a script that imports the products. Everything seems correct.

qualiteam 07-27-2016 08:45 PM

Re: Importing Products Automatically
 
Thanks. I see where the confusion comes from.
But, yes, importing is not done automatically. The cron task is only used to trigger the steps that the whole import/export process is split into.

gior_08 01-22-2019 12:05 AM

Re: Importing Products Automatically
 
Hello,

May I ask you a question I have about execute a scheduled task.

Lets say I want to execute an automatically renewal of the Facebook Ads and Instagram Ads addon Product Feed or an automatically re-generation of the XML sitemap.

The scripts that I am going to call are these:

https://www.MY_DOMAIN.com/admin.php?target=sitemap&action=Generate&xcart_for m_id=<MY_ID>

https://www.MY_DOMAIN.com/admin.php?target=facebook_marketing&action=Generat e&xcart_form_id=<MY_ID>

Am I correct?

Another question the xcart_form_id value is it fix or is it changing at each scripts call?


All times are GMT -8. The time now is 09:58 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.