You are here:  » How To Show Applicable Products When Voucher Codes Contains a Hyphen?

Support Forum



How To Show Applicable Products When Voucher Codes Contains a Hyphen?

Submitted by bat on Wed, 2013-04-03 11:15 in

Hi David
I've come across a new issue with my voucher codes. I'm not using the new voucher code update you've released in the new version, I'm using the previous one.

One of the merchants is using voucher codes with a hyphen, eg: GHJ-890

Whenever I click on the voucher code merchant name/logo on the coupons, it usually takes me to a page displaying the products the code is applicable to but I'm getting the 'no results found' page for the codes with hyphens.

Is there a fix for this please?

Here's an example on my site {link saved}

Thanks!
Bat

Submitted by support on Fri, 2013-04-05 07:56

Hello bat,

Ah I see - this is because of the normalisation that takes place at the top of search.php, which removes hyphens (since they are used in place of spaces in clean URLs).

Simplest solution would be to prevent normalisation of the input "q" parameter if it begins "voucher:", so to do this, edit search.php and look for the following code at line 6:

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

...and REPLACE with:

  if (substr($q,"voucher:")!==0) $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Fri, 2013-04-05 08:08

Hi David,
Thanks, just tried it but it doesn't appear to be working...

Submitted by support on Fri, 2013-04-05 08:47

Ah sorry bat, $q not set at that point - use instead as the replacement:

  $q = (isset($_GET["q"])?$_GET["q"]:"");
  if (substr($q,"voucher:")!==0) $q = tapestry_normalise($q,":\.");

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Fri, 2013-04-05 09:01

Still nothing, I'm afraid.

Submitted by support on Fri, 2013-04-05 09:16

Hi bat,

Could you email me your search.php, I'll check it all out on my test server with a similar code...

(if you could also include link to problem page on your server in the email that will help...)

Thanks,
David.
--
PriceTapestry.com