This tutorial will walk you through the steps necessary to create an addon, that will cause any "listing extras" to start out automatically checked when placing a new listing.
Requires Geo 4.0.0
This tutorial assumes a basic understanding of PHP and knowledge of how to FTP files from and to your server.
<?php //file /addons/auto_check_extras/info.php class addon_auto_check_extras_info { var $name = 'auto_check_extras'; var $version = '1.0.0'; var $title = 'Auto-Check Listing Extras'; var $author = "Geo Developer Tutorial"; var $description = 'Automatically checks listing extas when a user places a new auction or classified listing.'; var $auth_tag = 'my_addons'; }
<
<?php //file /addons/auto_check_extras/order_items/auto_check_listing_extras.php require_once CLASSES_DIR . PHP5_DIR . 'OrderItem.class.php'; class auto_check_listing_extrasOrderItem extends geoOrderItem { //Note: only the most necessary methods needed for the current task //are defined here. For a complete list of methods, see the file //classes/order_items/_template.php //This is where the action happens for this order item! public static function geoCart_other_detailsDisplay (){ $cart = geoCart::getInstance(); if (isset($cart->site->session_variables['auto_check_ran'])) { //make sure we only auto-check the first time the page //loads! return; } $cart->site->session_variables['auto_check_ran'] = 1; //Un-Comment the lines for the extras you want to auto-check //un-comment for better placement //$cart->site->session_variables ['better_placement'] = 1; //un-comment for bolding //$cart->site->session_variables ['bolding'] = 1; //un-comment for featured level 1 //$cart->site->session_variables ['featured_ad'] = 1; //un-comment for featured level 2 //$cart->site->session_variables ['featured_ad_2'] = 1; //un-comment for featured level 3 //$cart->site->session_variables ['featured_ad_3'] = 1; //un-comment for featured level 4 //$cart->site->session_variables ['featured_ad_4'] = 1; //un-comment for featured level 5 //$cart->site->session_variables ['featured_ad_5'] = 1; } protected $type = "auto_check_listing_extras"; const type = 'auto_check_listing_extras'; protected $defaultProcessOrder = 10; const defaultProcessOrder = 10; //required by system public function displayInAdmin() { return false; } //required by system, doesn't have to do anything though public static function geoCart_initSteps($allPossible=false){ } //required by system public static function geoCart_initItem_forceOutsideCart() { return false; } //required by system public static function getParentTypes(){ return array('classified','auction'); } //required by system public function getDisplayDetails ($inCart){ return false; } //required by system public static function geoCart_initSteps_addOtherDetails(){ return false; } }
<
//un-comment for bolding //$cart->site->session_variables ['bolding'] = 1;
And change to:
//un-comment for bolding $cart->site->session_variables ['bolding'] = 1;
<