Hi,
I would like to display the actual criteria on the filters page.
Right now, it display 3 or 4 columns (Search and Replace, Configure Delete, Field) depending on how you count it.
I would like to display the criteria at the end of each row. I can tell it's probably on the feeds_filters.php page, but, how can I do that?
Thanks.
Hi,
That was the plan...! This line:
print "<td>".unserialize($filter["data"])."</td>";
...should actually be:
print "<td>".print_r(unserialize($filter["data"]),TRUE)."</td>";
The output may appear a little cryptic but you should be able to pick-out all the relevant information without needing special code to display the settings for each filter type.
Cheers,
David.
Okay, thanks. I thought I would re-try explaining it just in case we weren't thinking the same thing. Anyways, I understand the output.
For some reason it doesn't display inside the table cell, but, that's alright, it displays what I need to know.
To make the same modification for Global Filters, look for the following code at line 69 of admin/global_filters.php
print "<th>Field</th>";
...and REPLACE with:
print "<th>Field</th>";
print "<th>Criteria</th>";
...and then look for the following code at line 87:
print "<td>".$config_fieldSet[$filter["field"]]."</td>";
...and REPLACE with:
print "<td>".$config_fieldSet[$filter["field"]]."</td>";
print "<td>".print_r(unserialize($filter["data"]),TRUE)."</td>";
Cheers,
David.
--
PriceTapestry.com
This is a good mod. Thanks.
I use HTML in my filters so I added htmlspecialchars to make the html display as text instead of being interpreted. Here's the code. Please let me know if you see any issues.
print "<td>".htmlspecialchars(print_r(unserialize($filter["data"]),TRUE))."</td>";
Thanks,
Gregor
That looks fine, Gregor!
Cheers,
David.
--
PriceTapestry.com
Hi David,
I use this mod and it works well and is really useful. Is there a way to display the category mapping with a list of alternates in a similar way in the admin panel, so you can easily see the alternatives. Obviously it might be too much for larger sites but where there are just a few category mappings it could save overlaps.
I have tried the following on categories.php in a similar place to the filters.php, but it does not work
print "<td>".print_r(unserialize($category["alternates"]),TRUE)."</td>";
Hi Ben,
The `alternates` field is actually stored as a new-line separated string, so have a go with just:
print "<td>".print nl2br($category["alternates"])."</td>";
Regarding the shortlist - sure the cookies can be made persistant (by setting an expire date way into the future). In the shoppingList.php script there are 2 instances of the line that sets the cookie:
setcookie("shoppingList",serialize($shoppingList));
...REPLACE each with:
setcookie("shoppingList",serialize($shoppingList),mktime(0,0,0,1,1,2035));
Cheers,
David.
--
PriceTapestry.com
Hi David
They both work brilliantly. Fantastic Help as Always
Thank you very much
Ben
Ps The first set cookie line of your reply to be replaced should have been
setcookie("shoppingList",serialize($shoppingList));
Ah yes, well spotted! (corrected above)
Cheers,
David.
--
PriceTapestry.com
Bob L.
Hi David,
Ran into a problem with this mod that I use on previous versions.
version 15/09 Beta
I've tried this
print "<td>".$fields[$filter["data"]]."</td>";
& this.
print "<td>".print_r(unserialize($filter["data"]),TRUE)."</td>";
But neither returns any output.
Thanks in advace.
Hello Bob,
The second version;
print "<td>".print_r(unserialize($filter["data"]),TRUE)."</td>";
...should work fine in 15/09A (Beta) however for a more user-friendly output, have a go with the following modification to admin/feeds_filters.php. Look for the following code at line 149:
print "<td>".$fields[$filter["field"]]."</td>";
...and REPLACE with:
print "<td>".$fields[$filter["field"]]."</td>";
print "<td>";
$data = unserialize($filter["data"]);
foreach($data as $k => $v)
{
print "<strong>".$k."</strong>: ".$v."<br />";
}
print "</td>";
If still nothing showing let me know and I'll check it out further with you...
Cheers,
David.
--
PriceTapestry.com
Bob L.
You be the man, Mr. David.
Your version worked like a Champ.
Thank you.
Bob L.
I really like the output of this mod David.
Might be a quick fix ???
These 6 Filters return an error code on line# foreach as there isn't any data required for them.
Name Case
UTF8 Encode
UTF8 Decode
HTMLEntityDecode
Trim Spaces
Remove Duplicates
Thanks in advance.
Bob L.
Hello Bob,
No problem, alternative replacement:
print "<td>".$fields[$filter["field"]]."</td>";
print "<td>";
$data = unserialize($filter["data"]);
if (is_array($data))
{
foreach($data as $k => $v)
{
print "<strong>".$k."</strong>: ".$v."<br />";
}
}
print "</td>";
Cheers,
David.
--
PriceTapestry.com
Hi,
Yes - that can be done quite easily. In admin/feeds_filters.php, look for the following code at line 80:
print "<th>Field</th>";
...and REPLACE with:
print "<th>Field</th>";
print "<th>Criteria</th>";
And then look for the following code at line 98
print "<td>".$fields[$filter["field"]]."</td>";
...and REPLACE with:
print "<td>".$fields[$filter["field"]]."</td>";
print "<td>".print_r(unserialize($filter["data"]),TRUE)."</td>";
Hope this helps!
Cheers,
David.