auto-import csv file every 10 minutes

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
13 years 1 month ago #12551

The message says "already triggered recently". That's why it's not triggered. In your php you use some code to sip the processing if the file was already triggered in a period that you can define in the config of the plugin. In your xml, you define that option as 1 per day. So the import of your file will only run once a day as you wrote it.

If you remove the beginning of the code in your cron function:
$pluginsClass = hikashop::get('class.plugins');
$plugin = $pluginsClass->getByName('hikashop','rates');
if(empty($plugin->params)){
$plugin->params = 86400;
}
if(!empty($plugin->params) && $plugin->params+$plugin->params>time()){
return true;
}
$plugin->params=time();
$pluginsClass->save($plugin);

then, it will import the CSV each time the cron url is triggered.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
13 years 1 month ago #12557

It works!!! :-)

You guys deserve a medal :woohoo:

This is by far the best (and fastest) support I ever received.

Great work on Hikashop!

Nikajoloem

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
13 years 1 month ago #12659

Another question...

Manually, the cron works fine.
I setup the cron to work every 15min in Hikashop backend, but the automated cron is not importing the csv...

Any ideas?

Nikajoloem

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
13 years 1 month ago #12674

Did you configured your cron in the configuration of HikaShop ?

Do you have some extension/plugin which redirects the page on the front end ?
That would explain why it doesn't work as the cron system we have on our end does not follow redirects like a browser in order to reduce the load on our end.
So if you removed the redirection that would solve the problem.

Another solution would be to use the cron manager of your hosting and set the cron URL in there so that you are independent from us.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
12 years 11 months ago #15742

Here is an auto import plugin where you can just specify the path of the CSV.

There is also an option to specify columns conversion :

old_column1_name:new_column1_name;old_column2_name:new_column2_name

File Attachment:

File Name: HikashopDa...ed_1.zip
File Size:2 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 33
  • Thank you received: 2
12 years 11 months ago #15851

How do I use this plug in? Do I install it in the shop?

Almost none of my supplier's columns match up with Hika shop.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
12 years 11 months ago #15853

You indeed need to install it via the joomla installer.

In the options of the plugin, you have one option to tell the system which column correspond to which one in hikashop as explained in my previous post.

Please Log in or Create an account to join the conversation.

  • Posts: 33
  • Thank you received: 2
12 years 11 months ago #15856

Here is the problem I run into with this method. Seems my supplier uses an XML feel to update inventories every 2 hours.

Here is the format it uses:

<Answer><APITimestamp>2011-05-07T08:02:35.000</APITimestamp>
<Products>
<Product toBeDiscontinued="N" discontinueDate="" estDeliveryDate="">
<ProductCode>00-238X1</ProductCode>
<InventoryLevel>65</InventoryLevel></Product>
<Product toBeDiscontinued="N" discontinueDate="" estDeliveryDate="">
<ProductCode>00-238X11</ProductCode><InventoryLevel>0</InventoryLevel>
</Product>

I do have an email in to them to see if they have a csv update.

So, regarding the plugin in, this is what I should be entering in the "Column Names" box:

productcode:product_code;inventorylevel:product_quantity


Lastly, can I use this plug-in if I have to do a manual update? I might just to an update weekly if I can't do it in real time.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
12 years 11 months ago #15858

Having the feed in XML is indeed a problem. The plugin only supports CSV, like the import function of hikashop. If your supplier can provide a CSV file, that would greatly simplify your task, otherwise, you would have to convert the XML to a CSV.


What you entered in the option of the plugin is fine but you would first need to have a CSV...

You can always run the cron manually when you need to run the import by calling the cron URL that you will find in the tab cron of the configuration via your browser.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
12 years 11 months ago #17229

Hi,

I have a follow-up question on csv-import.
Is it possible to define the product order in the csv?

Kind regards,
Nikajoloem

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
12 years 11 months ago #17232

No. It's not possible.
What you can do though is to put the products in your CSV in the order you want them and then, insteadof sorting them by the ordering field on your modules/menus, you could order them by product_id.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
12 years 11 months ago #17242

Is it normal that product ordering is changed when updating products?
Product ordering = set to ordering (manual), but after uploading the csv (with new prices for example), the order field is ste to 0 for all products...

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
12 years 11 months ago #17248

Well, that's indeed how it is.

All the links to the categories are deleted for the imported product and the new ones in the CSV recreated.

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 4
10 years 11 months ago #106792

So i have set this up on a site.

And i have had alot of problems.
It seems that the Column names part doesn't work...

If i set the right collumnames i the csv, i can get it to work, but only for the collums i have set the right names in the file for.

Also if the file doesn't end on .csv it doesn't work either.
And i can noway define multi files by wildcard or other way, so i can only do this for one file... what now, if i have more than one file uploaded to me ?

The most important thing to get a fix for, is the Column names part as i need this asap so the site can go live.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 years 11 months ago #106991

Hi,

You didn't say how you configured your column names part, so I can't tell you what you did wrong.
Having the CSV would also help.

There is indeed code in the plugin which checks that you import only CSV files. So if the extension of the file is not CSV, it will reject it. If you don't want that, you can remove the code below in the file of the plugin:

				$messages[] = 'Could not find the file '.JPATH_ROOT.DS.$path;
				return true;

There is indeed no way to specify multiple files in the plugin. You won't have to generate several plugins based on that one by changing the name of the plugin for each instance in the code and then enter each file in the options of the plugins.

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 4
10 years 11 months ago #107019

file pricefiles/Pricelist_104213.csv
Column names ItemID:product_code;Item:product_name;ItemWebDescription:product_description;StockActual:product_quantity;Price:price_value;CreateDateTime:product_created;
charset UTF-8

a few lines from the file
"product_code";"Qty";"ItemOEM";"ItemEAN";"Item";"ItemTxt";"ItemWebDescription";"Unit";"StockActual";"ExpectedDate";"price_value";"PriceTaxAndFees";"Currency";"VatTax";"ItemType";"Brand";"Weight";"Volume";"Height";"Width";"Depth";"AddFeesTax";"CustItemId";"CreateDateTime";"StatCode";"OrigCountry";"MinQ";"Multiples";"Colli";"BrandTxt";"ItemTypeTxt";"NonStockItemTxt";"BIDID"
"BROBP60PA";1;"BP60PA";"4977766628501";"Ink-jet paper (250 ark)";"";" 250 ark Ink-jet papir - A4. Gramvægt:80 g/m2.Passer til følgende printere:Alle Brother blækprintere/-fax.";1;0;"2013/05/30";21.19;21.19;"DKK";5.2975;"PAP140";"BRO";0.269;0;0;0;0;0;"";"30052013043325";"48025620";"JP";1;1;20;"Brother";"Office paper";0;""
"BROBP71D1BOM";1;"BP71D1BOM";"";"Brother paperstand incl. paper.";"";" Nu har du mulighed for at gøre en ekstra god forretning på den originale BP71-papirserie til Brothers inkjet-printere.Bestil en startpakke nu! Startpakken indeholder følgende:10 pk. BP71GA3 A3 glossy fotopapir – 20 ark10 pk. BP71GA4 A4 glossy fotopapir – 20 ark20 pk. BP71GP50 10 × 15 cm glossy fotopapir – 50 ark(Alle papirtyper er 260g/m2)";1;0;"";1999;1999;"DKK";499.75;"PAP100";"BRO";0.05;0;0;0;0;0;"";"30052013043325";"84439990";"JP";1;1;20;"Brother";"Photo paper, special";1;""


anything else you need to be able to help me ?

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 years 11 months ago #107022

The column itemID does not exist in your CSV, so ItemID:product_code is wrong in your column names. You should remove it.
Same for the column Price, so you should remove Price:price_value too.

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 4
10 years 11 months ago #107025

sorry those lines was from the test file, i made... here are the real once
"itemId";"Qty";"ItemOEM";"ItemEAN";"Item";"ItemTxt";"ItemWebDescription";"Unit";"StockActual";"ExpectedDate";"Price";"PriceTaxAndFees";"Currency";"VatTax";"ItemType";"Brand";"Weight";"Volume";"Height";"Width";"Depth";"AddFeesTax";"CustItemId";"CreateDateTime";"StatCode";"OrigCountry";"MinQ";"Multiples";"Colli";"BrandTxt";"ItemTypeTxt";"NonStockItemTxt";"BIDID"
"BROBP60PA";1;"BP60PA";"4977766628501";"Ink-jet paper (250 ark)";"";" 250 ark Ink-jet papir - A4. Gramvægt:80 g/m2.Passer til følgende printere:Alle Brother blækprintere/-fax.";1;0;"2013/05/31";21.19;21.19;"DKK";5.2975;"PAP140";"BRO";0.269;0;0;0;0;0;"";"31052013043335";"48025620";"JP";1;1;20;"Brother";"Office paper";0;""
"BROBP71D1BOM";1;"BP71D1BOM";"";"Brother paperstand incl. paper.";"";" Nu har du mulighed for at gøre en ekstra god forretning på den originale BP71-papirserie til Brothers inkjet-printere.Bestil en startpakke nu! Startpakken indeholder følgende:10 pk. BP71GA3 A3 glossy fotopapir – 20 ark10 pk. BP71GA4 A4 glossy fotopapir – 20 ark20 pk. BP71GP50 10 × 15 cm glossy fotopapir – 50 ark(Alle papirtyper er 260g/m2)";1;0;"";1999;1999;"DKK";499.75;"PAP100";"BRO";0.05;0;0;0;0;0;"";"31052013043335";"84439990";"JP";1;1;20;"Brother";"Photo paper, special";1;""

Please Log in or Create an account to join the conversation.

  • Posts: 171
  • Thank you received: 4
10 years 11 months ago #107027

when i run the cron i get
Notice

The line '"BROBP60PA";1;"BP60PA";"4977766628501";"Ink-jet paper (250 ark)";"";" 250 ark Ink-jet papir - A4. Gramvægt:80 g/m2.Passer til følgende printere:Alle Brother blækprintere/-fax.";1;0;"2013/05/31";21.19;21.19;"DKK";5.2975;"PAP140";"BRO";0.269;0;0;0;0;0;"";"31052013043335";"48025620";"JP";1;1;20;"Brother";"Office paper";0;""' could not be imported Product not found

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 years 11 months ago #107031

The column itemID does not exist in your CSV.
It's the column itemId which is there.

The product_code column is the most important one. If the system cannot find it, it can cause a lot of issues.

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds
Powered by Kunena Forum