Active
Project:
UberPOS
Version:
6.x-1.0-alpha1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2011 at 09:51 UTC
Updated:
19 Nov 2011 at 20:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
krlucas commentedThis patch adds a very simple sub-module to UberPOS that provides integration with UC Discounts Alt. The module adds a button DISC and a command DC. When preceded by a discount code, the commant attempts to apply the discount code to the order. If no code is provided, it tries to apply any possible codeless discounts to the order. UC Discounts ALT does all the heavy lifting.
Comment #2
krlucas commentedThis is an updated patch. Re-applies and re-calculates order-wide discounts as products are added/removed.
Comment #3
krlucas commentedComment #4
last call media commentedCommitted!
Comment #5
rhmtts commentedThanks a lot for this!
However, "[re-applying]and [re-calculating] order-wide discounts as products are added/removed" does not work 100% yet. If you have site wide discounts (for certain user roles, say), this does not happen as the implementation of hook_order checks for presence of discount codes before it tries to apply discounts. For site wide discounts, there is no discount code, so nothing happens.
To fix this, the function up_discounts_order should simply be:
Unfortunately, if you do this and no discounts were applied, which is usually the case, a warning message appears. This warning message needs to be suppressed (I think), so the function up_discounts_process needs to be rewritten to:
The drawback to this suppression is that if a user explicitly calls the DC command and nothing happens, no warning appears. There's probably a (convoluted) way around that, however, but since I don't need it, I haven't implemented it.
Could the changes above please be added to the code for the up_discounts module?
Thanks!
Comment #6
rhmtts commentedIt's also probably a good idea to apply discounts in the uberpos code itself, using the new uc_discounts_apply() function (see http://drupal.org/node/1166912)
Comment #7
krlucas commentedThat all makes sense to me. Thanks for getting jrust to add that api function! I should get this reviewed and committed this weekend.
Comment #8
rhmtts commentedNow that there is a uc_discounts_apply() function in UC Discounts Alt (albeit only in the dev version) the code needs to be patched according to the attached, ehm, patch.
Comment #9
rhmtts commentedWoops. There was a typo in the patch. Sorry. Here's the fixed one.
Comment #10
deggertsen commentedHas this last patch been committed?