Hi Dave
is there a limit of how many filters you can have on any one product, 3 filters seems to do this to the link
eg.Toshiba-37WLT58--LCD--with-IDTV.html
when you click the link it doesn't work, but when you chnage filters so it only takes 2 it works no bother
regards
phil
Hi Dave
Say there are 2 products
producta Plasma tv
productb Plasma
what would be the filters you would recommend using, i think because i am using both search and replace filters for both eg. "plasma tv" and "Plasma"
it means it creates a file producta--.html which doesn't exist, would iu be right in asuming this?
Regards
P Stone
Ok, I see what's happening. You're correct - the result of search and replace (with nothing) on both "Plasma tv" and "Plasma" would result in a "URL safe" product name of "producta--" (for the first one) and "productb-" (for the second example).
However, on entry to search.php, the query first has all "-"'s converted into spaces; and is then trimmed; resulting in just "producta", for which there is no entry found because it is in the database as "producta " (the hypens are generated by the code that prepares a product name for use in a URL, they're not in the database).
I think the bese place to fix this is to modify the search and replace filter to trim the result before returning the modified value back to the import handler.
To do this; modify filter_searchReplaceExec() in includes/filters.php from:
<?php
function filter_searchReplaceExec($filter_data,$text)
{
return str_replace($filter_data["search"],$filter_data["replace"],$text);
}
?>
to:
<?php
function filter_searchReplaceExec($filter_data,$text)
{
return trim(str_replace($filter_data["search"],$filter_data["replace"],$text));
}
?>
That should fix it up after the next import...
hi Dave
see in the filters, is there anyway that you could have a filter that cut out the text from before a symbol
eg
Zanussi ZCM930X / Dual Fuel Range Cooker
i only want
Zanussi ZCM930X so that it is compared with more merchants on one page, to save setting up filters for the whole feed could there be
Only text before/after option
then in the box i would just enter "/"
i tried the above adjustment, unfortunately it didn't work, kept coming up with -- and --- in the html address.
thanks for your help,
P Stone
Hi Phil,
Just to confirm - you did re-import the affected feed after modifying the filter code...?
If you add the following block of code to the end of includes/filters.php, this will add a new filter "Split", which should do as you require - but there may be the odd syntax error as i've not tested this...!
<?php
/*************************************************/
/* split */
/*************************************************/
$filter_names["split"] = "Split";
function filter_splitConfigure($filter_data)
{
print "Split Character or String:<br />";
print "<input type='text' size='40' name='text' value='".widget_safe($filter_data["text"])."' />";
widget_errorGet("text");
}
function filter_splitValidate($filter_data)
{
if (!$filter_data["text"])
{
widget_errorSet("text","required field");
}
}
function filter_splitExec($filter_data,$text)
{
return trim(substr($text,0,strpos($text,$filter_data["text"])));
}
?>
thanks for that dave
i did re-import the feeds a few times for the safe url problem - --.html , not sure what the problem may be
i tried the splitting code out, it doesn't seem to work
was wondering do i need to add "/" to the acceptable characters list to make that work? and if so where would i do that?
Regards
P Stone
Of course - / is stripped before it reaches the filter....!
Ok, back to the drawing board on this one, bear with me....
One option is to move the user filters infront of the standard filters in admin__importRecordHandler().
If you move the following code...
<?php
/* apply user filters */
$filter_dropRecordFlag = false;
if ($admin_importFiltersExist)
{
foreach($admin_importFilters as $filter)
{
$execFunction = "filter_".$filter["name"]."Exec";
$record[$filter["field"]] = $execFunction($filter["data"],$record[$filter["field"]]);
}
}
?>
...above the line that says
<?php
/* apply standard filters */
?>
...then you should be able to process on the "/" character...
Working now!!
split whole feed no problems, thanks dave. If you have any joy with the other filter issue let me know - your a star
Another wee thing, is there anyway to add the "brand" into the product name through the filter page using the text before method?
just would help match up a few more feeds if it was possible
thanks
Phil
Hi dave
Wee Problem
imported my dixons feed, and had to reset the filters, but i got that done ok, but i am trying to add some "text after" to the description feed
the code i have typed in is
<br><b><p>Spend £300 - £25 Discount - Use Code ONLINE25.<br>Spend £600 - £50 Discount - Use Code ONLINE50.<br>Spend £1500 - £100 Discount - Use Code ONLINE100. <p>Use this Promotional code when buying this or any product from Dixons</b><br>This Discount has not been taken from the price column! <br><b>All Dixons Vouchers will Run until 31st May 06</b>
if you go to Here you will see whats happening, this only seems to have happened since i changed the admin.php file
Please could you have a wee look and advise me on what i should do to fix this
Regards
phil
ps The currys feed has not been reimported yet, thats why it shows the way the dixons one should show
Hi Phil,
That's because the description is being "normalised" as part of the standard filters; and now, because of the changes you made yesterday, that is taking place after your additional code has been applied through the "Text After" filter.
In this case, I think the best thing to do is to remove the normalisation on the description field; and just keep a careful eye on your site to make sure that everything looks ok for you; as this will mean that HTML from the feed will make it onto your website.
Look for the following code in the admin__importRecordHandler() function in includes/admin.php:
<?php
if ($admin_importFeed["field_description"])
{
$record[$admin_importFeed["field_description"]] = strip_tags($record[$admin_importFeed["field_description"]]);
$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!");
}
?>
If you wish to preserve your additional HTML, I would simply comment out the above block of code and this will leave the description field unmodified.
David,
I've been commenting out the description and product name blocks as described above. It's worked well until I found a merchant who is insisting on using the # symbol in the product name. This gets passed into the url and causes all types of errors as the browser thinks its is looking for an anchor link.
I still would like to allow typical symbols in the name such as commas, periods and parentheses but I need to strip out the #. If I uncomment this
<?php
$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]]);
?>
<?php
$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],"&:\.\/\(\)\+\,"):"");
?>
I guess I need to figure out how to allow periods, commas, parentheses and slashes in the name without allowing everything else.
Hi,
You can make the characters you wish to permit be allowed in by changed the line that you have previously uncommented:
$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]]);
...as follows:
$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],"&:\.\/\(\)\+\,");
That should match what you are allowing in through $q....
Hope this helps!
Cheers,
David.
Hi Phil,
There isn't any set limit. Can you describe what filter settings you're using, and give an example of the original value, that should help us to see what's going on...
Thanks,
David.