You are here:  » Taking "-" out of product names

Support Forum



Taking "-" out of product names

Submitted by ANDREWCX on Wed, 2007-09-26 23:44 in

Hi,

Is there a way I can take the - character out of the name of 'products' in the window title? The code I am using is:

 $header["title"] = "".$_GET["q"]." Coupons, ".$_GET["q"]." Cashback, ".$_GET["q"]." Rebates, ".$_GET["q"]." Points & Frequent Flyer Miles | RewardsDB.com";

if you look at http://rewardsdb.com/product/Frames-Direct.html you can see it displays as "Frames-Direct" - i'd like it to display as "Frames Direct".

Thanks

Submitted by support on Thu, 2007-09-27 09:18

Hi Andrew,

If you use $q instead of $_GET["q"] you should have the product name without the hyphens. $q is preserved through the script as the value of the ?q= on the URL, so it should work fine.

Cheers,
David.

Submitted by ANDREWCX on Thu, 2007-09-27 12:12

hmm,

I switched it to;

$header["title"] = "".$q." Coupons, ".$q." Cashback, ".$q." Rebates, ".$q." Points & Frequent Flyer Miles | RewardsDB.com";

and still see the "-" character...

Submitted by support on Thu, 2007-09-27 12:17

Hi Andrew,

What line of products.php are you adding your code? The "-" characters are removed from $q by the following code, which is line 4:

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

I'm not sure why the "-" are surviving in your code; but it does depend where it is. You can always remove the "-" manually and not rely on it being done elsewhere, and as we know that $_GET["q"] holds the product names with hyphens, I would just use something like this:

  $pname = str_replace("-"," ",$_GET["q"]);
  $header["title"] = "".$pname." Coupons, ".$pname." Cashback, ".$pname." Rebates, ".$pname." Points & Frequent Flyer Miles | RewardsDB.com";

That should definitely do the trick....!

Cheers,
David.

Submitted by ANDREWCX on Thu, 2007-09-27 12:56

Ah - the de dashing line was on line 24 and my title set was on line 4 - so I just moved the de-dasher up above the title and it now works.

Thanks again,

Andrew

Submitted by ANDREWCX on Thu, 2007-10-04 11:27

Follow up question - how can I add the description from the database to the meta tags for a product?

Submitted by support on Thu, 2007-10-04 12:03

Hi Andrew,

The description meta tag for product pages is set by the following code on line 52 of products.php:

$header["meta"]["description"] = translate("Price search results for")." ".htmlentities($q,ENT_QUOTES,$config_charset);

To add the description, change this as follows:

$header["meta"]["description"] = translate("Price search results for")." ".htmlentities($q,ENT_QUOTES,$config_charset)." ".htmlentities($product["products"][0]["description"],ENT_QUOTES,$config_charset);

Hope this helps,
Cheers,
David.

Submitted by ANDREWCX on Thu, 2007-10-04 12:44

Hi,

I added the code but its not displaying. What code needs to be before that statement for it to work?

Andrew

Submitted by support on Thu, 2007-10-04 13:06

Hi Andrew,

There shouldn't need to be any more code added. If you would like to email me a copy of your modified products.php i'll take a look for you...

Cheers,
David.