Integrating with Conditional Actions will follow Ubercart best practices and will allow orders to be exported at checkout if desired.

Cheers,

Antoine

Comments

jantoine’s picture

StatusFileSize
new25.09 KB

A new patch is attached with the following changes:
- Added an "Order has been exported" trigger to pull when an order has been exported.
- Added an "Export an order" action that will export a single order.
- Added an "Export the order" predicate that will execute the "Export an order" action with an order status condition.
- Added an "Update an order after export" predicate with the actions "order update status", "order add comment" and "order add comment (admin)".
- Added new "Order export method" setting allowing the user to specify either "On checkout completion", "On a specified interval" or "Manually".
- Added settings submit handler to alert the user as to when the settings form modifies Conditional Actions based on the selected order export method.
- Updated the manual order export page to display a message more closely related to the order export method.
- Updated the create export function to handle calling delivery methods such as by mail to avoid duplicate code in order export function.
- Added a new export order function for exporting a single order.
- Updated the export orders function replacing the order update functionality with a pull of the new "Order has been exported" trigger.

Cheers,

Antoine

jantoine’s picture

Status: Active » Needs review
illepic’s picture

A quick note:

- All actions and triggers register correctly. It was a breeze to hit the Conditional Actions section of Ubercart and see uc_edi's actions and triggers.
- On the Trigger: Customer completes checkout, the predicate Export the order doesn't seem to fire regardless of the condition on Check the order status. In other words, I could never get an immediate export dump at the time of order completion, regardless of "order status" that I set in that condition. So I just removed that condition and all successful orders are now exporting correctly.

jantoine’s picture

Illepic,

A couple of questions. First, did you update the settings to export at checkout rather than by interval or manually? Second, did predicates that ran prior to the Export the order predicate set the order status correctly so that the condition was TRUE?

I debated whether or not to keep the condition in. My final reasoning to keep it in was that I don't want the module to screw up a user's current Conditional Actions workflow, so the module defaults to export at a specified interval which disables the predicate. This gives the user a chance to configure his Conditional Actions before enabling the predicate. When the user changes the settings to export on checkout, this puts the export under Conditional Actions control by enabling the predicate. The user is also informed to check his Conditional Action settings. I do think I will change this to a warning instead of just a regular message.

I do think better documentation would greatly help, so I'll work on adding that in as well. New patch to come shortly.

Cheers,

Antoine

jantoine’s picture

StatusFileSize
new37.25 KB

A new patch is attached with the following changes:
- Added configuration documentation to the README.txt file.
- Removed the "order status" condition from the "Export the order" predicate.
- Added a dependency on the Conditional Actions module in the uc_edi.info file.
- Implemented hook_help with the same information as the "CONFIGURATION" section of the README.txt file.
- Implemented hook_form_FORM_ID_alter to disable the "Status" field on the "Export the order" predicate form since this is controlled by the "Export method" field on the Ubercart EDI settings page. The description under the field has been modified to reflect these changes.
- Added a warning message to the Ubercart EDI settings page if the "Export method" is changed and it modifies the "Export the order" predicate.
- Changed the settings submit handler Conditional Actions alert to a warning.

Cheers,

Antoine

illepic’s picture

StatusFileSize
new926 bytes
new938.85 KB
new85.67 KB

I did a full uninstall of the module. Then I rolled back uc_edi-949690.patch and then applied this one (uc_edi-949690_1.patch).

Upon enabling from sites/build/modules I get the success screen with a link to configure the module (Image 1). It however doesn't prepend my site's domain and instead just links to the string "admin/store/settings/edi". This may be due to my screw up in my dev site settings (base domain and all that jazz).

I hit the settings page and input my export patterns. (Image 2). There was some confusion in the issue queue here about having to wrap your replacement patterns with commas, like this:
,!order_id,
That took me awhile earlier to figure out. Also a link here to a complete list of replacement patterns would be reeeeally nice (a la http://www.xtuple.org/ubercart-integration).

It looks like the conditions have been removed by default for the "Export the order predicate". Woot! I run an order and get my xml output just fine. Sample XML included in attachment 3.

Looks pretty solid to me! This has been a dream to use to get valid XML out of my system. I will be attempting a patch (I'm terrible at patches) today to get line items like tax into a replacement pattern.

illepic’s picture

StatusFileSize
new918 bytes

Here is a patch against 949690_1 (I'm terrible with patches, let me know if I screwed it up!) that simply adds a !uc_tax replacement pattern. If I was smart, I'd loop through the $order['line_items'] like you did with the $order array itself so we'd get ALL the line items as replacement patterns. But, this gets the job done-ish.

jantoine’s picture

Status: Needs review » Fixed
StatusFileSize
new37.7 KB

illepic,

Regarding comment #6:
- Good catch on the install link, that has been fixed.
- I am not familiar with issues regarding the export pattern, but those will be obsolete when patterns are replaced with template files: #957384: Use token hooks for replacement tokens and use template files instead of pattern variables..
- These changes are in the attached patch and have been committed to head!

Regarding comment #7:
- Generally speaking, for items that are unrelated to an existing issue, a new issue should be created. With that said, tax_line_items will be available for export via template files: #957384: Use token hooks for replacement tokens and use template files instead of pattern variables..

Cheers,

Antoine

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.