You are here:  » How to delete feed filters via a SQL query in phpMyAdmin


How to delete feed filters via a SQL query in phpMyAdmin

Submitted by Convergence on Sat, 2016-05-21 15:47 in

Heavily modified v12/10B

Hi David,

We have come to the point where we are adding some filters to the Global Filters and require the ability to delete the original feed filter from merchant filters.

We would like to be able to do this via a SQL query on the pt_filters table (as we have too many merchants with a particular filter to manually delete each one, one at a time).

Can you help with this?

Thanks!

Submitted by support on Sun, 2016-05-22 10:38

Hi Convergence,

The `name` field on the pt_filters table uses the keys of the $filter_names array which is populated in html/filter.php for example, at line 20;

$filter_names["searchReplace"] = "Search and Replace";

"searchReplace" is what will appear in the `name` field. So to delete all filters of that type for the feed "merchant1.xml", the query would be:

DELETE FROM pt_filters WHERE filename='merchant1.xml' AND name='searchReplace'

Always make sure good backups are in place and one thing I tend to do as a safety net when working in phpMyAdmin is to start with a SELECT clause instead of DELETE e.g.

SELECT * FROM pt_filters WHERE filename='merchant1.xml' AND name='searchReplace'

...make sure the result set is exactly what you intend to delete, and then change SELECT * to DELETE...

Cheers,
David.
--
PriceTapestry.com

Submitted by Convergence on Sun, 2016-05-22 13:21

Hi David,

Is there a way to DELETE a specific filter itself, example the filter is:

Text After (Product Description)
"Prices subject to change without notice"

We are not sure since "Prices subject to change without notice" is stored in "data" and contained within "BLOB".

Would something like this work?
SELECT * FROM pt_filters WHERE data='Prices subject to change without notice'

Clear as mud?

Thanks!

Submitted by support on Sun, 2016-05-22 13:41

Hi,

A "LIKE" clause would work - the "%" character can be used as a wildcard. Have a go with;

SELECT * FROM pt_filters WHERE data LIKE '%Prices subject to change without notice%'

Cheers,
David.
--
PriceTapestry.com