4.5 Adding Products

After the partial configuration of the PayPal settings we have to take a look at the last new folder called 'Products'.

Opening that folder we will find each file for each product.
The filename is equal to the product Id.
So before editing one product file rename it, since the id is the filename.
Example :
The file productHX0001.php has ID productHX0001
The file productHX0002.php has ID productHX0002 and so on .
The ID should be unique for each product so it is good to have a progressive product number. If for some reason want a product ID 'p33HX11' then just rename the associated product file with that file name (p33HX11.php).

Now let's open the 'productHX0001.php' which happens to be our first product in this demo (FirstBook).
<?php 
//1. MODIFY PRODUCT INFORMATIONS
$Product['Name']='First Book';
$Product['Price']='5';
$Product['Currency']='USD'; //Possible values: USD , 
EUR ,  AUD , GBP , CAD , HKD , JPY
$Product['Filename']='ebook.zip';


//2. MODIFY YOUR 'BUY NOW' BUTTON FOR THIS PRODUCT. 
Copy it from PayPal.com 'Add a Buy Now button'.
$Product['ButtonLink'] = '
Substitute this string with the BUY NOW code that 
gives paypal.com or sandbox.paypal.com
';


//3. MODIFY RESPONCE MESSAGES
$Product['DownloadMessage'] = 'Download this product 
from here. (Max two attempts)';
$Product['ThanksMessage'] = 'Thanks for your 
purchase.<br>If you have download problems contact 
with us at company@email.com';
$Product['ErrorMessage'] = 'Your data does not match 
with the selected product.<br>Please contact with us 
at company@email.com';
$Product['ReturnToHomepage'] = 
'<a href="http://www.mysite.com"> 
Return to Mysite.com </a>';


//DO NOT MODIFY
$Product['id']=basename(__FILE__ , ".php");
?>
Here we have three sections :
  • Product information
  • Modify this information at your needs. Possible currecy values are : USD , EUR , AUD , GBP , CAD , HKD , JPY
    Please note that 'Filename' must be the correct filename product which is on the SecretDownloads path. In this case Filename is 'ebook.zip' If you go to SecretDownloads in the sub folders you will find the ebook.zip
  • The 'BUY NOW' button link for this product.
  • For now leave it as is. Later we will edit it.
  • Response messages
  • Modify them as you want.
As you can see like the PayPal settings we are unable to fill all the information because we have to take this data from PayPal. This will be done at the 'Going DEMO' chapter.



Copyright © TrustFm.net 1998-2024 - Made by TrustFm - All Rights Reserved Worldwide