Username:

Password:


  • Home
  • Help
  • Search
  • Downloads
  • Login
  • Register
CubeCart - FreeForums For All ยป Recent Posts
Pages: [1] 2
 1 
 CubeCart 5 / Developer's Kit / Cart Class
 on: July 31, 2013, 10:05:14 AM 
Started by Chief! - Last post by Chief!
Cart
+ basket = null; array; Current basket
+ basket_data = false; array; Basket data
+ basket_digital = false; bool; Digital basket
- _discount = 0; float; Cart discount
- _item_discount = false; bool; Cart item discount flag
- _shipping = 0; float; Shipping cost
- _shipping_discount = 0; float; Shipping discount
- _subtotal = 0; float; Cart subtotal
- _total = 0; float; Cart total
- _weight = 0; float; Cart weight
# _instance; static instance; Class instance
# __construct; final
+ __destruct
+ getInstance; static
+ add
+ autoload
+ clear
+ discountAdd
+ discountRemove
+ get
+ getBasketDigital
+ getSubTotal
+ getTotal
+ getWeight
+ load
+ loadShippingModules; array|false;
+ checkShippingModuleCountry
+ remove; status|false; Remove an item from the basket
+ save; nothing; Save basket
+ set
+ update
- _applyDiscounts; bool; Apply a discount to the cart
- _applyProductDiscount; nothing; Apply product discount
- _checkOption; bool; Check option choice
As of CC522

 2 
 CubeCart 5 / Developer's Kit / Order Class
 on: July 31, 2013, 09:35:42 AM 
Started by Chief! - Last post by Chief!
Order
- _order_id;
- _basket;
- _email_enabled = true;
- _email_admin_enabled = true;
- _skip_order_complete_email = false;

- _instance; static instance

; Order status constants
const ORDER_PENDING = 1;
const ORDER_PROCESS = 2;
const ORDER_COMPLETE = 3;
const ORDER_DECLINED = 4;
const ORDER_FAILED = 5; # Fraudulent
const ORDER_CANCELLED = 6;

; Payment Constants
const PAYMENT_PENDING = 1;
const PAYMENT_PROCESS = 2;
const PAYMENT_SUCCESS = 3;
const PAYMENT_DECLINE = 4;
const PAYMENT_FAILED = 5;
const PAYMENT_CANCEL = 6;

; Compatibility mode
- _order_inventory;
- _order_summary;
+ __construct
+ getInstance; static instance; Setup the instance (Singleton)
+ addNote
+ createOrderId
+ deleteCard
+ deleteOrder
+ disableAdminEmail
+ getSummary
+ logTransaction
+ orderStatus
+ placeOrder
+ paymentStatus
+ storeTrans
+ updateSummary
- _addHistory
- _createCertificate
- _createDownload
- _digitalDelivery
- _getInventory
- _manageStock
- _orderAddProduct
- _orderSummary
- _retrieveOrder
- _saveAddresses
- _sendCoupon
- _tidyOrders
- _updateOrder
- _notifyAdmins
As of CC522

 3 
 CubeCart 5 / Developer's Kit / Language Class
 on: November 15, 2012, 11:25:09 PM 
Started by Chief! - Last post by Chief!
CubeCart 5.0.7
Language Class
- _language = ''; string; Current language
    Matches the LANG_REGEX. Examples: en-US, en-GB, en-CA, de-DE, fr-FR, fr-CA
  • - _language_custom = array(); array; Custom language
    This is used in the magic setter and magic unsetter as a flag that this string name=>value pair is temporary as the value does not matter (it is not used anywhere else in this class). Examples: $_language_custom['yada']="yada", $_language_custom['yowza']="yowza"
- _language_data = array(); array; Language data - holds the language file <info> block
   'title'=>"Italiano",
   'code'=>"it-IT",
   'locale'=>"it-IT',
   'character_set'=>"utf-8",
   'version'=>"1.0.0",
   'minVersion'=>"5.1.0",
   'maxVersion'=>"5.0.*",
- _language_definitions = array(); array; Language definitions
- _language_definition_data = array(); array; Language definitions data
- _language_groups = false; array; Language groups
- _language_strings = array(); array; Language strings

const LANG_REGEX = '#^([a-z]{2})\-?([A-Z]{2})?$#';
const EMAIL_FILE = '#^email_(([a-z]{2})(\-[A-Z]{2})?(\-custom)?)\.[a-z]+(\.gz)?$#';

# _instance (static); instance; Class instance
# __construct() (final);
  • If the language is trying to be changed try to change it
  • See if the language is set in the session
  • Else try the default config language
  • Set the language to the session
  • Load the language
+ loadlang(); Load the core language files, Set the system locale
+ assignLang(); Gives the _language_strings to Smarty
+ __get($name); Magic get of a string value;
   string: name of string node
   returns string: value of string node
+ __isset($name); Magic isset of a string value
   string: name of string node
   returns boolean
+ __set($name, $value); Magic set of a string value
   name and value of string node
   string: name of string node
   array: value of string node
   if not already in _language_strings, assigns to _language_custom and _language_strings
+ __unset($name); Magic unset of a string value
   string: name of string node
   if in _language_custom, removes from _language_custom and _language_strings
+ static getInstance(); Setup the instance (singleton)
+ addStrings($strings); Add strings to the language
   array: name=>value pairs
   merges to _language_strings
+ change($language); Change language
   string: language
   assigns to _language, loadLanguageXML(), _setLocale()
+ create($array); Create language file
   array: array of nodes for the language->info node
   creates file 'lang_code.xml' in language folder
   returns boolean
+ current(); Current language
   returns _language
+ deleteLanguage($code, $path = CC_LANGUAGE_DIR); Delete a language
   string: language code
   tring: path to language directory
   returns boolean
+ fullyTranslated($type, $id); Check if a prod/doc/cat is translated in all languages
   string: 'document'|'product'|'category'
   int: id
   returns boolean
+ getCustom($group, $language = ''); Get custom language strings
   string: the `type` in the language database
   string: the language desired, the default is _language
   returns array of name=>value pairs or empty array
+ getData($element = ''); Get language data
   string: node in info block of language data
   returns _language_data of the $element, or the entire _language_data, or false
+ getDefinitions($group); Get language definitions
   string:
   returns array: , or empty array
+ getGroups(); Get language groups
+ getLanguage(); Get current language
+ getLanguageInfo($language); Get langauge information
+ getLanguageStrings(); Get all the language strings
+ getFriendlyModulePath($path, $name_only = false); Get friendly module path from relative path
+ getStrings($group = false); Get language strings
+ importEmail($source, $path = CC_LANGUAGE_DIR); Import email language
+ importLanguage($file, $overwrite = false); Import language file if valid
+ listLanguages($cache = true); List available languages
+ loadDefinitions($name, $path = CC_LANGUAGE_DIR, $file_name = 'definitions.xml', $cache = true); Load language definitions
+ loadLanguageXML($name, $language = '', $path = CC_LANGUAGE_DIR, $merge = true); Load language XML file(s)
+ saveLanguageXML($language, $compress = false, $replace, $path = CC_LANGUAGE_DIR); Save XML file
+ setTemplate(); Sets all the LANG variables in the templates
+ translateCategory(&$category); Translate a category
+ translateDocument(&$document); Translate a document
+ translateProduct(&$product); Translate a product
- _checkPath($path); Checks to make sure the path passed in is valid
- _extractXML($language); Extract XML information
- _setLocale(); Set Locale
- _valid($language); Validate language

 4 
 CubeCart 5 / Developer's Kit / Module Class
 on: February 21, 2012, 10:25:58 PM 
Started by Chief! - Last post by Chief!
CubeCart 5.0.7
Module controller
+ _settings; array; Module settings
- _content; string; Module content
- _info = false; array; Module info
- _local_name; string; Module local name
- _module_name; string; Module name
- _package_file = 'package.conf.inc'; string; Module package file
- _package_xml = 'config.xml'; string; Module config file
- _path; string; Module path
- _strings; array of strings; Module language strings
- _taxes; array; Taxes
- _template; string; Template to load in the module
- _template_data = array(); array; Template data
+ __construct($path = false, $local_name = false, $template = 'index.tpl', $zones = false, $fetch = true)
+ __get($key); Get a module value
+ assign_to_template($name, $value); Assign data to the template
+ communicateURL($method = 'process'); Generate URL
+ display($return = true); Display module content
+ fetch(); Send template date to the screen
+ module_fetch_logo($type, $name, $module_title = ''); Get module logo
+ module_language(); Get module language strings
+ module_name(&$module_name);(static) Get module name
+ module_settings_save($settings); Save module settings
- _module_classes(); Load module classes
- _module_data($path = false, $local_name = false); Get module data
- _module_zones(); Load module zones

 5 
 CubeCart 5 / Developer's Kit / SEO Class
 on: February 21, 2012, 10:03:56 PM 
Started by Chief! - Last post by Chief!
CubeCart 5.0.7
SEO Class
- _cat_dirs = null; array of strings; Category directories
- _cat_path = null; array of strings; Category paths
- _dynamic_sections = array('prod', 'cat', 'doc'); array of strings; Dynamic URL sections
- _extension = '.html'; string; SEO url extension
- _ignored = array('account', 'addressbook', 'basket', 'checkout', 'complete', 'confirm','downloads', 'gateway', 'logout', 'openid', 'plugin', 'profile', 'recover','recovery', 'remote', 'vieworder'); array of strings; Ignored URL sections
- _meta_data = array();; array; Meta data
- _sitemap_xml = false; handle; Sitemap XML handle
- _static_sections = array('saleitems', 'certificates', 'trackback', 'contact', 'search','login', 'register'); array of strings; Static URL sections
# _instance (static); instance; Class instance
const TAGS_DEFAULT   = 0;
const TAGS_MERGE   = 1;
const TAGS_REPLACE   = 2;
const PCRE_REQUEST_URI = '(.*/)?[\w]+.[a-z]+\?_a\=([\w]+)\&(amp;)?([\w]+)\=([\w\-\_]+)([^"\']*)';
+ _a = '';
+ __construct();
   Build an array of ALL categories
   If SEO is enabled and If URL is an un-ignored SEO.
   Generate SEO URL. If the SEO URL != to the current URL, Push the user to that URL
+ static getInstance(); Setup the instance (singleton)
+ addIgnore($string); Add another element to the ignored url segments
+ buildURL($type, $item_id = false, $amp = '&'); Build SEO URL
+ delete($type, $item_id); Delete SEO URL
+ displayMetaData(); Put the META data to the GUI
+ enabled(); SEO enabled?
+ fullURL($url, $process = false); Create full URL
+ getItem($path, $url = false); Create item URL
+ getdbPath($type, $item_id); Get SEO URLs from the DB
+ generatePath($id = null, $type = null, $key = null, $absolute = false, $extension = false); Generate SEO path
+ getDirectory($cat_id, $link = false, $glue = '/', $append = false, $custom = true); Create meta description
+ getExtension(); Get the SEO extension
+ meta_description($glue = ' - '); Create meta description
+ meta_keywords($glue = ','); Make Meta keywords
+ meta_title($glue = ' - '); Make Meta title
+ queryString($query); Parse query string
+ rebuildCategoryList(); Rebuild category listings
+ rewriteUrls($page_html, $full_urls = false); Rewrite URL
+ SEOable($path); Can we use SEO
+ setdbPath($type, $item_id, $path, $bool = true, $show_error = true); Set a DB path
+ set_meta_data($meta_data); Set all meta data
+ setCache($enable); Enable/Disable cache
+ sitemap(); Create sitemap
- _getBaseUrl($full_urls = false); Get the base url
- _getCategoryList($rebuild = false); Get categories
- _getItemVars($type, $item_id); Get an SEO item
- _safeUrl($url); Is URL safe?
- _sitemap_link($input, $updated = false, $type = false); Create sitemap link
- _trackback($product_id = false, $data = false); Create talkback

 6 
 CubeCart 5 / Developer's Kit / Transaction Workflow
 on: February 19, 2012, 03:23:28 PM 
Started by Chief! - Last post by Chief!
The following is a line-by-line analysis of what happens when a customer selects a payment gateway and clicks Continue...

I chose to use Goober's (www.ccmodder.com) Payment Test Gateway.

0170 public function loadPage() ## from /index.php?_a=gateway and $_POST['gateway']="PTG"
0172 False
0231 True
0233 False
0237 switch 'gateway'
0339 default:
0340 $method = '_gateway'
0341 True
0342 $this->{$method}()
------------------------------------------------------------
 1613 private function _gateway()
 1614 False
 1620 $gateway = "PTG"
 1621 $this->_displayGateways($gateway);
------------------------------------------------------------
  1419 private function _displayGateways($name = "PTG")
  1420 $where = array('module' => 'gateway', 'status' => '1')
  1421 $this->_basket =& $GLOBALS['cart']->basket
  1422 True
  1423 $where['folder'] = $name
  1425 Update Cubecart_order_summary
  1427 $gateways[0] = array('module_id'=>"22",'module'=>"gateway",'folder'=>"PTG",'status'=>"1",'default'=>"0",'countries'=>null)
  1431 True
  1432 True
  1433 False
  1437 $module = array('description'=>"Testing Gateway",'ReturnStatus'=>"Processing",'countries'=>null)
  1439 False
  1442 $folder = 'gateway'
  1443 $class_path = CC_ROOT_DIR."\modules\gateway\PTG\gateway.class.php"
  1445 True
  1446 include $class_path
  1447 $gateway = new Gateway($module, $this->_basket);
------------------------------------------------------------
   gateway.class.php
   0008 public function __construct($module = false, $basket = false)
   0009 $this->_module = $module;
   0010 $this->_basket =& $GLOBALS['cart']->basket;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1448 True
  1449 $transfer = $gateway->transfer()
------------------------------------------------------------
   gateway.class.php
   0021 return array('method'=>'post','target'=>'_self','submit'=>'auto',
            'action'=>$GLOBALS['storeURL'].'/modules/gateway/PTG/gateway/gateway.php')
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1449 $transfer = array('action=>URL,'method'=>'post','target'=>'_self','submit'=>'auto')
  1450 switch 'auto'
  1461 auto:
  1463 $transfer['mode'] = "automatic"
  1464 Smarty->assign("Proceed")
  1465 $build_hidden_vars = true
  1479 True
  1480 $methods = array('fixedVariables','repeatVariables')
  1481 foreach $methods 'fixedVariables'
  1482 True
------------------------------------------------------------
   gateway.class.php
   0030 return array('cartId'=>basket['cart_order_id'],'status'=>module['ReturnStatus'],'amount'=>basket['total'],
            'responseURL'=>$GLOBALS['storeURL'].'/index.php?_g=rm&amp;mod_type=gateway&amp;cmd=process&amp;module=PTG')
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1483 $variables = array('cartId'=>basket['cart_order_id'],'status'=>module['ReturnStatus'],'amount'=>basket['total'],'responseURL'=>URL
  1484 True
  1485 $form_vars = $variables
  1481 foreach $methods 'repeatVariables'
  1482 True
------------------------------------------------------------
   gateway.class.php
   0026 return false
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1483 $variables = false
  1484 False
  1493 True
  1494 Smarty->assign("Form_Vars")
  1501 Smarty->assign("Transfer")
  1543 return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1622 $this->_checkoutProcess('gateway');
------------------------------------------------------------
  0950 private function _checkoutProcess($section = null)
  0951 switch 'gateway'
  0955 case 'gateway: status=2
  ....
  0994 $url = "?_a=gateway"
  ....
  1006 Smarty->assign("CHECKOUT_PROGRESS")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1626 Smarty->assign("Page_Content")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0351 exit

Javascript auto-submit
/index.php?_g=rm&mod_type=gateway&cmd=process&module=PTG'


 7 
 CubeCart 5 / Developer's Kit / Module Class
 on: February 15, 2012, 10:29:41 PM 
Started by Chief! - Last post by Chief!
Module
+ _settings; array; Module settings
- _content; string; Module content
- _info = false; array; Module info
- _local_name; string; Module local name
- _module_name; string; Module name
- _package_file = 'package.conf.inc'; string; Module package file
- _package_xml = 'config.xml'; string; Module config file
- _path; string; Module path
- _strings; array of strings; Module language strings
- _taxes; array; Taxes
- _template; string; Template to load in the module
- _template_data = array(); array; Template data
+ __construct($path = false, $local_name = false, $template = 'index.tpl', $zones = false, $fetch = true)
Does a lot of things but returns false
+ __get($key)
Get a module value from key, or false
+ assign_to_template($name, $value)
Put a $name => $value, returns true|false
communicateURL($method = 'process')
Returns string URL
+ display($return = true)
Returns|Outputs module content
+ fetch()
Renders template data
module_fetch_logo($type, $name, $module_title = '')
Returns the module's <img>|Title|Name
+ module_language()
Returns module's language strings
+ module_name(&$module_name) static
Returns prepared module's name
+ module_settings_save($settings)
Saves the module's settings, returns true|false
- _module_classes() Load module classes
Return true|false
- _module_data($path = false, $local_name = false)
Get module's data
- _module_zones()
Load and assign CubeCart_geo_country records to template

 8 
 CubeCart 5 / Developer's Kit / Converting the Killer Skin
 on: February 10, 2012, 11:17:32 PM 
Started by Chief! - Last post by Chief!
One of the skins that ships with CubeCart 3 is Killer, a full-width skin that has been ported to CubeCart 4. Let's port Killer from CubeCart 3 to CubeCart 5.

Table 1
CubeCart 3Cubecart 5
/styleImages/images/common
/styleImages/backgrounds/*/images/blue/*
Then move topHeader.* into /logo renaming it to default.*
/styleImages/buttons/*/images/blue/*
/styleImages/icons/*/images/common/*
/styleImages/*/images/common/*
/styleSheets/*/styles/blue/*
Then move style.css to the parent folder and rename to common.css
Start by copying the folder structure (but not necessarily any of its contents except as noted in the list) of an existing CC5 skin and naming the new folder "killer". The folder structure will be:
  • images
    • blue
      • logo
    • common
    • orange
      • logo
  • js
    • script.js
  • styles
    • blue
    • orange
    • common.css
    • ie7.css
    • print.css
    • reset.css
  • templates
  • config.xml

Make copies of the files listed in Table 1 renaming them where indicated:

 9 
 CubeCart 5 / Developer's Kit / Web Site Design
 on: February 10, 2012, 11:55:40 AM 
Started by Chief! - Last post by Chief!
Designing a web site for CubeCart 5 involves creating a series of HTML files that comprise:
  • Global Superstructure
    • Content Details
    • Common Details

The global structure holds the various parts and pieces in place and has the requisite <html>, <head>, and <body> blocks. Each of the content details is usually placed in the center or the right side under the banner and the left side column is typically used for navigation and other details common to every page. But there may also be a right side column to hold some of the common details.

The Content and Common detail blocks are represented in the global structure as {$PLACEHOLDERS}. Each of these placeholders will be replaced by actual HTML code built from their respective purpose. There is no need, however, to make sure each placeholder gets replaced. The engine that builds the final HTML code will strip any placeholder it finds whether there is any content for it or not.

The standard CubeCart skin has these placeholders:The file containing the HTML to hold this data:
{$SHOPPING_CART}box.basket.php
{$CURRENCY}box.currency.php
{$SITE_DOCS}box.documents.php
{include file='templates/box.errors.php'}box.errors.php
{$RANDOM_PROD}box.featured.php
{$LANGUAGE}box.language.php
{$CATEGORIES}box.navigation.php
{$MAIL_LIST}box.newsletter.php
{if isset($POPULAR_PRODUCTS)}{$POPULAR_PRODUCTS}{/if}box.popular.php
(this one has a condition that checks if "show popular products" has been set in the admin dashboard)
{if isset($CHECKOUT_PROGRESS)}{$CHECKOUT_PROGRESS}{/if}box.progress.php
(shows the checkout steps on checkout pages: 1. Basket - 2.Checkout - 3. Payment - 4. Complete)
{$SALE_ITEMS}box.sale_items.php
{$SEARCH_FORM}box.search.php
{$SESSION}box.session.php
{if isset($SKIN_SELECT)}{$SKIN_SELECT}{/if}box.skins.php
(condition checks if "allow users to change front-end skin" has been set to Yes in the dashboard)
{$COPYRIGHT}loads the content as entered in the dashboard under Store Settings > Copyright
{$PAGE_CONTENT}loads the page content based on what URL you are looking at
{$STORE_URL}the base URL of your store, eg. "http://domain.com" or "http://www.domain.com/shop"
{$SKIN_FOLDER}the folder name of the skin your store is currently using, eg. "vanilla"
{$SKIN_SUBSET}the folder name of the skin subset/style your store is currently using; only applicable if your skin has subsets



logo for skins with subsets:
<a href="{$STORE_URL}/index.php"><img src="{$STORE_URL}/images/logos/{$SKIN_FOLDER}-{$SKIN_SUBSET}.php" alt="{$META_TITLE}" /></a>

logo for skins without subsets:
<a href="{$STORE_URL}/index.php"><img src="{$STORE_URL}/images/logos/{$SKIN_FOLDER}.php" alt="{$META_TITLE}" /></a>


template files for page content (
{$PAGE_CONTENT}
in the main.php template file) and corresponding URLs

content.category.php = index.php?_a=category&cat_id=1
content.certificates.php = index.php?_a=certificates
content.contact.php = index.php?_a=contact
content.document.php = index.php?_a=document&doc_id=1
content.homepage.php = index.php
content.login.php = index.php?_a=login
content.product.php = index.php?_a=product&product_id=1
content.recover.php = index.php?_a=recover
content.recovery.php = index.php?_a=recovery
content.register.php = index.php?_a=register
content.search.php = index.php?_a=search

checkout pages
content.checkout.php = index.php?_a=basket
content.checkout.confirm.php = index.php?_a=confirm (step 2 of the checkout; for registered users shows a selection of saved addresses, for unregistered users shows a form to enter an address)
content.gateway.php = index.php?_a=gateway

customer account pages
content.addressbook.php = index.php?_a=addressbook
content.downloads.php = index.php?_a=downloads
content.newsletter.php = index.php?_a=newsletter
content.orders.php = index.php?_a=vieworder
content.profile.php = index.php?_a=profile
content.receipt.php = index.php?_a=vieworder&cart_order_id=111111-111111-1111

 10 
 CubeCart 5 / Developer's Kit / Database Class
 on: February 10, 2012, 09:14:18 AM 
Started by Chief! - Last post by Chief!
Database_Contoller
# _allowed_exceptions = array(
   'CURRENT_TIMESTAMP',
   'NOW()',
   'offline_capture'); Allowed exceptions
# _cached = false; bool; Was it a cached query?
# _db_connect_id = null; resource; database connection
# _found_rows = null; int; Number of rows found
# _prefix = ''; string; Store prefix
# _query = false; string; Query to execute
# _query_time = null; float; Query run time
# _result = null; array; Query result
# _instance; static instance; Class instance
# __construct
+ __destruct
+ column_sort; string; Display column sort
+ count; int|false; Query count a field
+ debug; string; Returns "[QUERY] - " and derived query
+ delete; bool; DELETE query
+ doSQLBackup; string; Create schema/data restore script
+ getDebug; array; Get database debug info
+ getFulltextIndex; array; Get all fulltext fields from table
+ getFoundRows; int; Get the number of rows found
+ getSearchWordLen; int; Gets the size of the ft_min_word_len
+ getRows; array|false; Get all rows from a table
+ getQuery; string; Returns derived query
+ insert; int|false; Insert data into a table
+ misc; bool; Execute a misc query
+ numrows; int|false; Get the number of rows
+ pagination; string|false; Create a pagination
+ parseSchema; bool; Parse and execute schema script
+ query; array|false; Query database
+ select; array|false; SELECT query
+ sqldumptable; string; Create table schema/data restore script
+ strip_slashes; string; Strip slashes
+ truncate; bool; TRUNCATE query
+ update; bool; UPDATE query
+ where; string|false; Builds a WHERE string
# _getCached; array|false; Get cached query
# _logError; Log SQL errors
# _sqlDebug; bool; SQL debug
# _startTimer; Starts a timer for a query
# _stopTimer; Stops a timer
# _writeCache; bool; Write data to cached query

Pages: [1] 2
Powered by SMF 1.1.23 | SMF © 2015, Simple Machines
Nly-Grey Theme by N a t i
Loading...