Wizard’s Toolkit Documentation

Ecommerce.php

This contains all Wizard’s Toolkit functions that involve ecommerce.

All rights reserved.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tags
author
Programming Labs
license
All rights reserved
version
2.0

Table of Contents

wtkPayPalOneItem()  : html
wtkPayPalOneItem
wtkShoppingCart()  : html
Shopping Cart
wtkViewCart()  : html
View Cart
wtkBuyNow()  : html
Buy Now
wtkBuyRedir()  : html
Buy Redirect
wtkSubscribePayPal()  : html
Pass in parameters to create a PayPal Subscribe button
wtkUnSubscribePayPal()  : html
Creates Unsubscribe button for PayPal

Functions

wtkPayPalOneItem()

wtkPayPalOneItem

wtkPayPalOneItem(string $fncItemName, decimal $fncPrice, string $fncPage[, string $fncDescription = '' ][, string $fncThanks = '' ][, string $fncSKU = '' ]) : html

This uses 2021 JS code that PayPal recommends using paypal-js. Must include in spa.htm like:

<script type="text/javascript" src="https://unpkg.com/@paypal/paypal-js@4.1.0/dist/iife/paypal-js.min.js" defer></script>

gloPayPalClientId must be defined in /wtk/js/wtkClientVars.js with your PayPal ClientID in order for this to work.

Parameters
$fncItemName : string

Name of the item being sold

$fncPrice : decimal
$fncPage : string

this is passed to JS function wtkPayPal which passes it to cliPayPal cliPayPal is defined in /wtk/js/wtkClientVars.js for your custom coding

$fncDescription : string = ''

optional, defaults to blank

$fncThanks : string = ''

optional: custom thanks message to show after successful purchase

$fncSKU : string = ''

optional

Return values
html

with JavaScript for PayPal to show purchase buttons

wtkShoppingCart()

Shopping Cart

wtkShoppingCart(string $fncItemName, string  $fncItemUID, mixed  $fncSKU, string $fncPrice , string  $fncShipping[, string $fncCost = '0' ] ) : html

Called from BrowsePDO function if gloMoreButtons includes: $gloMoreButtons = array(
'Ecommerce' => array(
'act' => 'ShoppingCart',
'img' => 'arrow-right'
)
);

This code was written in 2011 and should be retested to verify PayPal has not changed.

Parameters
$fncItemName : string
$fncItemUID : string
$fncSKU : mixed
$fncPrice : string
$fncShipping : string
$fncCost : string = '0'

optional: defaults to 0

Return values
html

with form for PayPal to add an item to a Shopping Cart

wtkViewCart()

View Cart

wtkViewCart() : html

Will want to do something like this: wtkSearchReplace('<!-- @MoreButtons@ -->', wtkViewCart());

This code was written in 2011 and should be retested to verify PayPal has not changed.

Return values
html

with form for PayPal View Cart functionality

wtkBuyNow()

Buy Now

wtkBuyNow(string  $fncItemName, string $fncPrice[ , string  $fncItemUID = '' ] [, mixed $fncSKU = '' ] [, string  $fncShipping = '0' ] [, string $fncShippingRequired = 'N' ] ) : html

Pass in parameters to create a PayPal BuyNow button. This code was written in 2011 and should be retested to verify PayPal has not changed.

Parameters
$fncItemName : string
$fncPrice : string
$fncItemUID : string = ''

Defaults blank, can be used for Inventory Droplist options (currently disabled)

$fncSKU : mixed = ''
$fncShipping : string = '0'

cost to be appended - defaults to 0

$fncShippingRequired : string = 'N'

defaults to 'N'; set to 'Y' if shipping is required

Return values
html

with form for PayPal Buy Now button and functionality

wtkBuyRedir()

Buy Redirect

wtkBuyRedir( string  $fncItemName, string $fncPrice [, string  $fncItemUID = '' ] [, mixed $fncSKU = '' ][ , string $fncShipping = '0' ] ) : html

Pass in parameters to create a PayPal BuyNow set of form fields then auto-submit those to go to PayPal page This can replace the BuyNow button function when additional processing needs to be done before posting to PayPal. The exact sampe parameters are used as the BuyNow button

Parameters
$fncItemName : string
$fncPrice : string
$fncItemUID : string = ''

Defaults blank, can be used for Inventory Droplist options (currently disabled)

$fncSKU : mixed = ''
$fncShipping : string = '0'

cost to be appended - defaults to 0

Return values
html

with full page that includes wtkBuyNow and then submits it to PayPal

wtkSubscribePayPal()

Pass in parameters to create a PayPal Subscribe button

wtkSubscribePayPal( string  $fncItemName, string $fncPrice [, string  $fncItemUID = '' ][, string  $fncFrequency = 1 ] [, string  $fncTerm = 'M' ] [, string  $fncBtnType = 'CC_LG' ]) : html

Pass in parameters to create a PayPal BuyNow button. This code was written in 2013 and should be retested to verify PayPal has not changed.

Parameters
$fncItemName : string
$fncPrice : string
$fncItemUID : string = ''

Defaults blank, can be used for Inventory Droplist options (currently disabled)

$fncFrequency : string = 1

defaults to 1

$fncTerm : string = 'M'

defaults to 'M' for monthly

$fncBtnType : string = 'CC_LG'

defaults to CC_LG

Return values
html

with form for PayPal Subscribe button and functionality

wtkUnSubscribePayPal()

Creates Unsubscribe button for PayPal

wtkUnSubscribePayPal() : html

Uses PayPal email address defined in wtkServerInfo.php. This code was written years ago and should be retested.

Tags
global

string $gloPayPalEmail

Return values
html

for PayPal Unsubscribe button

Search results