| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Discount on individual order | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Discount on individual order
I would like to make discounts "manually" on individual order in my module, just as one can do in the admin page for order editing. I am aware that
a correct way would be to set up "surcharges/modifiers". However, a quick look at the xcart table structure reveals that the table xc_order_items have columns itemNetPrice and discountedSubtotal. So, I thought it would suffice to modify these columns (and of course, the total in xc_order). However, if I change manually the content of the table Code:
Code:
When one edits the orders in admin page, one simply modifies the column "price", but I would like to leave that column unchanged.
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Discount on individual order
It is not only the order items table, discounts/surcharges are also registered in the order surcharges table.
I'd suggest you follow the XC way of working with discounts/surcharges instead of direct changes to number sin database as this may just not always work properly
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
Re: Discount on individual order
Quote:
basically I would need, besides the usual classes (Viewer, Controller, whatever is needed to get forms), a Model class to decorate /Model/Order/Surchare.php, and a class extending Logic/Order/Modifier/Discount.php, or am I still missing something? Quote:
OK, so let's forget about the netPrice column, although I wonder why it is there if it is the result of calculation. At least for one of the modules I am writing, I don't mind changing the values of "price" column in OrderItem table, which is actually done in XC's stock class. As far as I understand, there is the class /View/ItemsList/Model/OrderItem.php, which starts with Code:
Code:
For example, if I try to feed the "value" of "order" by doing something like /View/Page/Admin/Demo.php Code:
it leads to an internal error, instead of showing a widget to edit the order with order_id=1. Any idea on what I am doing wrong here?
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#4
|
|||||||
|
|||||||
Re: Discount on individual order
Quote:
Quote:
I realized that in XC5.3, orders couldn't be edited on admin order detail page (admin.php?target=order&order_number=..." whereas in XC5.4 they can. So there must be something new in XC5.4. However, I compared the codes of the classes Model/OrderItem.php, View/ItemsList/OrderItem.php Controller/Admin/Order.php in two versions to find out why orders are editable in XC5.4 and not in XC5.3. However, I don't really see anything. Does anyone know where the difference comes from?
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
|
|||
X-Cart forums © 2001-2020
|