• Welcome to KonaKart Community Forum. Please login or sign up.
 

Set StoreID before saving the order

Started by rkonakart, May 07, 2012, 09:41:31 pm

Previous topic - Next topic

rkonakart

Dear All,

I have mulit-store environment with shared products & customers. I need to change the storeId before saving the order into the database.

I know that I have to change in "OrderIntegrationMgr" but when I checked the place where the storeId is set in the kkEng, I found that kkEng take StoreInfo(which includes storeId) in its constructor.

I also tried to create new EngineConfig and set storeId in it but I want to set this EngineConfig in the kkEng without creating new engine &  before saving the order, I don't know how???

After searching I found some replies that I have to save the order with initial storeId then update the order tables with the required ID, is it the only solution for this??????? If so please mention exactly the required tables to update in it.

Appreciate your quick response as it is really urgent case for us.

Asset


ryan

Create a method in the OrderIntegrationMgr for dispatching an order to another store and call it after the order has been saved. The code inside the method will be something like this:

       String storeId = "destinationStoreId";

        BasePeer.executeStatement("update orders set store_id='" + storeId + "' where orders_id="+ order.getId());
        BasePeer.executeStatement("update orders_products set store_id='" + storeId + "' where orders_id=" + order.getId());
        BasePeer.executeStatement("update orders_products_attributes set store_id='" + storeId + "' where orders_id=" + order.getId());
        BasePeer.executeStatement("update orders_status_history set store_id='" + storeId  + "' where orders_id=" + order.getId());
        BasePeer.executeStatement("update orders_total set store_id='" + storeId + "' where orders_id=" + order.getId());