You are here:  » Voucher Codes - Exact name display, displaying codes on merchant profile and Selected Products Link


Voucher Codes - Exact name display, displaying codes on merchant profile and Selected Products Link

Submitted by bat on Sat, 2013-04-13 19:57 in

Hi David
I've got a few things I'd like to implement which I wonder if you can help with, please.

1. I'd like the Product/Category/Brand name to be displayed on vouchers.php instead of 'selected products' text, only if the name is an EXACT match (not keyword match).

2. For 'Selected Products' text on the vouchers.php, I'd like it to be a link taking users to the page of the applicable products, just like the merchant name does.

3. I'd like to display the applicable voucher codes on a merchants 'profile', i.e. http://www.example.com/merchant/thismerchant I already have info pages set up for them where I can insert text, so just looking for some code where it'll display the applicable codes for that merchant.

Thanks very much, David!

Submitted by support on Sun, 2013-04-14 09:30

Hi bat,

Re: 1/2/
In vouchers.php look for the following code at line 45:

      if ($voucher["match_value"])
      {
        $vouchers[$k]["text"] .= " ".translate("on selected products");
      }

This is where you could embellish the description using the `match_field` value together with `match_field`. Have a go with something like:

      if ($voucher["match_value"] && ($voucher["match_type"]=="exact") )
      {
        $vouchers[$k]["text"] .= " <a href='".$vouchers[$k]["href"]."'>".$voucher["match_value"]."</a>";
      }
      elseif ($voucher["match_value"])
      {
        $vouchers[$k]["text"] .= " <a href='".$vouchers[$k]["href"]."'>".translate("on selected products")."</a>";
      }

Re: 3/
This can be done by starting with a copy of vouchers.php saved as merchantvouchers.php. Do this after making the above mod. Then, in the new file, DELETE every line beginning "require", except for:

  require("html/coupons.php");

Then, in the line that constructs the SQL, search for

ORDER BY merchant

...and REPLACE with:

AND merchant = '".database_safe($merchantName)."'

Then, all you need to do is in your merchant text, is call in the new file using:

<?php
  $merchantName 
"Merchant Name":
  require(
"merchantvouchers.php");
?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Tue, 2013-04-16 08:46

Hi David
Thank you so much! The first two parts work a treat, but I think I may have done something wrong in the third. Am I ok to send you my merchantvouchers.php ?

Submitted by support on Tue, 2013-04-16 08:50

Sure!

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Sun, 2020-04-26 12:01

Hi David,
I'm using the l5/09A revision and I'm using admin method to create custom description/meta for my merchant/brand pages.

I've tried doing the above but I think the php is being commented out if I post it in the admin section.

Could I hardcode it somewhere, guessing searchresults.php so that it appears above the search results but under my merchant description, and obviously pulls in the correct merchant name for the page it's on.

<?php
  $merchantName = "Merchant Name":
  require("merchantvouchers.php");
?>

thank you.

Submitted by support on Mon, 2020-04-27 07:25

Hi,

Sure - if you add at the top of html/searchresults.php below the PHP section that shows your description for example;

<?php
  
if (($parts[0]=="merchant") && ($rewrite) && ($page==1))
  {
    
$merchantName $parts[1];
    require(
"merchantvouchers.php");
  }
?>

(or leave out the PHP tags and merge with the existing code)

The ($rewrite) and ($page==1) conditions will make the content show for page 1 / default sort (which is the case when using rewrite) which is normally suggested for description etc. to avoid duplicate content issues however if you wanted the vouchers to show on every page for merchant search results just use...

<?php
  
if ($parts[0]=="merchant")
  {
    
$merchantName $parts[1];
    require(
"merchantvouchers.php");
  }
?>

Cheers,
David.
--
PriceTapestry.com