You are here:  » Linking to product pages containing ampersand

Support Forum



Linking to product pages containing ampersand

Submitted by clickspace on Sun, 2008-02-24 20:56 in

Hi David,

I'm still trying but failing miserably to work out how to use the ampersand fix from another forum thread i.e.

$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],"&:\."):"");

My search.php code has been previously customised (by your good self) and I'm trying to work out how to change the following line of code to allow for this;

$q = (isset($_GET["q"])?str_replace("-"," ",stripslashes($_GET["q"])):"");

Also not sure if I'll also need to import the feeds again after any fix.

Cheers,
Steven

Submitted by support on Mon, 2008-02-25 09:32

Hi Steven,

That second line shouldn't require modification as there is nothing there that would strip the &; however this is very difficult to make work, and I think it involves a fix that appends the value of any other query string parameter that has been spearated from the original query by the &.

However, before going there - have you already modified includes/admin.php to permit the & character during import? Line 159:

    $record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]]);

...would need to be changed to:

    $record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],"&");

...and then all feeds re-imported...

Cheers,
David.

Submitted by clickspace on Mon, 2008-02-25 11:10

Hi David,

My includes/admin.php looks to already have that change?

/* apply standard filters */
// $record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]]);
// ##### modified
$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],",'\'\.%!&;#");
// ##### end mod

Cheers,
Steven

Submitted by support on Mon, 2008-02-25 11:14

Hi Steven,

Can you send me a link to your site so I can see what's happening - ideally to some search results that show a product with & in the title... If you could also attach your .htaccess and search.php i'll take a look for you...

Cheers,
David.

Submitted by clickspace on Mon, 2008-02-25 12:18

For anyone else who has this issue, David suggested the following fix that worked first time...

At the top of products.php you have:

require("includes/common.php");

Insert the following code on the next line:

 foreach($_GET as $k => $v)
 {
   if (($k <> "q") && ($k <> "rewrite"))
   {
     $_GET["q"] .= "&".$k.$v;
   }
 }

This will "rebuild" the query to include the & character