Saturday, January 15, 2011

PHP Shopping Page v2.0

Last time I showed you a script to make a simple PHP Shopping page using just PHP and your AlertPay account. There were some glitches in them including you had to add/change the link to your download page manually on your product page. So I made a small file dbase.js to act as a database to hold all the data about your product. So all you have to do is paste a link like
<script type="text/javascript" src="dbase.js"></script>
on your product/ gallery page and it'll make a neat display of all your scripts along with their names, thumbs, author's name and prices.
Here is the script

// DBase Script (part of PHP Shopping Page Script)
// © Copyright, Design
  // Script written by Tanmay Das

// Name of the files, Name of the Template to be shown, Name of the Author, prices

  'H5p9O33k7Uf5','Name of the Template','Tanmay Das','18','20',

function listDisplay(dataArr)
  var furl, name, author, r1, r2, l, v;
  v = 5;
  l = (dataArr.length / v)-(dataArr.length / v);
  furl = dataArr[l * v];
  name = dataArr[(l * v)+1];
  author = dataArr[(l * v)+2];
  r1 = dataArr[(l * v)+3];
  r2 = dataArr[(l * v)+4];

  document.write('<div style="float:left; margin-right:10px; margin-top:5px; margin-bottom:5px;">');
  document.write('<table width="200" border="0" cellspacing="0" cellpadding="0">');
  document.write('<tr><td><img src="thumbs/'+furl+'.jpg" width="200" height="150" /></td></tr>');
  // thumbnails are in thumbs folder
  document.write('<tr><td width="53">Author : '+author+'</td></tr>');
  document.write('<tr><td>Price : $'+r1+'</td></tr>');
  document.write('<tr><td><a href="');
  document.write('id='+furl+'&amp;name='+name+'&amp;aut='+author+'&amp;r1='+r1+'&amp;r2='+r2+'" target="_self">');
  document.write('<tr><td><a href="');
  document.write('id='+furl+'&amp;name='+name+'&amp;aut='+author+'&amp;r1='+r1+'&amp;r2='+r2+'" target="_self">');
  document.write('<img src="buy_small.gif" width="115" height="27" border="0" /></a></td></tr>');

Go to to watch it working.

Now use it as you want but please credit me for my work.
P.S.- Remember to make it simple I used the same variable for all the files.
Meaning, if you are selling a template, the name of the thumbnail image, screenshot image and .zip file which people will download should be the same. e.g.- H5p9O33k7Uf5.
You can use a randomizer script to make cryptic names for your files.

No comments:

Post a Comment