You are here:  » Voucher codes don't appear


Voucher codes don't appear

Submitted by Retro135 on Mon, 2015-09-07 21:18 in

I thought I carefully followed your voucher instructions on http://www.pricetapestry.com/node/3688, but no voucher codes appear. I did allow in config.advanced with 2 as I'm importing daily. Just trying one feed at the moment, so only one network's codes appear. Here is a link where code should appear (actually 2 for this one, % off + free ship):

{link saved}

After I registered and listed in admin, should "vouchers" table be populated? It isn't.

Also followed instructions here:
http://www.pricetapestry.com/node/5590
http://www.pricetapestry.com/node/5259

(And tried w/o)

And this is in tapestry.php

      if ($config_useVoucherCodes === 1)
      {
        $rows = tapestry_applyVoucherCodes($rows);
      }

Submitted by support on Tue, 2015-09-08 09:21

Hi,

Voucher code feeds are only used to assist in setting up codes, so just registering a voucher code feed and then listing won't be enough to populate anything in the voucher codes table.

What you need to do is from the List page of a voucher code feed, choose a code that you wish to add to your site and click Add. This will take you to the voucher codes edit page where the script will attempt to pre-populate most of the field values based on an automatic interpretation of the description etc. Valid from / to dates should also be pre-set if you have mapped fields for Valid From and Valid to on Voucher Code Feed Registration Step 2.

After checking / completing the fields, click Save to create the voucher code on your site, and as you are using level 2 integration you should then perform an import of the associated feed, or wait for your next CRON process to take place.

You can then browse voucher codes on the front end by browsing to vouchers.php (so on your site which is in the /shops/ subdirectory, go to /shops/vouchers.php and you should see the new code listed, and the link to view qualifying products...

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Tue, 2015-09-08 17:03

Oops, I forgot to reimport feed after adding/saving. OK, changed to 1. Using only one merchant now so I can customize: {link saved}

1. Discount appears with decimal (as dollar) unless I use custom description. Any way to change that?

2. {link saved}

Need to customize to match rest of my site, so using "Other" for description. Where can I suppress additional automatic text after my text in bullet list at top: "when you spend $XXX.00 using coupon code ..." or "using voucher code ..."

2A. Need to add class to bullet list for styling (I already have class, can't find where to add it).

3. How to suppress voucher text in parens after "from Merchant" in description + under "Voucher Code" next to Buy button. (just leave code).

3A. Where to change "Voucher Code" in heading to "Coupon Code"...found other places, didn't find this one.

Submitted by support on Wed, 2015-09-09 09:22

> 1. Discount appears with decimal (as dollar) unless I use custom
> description. Any way to change that?

A $ value without decimals can be converted to decimals with a preg_replace call. In includes/coupons.php look for the following code around line 31:

<?php
 
print $voucher["text"]; 
?>

...and REPLACE with:

<?php
 
print preg_replace('/(\$[0-9]+)/','$1.00',$voucher["text"]); 
?>

(although the above code looks like it will just replace any price found with $1.00 the $1 is actually a back-reference to non-decimalised price matched by the regexp...!)

> 2. {link saved}
> Need to customize to match rest of my site, so using "Other" for
> description. Where can I suppress additional automatic text after
> my text in bullet list at top: "when you spend $XXX.00 using
> coupon code ..." or "using voucher code ..."

To suppress the auto-generated description where a textual description exists, edit vouchers.php and look for the following code at line 40:

  if ($voucher["min_price"] > 0)
  {
    $vouchers[$k]["text"] .= " ".translate("when you spend")." ".$config_currencyHTML.$voucher["min_price"];
  }
  if ($voucher["match_value"])
  {
    $vouchers[$k]["text"] .= " ".translate("on selected products");
  }
  $vouchers[$k]["text"] .= " ".translate("using voucher code")." <strong>".$voucher["code"]."</strong>";

...and REPLACE with:

  if ($voucher["discount_type"]=="S")
  {
    if ($voucher["min_price"] > 0)
    {
      $vouchers[$k]["text"] .= " ".translate("when you spend")." ".$config_currencyHTML.$voucher["min_price"];
    }
    if ($voucher["match_value"])
    {
      $vouchers[$k]["text"] .= " ".translate("on selected products");
    }
    $vouchers[$k]["text"] .= " ".translate("using voucher code")." <strong>".$voucher["code"]."</strong>";
  }

> 2A. Need to add class to bullet list for styling (I already have
> class, can't find where to add it).

The voucher codes list is displayed by html/coupons.php - look for the opening of the loop using:

<?php foreach($coupons["vouchers"] as $voucher): ?>

Each coupon is actually displayed using row/small-12 columns but this could be converted to a list if you preferred - start the list outside the foreach(...) line mentioned above, and close it beyond the corresponding <?php endforeach; ?> (line 49) and then modifying the output to use <li> ... </li> as required.

> 3. How to suppress voucher text in parens after "from Merchant" in
> description + under "Voucher Code" next to Buy button. (just leave code).

To remove the description edit includes/tapestry.php and look for the following code at line 236:

$product["voucher_code"] .= " (".$voucher["discount_text"].")";

...and either comment out or delete that line to leave just the code displayed. Note that the custom description field is really intended for non-discount offers e.g. "Free Shipping" so that the benefit of the code is displayed where no actual discount is applied...

> 3A. Where to change "Voucher Code" in heading to "Coupon Code"...found
> other places, didn't find this one.

It's in html/prices.php, displayed conditionally if there are voucher codes applicable to the price comparison table - look for the following;

<th><?php print translate("Voucher Code"); ?></th>

Cheers,
David.
--
PriceTapestry.com