View Single Post
  #1  
Old 09-26-2019, 12:51 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default "Fake" orders (or how do a cart become an order ?)

I would like to create a "fake checkout page" so that a "fake order" can be placed. To be more precise, the fake orders will have all "properties" that the real orders have, but they don't trigger the actions that real orders do, except being saved in the database, and they shouldn't show up in the order list.

It looks like all I would need is to save the order with the property is_order set to 0.
However, I have no idea on how to achieve this.

What I have figured out so far is that when one places an order, doActionCheckout()
function in the controller class is called. Which in turn calls the function registerOrderPackaging( , ) from Core/OrderHistory.php. This function, in turn, calls for
registerPlaceOrder, registerEvent which somehow register the order event in the
xc_order_history_events table. But I don't see exactly how the order is saved in xc_orders table. So my first question is: is there any way to save a "fake order" placed on "fake" ckeckout page in the table with is_order=0?


Otherwise, I have so far succeeded to decorate the /Model/Order.php class so that it
has a new column "is_fake", and "fake orders" have is_fake set to 1. Unfortunately I can't set is_order=0 this way because getCart() has no such property as is_order.
So another way to achieve my goal would be to decorate all classes involving the treatment of orders (like email notification, admin order list, customer order list etc.) ignore the orders with the property is_fake = 1. But to start with, how do I find complete set of such classes?


Thank you very much in advance.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote