0

Would like to change order status throgh Magento 2 MySQL Query

But Order Status belongs to so many tables like

sales_order
sales_order_grid

Need to use sales_order_aggregated_created & sales_order_aggregated_updated?

In sales_order_status_state what's difference between Status & State?

Example: Status is fraud, but Stat is payment_review.

Can use below method to update order status

$update = $collection->update('sales_order', [
                    'status' => 'complete',
                ], ["entiry_id = ?" => 1]
        );

In how many tables I have to change status? Will don't have like update in 1 table & changes will be applied in respective relational tables.

How to update multiple tables at same time

Example

$update = $collection->update('sales_order','sales_order_grid'
  • Sorry @krishnaijjadaati95Dev updated question. How many & how to do at one time, as i have given example. Not sure possible – Ankit Shah Oct 4 '16 at 6:38
3

What's difference between Order Status & Order State?

They both are different.

State is used by magento to tell if the order is new, processing, complete, holded, closed, canceled, etc.

Status are the one that you would be defining at the backend in Store -> Settings -> Order Status.

Magento displays order STATUSES and not STATES in the backend order detail page to let you know which status is assigned as per your mapping.

Remember, multiple statuses can be mapped with one state, while vice versa is not possible.

For more info check link

Below two table is responsible for order status

sales_order_grid
sales_order

For more info please check link

  • Hi @Prasshant u can just put link in comment below question regarding this. Actual question is different. – Ankit Shah Oct 4 '16 at 6:41
  • @PrashantValanda Magento 2 Don't have tables sales_flat_order & sales_flat_order_grid. Please double check – Ankit Shah Oct 4 '16 at 6:59
  • @AnkitShah update answer please check it – Prashant Valanda Oct 4 '16 at 7:04
  • @PrashantValanda 60% Achieved. 2 Thinks still remain 1] Need to use sales_order_aggregated_created & sales_order_aggregated_updated? 2] How to update multiple table at same time – Ankit Shah Oct 4 '16 at 7:12
  • @PrashantValanda If required then also can Post Separate Question for above 2 remaining points as 1 question contains multiple questions. Up to you – Ankit Shah Oct 4 '16 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.