Archive

Archive for the ‘osCommerce’ Category

New Community Add-Ons Site

September 22nd, 2007 Harald Ponce de Leon Comments off

The new community add-ons site is now live which aims to replace the current contributions section on the support site by providing additional features to help developers maintain their add-on packages.

The new site will be rolled out in 3 stages with the first stage contemplating the existing contributions section. In addition, community members and developers can help clean the structure of add-on packages by reporting uploads to be removed.

The following changes are planned for the second and third stages of updating the new site:

2nd Stage Updates:

  • register_globals compatibility flag for 2.2-RC1 and 2.2-Final installations
  • Maintainers can assign their add-ons as public or private to allow or disallow additional uploads from other community members
  • If an add-on is private, maintainers can assign other community members as maintainers who are allowed to upload files to the package

3rd Stage Updates:

  • Allow maintainers to edit descriptions
  • Allow maintainers to link their uploads to a forum topic (for support)
  • Allow maintainers to upload screenshots of the add-on in action
  • Allow maintainers to link to other add-ons as a “related” feature
  • Allow community members to adopt an inactive add-on

The new community add-ons site can be reached at:

http://addons.oscommerce.com

We look forward to rolling out the additional features in the coming weeks and look forward to the additional suggestions the community has for improving the experience of finding, downloading, and contributing additional add-on packages.

Categories: osCommerce Tags: ,

Introducing Product Attributes

September 3rd, 2007 Harald Ponce de Leon Comments off

Although the product attributes implementation has been replaced with the newer Product Variants feature, a new feature of the same title is being introduced to 3.0 Alpha 5 which deals with non-core related product data with a flexible and modular implementation.

This allows modules to be created to define new data parameters for a product which can easily be accessed via its module code.

Once a product attribute module has been installed via the Administration Tool (in the same manner payment and shipping modules are installed), its field is automatically added to the edit product page where the module controls the presentation of having its value defined.

This allows add-ons to be installed that add data fields to the product without the need to modify the edit product page in order to save the data in the database.

A minor change to the database class has also been performed to automatically bind the database table names in SQL queries which allows any database table to be accessed without the need to define it first in the includes/database_tables.php file. (This file will be removed in the 3.0 release)

Here is a short QuickTime movie showing the new Product Attributes feature with the following attribute modules:

1) Date Available (javascript controlled input field)
2) Manufacturer (pull down menu)
3) Shipping Availability (pull down menu)

osCommerce Online Merchant Product Attributes QuickTime Movie
osCommerce Online Merchant Product Attributes QuickTime Movie; 1.1MB

The product information page on the store front-end has also been updated to allow the dynamic product variant combination values to control certain data on the page, such as the product price and the product model.

osCommerce Online Merchant Product Info Page
osCommerce Online Merchant Product Info Page

The introduction of the new Product Attributes feature is currently defined for master products only, which product variants will use, and will be definable at the product variants level once the edit product page has been redesigned to handle the presentation of the data.

Categories: osCommerce Tags:

Product Variants and Custom Values

August 30th, 2007 Harald Ponce de Leon Comments off

The new Product Variants feature has been extended to allow custom variant values which customers can define themselves. Common use of custom variant values is accepting text to apply to the product, for example, Apple providing engravements on their iPod multimedia devices, and clothing stores that print custom text on the front and back of t-shirts.

Here is a short QuickTime movie showing how product variants are created for a t-shirt product, and extended on by providing custom variant values:

osCommerce Online Merchant Product Variants QuickTime Movie
osCommerce Online Merchant Product Variants QuickTime Movie; 3.7MB

The primary change to support custom variant values went into the shopping cart class where it referenced each product in the shopping cart via its product ID. This brought in a limitation where it was not possible for a customer to add a t-shirt with different custom text values to their shopping cart incase they wanted to order the same t-shirt multiple times with different texts.

To allow this behaviour, each product in the shopping cart is now referenced by an automatically generated, customer specific, item ID where it is possible to order multiple quantities of a product, and now possible to order a product multiple times with different custom variant values.

osCommerce Online Merchant Product Info Page
osCommerce Online Merchant Product Info Page

It is now possible to mark a product variant as the default product variant on the Administration Tool to have default values already selected on the product information page. This shows above with the “Size” pull down selection list and the “Colour” radio button choices.

As this product accepts custom values, each time it is added to the shopping cart it is treated as a separate product in the shopping cart contents. This allows the product to be added multiple times with the same variant combination values but with different custom text values.

osCommerce Online Merchant Shopping Cart Page
osCommerce Online Merchant Shopping Cart Page

This behaviour only applies to products with custom variant values where adding a normal standard product to the shopping cart multiple times would increment its quantity value.

The parsing of the product variant combinations are performed by modules assigned to the variant group, which can easily extend the behaviour of product variants to suit ones needs. This modular implementation has also introduced our first PHP 5 optimized abstract class which forces modules to follow an operation standard.

To further extend the Product Variants feature, we will also be looking at making it possible for customers to upload files when adding products to their shopping cart. This builds on the custom text possibility for t-shirts where logos and images can be attached to an order. The next set of changes will finalize the implementation for the 3.0 Alpha 5 release and be committed to /trunk/, with the file upload extension being looked into for the 3.0 Alpha 6 release.

Categories: osCommerce Tags:

Introducing Product Variants

August 21st, 2007 Harald Ponce de Leon Comments off

The Product Attributes implementation for the 3.0 Alpha 5 release is being replaced with a new cleaner and flexible solution called Product Variants. This extends the previous Product Attributes feature by creating separate product records for each variant and assigning them to one master product.

This allows the quantity, price, model, weight, status, and other product data information to be assigned distinctively to each variant a product has. As each variant has its own product record, referencing a product with a specific variant combination is easily performed with the product ID.

This is an extreme improvement over the previous implementation where specific attribute combinations were referenced with a string value containing the product ID and the various attribute group and attribute value IDs (eg, 14{2}14{5}256).

Here is a short QuickTime movie demonstrating how Product Variants are defined on the Administration Tool and how they are handled on the Online Store:

osCommerce Online Merchant Product Variants QuickTime Movie
osCommerce Online Merchant Product Variants QuickTime Movie; 1.6MB

The Administration Tool product listing identifies products containing variants and graphically distinguishes the records to normal product records:

osCommerce Online Merchant Administration Tool Product Listing
osCommerce Online Merchant Administration Tool Product Listing

The price range for the product variants (the minimum and maximum prices) are shown in the product listing as well as the number of total quantities the master product has.

Defining variants for a product can be performed by clicking on an “Add Variant” action button and by double clicking on the variant values to add:

osCommerce Online Merchant Administration Tool Product Variants
osCommerce Online Merchant Administration Tool Product Variants

The product variant combinations are held within javascript values and are first saved (or deleted) when saving the product record.

The Online Store also distinguishes between normal products and products with variants by showing either the full product price for normal products, or the minimum price for products with variations:

osCommerce Online Merchant Product Variant Pricing
osCommerce Online Merchant Product Variant Pricing

The Product Variants feature has been freshly committed to my subversion development branch and will be merged to trunk as soon as the implementation is finalized. The interaction with product variants on the product information page is being finalized and will be showcased later this week with another blogging entry.

If you’re keeping up to date with my development branch, please take a look at the changes and provide feedback on the community forums. Thanks!

Categories: osCommerce Tags:

Optimizing for PHP 5; Object Visibility

July 20th, 2007 Harald Ponce de Leon Comments off

With our recent announcement of optimizing the osCommerce Online Merchant v3.0 release for PHP 5, I will begin blogging about the changes performed here for the v3.0 Alpha 5 and v3.0 Alpha 6 releases to serve as a guide for our community developers. This should help in understanding how the v3.0 framework is designed and how add-ons can take advantage of the optimized framework.

gophp5-100x33.pngOur decision to optimize the v3.0 framework for PHP 5 is based on the end of life support cycle for PHP 4 which ends at the end of this year. The announcement the PHP Group made regarding this coincides with the efforts of the GoPHP5 initiative whom which we are also supporting.

This allows us to concentrate on a PHP 5 optimized framework for future releases in the v3.x release series without the need to spend resources on PHP 4 compatibility past its end of life cycle.

The first PHP 5 optimized commits have already been performed in our development repository which reflects the classes and Object Oriented design of the framework. The new Object Model of PHP 5 allows us to tighten the design of the framework with the use of “object visibility”, and will be the first step in optimizing the framework for PHP 5.

Object visibility is in regard to defining class members and methods into three different visibility levels: public, protected, and private, which reflect how they can be accessed from outside the class, within the class, and within its inherited children.

The three levels function as:

public – this element can be accessed from inside and outside the class object
protected – this element can be accessed from inside the class object and its inherited children
private – this element can only be accessed from inside the class object

We’ll take a look at a shortened version of the session class to describe how each three visibility levels work.

class osC_Session {
protected $_id = null;
protected $_name = 'osCsid';

public function __construct($name = null) {
$this->setName($name);
$this->_setCookieParameters(SERVICE_SESSION_EXPIRATION_TIME);
}

public function getID() {
return $this->_id;
}

public function getName() {
return $this->_name;
}

public function setName($name) {
session_name($name);

$this->_name = session_name();
}

protected function _setCookieParameters($lifetime = 0, $path = null, $domain = null, $secure = false, $httponly = false) {
return session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
}
}
?>

The class members $_id and $_name are both protected and allow only to be accessed from within the class and its inherited children. This disallows accessing these members from outside the class as shown in the following example:

$osC_Session = new osC_Session();

echo $osC_Session->_id; // not allowed
$osC_Session->_name = 'test'; // not allowed
?>

To allow access to these members from outside the class they must be defined with the public visibility level. As we don’t allow this as part of our coding standards, get and set methods are defined in the class that allow public access to the class members, as shown in the following example:

$osC_Session = new osC_Session();

echo $osC_Session->getID(); // allowed
$osC_Session->setName('test'); // allowed
?>

Accessing the getID() and setName() class methods from outside the class object is allowed as these have been defined with the public visibility level.

On the other hand, the _setCookieParameters() class method is defined with a protected visibility level and cannot be accessed from outside the class object. The _setCookieParameters() class method can therefore only be accessed from within the class and its inherited children, as is being done in the class constructor.

The session implementation in v3.0 (Alpha 5) has been impoved to allow modules to be loaded that define how the storage of the session data is accessed. An example session module is the database module that stores the session data in the database. Each session module is an extension to the osC_Session class and therefore inherits its class members and methods.

This allows the database session module, named osC_Session_database, to access the public and protected class members and methods from the main osC_Session class.

If there were class members and methods defined in the osC_Session class with the private visibility level, its inherited children such as the osC_Session_database class would not be allowed to access it.

The default behaviour in PHP 4 is to allow full public access to all class members and methods. By using the visibility levels PHP 5 provides, it is possible to disallow public access to class members and methods to keep certain functionality for internal use by the framework only.

Further information regarding object visibility levels can be read at the PHP Manual.

As each class is being updated in the framework, phpDocumentation is also being written to provide a developers API guide with the v3.0 release, that describes each class member and method. This documentation will be completed during v3.0 Alpha 5 and v3.0 Alpha 6.

Categories: PHP, osCommerce Tags: