Overview

Cette classe (helper) permet de créer autant de boutons Paypal que vous le voulez en mettant dans le fichier de base les paramètres nécessaires.

Installation

Télécharger et décompresser le fichier paypal-helper.zip
Copier le fichier (après modifications) "paypal.php" dans votre dossier "frog09x\frog\helpers"

Utilisation

Vous devez éditer le fichier paypal.php une fois, de la ligne 86 à la ligne 103, pour régler les paramètres par défaut. Lorsque c'est afit, transférez votre fichier paypal.php dans le dossier helpers de votre installation.

function PayPalButton() {
	//set up some defaults
	$this->accountemail = 'oweb@office-web.net';
	$this->currencycode = 'EUR';
	$this->amount = '0.00';
	$this->custom = '';
	$this->items = array();
	$this->subscriptions = array();
	$this->target = '';
	$this->target_text = '';
	$this->image = '';
	$this->buttonimage = '';
	$this->buttontext = 'Purchase';
	$this->askforaddress = true;
	$this->ipn_url = 'http://frog.office-web.net';
	$this->return_url = 'http://frog.office-web.net/thankyou.php';
	$this->cancel_url = 'http://frog.office-web.net/cancel.php';
	$this->class = 'button';
	$this->width = '';
	$this->askfornote = true;
}

Vous devez ajouter le code suivant dans votre page ou votre gabarit

<?php use_helper('paypal'); ?>

il est alors possible d'ajouter un ou plusieurs boutons pour acheter vos objets ou abonnements... voir les démos...

Ajouter un objet

Options minimum pour un bouton :

<?php
$button = new PayPalButton;
$button->AddItem('My item name','1','45.00','wsc002','1.00','1.00','3.00','0.00','Colour','Red and no stripes','Size','xl :)');
$button->OutputButton();
?>
Si vous ajoutez un paramètre (avec une valeur différente du fichier paypal.php) à votre bouton, les valeurs par défaut seront remplacées par les nouvelles.

Eléments

Les boutons Paypal sont différents si vous vendez un ou plusieurs éléments. Cette classe règle le problème pour vous.
Syntaxe : $button->AddItem(nom,quantité,prix,référence,expédition,expédition2,handling,taxe);
Voici quelques exemples :

  $button->AddItem('Item Name','1','100.00','wsc001');     //  Nom, quantité, prix, référence, taxe par défaut.
  $button->AddItem('Item Name','1','100.00','wsc001','','','','0.00');     //  Nom, quantité, prix, référence, pas de frais d'expédition, pas de manutention, PAS DE TAXE
  $button->AddItem('Item Name','3','100.00','wsc001','10.00');     //  Nom, quantité, prix, référence,  10.00€ d'expédition, taxe par défaut.
Plus d'exemples dans le fichier readme.txt

Téléchargement

Paypal button generator (283 fois)

Overview

This class helps you to insert one or more custom Paypal buttons.

Installation

Download and unzip the paypal-helper.zip file
Copy (after customisation) the "paypal.php" file in your "frog09x\frog\helpers" directory

Usage

You need to edit the paypal.php file just once, from line 86 to line 103, to define the default settings. When you're finished, upload the paypal.php file to your helpers directory.

function PayPalButton() {
	//set up some defaults
	$this->accountemail = 'oweb@office-web.net';
	$this->currencycode = 'EUR';
	$this->amount = '0.00';
	$this->custom = '';
	$this->items = array();
	$this->subscriptions = array();
	$this->target = '';
	$this->target_text = '';
	$this->image = '';
	$this->buttonimage = '';
	$this->buttontext = 'Purchase';
	$this->askforaddress = true;
	$this->ipn_url = 'http://frog.office-web.net';
	$this->return_url = 'http://frog.office-web.net/thankyou.php';
	$this->cancel_url = 'http://frog.office-web.net/cancel.php';
	$this->class = 'button';
	$this->width = '';
	$this->askfornote = true;
}

You must add this code to your page or layout

<?php use_helper('paypal'); ?>

then you can add your button(s) to buy one or more items or subscribe... like the demos...

Add an item

Minimum to have a button:

<?php
$button = new PayPalButton;
$button->AddItem('My item name','1','45.00','wsc002','1.00','1.00','3.00','0.00','Colour','Red and no stripes','Size','xl :)');
$button->OutputButton();
?>
If you add the same parameter (with new value) to your new button, your new value will be used.

Items

Paypal buttons are different when you're selling 1 item and anything more than 1 item. This class takes care of this for you.
Syntax: $button->AddItem(item_name,quantity,price,item_code,shipping,shipping2,handling,tax);
Here are a few examples:

  $button->AddItem('Item Name','1','100.00','wsc001');     //  1 quantity, default shipping, default handling, default tax.
  $button->AddItem('Item Name','1','100.00','wsc001','','','','0.00');     //  1 quantity, no shipping, no handling, NO TAX
  $button->AddItem('Item Name','3','100.00','wsc001','10.00');     //  3 quantities, $10.00 shipping, default handling, default tax.
More examples in the readme.txt file

Download

Paypal button generator (283 fois)

Paypal Button generator by JC21 - http://blog.jc21.com/?s=paypal
VERSION 1.1

Achat avec les paramètres de base

<?php
$button1 = new PayPalButton;
$button1->custom = 'my custom passthrough variable';
$button1->buttontext = 'Buy NOW';
$button1->AddItem('Item Name','1','100.00','wsc001','2.00','1.00','5.00','0.00','Colour','Red with White stripes','Size','One size fits all :)');
$button1->OutputButton();
?>

Achat bouton 2

<?php
$button2 = new PayPalButton;
$this->askforaddress = true;
$button2->AddItem('Achat 2','1','45.00','wsc002','1.00','1.00','3.00','0.00','Couleur','Rouge et sans rayure','Taille','Enorme :)');
$button2->OutputButton();
?>

A Multiple Item Purchase (shopping cart)

<?php
$button3 = new PayPalButton;
$button3->accountemail = 'jason@almost-anything.com.au';
$button3->custom = 'my custom passthrough variable';
$button3->currencycode = 'AUD';
$button3->image = 'http://www.jc21.com/paypal/logo.jpg';
$button3->buttontext = 'Buy all the items';
$button3->askforaddress = false;
$button3->return_url = 'http://www.jc21.com/';
$button3->ipn_url = 'http://www.jc21.com/';
$button3->cancel_url = 'http://www.jc21.com/';
$button3->AddItem('Item Name1','1','100.00','wsc001','2.00','1.00','5.00','0.00','Colour','Red with White stripes','Size','One size fits all :)');
$button3->AddItem('Item Name2','1','10.00','wsc002');
$button3->AddItem('Item Name3','1','120.00','wsc003','','','','0.00');
$button3->AddItem('Item Name4','3','110.00','wsc004','10.00');
$button3->OutputButton();
?>

Transactions are made every month

<?php
$button4 = new PayPalButton;
$button4->accountemail = 'jason@almost-anything.com.au';
$button4->custom = 'my custom passthrough variable';
$button4->currencycode = 'AUD';
$button4->image = 'http://www.jc21.com.au/paypal/logo.jpg';
$button4->buttontext = 'Subscribe now';
$button4->askforaddress = false;
$button4->return_url = 'http://www.almost-anything.com.au/index.php';
$button4->ipn_url = 'http://www.almost-anything.com.au/index.php';
$button4->cancel_url = 'http://www.almost-anything.com.au/index.php';
$button4->AddSubscription('My Subscription','10.00','SUB100',1,'M');
$button4->OutputButton();
?>


Cancel Subscription

<?php
$cancellink = new PayPalButton;
$cancellink->accountemail = 'jason@almost-anything.com.au';
$cancellink->buttontext = 'Cancel Subscription';
$cancellink->OutputSubscriptionCancel();
?>

Commentaires

0 comments