VirtueMart - 1.1 Developer's Guide

Page of 44
1
Chapter 1. Introduction
1.1. History
VM has its roots in an Open Source Shopping Cart Script called phpShop. This script was developed
by Edikon Corp. and the phpShop community (see www.phpshop.org [http://www.phpshop.org]).
VM  was  forked  from  phpShop  version  0.8.0  at  the  end  of  the  year  2003.  It  was  maintainend  and
developed under the name mambo-phpShop until September 2005. In October 2005 it was renamed
to VirtueMart.
1.2. Differences to phpShop
VM  still  contains  some  code  parts  from  phpShop,  but  experienced  phpShop  coders  will  find
similarities.
So when you have experience with phpShop or you are to integrate an existing Add-On for phpShop
into VM, you will have to know what is the difference between both scripts.
1. Parameter Renames/Changes
VM has introduced several new parameters and parameter name changes.
page
Syntax Change Most important is the change of the page parameter syntax from
a  pattern  like  "shop/index"  to  "shop.index"  just  to  provide  support  for  Search
Engine Friendly (SEF) links in your Joomla site. All references to the paramter
page that contain a slash instead of a dot will not be recognized and VM will print
out "module not found" error.
offset
Outdated/removed  The  offset  parameter  was  completely  replaced  by  the
parameter "limitstart", which is Joomla standard for page navigation. Although
there's  a  global  workaround  to  fill  $offset  with  the  value  of  $limitstart  it's  not
recommended to work with offset.
limitstart
The limitstart parameter is the replacement for offset and can be used just like this.
Itemid
This parameter is new and not VM-specific. It's a mandatory parameter that tells
Joomla, which Menu Item is selected and active, so the pathway can be written
correctly  (Home  ->  Online-Shop)  and  modules  which  shall  only  be  shown  on
specific pages are hidden/shown.
2. Database Interface
phpShop has its own database class: ps_DB, in a file called db_mysql.inc. This database class has
been completely modified to be a wrapper class for the Joomla Standard Database Class 'database'.
The new filename is 
ps_database.php
. The class name is still ps_DB, but its a Child Class of
the Joomla database class (class ps_DB extends database) and inherits all methods and properties.
This has a lot of advantages: the class is safe against Joomla database class changes and it provides
backward compatibility for the masses of database calls and queries in the scripts (which don't use
the Joomla functions, but the phpShop functions!). VM doesn't connect to the database, but it uses
the connection Joomla has built up. This is for optimal performance since VM doesn't connect to
the database each time a query is to be run.
3. Database Structure