Shipping and Workflow_ng

Posts: 37
Joined: 09/30/2007

Hello Lyle, I am still trying to get my shipping set up correctly.
First, quick question, I been reading the posts: Where do I find what version of Ubercart I am using? I understand you changed some setting in the uc_quote.module in alpha 8.

My questions mostly are in Workflow-ng. I am familiar with getting basic operation running, as I have enabled a tax by zone and UPS Ground successfully. I still would like to offer free shipping over $200. To do this I tried to activate flat rate shipping of $0.00 with a condition greater than $200, at the same time UPS was activated with a conditional under $200.00.

Problems:
In the conditional menu, if I do a numeric comparison...the order_total does not show up as a variable. The textbox, "Text to compare," has no drop downs, so you have to guess at the varaible to compare to the numeric. I found the variable in the database. What syntax do I use? uc_orders.order_total?
The order_total variable is in uc_order.module, but I am running "before checkout" in the uc_quote.module, and it doesn't show in that module as a choice.

Since I don't seem to be able to put a conditional on getting a shipping quote, what happens is I get a UPS ground quote all the time. If I disable UPS ground, and enable flat rate, I get the error message that you "need to select a ship option..." in the "review screen," which stops order processing dead in its tracks. The shipping module doesn't see flat rate as a viable shipping choice even though I made it active in both Workflow_ng and in the Shipping Quote menu.

Any thoughts, are appreciated. Thanks, Lyle

Posts: 2273
Joined: 08/07/2007
AdministratoreLiTe!

I'm not actually certain anymore that the order_total comparison actually works, even in the latest code. The main problem is that order_total is calculated by uc_order_load(), which doesn't work during checkout. So the quote module has to decide for itself what should go into the order total. I think it should just be the total price of the products, because there aren't really any other line items yet.

Does this seem reasonable to everybody? I don't like giving a different order total to the condition function because of the status of the order, but maybe it's just what we have to do.

Posts: 37
Joined: 09/30/2007

It seems to me that you have two different variables here. One you might identify as a subtotal and is simply the sum of the products, and is only used during check out. The other, order_total, is really the sum of products, shipping, and tax and is used in the order.module.

I would like to fix the problem that with only flat rate shipping chosen the review process does not thing a shipping option is selected. It seems like two problems. One the conditional variable to do a numeric comparison, and the other workflow_ng not thinking flat rate is a viable ship option.

Does this mean I will have a difficult time offering free shipping over $200, or is there a work around?

Posts: 2273
Joined: 08/07/2007
AdministratoreLiTe!

I think I've got a workaround in the Bazaar version of the code. If you can get that on your site, that should work reasonably well.

Posts: 37
Joined: 09/30/2007

Hi Lyle, Hope you had a nice Christmas.
Recap: Goal: Want UPS shipping quote under $200.00, and Flat Rate Shipping Quote over $200.00
Two Problems appeared:
(1) The flat rate shipping amount did NOT show during checkout, no matter what the order amount.
Solved this problem by checking both flat rate by product and order in the "shipping quote settings" in the configuration menu, AND (Thank you to TUTUSForToddlers in a post on 11/17/07)checking "shipping" under "Tax Shipping Costs" under tax edit rule under "Tax settings" in the configuration menu.
Now I have both UPS and flat rate quotes shown for all checkouts no matter what amount, and I no longer get the "At least one shipping quote method must be enabled" error message. I now can proceed to "Submit" order, whereas before I was blocked.

(2) So the last problem (hopefully) is how to only get flat rate to run over $200.00 and UPS under $200. Which leads me directly to workflow_ng. A couple of things.
(a)In testing under conditions in workflow_ng, I notice that I do not have the "Check the order total" option, that should show up, according to the on-site documentation in "Ubercart Integration with workflow_ng." This could be used with the numeric comparison in the conditions in workflow_ng to potentially solve the problem.
(b)There is no drop down menu of what to compare an amount to in Numeric Comparison. So you have to guess variable names. I've tried leaving the one blank to see if there was a default. I checked the various database tables, and came up with either: "cost" or "order_total." as potential variables to compare. I tried both of these with numeric comparison neither worked. Do I need to put this in a certain syntax, like db table.cost or db table.order_total, or do I need quotes. What syntax is the code looking for?
(c) It seems to me that conditionals are not being checked at all. Where in uc_quotes.module (line # or function) does conditions get called and numberic comparison occur? I looked at uc_quotes.nodule, line 1028, has workflow_ng_invoke_event which looks like it gets the quotes, but I'm not sure if the $method['id'] is turned on/off by the conditions before this call, or you always get all enabled methods.

I looked in Bazaar, and see you have been working in workflow_ng. I did not see anything that I thought would immediately solve the problem.

Posts: 2273
Joined: 08/07/2007
AdministratoreLiTe!

In uc_order_workflow.inc from the Bazaar version, you should see a function called uc_order_condition_order_total(). This is what provides Workflow-ng with the logic for the condition code. As far as I know, there isn't a token for the order total, so the Numeric comparison condition won't work.

workflow_ng_invoke_event() handles all of the actions and conditions that are configured for a particular event. Try using some other conditions to assure yourself that it really is working. I know the check for delivery zone or country has worked in alpha 8.

Posts: 37
Joined: 09/30/2007

Hi Lyle,
I looked at the current uc_order/uc_order_workflow.inc that I have installed on my site. I notice that uc_order_condition_info() only has four conditions (order_status, postal_code, delivery_zone, and delivery_country). So I went back and did what you suggested, and created a configurtation in workflow_ng to see if delivery_zone would work as a condition in workflow_ng_invoke_event(). I essentional said only get UPS if the zone is x. It worked fine, no UPS quote, unless zone was x. So I know workflow_ng_invoke_event() is working fine.

I then went to Bazaar and looked at the current code in uc_order/uc_order_workflow.inc, as you suggested. I notice there are now eight conditions, added conditions were: order_total, has_products, count_products, condition_is_shippable. Also looked at the rest of the file, and saw the other order_total function work you've done.

Conclusion: You are actively working on this module since the module was last updated on Dec. 19th.
Ok, I dropped the order_total condition, and the functions into the file, uploaded, deleted cache, and ran update.php. Nice upgrade! The module seems to work first time through correctly. If I then go back to view cart, to say update cart (to change products & quantities to change the amount), I get an error message at the top of the cart page:
"Unable to find condition of name uc_order_condition_order_total with the label Check the order total. Perhaps the according modules has been deactivated."
Yet, the conditionals seem to work fine first time, but not the second time through. I don't get the correct results the second time after the error message.

Is a database variable not being saved, updated or defined?
Thanks, Lyle, you do some nice work.

Posts: 2273
Joined: 08/07/2007
AdministratoreLiTe!

It sounds like the list of included files got cached somehow but it wasn't updated. I would try refreshing the page and trying again. If that doesn't help, maybe empty out the cache tables in the database.