You are here:  » Copy Filters when Filter Sort Order Mod is present v12/10B (Heavily Modded)


Copy Filters when Filter Sort Order Mod is present v12/10B (Heavily Modded)

Submitted by Convergence on Wed, 2016-05-04 14:16 in

v12/10B (Heavily Modded)

Greetings, David!

We have a version of the Filter Sort Order Mod (http://www.pricetapestry.com/node/4862) which works great by itself.

However, we also have the following version of: /scripts/copyfilters.php

{code saved}

Which allows us to run the following in a browser:
http://www.[path-to]/scripts/copyfilters.php?password=#########&sourceFilename=SOURCE.txt&destinationFilename=DESTINATION.txt

Problem we've been having is this:

While it copies the filters, and the filter sequence are shown in PT admin, it doesn't actually apply any of the displayed filter sequences. We have to "Configure" each copied filter and re-enter the sequence number. Also, while the sequence number is displayed in the /feeds_filters.php screen, once we hit "Configure" the actual sequence is "0".

Some of our merchants have dozens of filters and re-entering the sequence is very time consuming.

Any assistance is greatly appreciated.

Thanks, David!

Submitted by support on Wed, 2016-05-04 15:17

Hi,

In includes/admin.php, locate the admin_copyFilters() function, and within the body of the function the following code beginning at around line 611:

        $sql = sprintf("INSERT INTO `".$config_databaseTablePrefix."filters` SET
                        filename = '%s',
                        field = '%s',
                        name = '%s',
                        data = '%s',
                        created = '%s'
                        ",
                        database_safe($destinationFilename),
                        database_safe($filter["field"]),
                        database_safe($filter["name"]),
                        database_safe($filter["data"]),
                        $created++
                        );

...and REPLACE with:

        $sql = sprintf("INSERT INTO `".$config_databaseTablePrefix."filters` SET
                        filename = '%s',
                        field = '%s',
                        name = '%s',
                        data = '%s',
                        sequence = '%s',
                        created = '%s'
                        ",
                        database_safe($destinationFilename),
                        database_safe($filter["field"]),
                        database_safe($filter["name"]),
                        database_safe($filter["data"]),
                        database_safe($filter["sequence"]),
                        database_safe($filter["created"])
                        );

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Convergence on Mon, 2016-05-16 16:53

Hi David,

Just what we needed. Worked perfectly, Thank you!