Not for official support
We do not provide technical support in this forum.
If you want to contact our customer support, please use our support form.

You are not logged in.

#1 2009-02-05 13:31

C.Adley
Member

Delete option inside canceled orders.

Perhaps you might consider a simple button that would allow us to delete orders that have been canceled.

Offline

 

#2 2009-02-19 10:31

Alexey
Member

Re: Delete option inside canceled orders.

It is not a good practice, to delete orders completely. However it does not hurt much if taken with caution.

MAKE SURE TO HAVE A BACKUP OF YOUR DATABSE BEFORE TRYING THEM FOR A FIRST TIME. NO PROMISES OR GUARANTEES.

TO clear viewed statistics and all of your test attempts run this query on the database -

TRUNCATE `SC_aff_commissions`;
TRUNCATE `SC_aff_payments`;
TRUNCATE `SC_customer_addresses`;
TRUNCATE `SC_customer_reg_fields_values`;
TRUNCATE `SC_customer_reg_fields_values_quickreg`;
TRUNCATE `SC_customers`;
TRUNCATE `SC_order_status_changelog`;
TRUNCATE `SC_ordered_carts`;
TRUNCATE `SC_orders_discount_coupons`;
TRUNCATE `SC_shopping_cart_items`;
TRUNCATE `SC_shopping_cart_items_content`;
TRUNCATE `SC_shopping_carts`;
TRUNCATE `SC_orders`;
UPDATE `SC_categories` SET `viewed_times`=0;
UPDATE `SC_products`  SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sold'=0

This is to delete orders info completely but to keep customer info -

TRUNCATE `SC_order_status_changelog`;
TRUNCATE `SC_ordered_carts`;
TRUNCATE `SC_orders_discount_coupons`;
TRUNCATE `SC_shopping_cart_items`;
TRUNCATE `SC_shopping_cart_items_content`;
TRUNCATE `SC_shopping_carts`;
TRUNCATE `SC_orders`;

This is to delete orders with the certain status code (cancelled is "1" by default, but do check and edit queries id necessary) -

DELETE SC_aff_commissions FROM SC_aff_commissions LEFT JOIN SC_orders ON SC_aff_commissions.orderID=SC_orders.orderID WHERE  SC_orders.statusID=1;
DELETE SC_customer_reg_fields_values_quickreg FROM SC_customer_reg_fields_values_quickreg LEFT JOIN SC_orders ON SC_customer_reg_fields_values_quickreg.orderID=SC_orders.orderID WHERE  SC_orders.statusID=1;
DELETE SC_order_status_changelog FROM SC_order_status_changelog LEFT JOIN SC_orders ON SC_order_status_changelog.orderID=SC_orders.orderID WHERE  SC_orders.statusID=1;
DELETE SC_ordered_carts FROM SC_ordered_carts LEFT JOIN SC_orders ON SC_ordered_carts.orderID=SC_orders.orderID WHERE  SC_orders.statusID=1;
DELETE FROM `SC_orders` WHERE statusID=1;

Offline

 

#3 2009-02-22 17:54

groeschh
Member

Re: Delete option inside canceled orders.

hm...thanks for that. seems to be helpful. I got a whole bunch of test transactions to delete. will try it the next time.

Offline

 

#4 2009-03-08 11:55

wiz
Member

Re: Delete option inside canceled orders.

I always have a lot demo order to cancel.
What is the exactly procedure to delete cancelled orders ?
I dont know how to "run this query to a database"

Thanks

Last edited by wiz (2009-03-08 11:56)

Offline

 

#5 2009-03-10 02:28

Alexey
Member

Re: Delete option inside canceled orders.

Usually, it is done using PHPMyAdmin utility. It should be available in your hosting control panel. It has an SQL tab where you can post these queries and execute them.

Offline

 

#6 2009-03-21 17:05

wiz
Member

Re: Delete option inside canceled orders.

This works fine for me:

TRUNCATE `SC_order_status_changelog`;
TRUNCATE `SC_ordered_carts`;
TRUNCATE `SC_orders_discount_coupons`;
TRUNCATE `SC_shopping_cart_items`;
TRUNCATE `SC_shopping_cart_items_content`;
TRUNCATE `SC_shopping_carts`;
TRUNCATE `SC_orders`;

But this report me a syntax error in the last line:

TRUNCATE `SC_aff_commissions`;
TRUNCATE `SC_aff_payments`;
TRUNCATE `SC_customer_addresses`;
TRUNCATE `SC_customer_reg_fields_values`;
TRUNCATE `SC_customer_reg_fields_values_quickreg`;
TRUNCATE `SC_customers`;
TRUNCATE `SC_order_status_changelog`;
TRUNCATE `SC_ordered_carts`;
TRUNCATE `SC_orders_discount_coupons`;
TRUNCATE `SC_shopping_cart_items`;
TRUNCATE `SC_shopping_cart_items_content`;
TRUNCATE `SC_shopping_carts`;
TRUNCATE `SC_orders`;
UPDATE `SC_categories` SET `viewed_times`=0;
UPDATE `SC_products`  SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sol

Can you check if is correct ?

Thanks

Last edited by wiz (2009-03-21 17:06)

Offline

 

#7 2009-03-23 03:14

Alexey
Member

Re: Delete option inside canceled orders.

At the very end you have a letter and some other things missing. It should be -

UPDATE `SC_products`  SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sold'=0

Sorry, my mistake.

Offline

 

#8 2009-04-19 10:02

wiz
Member

Re: Delete option inside canceled orders.

Alexey wrote:

At the very end you have a letter and some other things missing. It should be -

UPDATE `SC_products`  SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sold'=0

Sorry, my mistake.

Thi line report me an error:

Errore

Pare che ci sia un errore nella query SQL immessa. L'errore del server MySQL mostrato qui sotto, se c'è, può anche aiutare nella risoluzione del problema

ERROR: Virgolette Non Chiuse @ 86
STR: `
SQL: UPDATE `SC_products`  SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sold'=0


query SQL:

UPDATE `SC_products` SET `viewed_times`=0, `customers_rating`=0, `customer_votes`=0, `items_sold'=0

Messaggio di MySQL: Documentazione
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Offline

 

#9 2012-01-23 11:53

cyrus
Member

Re: Delete option inside canceled orders.

who we can delet all canceld order?

Offline

 

#10 2012-01-24 00:18

rat
Administrator

Re: Delete option inside canceled orders.

Code:

DELETE FROM `SC_orders` WHERE `statusID` = (SELECT `statusID` FROM `SC_order_status` WHERE `status_name_en` = 'Cancelled')

Be careful what you wish for — you might get it.

Offline

 

#11 2012-08-03 09:15

Minisuit
Member

Re: Delete option inside canceled orders.

This is the query with joins
Delete * from SC_orders as SCO, SC_order_status as SCOS where SC.statusID=SCOS.statusID and SCOS.status_name_en="Cancelled" .

hope this can Meet your problems Solution.

Last edited by rat (2012-08-20 03:57)

Offline

 

Board footer

Powered by PunBB