SQL Tips & Tricks

It is strongly advised that these statements should only be made with the necessary expertise.
The information provided here was tested at the time of publication of this article, but may have changed in the meantime. The execution of this tutorial is at your own risk

Before you start, make a backup so that you can restore it if you run into trouble. Please note that these are adjustments of shopware and therefore the content of this tutorial is not officially supported!

Catalogues

Delete all products

With the following query you can delete all created products and empty the product overview completely.


delete pv.*, pt2.*, pt.*, psk.*, pr.*, pp2.*, pp.*, po.*, pm.*, pcfs.*, pcst.*, pcsap.*, pcs2.*, pcs.*, pct.*, pc.*, p.* from product p
left join product_category pc on p.id = pc.product_id 
left join product_category_tree pct on p.id = pct.product_id 
left join product_configurator_setting pcs on p.id = pcs.product_id 
left join product_cross_selling pcs2 on p.id = pcs2.product_id 
left join product_cross_selling_assigned_products pcsap on p.id = pcsap.product_id 
left join product_cross_selling_translation pcst on pcs2.id = pcst.product_cross_selling_id 
left join product_custom_field_set pcfs on p.id = pcfs.product_id 
left join product_media pm on p.id = pm.product_id 
left join product_option po on p.id = po.product_id 
left join product_price pp on p.id = pp.product_id 
left join product_property pp2 on p.id = pp2.product_id 
left join product_review pr on p.id = pr.product_id 
left join product_search_keyword psk on p.id = psk.product_id 
left join product_tag pt on p.id = pt.product_id 
left join product_translation pt2 on p.id = pt2.product_id 
left join product_visibility pv on p.id = pv.product_id;

Clear all properties

With the following query you can remove all properties.


delete pgt., pgot., pgo., pg. from property_group pg
join property_group_option pgo on pg.id = pgo.property_group_id
join property_group_option_translation pgot on pgo.id = pgot.property_group_option_id
join property_group_translation pgt on pg.id = pgt.property_group_id;

System / Settings

Disable non-standard plug-ins

With the following queries you can deactivate the plug-ins that are not already present when installing Shopware. This is especially useful for debugging errors, as you can quickly eliminate the influence of plug-ins.

If you use your own theme that is integrated via a plug-in, you should make sure in advance that the theme is not assigned to a sales channel. Alternatively, you may encounter problems when calling the appropriate sales channels.

First we create a temporary backup table. The current status of the plug-ins is saved in this table.


CREATE TABLE plugin_tmp LIKE plugin;
INSERT INTO `plugin_tmp` SELECT * FROM `plugin`;

Then you can deactivate the plug-ins


UPDATE `plugin` SET `active`= 0 WHERE (author <> 'shopware AG') OR (author IS NULL);

The original state of the plug-ins can be restored later as follows


UPDATE plugin AS p JOIN plugin_tmp AS pt ON p.id = pt.id SET p.active = pt.active;

Finally, you can delete the temporary backup table


DROP TABLE plugin_tmp;

Was this article helpful?