Agence-DnD / DnD-MagentoConnectorBundle

Connecteur Magento pour le PIM Akeneo
18 stars 13 forks source link

Delta export products for DnD-MagentoConnector #18

Open manh-nguyen opened 9 years ago

manh-nguyen commented 9 years ago

Hi team,

I think it's task is not easy but it's an actual need and we know how it's important.

I don't think we could learn much from Akeneo Magento connector Delta export, but it may be an example for you for thinking.

Anyway, your bundle is working awesome and I love it. Please support this feature if you can do.

Thank you very much, guys !

Cheers, Manh

DnD-Mimosa commented 9 years ago

Hi Manh,

In the product export, you can find an input where you have to enter a date (Last product modification date). If you leave this input blank, you have to enter the ID of your export in the input Export Product ID.

Then, it will export all products which were updated since the date you entered or if this input is empty, all the product since the last export execution (you have to enter the Export Product ID).

We are thinking about a way to find the export ID dynamically, it will be implemented in a futur release (see the roadmap).

In this way, you already have a delta products export.

I hope it help you.

Regards, Florian.

manh-nguyen commented 9 years ago

Hey guys, Thank for the response. It looks like we can do the delta export in some workaround ways. I tried to find one but it's still not completely good

{quote}

cron.sh

#!/bin/sh
MODIFIED_DATE=`date --date yesterday +%Y-%m-%d\ %H:%M:%S`
PHP_BIN=`which php`
CONSOLE_COMMAND=`app/console akeneo:batch:job --env=prod -c '{"exportFrom":"$MODIFIED_DATE"}' dnd_export_csv_products`
if ! ps auxwww | grep "$CONSOLE_COMMAND" ; then
    $PHP_BIN "$CONSOLE_COMMAND" &
fi

{quote}

/bin/sh cron.sh

But it's not working for the first time and some cases of error while exporting

Regards, Manh

DnD-Mimosa commented 9 years ago

Manh,

Can you execute your job with ssh but with the development environment :

app/console akeneo:batch:job --env=dev -c '{"exportFrom":"YOUR_TEST_DATE"}' dnd_export_csv_products

Then past in a new comment the error that you have if you can.

Regards, Florian.

manh-nguyen commented 9 years ago

It's worked for manually running the export Florian.

I meant in reality, we can not run the integration manually, we need to use cron job to run the integration periodically like i did above.

Cheers, Manh

DnD-Mimosa commented 9 years ago

Manh,

We'll try your code on our servers and we'll give our back shortly.

Regards, Florian.

BitOne commented 9 years ago

Hello @manh-nguyen,

The command provided by @DnD-Mimosa works perfectly for me:

   php app/console akeneo:batch:job -c '{"exportFrom":"2012-10-10"}' dnd_product_export

The problem comes from your shell script that doesn't handle well the configuration.

Here is a modified and working version:

#!/bin/sh
MODIFIED_DATE=`date --date yesterday +"%Y-%m-%d %H:%M:%S"`
JOB_NAME=dnd_product_export
JOB_CONFIG="{\"exportFrom\":\"$MODIFIED_DATE\"}"
CONSOLE_COMMAND="php app/console akeneo:batch:job --env=prod"

if ! pgrep -f $JOB_NAME ; then
    $CONSOLE_COMMAND -c "$JOB_CONFIG" $JOB_NAME
else
    echo "Export already running"                                                                                        
fi
manh-nguyen commented 9 years ago

Hi @BitOne , @DnD-Mimosa

Sorry for the confused description given above !

Actually, my cron.sh is working as well. but we could get trouble if some case bellow happening:

Another case for problem is when the job is ran the first time with our filter exportFrom yesterday, all products which are older than yesterday will not be exported.

I just had an idea when writing this that is we will save a text file with content is a string of exported successful date. IF it's NULL, MODIFIED_DATE is 1970-01-01 01:00:00, otherwise MODIFIED_DATE is the last exported successful date.

Do you see any problems with this approach?

Regards, Manh

ewallteam commented 8 years ago

Hi All,

I am unable to export the products from the akeneo, my export csv shows blank, please help me to export the products from the Akeneo.

Thanks. Ewall