[Skip to main content](#vessel-content)

#   Order - Copy order

##

- **[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")**
- [![dhusband's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/60503-dhusband "View dhusband's Profile") Topic Author
- [ Offline](/forum/user/60503-dhusband)

Less More

- Posts: 52
- Thank you received: 6
-
-

4 years 5 months ago [\#342102](#342102) by [dhusband](/forum/user/60503-dhusband "View dhusband's Profile")  *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342102 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")* was created by *[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")*

-- HikaShop version -- : 4.6.0
-- Joomla version -- : 3.10.9
-- PHP version -- : 7.4.29
-- Browser(s) name and version -- : Firefox

When you copy an order it copies it with the current status, for example 'Closed'.
If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.

Thank you
David

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

4 years 5 months ago [\#342107](#342107) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342107 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

Hi,

You should be able to do that with a mass action (menu System&gt;Mass actions) with a trigger "after an order is created", with a filter on the order column "order_status" being different than "created" and with an action "update the values" on the order_status column in "string" mode with the value "created".
That way, when an order is created or copied, it will check that the order status is "created" and if not it will set it to "created".

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")**
- [![dhusband's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/60503-dhusband "View dhusband's Profile") Topic Author
- [ Offline](/forum/user/60503-dhusband)

Less More

- Posts: 52
- Thank you received: 6
-
-

4 years 5 months ago [\#342117](#342117) by [dhusband](/forum/user/60503-dhusband "View dhusband's Profile")  Replied by *[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342117 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

Great, thank you.
I have set this up and it is working.
Is there any way to remove the history, as it records a history of a status that has not happened?

Thank you for the quick response.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

4 years 5 months ago [\#342124](#342124) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342124 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

The mass action mechanism doesn't allow for history manipulation. However, you could do it with an action "run MySQL query" with a query like this for example: Code:

DELETE FROM #__hikashop_history WHERE history_order_id={order_id};

Just make sure this action is before the one I talked about in my previous message so that the first history record is deleted before the second one is added for the status reset.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")**
- [![dhusband's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/60503-dhusband "View dhusband's Profile") Topic Author
- [ Offline](/forum/user/60503-dhusband)

Less More

- Posts: 52
- Thank you received: 6
-
-

4 years 5 months ago [\#342154](#342154) by [dhusband](/forum/user/60503-dhusband "View dhusband's Profile")  Replied by *[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342154 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

I will try this out.
From testing the mass action yesterday, a history was not added for the change of status.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")**
- [![dhusband's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/60503-dhusband "View dhusband's Profile") Topic Author
- [ Offline](/forum/user/60503-dhusband)

Less More

- Posts: 52
- Thank you received: 6
-
-

4 years 5 months ago [\#342159](#342159) by [dhusband](/forum/user/60503-dhusband "View dhusband's Profile")  Replied by *[dhusband](/forum/user/60503-dhusband "View dhusband's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342159 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

The code works standalone. For example as an action button for a user to click after they have done a copy or set to run After an Order is Updated (but you would not want this as you would keep losing your history each time you updated).

However, it does not work After an Order Is Created. It is as if the history record has not been written when the trigger fires.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

4 years 5 months ago [\#342160](#342160) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Order - Copy order](/forum/35-orders-management/904504-order-copy-order#342160 "-- HikaShop version -- : 4.6.0 -- Joomla version -- : 3.10.9 -- PHP version -- : 7.4.29 -- Browser(s) name and version -- : Firefox  When you copy an order it copies it with the current status, for example 'Closed'. If copying an order, could it not copy it as you are starting a new order and allocate it the status of 'Created'? You can then start the order journey with the copied order.  Thank you David")*

Ah yes, the history entry is added after.
Then, what you can do is instead a second mass action with a trigger "after an order is updated" with a filter on the order_status column being equal to "created" and with that MySQL query as action.
That way, it will trigger after the order_status is set to "created" and thus it should remove the history of the order creation with the status set to "closed" when it was copied.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNDUwNC1vcmRlci1jb3B5LW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.073 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
