Hello all,
I've rolled a patch against the latest CVS source, as of about 5 minutes ago.
It includes the following features:
- The uc_file_users patch as seen at http://www.ubercart.org/comment/42472/Re_There_seems_be_bug_file_download
- A change in the order of execution within uc_cart/uc_cart.module -> uc_cart_complete_sale()
- Fix to an apparent bug that was messing up serialization on the addresses field of uc_file_users.
Following are pastes of code I've changed.
uc_cart.module (line 1267):
$output_message = token_replace_multiple($output, array('global' => NULL, 'order' => $order));
// Move an order's status from "In Checkout" to "Pending"
$status = db_result(db_query("SELECT order_status FROM {uc_orders} WHERE order_id = %d", $order->order_id));
if (uc_order_status_data($status, 'state') == 'in_checkout') {
uc_order_update_status($order->order_id, uc_order_state_default('post_checkout'));
}
ca_pull_trigger('uc_checkout_complete', $order, $user->uid == 0 ? $account : $user);
$themed_output = theme('uc_cart_complete_sale', $output_message);
// Empty that cart...
uc_cart_empty(uc_cart_get_id());
// Clear our the session variables used to force the cart workflow.
unset($_SESSION['cart_order'], $_SESSION['do_complete'], $_SESSION['new_user']);
return $themed_output;
uc_file.pages.inc (line 337):
//$file_user->addresses = serialize($addresses);
$file_user->addresses = $addresses;
Let me know what you think.
Noah
Comments
Comment #1
torgospizzaHave you tested this with anonymous checkout? At DrupalCamp LA this weekend there was an issue where file downloads were not being granted for anon customers, but I'm not sure if that is an issue which has been fixed in the recent Dev build. I can provide testing and a fix if need be.
Comment #2
noahlively commentedYes, this works with anon. checkout. In fact, I built this primarily for a site that uses only anon purchasing.
I've corrected my patch, which apparently didn't include some of the changes I thought it did. Attached is the most current version of the patch.
A few other tweaks to be found in this patch:
Having a little trouble with code indent in Eclipse. I noticed that CMD+SHIFT+F messed up the indentation in some of the code, which is reflected in this patch. If somebody could point out to me how to get around this, I will re-roll the patch. Otherwise, please bear with me.
I've made a number of additional adjustments in a separate home-spun module, and I hope to post code shortly...
Comment #3
torgospizzaKickass! I'll forward this onto the UC guys to make sure they see it :)
Comment #4
Island Usurper commentedEclipse should have some kind of setting where indents use 2 spaces, and tabs are emulated with spaces (might call it "soft tabs").
I don't know Eclipse well enough to tell you where to find this.Ah, http://www.horstmann.com/bigj/help/eclipse/ has a picture of the screen. Preferences: Java, Code formatter, Style tab.I also see a stray dpm() in there.
Comment #5
noahlively commentedStray DPM call has been removed. I've re-rolled the patch against the latest version from CVS, as of 20 min ago. See attached.
Island Usurper, I am curious as to what dev environment you are using. I'm looking for an Eclipse alternative.
Comment #6
maxwellx commentedHow do you implement this patch? It looks like that the uc_cart.module file has change and the starting line is not on line 1267?
Line numbers would be nice for patch 3, not sure where to insert patche on the other files?
This is exactly what I need to do, allow a download for an order after the order is completed to an anonymous user
Thanks MX
Comment #7
maxwellx commentedTried installing the patch a few times. Keeps throwing an error message?
Parse error: syntax error, unexpected $end in /hermes/web09/xxxxx/as.occlass/wom/modules/ubercart/uc_file/uc_file.module on line 1851
Strange thing is its not referencing any of the changed lines but the end line that is empty?
Any ideas?
MX
Comment #8
j0rd commentedI've explained some issues related to Ubercart, Anonymous Checkout & UC File purchases here:
http://drupal.org/node/1227076
Comment #9
longwaveThis was fixed for both roles and downloads way back in #1192018: Duplicate order notification e-mail, and duplicate stock decrement