You are here:  » Voucher Code wrong


Voucher Code wrong

Submitted by MarcoCH on Thu, 2019-02-28 19:28 in

Hello

If I deposit a coupon code this will be displayed. But the URL path is wrong. I deposit:

- Shop
- Code
- Keyword
-%

returns: .../search.php?q=voucher:NETTOSHOP:ENJOY-WEB-10

but the link does not work, what is missing?

regards
Marco

Submitted by support on Fri, 2019-03-01 09:15

Hi Marco,

That will be because of the "-" characters in the code, as they are used to form the clean URLs they are removed by the normalise function. The best thing to do would be to use an alternative character e.g. "~" in the URL but change it back to "-". To do this, first edit vouchers.php and look for the following code at line 17:

  $vouchers[$k]["href"] = $config_baseHREF."search.php?q=voucher:".urlencode($voucher["merchant"]).":".urlencode($voucher["code"]);

...and REPLACE with:

  $vouchers[$k]["href"] = $config_baseHREF."search.php?q=voucher:".urlencode($voucher["merchant"]).":".urlencode(str_replace("-","~",$voucher["code"]));

Then edit search.php and look for the following code at line 6:

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

...and REPLACE with:

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

And finally the following code at line 177:

      case "voucher":

...and REPLACE with:

      case "voucher":
        $parts[2] = str_replace("~","-",$parts[2]);

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Mon, 2019-03-04 16:19

Hello

Unfortunately, it still does not work after the adjustment.
Would not it be necessary to search for the shop and keyword instead of shop and code?

regards
Marco

Submitted by support on Mon, 2019-03-04 17:24

Hi Marco,

The keyword is associated with the voucher code so all that needs to be passed to search.php is the merchant name and code but I might have mis-understood the actual voucher code in this case, is it:

ENJOY-WEB-10

...or

ENJOY WEB 10

Thanks,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Mon, 2019-03-04 18:37

Hello

My example:

Shop: Nettoshop
Keyword: Weber
Code: ENJOY WEB 10
Discount: 10%

You do not have to fill out more fields, right?

Is there an example where I see how it works, in your demo shop you have not deposited a promo.

regards
Marco

Submitted by support on Tue, 2019-03-05 08:59

Hi Marco,

The keyword field is optional - could you perhaps try a test by removing the keyword and then re-importing as that should make the code apply to all products. If that works, double check the keyword in use (not case sensitive) - easiest way would be from /admin/ > Tools > Feed Utilities and then click Imported Analysis for the feed and use the search box above product name to confirm that "Weber" is matching products for that merchant...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Thu, 2019-03-21 16:56

Hello

does not work as I mean.
Do I have to upload a feed? Or is it enough to deposit the code? Is not there an example where I can look at it?

{link saved}

Greeting
Marco

Submitted by support on Fri, 2019-03-22 10:09

Hi Marco,

You don't need a voucher code feed at all - the voucher code feed functionality is only to assist with entering voucher codes - everything can be entered manually.

I have uploaded some voucher codes to the demo site;

http://www.webpricecheck.co.uk/vouchers.php

Also have a look in /admin/

http://www.webpricecheck.co.uk/admin/

(this is using integration level 2 ($config_useVoucherCodes = 2) which means the voucher code is applied at import time and the discount reflected in the price)

Could you perhaps check using the code you have added "wein10all" so that we know it's not anything to do with the spaces / hyphens issue. If you go to edit that code, the only fields entered in Match Criteria should be the Minimum Spend of "150.00". I looked at the merchant from your Shops page and it has lots of products above that price, so then re-import the feed and then visit the link, the applicable products should be displayed and the discount already in the price (the product page will show "Using voucher code ..."

If still no joy i'd be happy to take a look at your site in more detail - if you email me the details I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Mon, 2019-03-25 20:18

Now it's time for the new import

Thank you very much!