Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Advanced Customization 2.x

Kevin Ottley edited this page Apr 11, 2014 · 1 revision

Advanced Customization of WebStore 2.x

Background

Web Store 2.0 is written using QCodo PHP5 web application framework . It follows the MVC (Model-View- Controller) application methodology and PHP5’s Object Oriented programming features.

Skill Requirements for Coding in Web Store 2.0

Advanced knowledge of PHP5 Understanding of Object-Orientated programming, class inheritance, method overloading Javascript and jQuery CSS3 HTML

Reference Sites

Background

WebStore has been designed using the Object Oriented model to allow programmers to expand the functionality of the program. Although you can make modifications to any file, we highly recommend that you modify following our recommendations on file placement and program structure. If you make modifications to WebStore's core files, it can prevent you from upgrading to future versions without overwriting your customizations. If you have any questions about our recommendations, please contact Xsilva or post on the Programming Forums.

Directory Structure

Below is a basic description of system files and folders. The source code itself contains additional phpDoc notes and instructions within the files beyond the basic descriptions found here.

From top level (additional breakdown follows)

Folder Notes
assets Images, CSS and Javascript used by Qcodo MVC (not WebStore specific)
custom_includes Folder for your custom programming. For examples on how to use this folder, see an example project at https://github.com/lightspeedretail/webstore/wiki/Creating-a-custom-controller
db_backup Backup files from performing WebStore database backup
favicon.ico
includes WebStore and Qcodo core CRUD functionality and data classes. Also contains created configuration files
index.html Redirect to index.php
index.php Index file, do not modify directly.
install.php Installer script. Is it not necessary to delete this file after installation.
photos Writable folder for product photos, also store header image
templates Shipping and custom templates folder
verify-img.php Captcha template
xls_admin.php Called by Web Admin panel
xls_ajax_search.php Called by AJAX searching mechanisms.
xls_image_upload.php Called by LightSpeed uploader for uploading photos.
xls_jumper.php Used by payment modules that redirect offsite (i.e. Paypal, Authorize.net Simple)
xls_payment_capture.php Called by payment processors
xls_soap.php Called by xls_ws_service.
xls_ws_service.php Called by LightSpeed uploader.
xlsws_includes WebStore logic files. Use these files as a guide for overloading the functions in custom_includes, but we highly recommend not making direct modifications.

Code Execution

Everything in Web Store 2.0 executes via index.php as far as visitors and customers are concerned. index.php works based on GET parameters and directs requests to files in custom_includes/xlsws_includes folder.

  • search=[Search term] - goes to searchresults.php
  • xlspg=[file name] - executes given filename in custom_includes or xlsws_includes. If the given file name (parameter is without the .php extension but file searched is with .php) is found in custom_includes folder it will take precendence over xlsws_includes folder.
  • product=[Product code] – dispatch to product.php in custom_includes or xlsws_includes folder)
  • customer_register= - Customer registration page
  • family=[Family name] – Show family page
  • cpage=[page key] – display custom page using custom_page.php

Files in xlsws_includes folder will include other modules like sidebars, shipping and payment gateways as required. Finally, it will render generated controls and components using defined template in templates directory.

Reserved Namespace

Xsilva reserves the right to modify or change any function, class, file or directory names prefixed with xls, _xls , xlsws. Please refrain from using these names.

Global Variables

Global variables are not used in Web Store 2.0 extensively. There are only two global variables that are exclusive to Web Store 2.0

  • $customer holds the current logged in customer
  • $XLSWS_VARS is a combination of $_GET and $_POST

Stack Functions

Since session maintenance of variables can be quite hectic, Web Store 2.0 uses a stack variable system which is maintained across page requests.

  • _xls_stack_add(VariableName , Value) : Will save Value under VariableName in the stack. You can keep calling this function with the same VariableName to keep adding more values on top of the old one
  • _xls_stack_get(VariableName) : will return the last added value under VariableName
  • _xls_stack_pop(VariableName) : will return the last added value under VariableName and remove it from the top of the stack.

Debugging

For quick debugging and step logging, please use function _xls_log(object or string or array as paramaeter). _xls_log will accept a single variable of any type. And it will print it in Apache’s error log or wherever PHP’s error logging is done. It will also insert this in the database for viewing by Admin Panel system logs.

Clone this wiki locally