Hi,
There are discounts event in drupal for current logged in user, but as in POS we keep same user account while assigning order to other customer. POS beta-7 supports discount limits and creating new customer account on fly. So, we need to load calculated price for the order owner rather than the current logged in user.
Patch OR, Rules........ anything is appreciable
Thanks a lot in advance
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | order_owner_discount-2793601-33.patch | 8.9 KB | shabana.navas |
| #26 | order_owner_discount-2793601-26.patch | 10.41 KB | sorabh.v6 |
| #6 | applying_order_owner_discount.gif | 2.11 MB | shabana.navas |
| #6 | order_owner_discount-2793601-6.patch | 8.8 KB | shabana.navas |
Comments
Comment #2
smccabe commentedComment #3
sharif.tanveer commentedHi,
It's nice to see that commerce pos is getting matured day by day. While improving for new features, how about looking back for something little old.
I am still hunting for the solution.... How to address membership discount on pos system for each individuals.
Current discount system can make it for the logged in user, but not for the current pos customer.
Any help is appreciated..
Comment #4
shabana.navas commentedSo, as I understand it, the current process is not sufficient because we need to apply different pricing/discount rules depending on who the order owner is, well before the payment stage, as products are added and the prices are calculated right? Because, basically, what is happening right now is, when we set the email of the customer for the POS transaction, it only sets the order->email part. Then, once the order is paid for and the transaction is complete, it then, assigns the user as the order owner.
Correct me if I'm wrong, but, instead of waiting till the payment part, if we set the order owner right away, as the customer email gets updated, shouldn't this fix the problem?
Comment #5
sharif.tanveer commentedI guess yes. We just need to apply some sort of rules... check the order owner/order assigned to - before calculating sell price for the POS.
Once the order owner gets updated, prize should gets updated as well.
but using Rules can cause another problem as well. Suppose, we have-
Product A that offer 20% flat discount to every customer.
And Product B has no discount.
If Customer1 is assigned for 10% loyalty discount, we need to make sure he gets 20% discount on Product B, and 10% on Product B. It will not be either 10% flat on both Product A &B or, 20% on Product A, 10% on Product B,, and then again 10% on Product A.
[We can solve this problem by assigning highest discount per product or using the discount compatibility function with other discount type]
**I found it has several other use cases too.
>>If some shop doesn't want to have discount option on salesman's hand or manual overriding.
>> Discount per customer
Comment #6
shabana.navas commentedI've got to admit, I had no idea when I initially committed to working on this what it really meant. But as I started working on it, things got a lot clearer.
So as it is right now, with the Discount module, we could only apply order and product discounts depending on the LOGGED in user. However, there wasn't a condition to apply discounts based on the owner of the order. So the first thing on the agenda was to introduce a new condition ('Order Owner') that would allow us to apply order/product discounts depending on who the owner of the order was, which is essentially what we want in POS. Because, POS transactions are almost always made on behalf of another user and NOT the logged in user.
The second thing we needed to do once we added the new discount condition was, we needed to change the default behaviour of POS where if a customer email address was added/changed, it wouldn't apply to the order until after the payment submit stage. So, we needed to apply the new customer to the order, immediately.
Then, the tricky part was, every time the order owner changed we needed to make sure all the line items prices were recalculated and the entire order refreshed, and reflected in the UI.
So, now, we have a working version of the POS loading the calculated prices for the order owner instead of the logged in user.
Comment #7
sorabh.v6Comment #8
sorabh.v6Comment #9
sorabh.v6Comment #10
sorabh.v6@shabana.navas I applied patch in #6 and cleared cache. Then I added two products using pos interface then I was applying discounts for individual product and whole order but nothing was happening. You can see in below gif image.
I am getting below notice and warning in recent log -
Please tell me if I am doing anything wrong to test this patch.
Thanks
Comment #11
sorabh.v6Comment #12
shabana.navas commentedOops! Thanks for catching that Saurabh. Forgot to take out an un-needed line. Can you test it now?
Comment #13
sorabh.v6Comment #14
sorabh.v6I applied patch and cleared cache. Then created discount as mentioned in gif #6. When I select a product and enter customer's email. It creates the discount for that customer. But after that, if I apply product wise discount then product price changes automatically. Gif image is attached for more understanding of bug.
Comment #15
sorabh.v6Comment #16
shabana.navas commentedSaurabh I believe this is the way the discounts work. What you are doing there is trying to double up on a discount. So you are trying to apply two discounts to a single product. I don't think this is a bug with the patch but the way discounts work. It basically cancels out the first one.
@smccabe Maybe you can chime in.
Comment #17
sharif.tanveer commentedI can't apply the patches. In Putty I got this lines:
[positivebd@web505 includes]$ patch -p0 < commerce_pos.transaction.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/includes/commerce_pos.transaction.inc b/includes/commerce_pos.transaction.inc
|index 3f5b940..5d58cac 100644
|--- a/includes/commerce_pos.transaction.inc
|+++ b/includes/commerce_pos.transaction.inc
--------------------------
File to patch: /commerce_pos.transaction.inc
/commerce_pos.transaction.inc: No such file or directory
Skip this patch? [y] includes/commerce_pos.transaction.inc
Skipping patch.
3 out of 3 hunks ignored
patching file b/modules/discount/commerce_pos_discount.inline_conditions.inc
patching file b/modules/discount/commerce_pos_discount.rules.inc
***Do I need any other modules like- commerce_extra_discount ?
What I'm missing
Comment #18
shabana.navas commentedI believe I might need to re-roll this patch against the latest versions.
Comment #19
sharif.tanveer commentedThanks for the quick response :)
Can't tell you how eagerly I'm waiting for this patch :)
Comment #20
sorabh.v6Comment #21
sorabh.v6Comment #22
shabana.navas commentedSaurabh if you've got time, could you re-roll this patch against the latest 7.x version of POS? It should be pretty straightforward.
Comment #23
sorabh.v6@shabana.navas Sure, will do it.
Comment #24
sorabh.v6Rerolled patch. Please review.
Comment #25
sharif.tanveer commented[positivebd@web505 includes]$ ls
commerce_pos.admin.inc commerce_pos.payment.inc
commerce_pos.common.inc commerce_pos.transaction.inc
commerce_pos.login.inc commerce_pos.transaction.patch
commerce_pos.pages.inc views
[positivebd@web505 includes]$ patch -p0 < commerce_pos.transaction.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/includes/commerce_pos.transaction.inc b/includes/commerce_pos.transaction.inc
|index 72e22ac..09b5fcb 100644
|--- a/includes/commerce_pos.transaction.inc
|+++ b/includes/commerce_pos.transaction.inc
--------------------------
File to patch: commerce_pos.transaction.inc
patching file commerce_pos.transaction.inc
patching file b/modules/discount/commerce_pos_discount.inline_conditions.inc
patching file b/modules/discount/commerce_pos_discount.rules.inc
[positivebd@web505 includes]$
Did I missed something
Comment #26
sorabh.v6@sharif.tanveer Ah! sorry, out of habit we were creating patch against 7.x-2.x branch. But this patch was meant to be for 7.x-2.0-beta7 branch. Rerolled the patch, please confirm if this works for you now.
Comment #27
shabana.navas commentedComment #28
sharif.tanveer commentedWhere is the commerce_pos_transaction_form file located you mentioned at line 5
Comment #29
sorabh.v6@sharif.tanveer commerce_pos_transaction_form is the function name and its located in commerce_pos.transaction.inc file and that file is in the includes folder.
Patch in #24 is for the 7.x-2.x branch.
Comment #30
sharif.tanveer commentedIt worked for me :) Using on live site :)
However, can we expect this patch to get rolled in 7.2 ?
Also... is it possible to get another rules.... for the "Order owner Role" ? This could be great for the big list of loyal customers
Comment #31
smccabe commentedHey Sharif, you want to set it to RTBC, not fixed. RTBC means you have tested it and it works, fixed means it has actually been committed into the code.
I'll try to commit this tomorrow.
Comment #32
sharif.tanveer commentedoh...sorry...
Got it :)
Comment #33
shabana.navas commentedPatch re-rolled against latest 7.x-2.x. Applies to both 7.x-2.x-dev and 7.2 version. Please test this out.
Comment #35
smccabe commented