You are here:  » Correct format for custom buy url

Support Forum



Correct format for custom buy url

Submitted by thelegacy on Thu, 2011-03-31 03:19 in

Hi David,

I was working at a custom page for my buy url (jump.php) page, does this code look correct to you below?

  require("includes/common.php");
  $sql = "SELECT filename,buy_url,name FROM `".$config_databaseTablePrefix."products` WHERE id=".database_safe($_GET["id"]);
  database_querySelect($sql,$rows);
  $product = $rows[0];
  $sql = "UPDATE `".$config_databaseTablePrefix."feeds` SET clicks=clicks+1 WHERE filename = '".$product["filename"]."'";
  database_queryModify($sql,$insertID);
  $product["buy_url"] = $product["buy_url"]."&clickref=".urlencode($product["name"]);
  print "<html>";
  print "<head>";
  print "<meta http-equiv='refresh' content='5; url=".$product["buy_url"]."' />";
  print "<link media='all' href='/css/cafe.css' type='text/css' rel='stylesheet' />";
  print "</head>";
  print "<body>";
  print "<div id='page_wrap'>";
  print "<div id='header'><h1> </h1>";
  print "<div class='banner'>";
  print "";
  print "</div>";
  print "</div>";
  print "<div id='header_nav'>";
  print "<div class='nav'>";
  print "<a href='/'>Home</a> <span>Shop By:</span> <a href='/brand/'>Brand</a> <a href='/category/'>Category</a> <a href='/merchant/'>Merchant</a> <span>Site Info:</span> <a href='/publish/'>Blog</a> <a href='/publish/contact-us'>Contact Us</a> <a href='/publish/about/privacy'>Privacy</a> <a href='/publish/partner-links'>Partners</a>";
  print "</div>";
  print "<div class='search'>";
  print "<form id='searchform' name='search' action='/search.php'><input type='text' tabindex='1' name='q' id='q' size='35' value='' class='field' /><input type='submit' value='Search' class='submit' /></form>";
  print "</div>";
  print "</div>";
  print "<div class='clear'></div>";
  print "<div id='content_wrap'>";
  print "<div class='main_col'>";
  print "<p>Thank you for using xxxxxxxxxx.</p>";
  print "<p><img src='/img/progress.gif' width='31' height='31' alt='progress.gif' border='0'></p>";
  print "<p>For Safe and Secure Ordering, You will now be redirected to the <strong>".$product["merchant"]."</strong> website to complete your purchase.<br /><a href='".$product["buy_url"]."'>Click here</a> if you are not automatically redirected within a few seconds.<br />Thank You and Come Again!</p>";
  print "</div>";
  print "</div>";
  print "</div>";
  print "</body>";
  print "</html>";

Just wanted to be sure I've the correct coding in place for the merchant buy url, and the merchant name before I implement it, it does appear to work thus far, other than the merchant name showing, thought I'd double check as I'm running this on the latest distribution.

Thanks in advance,

Ray

Submitted by support on Thu, 2011-03-31 08:03

Hello Ray,

All you'd need to do is add merchant to the list of fields in the SELECT SQL, that's all! In place of:

  $sql = "SELECT filename,buy_url,name FROM `".$config_databaseTablePrefix."products` WHERE id=".database_safe($_GET["id"]);

use:

  $sql = "SELECT filename,buy_url,name,merchant FROM `".$config_databaseTablePrefix."products` WHERE id=".database_safe($_GET["id"]);

And then merchant will display wherever you have used $product["merchant"]...

Cheers,
David.
--
PriceTapestry.com

Submitted by thelegacy on Fri, 2011-04-01 01:30

Thanks once again David :)