You are here:  » Buy Now Button


Buy Now Button

Submitted by Andrew2011 on Tue, 2012-05-29 11:36 in

Hi David

How do you create a buy now button? or can you remove product review and more information link and replace it with a buy now button and the voucher code for that merchant?

Kind regards
Andrew

Submitted by support on Tue, 2012-05-29 12:57

Hello Andrew,

Sure - the first thing you will need to do is enable level 2 voucher codes integration; where discounts are calculated and the voucher code field in the database populated at import time. To do this, changed line 41 in config.advanced.php as follows:

  $config_useVoucherCodes = 2;

With that in place, you can change the single merchant case in html/searchresults.php as follows - look for the following code beginning at line 27:

          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>

...and REPLACE with something like this; adjustable of course depending on how you wish to lay it out:

          <?php else: ?>
            <?php if ($product["voucher_code"]): ?>
              Voucher Code: <strong><?php print $product["voucher_code"]; ?></strong>
              <br />
            <?php endif; ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print tapestry_buyURL($product); ?>'>Buy Now</a>
            </span>
          <?php endif; ?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Andrew2011 on Tue, 2012-05-29 16:34

Hi David

Which Code is for the buy now button ?

Cheers

Submitted by support on Tue, 2012-05-29 17:00

Sorry Andrew,

...the replacement described above will just display "Buy Now" as text, from this line:

<span class='nobr'><a href='<?php print tapestry_buyURL($product); ?>'>Buy Now</a></span>

...but if you want that to be a button (image link), first upload a suitable image to your /images/ folder e.g.

/images/buynow.gif

...and then replace that line with:

<span class='nobr'><a href='<?php print tapestry_buyURL($product); ?>'><img border='0' src='<?php print $config_baseHREF."images/buynow,gif"?>' /></a></span>

Cheers,
David.
--
PriceTapestry.com

Submitted by Andrew2011 on Thu, 2012-05-31 07:21

Hi David

Were do I put the buy now code? is it in Index.php

Cheers
Andrew

Submitted by support on Thu, 2012-05-31 08:03

Hi Andrew,

The changes above all relate to html/searchresults.php

Cheers,
David.
--
PriceTapestry.com

Submitted by Andrew2011 on Sat, 2012-06-09 19:34

Hi David

Where do I place this code in the searchresults.php?

Cheers
Andrew

Submitted by support on Sun, 2012-06-10 09:37

Hi Andrew,

I've merged the image Buy Now button instead of text link with the original replacement described in the first reply - use the following code to replace the section described. If you're not sure; email me your existing html/searchresults.php and I'll add the code for you...

          <?php else: ?>
            <?php if ($product["voucher_code"]): ?>
              Voucher Code: <strong><?php print $product["voucher_code"]; ?></strong>
              <br />
            <?php endif; ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print tapestry_buyURL($product); ?>'><img border='0' src='<?php print $config_baseHREF."images/buynow,gif"?>' /></a></span>
          <?php endif; ?>

Cheers,
David.
--
PriceTapestry.com