Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We currently can import prices from the UI, but we can't export them.
Comment | File | Size | Author |
---|---|---|---|
#10 | commerce_pricelist-add-labels-to-export-3092961-10.patch | 16.16 KB | ben.hamelin |
#4 | commerce_pricelist-3092961-4.patch | 15.92 KB | jsacksick |
| |||
#4 | interdiff_3-4.txt | 3.19 KB | jsacksick |
#2 | price-list-items-export-ui.png | 110.16 KB | jsacksick |
Comments
Comment #2
jsacksick CreditAttribution: jsacksick at Centarro commentedAttached patch for review... In a follow-up issue, we should add support for custom fields that were potentially added to price list items.
The CSV file generated is saved in the "temporary://" directory, and a link to it is displayed once the export process is complete.
This is how the UI looks like (Similar to the "Import prices" page:
Comment #3
jsacksick CreditAttribution: jsacksick at Centarro commentedAdded tests coverage, and cleaned PriceListExportForm a bit.
Comment #4
jsacksick CreditAttribution: jsacksick at Centarro commentedRemoved the validateForm() which was added in the previous patch, instead an empty CSV with just the headers will be created in case no prices exist.
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commentedCommitted!
Comment #8
johnpicozzi@Jsacksick - Thanks for this improvement! It works well. Could we add the variation title to the export?
Comment #9
jsacksick CreditAttribution: jsacksick at Centarro commented@johnpicozzi: We could, what I did in a project that has custom field was that I overrode the route to use my form class:
I'm doing that from a RouteSubscriber.
then you technically just have to override buildRow() and buildHeader(), as needed.
Comment #10
ben.hamelin CreditAttribution: ben.hamelin at Oomph, Inc. commentedThis patch was rolled against 8.x-2.x-beta3, mimicking the patch from #4 but with the entity label added.
Added this issue as well for the same approach but rolled against 8.x-2.x-dev: https://www.drupal.org/project/commerce_pricelist/issues/3101855