classes/order_items/_template.php

Properties

Description

This is a "developer template" that documents most, if not all, of what an order item can do in the system.

Classes

_templateOrderItem

Properties

 
 
System  
No 
No 

Description

Developers: use this file as a template to create a new order item.
If this is a 3rd party order item, note that you can have order items inside of addons. See the examle addon, in the folder order_items in that addon.
Steps: 1. Rename the file to something that does not start with an underscore, all files that start with an underscore are ignored by the order item system. Pick something that will be unique to whatever the order item is, to prevent name collisions. 2. Rename the class name (below) to match the filename. For instance, if the filename is my_order_item.php, the class name needs to be my_order_itemOrderItem. Make sure you keep it so that it still extends the geoOrderItem class. 3. Change the class variable $type to match the filename, for instance if the filename is my_order_item.php, the line should read:
protected $type = "my_order_item"; 4. Change the class var $defaultProcessOrder to be a number that represents the order it will be processed, and order it will be displayed in various places. This is important, for instance if the defaultProcessOrder is higher than the defaultProcessOrder of the tax item, this item will not be used when calculating tax, and it will appear below the tax item when viewing the cart. It should normally need to be something below 1000 for any "normal" order items. 5. Implement each of the template functions below that will be used by this order item, and delete or comment out the functions that you know you will not need to use and that are marked as optional. Make sure you keep the required functions however (read the comments on each function). As a way to keep track of what you have finished, as you go once you have implemented a function, remove the TODO comment at the top of the function. 6. Only functions that are not implemented by the parent class geoOrderItem are in this template, but you are not limited to those functions, if you wish you can over-write any of the functions already implemented in geoOrderItem, for instance if you wanted to change the behavior of getCost(). Note: If a method is defined as static, that means it will be called statically by the system, so keep this in mind when implimenting each method.

Methods

Admin_site_display_user_data, Admin_user_management_edit_user_form, Admin_user_management_update_user_info, Admin_user_management_update_users_view, Order_processStatusChange, RecurringBilling_processPayment, User_management_home_body, User_management_information_display_user_data, adminDetails, adminItemDisplay, adminItemUpdate, adminPlanItemConfigDisplay, adminPlanItemConfigUpdate, adminRecurringDisplay, anonymousAllowed, auction_final_feesOrderItem_cron_close_listings, buy_now_close, copyListing, cron_close_listings, displayInAdmin, geoCart_cartDisplay_newButton, geoCart_deleteProcess, geoCart_getCartItemDetails, geoCart_initItem_forceOutsideCart, geoCart_initItem_new, geoCart_initItem_restore, geoCart_initSession_new, geoCart_initSession_update, geoCart_initSteps, geoCart_initSteps_addOtherDetails, geoCart_other_detailsCheckVars, geoCart_other_detailsDisplay, geoCart_other_detailsLabel, geoCart_other_detailsProcess, geoCart_previewDisplay, geoCart_setPricePlan, geoOrderItem_loadTypes_adoptions, geoOrderItem_loadTypes_obituary, geoOrder_processStatusChange_emailItemInfo, getActionName, getCostDetails, getDisplayDetails, getParentTypes, getRecurringDescription, getRecurringInterval, getRecurringPrice, getRecurringStartDate, getTypeTitle, isRecurring, listing_edit_getChoices, listing_insertListingFromSessionVars, my_account_links_newButton, processRemove, processRemoveData, processStatusChange, recurringBilling_cancel, recurringBilling_updateStatus,

Admin_site_display_user_data( int   $user_id, ) : string

Description

Show information about a user on the user info page in the admin.
**Optional.** **Used:** in Admin_site::display_user_data() (in file admin/admin_site_class.php) Can be used to display or gather information for a specific user, when viewing the user's details inside the admin. Useful for things like displaying a site balance, for example.

Arguments

Name Type Description Default
$user_id int

Return value

Type Description
string Text to add to page.

Admin_user_management_edit_user_form( int   $user_id, ) : string

Description

Display information about a user on the edit user form, in format to allow editing said information.
**Optional.** **Used:** in Admin_user_management::edit_user_form() (in file admin/admin_user_management_class.php) Can be used to display or gather information for a specific user, when on the page to edit user's information inside the admin. Useful for things like displaying and allowing edit a site balance, for example. Text returned will be inside of a form already, and when the form is submitted you can be notified via ___ function.

Arguments

Name Type Description Default
$user_id int

Return value

Type Description
string Text to add to page.

Admin_user_management_update_user_info( int   $user_id, ) : n/a

Description

Update user information in the admin panel.
**Optional.** **Used:** in Admin_user_management::update_users_view() (in file admin/admin_user_management_class.php) Used to update information about a user that may have been collected in Admin_site_display_user_data()

Arguments

Name Type Description Default
$user_id int

ID NOT VERIFIED at time this is called!

Return value

Type Description
n/a n/a

Admin_user_management_update_users_view( int   $user_id, ) : n/a

Description

Update information about the user in the admin panel.
**Optional.** **Used:** in Admin_user_management::update_users_view() (in file admin/admin_user_management_class.php) Used to update information about a user that may have been collected in Admin_site_display_user_data()

Arguments

Name Type Description Default
$user_id int

ID NOT VERIFIED at time this is called!

Return value

Type Description
n/a n/a

Order_processStatusChange( \geoOrder   $order, ) : n/a

Description

Perform some action at the time an order's status is changing.
**Optional.** **Used:** in geoOrder::processStatusChange This is *special case*, to allow doing something every time an order's status changes. **Do NOT use this in order to change the status of the order item**, instead see the processStatusChange() method for order items.

Arguments

Name Type Description Default
$order \geoOrder

Return value

Type Description
n/a n/a

RecurringBilling_processPayment( array   $vars, ) : n/a

Description

Perform some action at the time a recurring billing payment is being processed.
**Optional.** **Used:** in geoRecurringBilling::processPayment This is **special case**, to allow doing something every time a payment signal is received for recurring billing. Note that this is only called for transactions that are attached to a recurring billing and not any order This is notification, the return value is ignored.

Arguments

Name Type Description Default
$vars array

Associative array like array('recurring'=>geoRecurringBilling instance, 'transaction' => geoTransaction instance.

Return value

Type Description
n/a n/a

User_management_home_body( ) : n/a

Description

Use this to add a link to the My Account Links module (or old user management home page)
**Optional.** **Used:** in User_management_home::menu() Use this to add a link to the My Account Links module (or old user management home page)

Return value

Type Description
n/a n/a

User_management_information_display_user_data( ) : array

Description

Show information on the user information page under my account.
**Optional.** **Used:** in User_management_information::display_user_data() Use this to display info on the user info page. Stuff like displaying current account balance, tokens remaining, etc. This will appear below the price plan info

Return value

Type Description
array Associative array, with the structure array ('label' => 'Left side','value' => 'Right side')

adminDetails( ) : array

Description

Get the basic details for this order item, used when showing list of order items in admin.
**Optional**, but *required* if displayInAdmin() returns true. **Used:** in admin, display items in *Orders > Manage Items* (only for main items, not for sub-items) This should return an array containing details that will be used to display the order item in the list of order items. It is only used to show the item type and the item title, allowing to use a title based on something specific to the order item (for instance, a classified ad's title).

Return value

Type Description
array Associative array, in the form array ('type' => string, 'title' => string)

adminItemDisplay( int   $item_id, ) : string

Description

Display detailed informatino about this order item in the admin panel.
**Optional.** **Used:** In admin, when displaying an order item's details Return HTML for displaying or editing any information about this item, to be displayed in the admin. Should also call any children of this item. The other function that should work with this one, is adminItemUpdate, but note that this is not typical. Only time you would use adminItemUpdate is to allow the admin to apply changes directly to the order item. Note that the system already does 'built in' changes, like changing the status.

Arguments

Name Type Description Default
$item_id int

Return value

Type Description
string

adminItemUpdate( int   $item_id, ) : n/a

Description

Used to save changes to an item, any changes made possible with adminItemDisplay.
**Optional.** **Used:** *NOT currently used* - this functionality was never fully implemented. Used to save changes to details of an item in the admin. This is called using ajax, but any messages added using geoAdmin::message() will display to the client side.

Arguments

Name Type Description Default
$item_id int

Return value

Type Description
n/a n/a

adminPlanItemConfigDisplay( \geoPlanItem   $planItem, ) : string

Description

Shows the configuration for plan item settings in the admin panel.
**Optional.** **Used:** In admin, during ajax call to display config settings for a particular price plan item. If this method exists, a config button will be displayed beside the item, and when the config button is pressed, whatever this function returns will be displayed below the item using an ajax call.

Arguments

Name Type Description Default
$planItem \geoPlanItem

Return value

Type Description
string

adminPlanItemConfigUpdate( \geoPlanItem   $planItem, ) : bool

Description

Save any configuration changes for the plan item in the admin panel.
**Optional.** **Used:** In admin, during ajax call to update config settings for a particular price plan item. This is only used if adminPlanItemConfigDisplay() is used.

Arguments

Name Type Description Default
$planItem \geoPlanItem

Return value

Type Description
bool If return true, message "settings saved" will be displayed, if return false, message "settings not saved" will be displayed.

adminRecurringDisplay( \geoRecurringBilling   $recurringBilling, ) : array

Description

Display detailed information (possibly with editing options) about an item that is recurring billing capable.
**Optional.** **Used:** In admin, when displaying a recurring billing details Return HTML for displaying or editing any information about recurring billing, specific to this item type. Should also call any children of this item. The other function that should work with this one, is adminItemUpdate, for times that it is useful for the admin to edit something about the item.

Arguments

Name Type Description Default
$recurringBilling \geoRecurringBilling

the recurring billing object

Return value

Type Description
array See the file source for documentation on the various options that can be used in the returned array.

Tags

Name Description
since Version 4.1.0

anonymousAllowed( ) : bool

Description

Whether or not this order item can be used by someone not logged in.
**Optional.** **Used:** mainly in geoCart::initItem() but can be called elsewhere. Used when no one is logged in, to determine if anonymous sessions are allowed to use this item type. If this function is not defined, it will be assumed that this item is NOT allowed with anonymous sessions, and will not allow this item to be used without first logging in.

Return value

Type Description
bool Need to return true if item allowed to be used in an anonymous environment, false otherwise.

auction_final_feesOrderItem_cron_close_listings( array   $vars, ) : n/a

Description

Perform additional actions at time that an auction final fee is added to the order.
**Optional.** **Used:** In auction_final_fees order item (auction_final_feesOrderItem::cron_close_listings() NOT part of built-in cart system. Special case, functionality built into individual order items. This can be used to do stuff at the same time that an auction final fee is added to the order.

Arguments

Name Type Description Default
$vars array

See docs in function

Return value

Type Description
n/a n/a

buy_now_close( array   $vars, ) : n/a

Description

Perform additional actions at the time a buy now auction is being closed early.
**Optional.** **Used:** in process_bid in file classes/auction_bid_class.php This is called when a buy now auction is being closed. Note that the following things are automatically done: the "live" column is set to 0, and user favorites for the listing are removed, auction feedback inserted into db. Anything beyond that is up to being done in this function.

Arguments

Name Type Description Default
$vars array

Associative array, array('listing' => geoListing object)

Return value

Type Description
n/a n/a

copyListing( ) : n/a

Description

Used when copying a listing, to perform any extra tasks that might be needed.
**Optional.** **Used:** In listing order items such as classifiedOrderItem or auctionOrderItem **NOT part of built-in cart system.** Special case, functionality built into individual order items. This can be used to copy or re-create anything needed to duplicate the original listing. See other order items that are children to get some examples of how this can be utilized. The one that does the most stuff is the images order item.

Return value

Type Description
n/a n/a

cron_close_listings( array   $vars, ) : n/a

Description

perform additional actions at the time a listing is being closed during the close listing cron job.
**Optional.** **Used:** in file classes/cron/close_listings.php This is called for each listing that is being closed. Note that the following things are automatically done: the "live" column is set to 0, and user favorites for the listing are removed. Anything beyond that is up to being done in this function.

Arguments

Name Type Description Default
$vars array

Associative array, array('listing' => geoListing object)

Return value

Type Description
n/a n/a

displayInAdmin( ) : bool

Description

Whether to display this in the admin panel.
**Required.** **Used:** in admin, PricePlanItemManage class in various places. Return true to display this order item planItem settings in the admin, or false to hide it in the admin.

Return value

Type Description
bool

geoCart_cartDisplay_newButton( ) : n/a

Description

Get the text used to add a new item of this type to the cart.
**Optional.** **Used:** in geoCart::cartDisplay() Used only for "parent" items, this should return the text to use for the new button displayed in the cart view, for instance something like "Add New Classified".

Return value

Type Description
n/a n/a

geoCart_deleteProcess( ) : n/a

Description

Perform any additional steps that might be required when an item is being deleted from the cart.
**Optional.** **Used:** in geoCart::deleteProcess() The back-end already removes the item, all all children from the cart. Use this function to do any additional things needed, such as delete uploaded images, or if you expect that any children may need to be called, as they will not be auto called from the system. Can assume $cart->item is the item that is being deleted, which will be the same type as this is.

Return value

Type Description
n/a n/a

geoCart_getCartItemDetails( ) : n/a

Description

Perform special actions right before the contents of the cart are retrieved.
**Optional.** **Used:** in geoCart::_getCartItemDetails Most do not need to use this. This can be used for special items, that need to do stuff before the contents of the cart are retrieved for display in the cart view. For example, the tax and sub-total items use this in order to auto-add and auto-remove themself from the cart according to if criteria in the cart are met.

Return value

Type Description
n/a n/a

geoCart_initItem_forceOutsideCart( ) : bool

Description

Whether or not a seperate cart should be used just for creating this order item.
**Required.** **Used:** in geoCart::initItem() Whether or not a seperate cart should be used just for this order item or not. The alternate cart would be in addition to a "primary" cart that may have things in it already, and this item would be the ONLY thing in the cart. It is typical to not use this (return false), an example of when this may want to be used, is to allow adding to a site balance so that a user can pay for the rest of their cart.

Return value

Type Description
bool True to force creating "parellel" cart just for this item, false otherwise.

geoCart_initItem_new( ) : bool

Description

Called when creating a new order item, can be used to block new order item from being started.
**Optional.** **Used:** in geoCart::initItem() Used when creating a new item. Usually for use when adding a new item to the cart, so will usually only be called if this is a main order item with no parents.

Return value

Type Description
bool Need to return true if it's ok to create item, false otherwise

geoCart_initItem_restore( ) : bool

Description

Used when initiailizing an item, when the item already exists.
**Optional.** **Used:** in geoCart::initItem() This is used when the cart is loading and the order item is being initialized, when the item already exists. For example on the second page load during process of placing a listing. Can use this as a notice (just remember to return true!), or as a way to block an order item from being loaded for whatever reason, just return false. To allow the item to be initialized just return true.

Return value

Type Description
bool Need to return true if it's ok to restore item, false otherwise

geoCart_initSession_new( ) : n/a

Description

Notification for when new cart session is being created.
**Optional.** **Used:** in geoCart::initSession() This will be called when a cart is being created for the first time. Keep in mind this is done before steps are initialized and before the first item is added to the cart. The most common use of this will be for special case items, such as something like a shipping calculator or something.

Return value

Type Description
n/a n/a

geoCart_initSession_update( ) : n/a

Description

Notification for when a cart session is being restored.
**Optional.** **Used:** in geoCart::initSession() This will be called on any cart page load when the cart session has already been created. Keep in mind this is done before steps are initialized. The most common use of this will be for special case items, such as something like a shipping calculator or something.

Return value

Type Description
n/a n/a

geoCart_initSteps( bool   $allPossible = false, ) : n/a

Description

Initialize the cart steps that are required to create this item.
**Required.** **Used:** in geoCart::initSteps() (and possibly other locations) NOTE: This is best viewed in the PHP API documentation to see all the markup, available on the geodesicsolutions.com website. If this order item has any of it's own steps it wants to display or process as part of the sell process, it needs to add them to the cart here, by getting an instance of the cart, and $cart->addStep('item_name:step_name');. It also needs to call any children order items to do the same, as only parents are called by the Cart system. Format of steps: ================ : Example: ======== **Example Step Name:** _template:details CheckVars / Process Methods =========================== When the process gets to the step _template:details, if $_REQUEST['process'] is defined, then it will make the following static method calls: _template::CheckVars(); - if return true, then: _template::Process(); - if return true, then it will continue on to next step Display Method ============== If *$_REQUEST['process']* is NOT defined, or <STEP_NAME>CheckVars() or <STEP_NAME>Process() either return false, then it will call: _template::Display(); That display function is responsible for displaying the page, then including app_bottom.php, then exiting. If it does not exit, the system will display a site error. Step Label ========== If the below optional method exists, it will also call that method to determine the "label" for the step, to be displayed in templates that show the progress. The method below should return a string to display as the name of the step, or an empty string if you wish to hide the step from the user: _template::Label(); (Of course, above you would replace <STEP_NAME> with "details" if your step was "_template:details")

Arguments

Name Type Description Default
$allPossible bool

If true, initialize every single possible step, do not skip steps based on user info / user group or price plan settings. Skip steps based on "site wide" settings is still OK, for instance a check for whether auctions is turned on. If this is true, this is being called in the admin panel to determine all of the possible steps, to allow combining the steps during the listing process.

false

Return value

Type Description
n/a n/a

geoCart_initSteps_addOtherDetails( ) : bool

Description

Whether to show the "other details" step for this order item.
**Required.** **Used:** in geoCart::initSteps() Determine whether or not the other_details step should be added to the steps of adding this item to the cart. This should also check any child items if it does not need other_details itself.

Return value

Type Description
bool True to add other_details to steps, false otherwise.

geoCart_other_detailsCheckVars( ) : n/a

Description

The checkVars method for the "other_details" step.
**Optional.** **Used:** in geoCart::other_detailsCheckVars() Used by items that are displayed & processed at the built-in other details step, or items that may have children at this step. If a problem with input vars is found, or it should not proceed to next step for whatever reason, use geoCart::addError() to let the system know there is a problem. Note that this is called for all order items, so need to check to see if main type warrents it checking vars first. This can be used as a template for other checkVars functions for specific not-built-in steps

Return value

Type Description
n/a n/a

geoCart_other_detailsDisplay( ) : n/a

Description

The display method for the "other_details" step.
**Optional.** **Used:** in geoCart::other_detailsDisplay() Used by items that are displayed & processed at the built-in other details step. This will be called during other_details step, if that step is displayed, for all items and children items, even if there are none of this type of item in the cart yet. TODO: document this function further - needs to return an associative array like any of the listing extras do

Return value

Type Description
n/a n/a

geoCart_other_detailsLabel( ) : string

Description

The label method for the "other_details" step.
**Optional.** **Used:** in geoCart::other_detailsLabel() Used by "main" items that are displayed & processed at the built-in other details step. This should return the text label for the step. For instance, if this item were for placing a listing, and the "other details" step was used for listing extras, this function should return something like "Listing Extras". The text is used by some templates to display the progress of adding something to the cart. Note: if this function is not defined, the step will be set to "Extras" by default in the cart. If you want to "hide" the step from displaying, return an empty string (depends on template to skip steps without a label to be totally hidden)

Return value

Type Description
string The string to display to represent this step as is pertains to this order item.

geoCart_other_detailsProcess( ) : n/a

Description

The process method for the "other_details" step.
**Optional.** **Used:** in geoCart::other_detailsProcess() Used by items that are displayed & processed at the built-in other details step, or items that may have children at this step. Things like adding or removing an item based on a checkbox selection should be done here. Note that this is called for all order items, so need to check to see if main type warrents it processing for that main type first. This can be used as a template for other Process functions for specific not-built-in steps

Return value

Type Description
n/a n/a

geoCart_previewDisplay( ) : n/a

Description

Display a preview of the item.
**Optional.** Required if in getDisplayDetails() you returned true for the array index of canPreview. **Used:** in geoCart::previewDisplay() Display a preview of the item.

Return value

Type Description
n/a n/a

geoCart_setPricePlan( array   $vars, ) : n/a

Description

Perform additional actions at the time the price plan is being set for the cart.
**Optional.** **Used:** from geoCart::setPricePlan() Most should remove this function. Its use would be to set some price plan setting in addition to the settings auto retrieved. An example of where it is used is in the subscription order item.

Arguments

Name Type Description Default
$vars array

array ('price_plan' => int, 'category' => int)

Return value

Type Description
n/a n/a

geoOrderItem_loadTypes_adoptions( ) : n/a

Description

Notification, ideal place to "adopt" another parent order item's child order items.
**Optional.** **Used:** In geoOrderItem::loadTypes() at the end, after all the order item types have been "loaded". This is the recommended place to make any needed calls to {@link geoOrderItem::addParentTypeFor()} if the order item needs to adopt a child order item (thus the ending of _adoptions). This will be called before the similar call to geoOrderItem_loadTypes_obituary.

Return value

Type Description
n/a n/a

geoOrderItem_loadTypes_obituary( ) : n/a

Description

Notification, ideal place to disable other order items.
**Optional.** **Used:** In geoOrderItem::loadTypes() at the end, after all the order item types have been "loaded", and after all the "adoptions" have taken place. This is the recommended place to make any needed calls to {@link geoOrderItem::unregisterItemType()} if the order item needs to "kill" an order item type (thus the ending of _obituary). This will be called after the call to geoOrderItem_loadTypes_adoptions.

Return value

Type Description
n/a n/a

geoOrder_processStatusChange_emailItemInfo( ) : string

Description

Get the item info to be displayed in an e-mail.
**Optional** (if not defined here, parent will return title - price) where title is the title part returned by getDisplayDetails(false) **Used:** in geoOrder::processStatusChange Use this to display info about each main item, in the e-mail sent saying the order has been approved. To keep consistent, use this format: ITEM TITLE [STATUS] - $COST Be sure you also add up any costs of sub-items of this item.

Return value

Type Description
string

getActionName( array   $vars, ) : string

Description

Get the action name used for whatever the current action is.
**Optional.** **Used:** in geoCart and my_account_links module This is used to display what the action is if this order item is the main type. It should return something like "adding new listing" or "editing images".

Arguments

Name Type Description Default
$vars array

Array containing the action and step to get the action name for

Return value

Type Description
string

getCostDetails( ) : array|bool

Description

Get information about the cost, if there is any cost for the order item
**Required.** **Used:** By payment gateways to see what types of items are in the cart. Note that for backwards compatibility with older order items, this is implemented in the parent geoOrderItem class, so if you leave it off it will "work". It is still highly recommended to implement anyways in each order item, simply because it's role will be much more important when the ability to use the cart between users is implemented down the road. This is very similar to {@see _templateOrderItem::getDisplayDetails()} except that the information is used by payment gateways and is specifically for information about what the "cost" of something is for. Should return an associative array, that follows: array( 'type' => string, //The order item type, should always be $this->getType() 'extra' => mixed, //used to convey to payment gateways "custom information" that may be needed by the gateway. Most can set this to null. 'cost' => double, //amount this adds to the total, what getCost returns 'total' => double, //amount this AND all children adds to the total 'children' => array(), //optional, should be array of child items, with the index //being the item's ID, and the contents being associative array like //this one. Careful not to get into any infinite loops... )

Return value

Type Description
array|bool Either an associative array as documented above, or boolean false if this item has no cost (positive or negative, including children).

Tags

Name Description
since Version 6.0.0

getDisplayDetails( bool   $inCart, bool   $inEmail = false, ) : array|bool

Description

Get information about the order item for display purposes.
**Required.** **Used:** Throughout the software, wherever order details are displayed. Used to get display details about item, and any child items as well, both in the main cart view, and other places where the order details are displayed, including within the admin. Should return an associative array, that follows: array( 'css_class' => string, //leave empty string for default class, only applies in cart view 'title' => string, 'canEdit' => bool, //whether can edit it or not, only applies in cart view 'canDelete' => bool, //whether can remove from cart or not, only applies in cart view 'canPreview' => bool, //whether can preview the item or not, only applies in cart view 'priceDisplay' => string, //price to display 'cost' => double, //amount this adds to the total, what getCost returns but positive 'total' => double, //amount this AND all children adds to the total 'children' => array(), //optional, should be array of child items, with the index //being the item's ID, and the contents being associative array like //this one. Careful not to get into any infinite loops... )

Arguments

Name Type Description Default
$inCart bool

True if this is being called from inside the cart, false otherwise. Note: do NOT try to use the geoCart object if $inCart is false.

$inEmail bool

True if this is being used to build the text of an email notification sent by the system, false otherwise. Param added in 6.0.6

false

Return value

Type Description
array|bool Either an associative array as documented above, or boolean false to hide this item from view.

getParentTypes( ) : array

Description

Get the parent order item types for this order item.
**Required.** **Used:** In geoOrderItem class when loading the order item types, to get the defailt parent types. This should return an array of the different order items that this order item is a child of. If this is a main order item type, it should return an empty array. Note that more parent types can be added later using geoOrderItem::addParentTypeFor() but only if this method (getParentTypes) returns an array with at least one parent type.

Return value

Type Description
array

getRecurringDescription( ) : string

Description

Get the recurring description for the item.
**Optional.** **Used:** usually in recurring payment gateways. Required if isRecurring() returns true, otherwise it will default to "Recurring Item". This needs to return the description for this item that will be used in the payment gatway transaction and possibly other places for the recurring billing.

Return value

Type Description
string

Tags

Name Description
since Version 4.1.0

getRecurringInterval( ) : int

Description

Get the recurring interval for the item.
**Optional.** **Used:** usually in recurring payment gateways. Required if isRecurring() returns true, otherwise it will default to 0 (basically recurring being off). This needs to return the interval for the recurring billing, in seconds.

Return value

Type Description
int The recurring interval in seconds.

Tags

Name Description
since Version 4.1.0

getRecurringPrice( ) : float

Description

Get the recurring price for the item.
**Optional.** **Used:** usually in recurring payment gateways. Required if isRecurring() returns true, otherwise it will default to 0 (basically recurring being off). This needs to return the price for the recurring billing.

Return value

Type Description
float The recurring price

Tags

Name Description
since Version 4.1.0

getRecurringStartDate( ) : int

Description

Get the start date for the recurring item.
**Optional.** **Used:** usually in recurring payment gateways. Only used if isRecurring() returns true, if not implemented the geoOrderItem superclass will return the current time. This is expected to return the timestamp for when the initial recurring billing first payment should be made. This will make the system allow for if something is already paid for through a certain date.

Return value

Type Description
int Unix timestamp for when recurring start date should be.

getTypeTitle( ) : string

Description

Get the order item type's title.
**Optional.** **Used:** In admin, when displaying the order item type for a particular item, used in various places in the admin.

Return value

Type Description
string

isRecurring( ) : bool

Description

Whether this order item can function as a recurring billing item.
**Optional.** **Used:** throughout code. Specify whether or not this item is a recurring billing item or not, if this method is not defined the superclass will return false.

Return value

Type Description
bool

Tags

Name Description
since Version 4.1.0

listing_edit_getChoices( ) : array

Description

Get choices to show when editing a listing.
**Optional.** **Used:** In listing_editOrderItem::geoCart_initSteps() **NOT part of built-in cart system.** Special case, functionality built into individual order items. This can be used to add additional things to be edited when editing a listing.

Return value

Type Description
array Associative array, as documented in function.

listing_insertListingFromSessionVars( array   $vars, ) : n/a

Description

Insert a new listing based on the session variables presented.
**Optional.** **Used:** In _listing_placement_commonOrderItem::_insertListingFromSessionVars() **NOT part of built-in cart system.** Special case, functionality built into individual order items. This can be used to set listing vars manually instead of by using session vars, at the time that session vars are being used to populate a listing

Arguments

Name Type Description Default
$vars array

array containing session_variables and listing_id

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.1.0

my_account_links_newButton( ) : array

Description

Get button information about link to add one of these, for the my account links module.
**Optional.** **Used:** in my_account_links module Used only for "parent" items, this should return an associative array: array ( 'label' => 'Link Text', 'icon' => 'new something' ) Note that the icon is rarely used these days, as using icons tend to not match with the new design. Will probably want to use an empty string for the icon.

Return value

Type Description
array

processRemove( ) : bool

Description

Perform any extra actions needed when order item is being removed, or "refuse" to allow an order item to be removed.
**Optional.** **Used:** from geoOrderItem::remove() when removing an order item. Use this function if you need to do things like remove a listing from the database, or delete images or something. Be sure to return true or the item will not be removed by the system. Note that normal back-end stuff like removing registry settings and removing the order item from the DB are handled by the system, this function is primarily for special case stuff like deleting files, or removing stuff from the DB that isn't part of normal order items.

Return value

Type Description
bool True to proceed with removing the item, false to stop the removal of the item.

processRemoveData( ) : bool

Description

Perform any actions needed when removing the order item data (as part of archiving old information).
**Optional.** **Used:** from geoOrderItem::removeData() when removing an order item's old data. Use this function if you need to do things like remove data from a custom table (note that order item registry data is automatically removed for you). This *should NOT affect anything on the site*, like removing a listing or removing old images, as the listing this order item is used on may still be live, we are just removing the order item's data. It's the equivelent of shredding old invoices after they become 5 years old, the stuff that was purchased on those invoices still exist, but the records for the invoice are being deleted since they are so old. Note that normal back-end stuff like removing registry settings and removing the order item from the DB are handled by the system, this function is primarily for special case stuff as mentioned above.

Return value

Type Description
bool True to proceed with removing the item, false to stop the removal of the item.

processStatusChange( string   $newStatus, bool   $sendEmailNotices = true, bool   $updateCategoryCount = false, ) : n/a

Description

Perform some action when the order item's status changes.
**Optional.** **Used:** In the admin when admin activates order or item, or on client side when payment is made and settings are such that it does not need admin approval to activate the item. If this is not implemented here, the parent class will do common stuff for you, like call child items and actually set the status This is responsible for actually changing the status of the item, as well as anything such as activating/deactivating a listing depending on what the previous status is, and what it is being changed to. Use template function as a guide, and add customization where comments specify to. Remember to call children where appropriate if you decide not to call the parent to do it for you. It can be assumed that if this function is called, all the checks as to whether the item should be pending or not have already been done, however there may be other custom checks you wish to do.

Arguments

Name Type Description Default
$newStatus string

a string of what the new status for the item should be. The statuses built into the system are active, pending, and pending_alter.

$sendEmailNotices bool

If set to false, you should not send any e-mail notifications like might be normally done. (if it's false, it will be because this is called from admin and admin said don't send e-mails)

true
$updateCategoryCount bool

True if should update the category count

false

Return value

Type Description
n/a n/a

recurringBilling_cancel( \geoRecurringBilling   $recurring, ) : n/a

Description

Perform actions at the time recurring billing subscription is canceled.
**Optional.** **Used:** in {@link geoRecurringBilling::cancel()} after gateway has processed the cancelation. Use this to make changes when a recurring billing has been canceled, such as updating the expiration of an item or removing a subscription.

Arguments

Name Type Description Default
$recurring \geoRecurringBilling

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 4.1.0

recurringBilling_updateStatus( \geoRecurringBilling   $recurring, ) : n/a

Description

Perform actions at the time the recurring billing status is changing.
**Optional.** **Used:** in {@link geoRecurringBilling::updateStatus()} after gateway has updated status on the recurring billing. Use this to make changes when a recurring billing has been updated, such as updating the expiration of an item or extending a subscription.

Arguments

Name Type Description Default
$recurring \geoRecurringBilling

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 4.1.0

Properties

$defaultProcessOrder, $type,

int  protected  $defaultProcessOrder = 10

Needs to be the order that this item will be processed. This is the default
for example: when computing tax the "tax function" (tax.php, defaultProcessOrder of 20,000) will get all "totals" of all orderitems with a $defaultProcessOrder below 20,000 to get the total amount to charge the tax on. System order item #'s: * < 1000 - "normal" order item (such as listing) * 10,000 - subtotal order item * 20,000 - tax order item Note: total is handled by system, always at very bottom. note: different items can have the same defaultProcessOrder value. Different criteria then determine order like alphabetical

string  protected  $type = "_template"

Set this to match the filename and the class name.
If not set here, need to set it in constructor.

Constants

  defaultProcessOrder = 10

Optional, use this as a hassle-free way to determine the process order without having to hard-code the # everywhere else, instead use self::defaultProcessOrder


  type = '_template'

Optional, use this as a hassle-free way to determine the type without having to hard-code the type everywhere else, instead use self::type


Documentation was generated by phpDocumentor 2.2.0 .

Namespaces

  • global

    Packages

    • Default
      • ExampleAddon
        • addon_example_admin
          In charge of doing stuff on the admin side, this is optional.
        • addon_example_info
          Required class for addons, this is the Addon information class, used by the addon system to determine what the addon can do. Also contains info about the addon that can be viewed in the addon management page in the admin.
        • addon_example_pages
          Addon page class, used by the addon system to display pages on the client side.
        • addon_example_setup
          This class is not required. If it, and the function for a particular routine exist, then that function will be called IN ADDITION TO the automated routines of the addon framework.
        • addon_example_tags
          Expects one function for each tag. Function name should be the same as the tag name. Can also have a constructor if anything needs to be constructed.
        • addon_example_util
          This is where to put functions that the main part of the addon will use.
        • eWidgetOrderItem
          This order item is designed to allow users on your site to purchase an eWidget.
      • System
        • DataAccess
          This is the main Database access object.
        • Singleton
          Singleton method class
        • _templateOrderItem
          Developers: use this file as a template to create a new order item.
        • _templatePaymentGateway
          This is the "developer template" payment gateway handler, a developer could use this file as a starting point for creating a new payment gateway in the system.
        • geoAPI
          The main system class for receiving and handling remote API calls, this acts as a translation layer between the communication with the "outside" and each API call.
        • geoAddon
          This is the class that handles anything and everything to do with addons.
        • geoArrayTools
          Utility functions for manipulating arrays
        • geoBrowse
          Contains functions common to browsing listings
        • geoBrowsingFilter
          System for activating, storing, and deactivating browsing filters.
        • geoCJAX
          Class that wraps the CJAX_FRAMEWORK, used to get the CJAX class.
        • geoCache
          This is the main part of the Geo cache system, it does all the "low level" stuff like writing files and escaping cache data.
        • geoCacheModule
          Part of Geo Cache system, specifically tuned to work best with cacheing module data (which will be an array).
        • geoCachePage
          Cache system specifically tuned to work best with cacheing output of pages and modules
        • geoCacheSetting
          Part of Geo Cache system, specifically tuned to work best with cacheing site-wide key=value type settings.
        • geoCacheText
          Part of Geo Cache system, this part specifically tuned to work best with cacheing language specific messages.
        • geoCalendar
          Holds utility method(s) for manipulating stuff dealing with calendar selector.
        • geoCart
          This class is behind the cart, loading all the order items and such and displaying, and processing all the different pages.
        • geoCategory
          Utility class that holds various methods to do stuff with categories in the system.
        • geoCombineResources
          This class helps to combine CSS and JS files, minify them, and optionally compress them.
        • geoCron
          This is the cron job backend, it handles all the communication and security and all that.
        • geoCrypt
          Class to use for encrypting information that needs to be able to be retrieved later.
        • geoDate
          Holds utility method(s) for manipulating stuff dealing with dates.
        • geoEmail
          Class that sends out e-mails.
        • geoFields
          Class that holds settings information for fields to use.
        • geoFieldsField
          A mini object to hold data about a specific field.
        • geoFile
          As the name implies, this is used for file-based utility methods.
        • geoFilter
          A few utility methods, good for filtering stuff.
        • geoFormatString
          Used to display a message nice and pretty, we'll probably be getting rid of this class though so don't go crazy using it.
        • geoHTML
          Class to generate chunks of HTML that are very common, used the most in the admin panel.
        • geoImage
          This class is responsible for a lot of the image processing, along with other aspects like generating the image tag for thumbnails.
        • geoInvoice
          This is the invoice object representing an invoice in the system.
        • geoLeveledField
          Class for doing common things with leveled fields.
        • geoListing
          A listing object, basically a container object for particular listing.
        • geoListingDisplay
          This is basically a container that is responsible for helping to display {listing .
        • geoListingFeed
          Class that helps to render RSS or other types of feeds based on list of listings.
        • geoMaster
          This is dedicated class for getting the value of, and setting, the various "master switches" within the software. Since this is meant as an easy way to get the values of master switches, most of the methods are static.
        • geoNumber
          Utility functions relating to number conversion/manipulation/validation ect.
        • geoOrder
          The geoOrder object, an object representation of an order in the system.
        • geoOrderItem
          The class that all order items must extend.
        • geoPC
          Used for login credential validation, password hashing, etc. along with software licensing.
        • geoPagination
          Utility functions useful for generating pagination of a results page such as when browing ads or searching
        • geoPaymentGateway
          This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.
        • geoPlanItem
          A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
        • geoRecurringBilling
          The geoRecurringBilling object, an object representation of a recurring billing in the system.
        • geoRegion
          Stuff for regions and sub-regions.
        • geoRegistry
          Handy little object, can be used to set registry type settings.
        • geoSearchUtils
          Class for search utilities.
        • geoSellerBuyer
          Handles back-end for the seller/buyer payment gateways, to allow the buyer to more easily pay the seller for a won auction. This handles the underlying system, but the actual work is done by individual seller/buyer gateways, for instance the Paypal buy-now functionality.
        • geoSession
          Manages session storage and session cookies for user sessions.
        • geoString
          Utility functions relating to languages and string manipulation.
        • geoStringData
          This class is to store accented chars, to be used by {@link geoString::removeAccents()}, mainly to keep the String.class.php file un-cluttered.
        • geoTable
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRow
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRowset
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableSelect
          Class used to generate a select query, useful when multiple areas want to affect a single query, for instance when generating a search query and there are addons involved.
        • geoTables
          Used to hold database table names, used throughout the code.
        • geoTemplate
          Template object that extends the Smarty class (a 3rd party library) to enable using templates to display things.
        • geoTransaction
          This is the object used for a transaction in the order and invoice system.
        • geoUser
          An object representative of a certain user in the system.
        • geoUserRating
          Store, retrieve, and display inter-user ratings
        • geoUtil
          Misc utility functions
        • geoView
          As the name implies, this is used for creating the page view. It does take a little setup (like any class), the setup is normally done in the display_page method in geoSite, or display_page in geoAdmin if displaying a page in the admin.
        • iApiTransport
          Interface for API Transports, a transport must implement this interface for the system to use it.
        • iOrderItem
          You cannot have abstract static functions, so instead need to have an interface to force the given static functions to be defined.
        • metaDbTables
          Used so that old locations that use the old name geoTables will still work.