When "Trigger: Getting shipping quote via Flat Rate" it's run?

Comments

dman’s picture

I've just been into the code. It appears never :-)
Getting the quote is hard-coded in, it does't run through the trigger system.

You can ADD the action to your own trigger though.

But I'm looking at a patch that will make the trigger work as it's expected to.

akongz’s picture

Oh.. thanks...

I taught this trigger run when edit the order and put some shipping flatrate... but It's not run the trigger when I execute that...

The fact properly must be like that? Isn't it?

dman’s picture

Yes, it should be, but it isn't.
The code took a short-cut.
I've found the right way to do it, but need to see if my patch will fit

guypaddock’s picture

Any word on this, dman?

dman’s picture

Looking at my records, I think it's this

Index: shipping/uc_quote/uc_quote.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ubercart/shipping/uc_quote/Attic/uc_quote.pages.inc,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 uc_quote.pages.inc
--- shipping/uc_quote/uc_quote.pages.inc	21 Sep 2009 14:34:47 -0000	1.1.2.8
+++ shipping/uc_quote/uc_quote.pages.inc	12 Dec 2009 01:41:23 -0000
@@ -140,7 +140,25 @@ function _uc_quote_assemble_quotes($orde
     $predicates = ca_load_trigger_predicates('get_quote_from_'. $method['id']);
     $predicate = array_shift($predicates);
     if ($predicate && ca_evaluate_conditions($predicate, $arguments)) {
-      $data = uc_quote_action_get_quote($order, $method, $user);
+
+      # dman 2009-12 : Modify the quote process to use callbacks properly
+      // Do things the user asked to do at this point
+      // Unless you've messed with thing, this will include a call to 
+      // uc_quote_action_get_quote() (the default action)
+      $action_results = ca_perform_actions($predicate, $arguments);
+      // The $action_results will now include the quote itself, but hidden in an array
+      foreach ($action_results as $action_result) {
+        // Need to dig a little
+        if (is_array($action_result)) {
+          foreach ($action_result as $quote) {
+             if (isset($quote['rate'])) {
+               // Yeah, it's the right kind of result
+               $data = $action_result;
+             }
+          }
+        }
+      }
+      # end dman 2009-12 patch
 
       foreach ($data as &$quote) {
         if (isset($quote['rate'])) {

Swaps out the hard-coded "uc_quote_action_get_quote()" for a call to the trigger that fires "uc_quote_action_get_quote()" instead

I didn't have it as a clean patch because I've also got 4 other small (UI) tweaks I had to make in the project.

Sorry, it was a while ago and not to clear in my head any more.

longwave’s picture

Status: Active » Closed (won't fix)

Shipping quote (and tax) triggers only use the conditions; it seems useless to call actions here.