Wizards Toolkit Documentation

Ecommerce.php

This contains all Wizards 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

wzPayPalOneItem()  : html
wzPayPalOneItem
wzShoppingCart()  : html
Shopping Cart
wzViewCart()  : html
View Cart
wzBuyNow()  : html
Buy Now
wzBuyRedir()  : html
Buy Redirect
wzSubscribePayPal()  : html
Pass in parameters to create a PayPal Subscribe button
wzUnSubscribePayPal()  : html
Creates Unsubscribe button for PayPal

Functions

wzPayPalOneItem()

wzPayPalOneItem

wzPayPalOneItem(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 main.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 /wz/js/wzClientVars.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 /wz/js/wzClientVars.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

wzShoppingCart()

Shopping Cart

wzShoppingCart(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

wzViewCart()

View Cart

wzViewCart() : html

Will want to do something like this: wzSearchReplace(' ', wzViewCart());

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

wzBuyNow()

Buy Now

wzBuyNow(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

wzBuyRedir()

Buy Redirect

wzBuyRedir( 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 wzBuyNow and then submits it to PayPal

wzSubscribePayPal()

Pass in parameters to create a PayPal Subscribe button

wzSubscribePayPal( 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

wzUnSubscribePayPal()

Creates Unsubscribe button for PayPal

wzUnSubscribePayPal() : 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