Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta export products for DnD-MagentoConnector #18

Open
manh-nguyen opened this issue Apr 24, 2015 · 8 comments
Open

Delta export products for DnD-MagentoConnector #18

manh-nguyen opened this issue Apr 24, 2015 · 8 comments

Comments

@manh-nguyen
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

Manh,

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

Regards,
Florian.

@BitOne
Copy link
Contributor

BitOne commented May 6, 2015

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
Copy link
Author

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:

  • We setup the cronjob running 1 time each day
  • Today the job is running and found 10 valid products for exporting. While exporting, we may get a fatal error that will stop the job. i.e. File permission is changed to be not allowed writing....
  • Tomorrow the job will be ran and found 0 products valid with our filter exportFrom yesterday. But actually, we still have 10 valid products in DB which have not been exported yet.
    So problem is this case.

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants