You are here:  » Vouchers code Problem

Support Forum



Vouchers code Problem

Submitted by technoarenasol on Tue, 2012-09-25 10:40 in

Hello David

I am use following code for vouchers code but not appearing in price compare table

<td>
<?php if ($product["voucher_code"]): ?>
<small>using voucher code:</small><br />
<strong><?php print $product["voucher_code"]; ?></strong><br />
<?php endif; ?>
</td>

This is correct or not ??? Thanks you

Submitted by support on Tue, 2012-09-25 12:32

Hi technoarenasol,

Yes that's fine - it's the distribution code. It will only display a voucher code where one exists for the product so double check that a voucher code that you have entered in the /admin/ area is valid today and for the product that you are looking at.

If you are not sure; when you have entered vouchers; you can browse to

/vouchers.php

...and then click on a valid voucher and you get search results for all products that are valid for that voucher code; then you can click the product to go to the product page where you should then see the voucher code in the price comparison table...

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Tue, 2012-09-25 19:05

technoarenasol

David actually I am edit code of products.php page so which code require for vouchers

Submitted by support on Tue, 2012-09-25 19:10

Hi technoarenasol,

It is this code in products.php that is crucial for Voucher Codes:

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

(search on $config_useVoucherCodes)

If you don't find that, compare your modified version to the latst distribution version to see where it should go...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Tue, 2012-09-25 19:14

for easy reference I send you Full code of product.php

{code saved}

Submitted by support on Wed, 2012-09-26 07:49

Thanks technoarenasol,

I see you are using a custom file html/product1.php (presumably in place of html/product.php and html/prices.php) - please could you post that file; and if possible a link to the page where the voucher code is not being displayed (I'll remove before publishing your reply...)

Thanks,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Wed, 2012-09-26 12:57

technoarenasol

This is Product1.php and Price.php main coode
{code saved}

Submitted by support on Wed, 2012-09-26 13:58

Hi technoarenasol,

Everything looks fine - if there is a voucher code it should display!

Please could you post a link to your vouchers.php page and a product page that should be showing a voucher code but is not e.g.

http://www.example.com/vouchers.php
and
http://www.example.com/product/Product-Name.html

(i'll remove your links before publishing your reply)

...and I'll take a look for you...

Thanks,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Wed, 2012-09-26 20:04

technoarenasol

{link saved}

Submitted by support on Thu, 2012-09-27 08:22

Hi

I think I can see what's going on - i'll follow up by email as I'd like to check the voucher code configuration in your /admin/ area...

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2012-09-27 13:57

technoarenasol

Hi David.Vouchers code now working ..Actually problem in Capital and Small latter URL of category and merchant..

Some URL Example

http://example.com/mobile/search.php?q=nokia&categoryFilter[]=Mobile
http://example.com/mobile/search.php?q=nokia&categoryFilter[]=Mobile&merchantFilter[]=Homeshop18

So In Mobile Word First latter is capital :

So Can You Possible Convert automatically into small convert(whatever in feed.Its may be Capital latter or Small latter )

We need like
http://example.com/mobile/search.php?q=nokia&categoryFilter[]=mobile

Also Convert product page URL into latter

http://example.in/mobile/product/Nokia-BL-4J-NEW-Battery.html
http://example.in/mobile/product/nokia-bl-4j-new-battery.html (seo friendly URL)

Submitted by support on Thu, 2012-09-27 14:04

Hi,

To make filter values lowercase all the time, in your modified html/searchresults.php look for each line where the checkboxes are generated - search for

type='checkbox'

(one for each of merchant, category and brand filters)

Within that line, taking the merchant filter as an example, you'll find where the filter value is output using the variable:

$row["merchant"]

Simply REPLACE that with:

strtolower($row["merchant"])

(and same for category and brand).

To make your product page URLs lower case, in includes/tapestry.php look for the following code at line 53:

return $config_baseHREF."product/".urlencode(tapestry_hyphenate($product["normalised_name"])).".html";

...and REPLACE with:

return $config_baseHREF."product/".urlencode(tapestry_hyphenate(strtolower($product["normalised_name"]))).".html";

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Sat, 2012-09-29 08:44

technoarenasol

Thnx David .Its work now
On Product page only display only "using voucher code :(coupon code)"

But we want to display like "Get Rs. 200.00 on above Rs. 500.00 using voucher code 8d6kcm

Submitted by support on Mon, 2012-10-01 07:25

Hi,

Since the function that applies voucher codes overwrites the price field with the discounted price first you'd have to keep a copy of the original price in the product record. To do this, look for the following code at line 235 of includes/tapestry.php

          $products[$k]["price"] = $product["discount_price"];

...and REPLACE with:

          $products[$k]["original_price"] = $products[$k]["price"];
          $products[$k]["price"] = $product["discount_price"];

Next, in place of the section of code that displays the voucher code (from your first post in this thread), replace that with something like:

<td>
<?php if ($product["voucher_code"]): ?>
<small>Get Rs. <?php print sprintf("%.2d",($product["original_price"]-$product["price"])); ?> on above Rs. <?php print $product["original_price"]; ?> using voucher code:</small><br />
<strong><?php print $product["voucher_code"]; ?></strong><br />
<?php endif; ?>
</td>

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Mon, 2012-10-01 18:39

technoarenasol

Hi Its Working David..But its Display some wrong information

Get Rs. 200 off on above Rs. 5990.00 using voucher code: 8d6kcm

and original : Get Rs. 200 off on above Rs. 500.00 using voucher code: 8d6kcm

Submitted by support on Tue, 2012-10-02 09:56

Hi,

I had used the wrong format in sprintf() sorry about that - have a go with:

<td>
<?php if ($product["voucher_code"]): ?>
<small>Get Rs. <?php print sprintf("%.2f",($product["original_price"]-$product["price"])); ?> on above Rs. <?php print $product["original_price"]; ?> using voucher code:</small><br />
<strong><?php print $product["voucher_code"]; ?></strong><br />
<?php endif; ?>
</td>

...however I can't immediatly see why the original_price is incorrect - can you confirm that 5990.00 should be 500.00 in the above example?

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Fri, 2012-10-05 18:04

technoarenasol

Hi David..We only want to display minimum spending amount and Discount amount

Submitted by support on Sun, 2012-10-07 09:30

Hi technoarenasol,

Ah my apologies so you want to the normal voucher discount text to be displayed; not specific values relating to the particular product.... OK that can be done. First, undo the above modifications to includes/tapestry.php so that now in place of the following code at line 25:

      $products[$k]["price"] = $product["discount_price"];

...you now have:

      $products[$k]["price"] = $product["discount_price"];
      switch($voucher["discount_type"])
      {
        case "#":
          $products[$k]["voucher_text"] = translate("Save")." ".$config_currencyHTML.$voucher["discount_value"];
          break;
        case "%":
          $products[$k]["voucher_text"] = translate("Save")." ".$voucher["discount_value"]."%";
          break;
        case "S":
          $products[$k]["voucher_text"] = $voucher["discount_text"];
          break;
      }
      if ($voucher["min_price"] > 0)
      {
        $products[$k]["voucher_text"] .= " ".translate("when you spend")." ".$config_currencyHTML.$voucher["min_price"];
      }
      if ($voucher["match_value"])
      {
        $products[$k]["voucher_text"] .= " ".translate("on selected products");
      }
      $products[$k]["voucher_text"] .= " ".translate("using voucher code")." <strong>".$voucher["code"]."</strong>";

And then in html/prices.php, as your voucher code table cell:

<td>
<?php
  if ($product["voucher_code"])
  {
    print "<small>".$product["voucher_text"]."</small>";
  }
?>
</td>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com