OSCOM v3.0 Intelligent Checkout With Product Types

Checkout Application

The number of steps during the checkout procedure has been drastically reduced with the new Checkout Application. The checkout procedure no longer starts at the shipping page but now heads directly to the confirmation page which takes care of all dependencies for the order.

The new Checkout Application is simply accessed with:

index.php?Checkout

and works exceptionally well with the flexible Product Types implementation to gather all the information required to complete the order.

Product Types

Each product (or product variant) is assigned a Product Type group which define certain conditions that must be met when a Product Type action is called. Examples of Product Type actions are:

AddToShoppingCart Called when products are added to the shopping cart
PerformOrder Called when the Checkout Application is initialized

Each Product Type action is assigned one or more modular conditions which are checked in the specified order and return either true or false depending on the condition to meet. Failed conditions can optionally execute an onFail() function to help pass the condition. Example conditions are:

RequireBilling Passes true if a billing address and billing method is available
RequireShipping Passes true if a shipping address and shipping method is available
RequireCustomerAccount Passes true if a customer is logged in with their account
RequireStock Passes true if sufficient stock is available

Most, if not all, products would need the RequireBilling condition for the PerformOrder action. Physical products for shipping would obviously also need the RequireShipping condition, whereas digital products would not.

Want to force a customer account for orders? That’s possible with the RequireCustomerAccount condition. Should customers be logged in to add certain products to their shopping cart? No problem. Simply assign the AddToShoppingCart action and the RequireCustomerAccount condition to its Product Type group. Done.

Creating new conditions is amazingly simple with developing new modules that check on the conditions to meet.

Here is how the RequireCustomerAccount condition module is developed:

<?php
  namespace oscommerce\OM\Site\Shop\Module\ProductType;

  use oscommerce\OM\Registry;
  use oscommerce\OM\OSCOM;
  use oscommerce\OM\Site\Shop\Product;

  class RequireCustomerAccount {
    public static function isValid(Product $OSCOM_Product) {
      $OSCOM_Customer = Registry::get('Customer');

      return $OSCOM_Customer->isLoggedOn();
    }

    public static function onFail(Product $OSCOM_Product) {
      $OSCOM_NavigationHistory = Registry::get('NavigationHistory');

      $OSCOM_NavigationHistory->setSnapshot();

      osc_redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
    }
  }
?>

Easy.

Intelligent Checkout

The Checkout Application intelligently gathers the information required to process the order. Both RequiredShipping and RequiredBilling would be common conditions to meet for the PerformOrder action, and would operate with the following workflow:

  1. If no shipping address is defined, automatically use the default customer address if one exists or present the new address form.
  2. Automatically select the cheapest shipping method available for the order.
  3. If no billing address is defined, use the shipping address.
  4. Automatically select the first payment method available for the order.
  5. Present payment method on the confirmation page (eg, credit card details).
  6. Provide links to change the shipping address, shipping method (eg, Express Shipping), billing address, and payment method on the confirmation page.
  7. Process the order once confirmed.

For a customer that is logged in, all information required for the order is already available and is directly taken to the checkout confirmation page. For guests, the minimum checkout flow is 2 steps with the shipping address form and confirmation page.

There is still plenty of room for improving the user experience as described previously with <a href="http://blogs.oscommerce.com/2009/12/16/london-public-meet-up/”>mockups of how the Checkout Application can function.

We look forward to extending this flexibility in future releases to also properly support services that are sold with recurring billing.

Community Feedback

Feedback to this blog entry can be posted on the following topic in the community support forums:

<a href="http://forums.oscommerce.com/topic/358932-oscom-v30-framework-optimized-for-php-v53/”>http://forums.oscommerce.com/topic/358932-oscom-v30-framework-optimized-for-php-v53/

OSCOM v3.0 Application Actions

What Application Actions Do

Application Actions allows functionality to be added to Applications in a flexible manner without needing to edit core source code files. Actions typically define what page content is presented in a given situation and can load nested actions for further processing of data.

Actions are loaded through the page request in the following manner:

index.php?Shop&Account&AddressBook

This initializes the Shop Site, loads the Account Application, and executes the AddressBook Action. The files executed as part of this page request are located in:

oscommerce/OM/Site/Shop/Controller.php Shop Site
oscommerce/OM/Site/Shop/Application/Account/Controller.php Account Application
oscommerce/OM/Site/Shop/Application/Account/Action/AddressBook.php AddressBook Action

Nested Actions

The AddressBook Action only presents the address book page to the customer and contains no data processing logic whatsoever. As the address book should provide functionality to create, edit, and delete address book entries, these operations are properly handled through nested Actions in the following manner:

index.php?Shop&Account&AddressBook&Create
index.php?Shop&Account&AddressBook&Create&Process
index.php?Shop&Account&AddressBook&Edit=1
index.php?Shop&Account&AddressBook&Edit=1&Process
index.php?Shop&Account&AddressBook&Delete=1
index.php?Shop&Account&AddressBook&Delete=1&Process

The files executed as part of these page requests are located in (from the Shop Site directory):

Application/Account/Action/AddressBook/Create.php
Application/Account/Action/AddressBook/Create/Process.php
Create and Process Actions
Application/Account/Action/AddressBook/Edit.php
Application/Account/Action/AddressBook/Edit/Process.php
Edit and Process Actions
Application/Account/Action/AddressBook/Delete.php
Application/Account/Action/AddressBook/Delete/Process.php
Delete and Process Actions

Security And Protection

All Actions in the page request are executed in order. This allows control logic to be defined in the main Action class and affects nested Actions as they are executed. An example is having a customer log-in check in the main Action class and not needing to perform the same check in the nested Actions.

As the dynamic nature of Actions allows great flexibility and ease in adding features and functions to a Sites Application, the order of Actions executed as defined in the page request is halted as soon as an Action does not exist or if the name of the Action is the same as the Session name.

Nested Actions also take priority over parameters in the page request that share the same name.

For example, product information pages are loaded in the following manner with the product keyword:

index.php?Shop&Products&oscommerce-tshirt

The Products Application has the following Actions which therefore cannot be used as product keywords:

  • All
  • Images
  • Reviews
  • Specials
  • TellAFriend

Community Feedback

Feedback to this blog entry can be posted on the following topic in the community support forums:

<a href="http://forums.oscommerce.com/topic/358932-oscom-v30-framework-optimized-for-php-v53/”>http://forums.oscommerce.com/topic/358932-oscom-v30-framework-optimized-for-php-v53/

JavaScript placement for performance

A new post in Web Application Performance series have been posted. If JavaScript is not placed properly it can reduce front end performance badly. See the post JavaScript Placement to see how JavaScript should be placed.

CSS Placement for performance

Another post in web application performance series has been posted. The post covers how css file should be placed in a web page to improve its performance. You can see the post “Web Application Performance: CSS Placement“on our blog. You can find more post to improve performance at http://www.infotales.com/topic/web-performance-optimization/.

Reducing http requests for performance

In web application performance series if have posted a new post describing how to reduce http requests . Reducing http requests can significantly improve page performance and load time. Stay tuned for more in web application performance series.

Web Application Performance series

I have started a new series of post to enhance web application performance. The series will include different methods to improve web application performance both at server side and front end.

Main topics covered includes

Stay tuned to be updated about these topics for web performance enhancements.

SEO how to tell Google more about page?

Telling as much as possible to Google about your different pages, can certainly help in SEO. For example if you have a tables of content, or glossary for the site do tell it to Google and other search engines. Now the question is how to do it for that, see Establishing relationship between pages for SEO. In the post different tags are listed with example, to establish relationship between different pages.

For more on SEO please visit http://www.infotales.com/

How to extend the admin lifetime in oscommerce or oscMax?

I have done this for a few clients. Though they have all come up with different issues, the solutions seems to be the same.
“When I take too long to edit the product, I get logged out.”
“If I leave the admin for a few minutes, I need to redo anything I was doing the last time. The system just says to me to login and all changes are lost.”

The Solution:
Find the following file:
if (!$SESS_LIFE = get_cfg_var(’session.gc_maxlifetime’)) {
$SESS_LIFE = 1440;
}

Replace it with:
/*
if (!$SESS_LIFE = get_cfg_var(’session.gc_maxlifetime’)) {
$SESS_LIFE = 1440;
}
*/
$SESS_LIFE = 86400;

The code may vary a bit depending on the version you might be using. But that should keep the admin session alive for 86400 ( 24 hrs x 60 minutes x 60 seconds = 86400 seconds ) seconds i.e, a Day.

The same solution can be applied to Zen cart and CRE Loaded ( or any other derivative/clone of oscommerce ). Feel free to contact us in case you need any help.

Cheers,
Shiva

PCI – Oscommerce Issues : Interesting Read

The Article is an interesting read on PCI and its compliance issues with open source softwares.. specifically oscommerce. you can view the articlehere.

Cubecart : New security issue found : Ship Key – SQL Injection

The cubecart team today quoted in their forums about a possible SQl injection possible in Cubecart versions 4.4 and lower. The vulnerability was found by the Core Security Team. The exact details can be found here.

The Cubecart Team has however, been very responsive top post a solution to this problem within in a few hours. The team had the following reply on the vulnerability alert ( Original Source: here )


CORE Security Advisories Team have found an SQL injection vulnerability in all current versions of CubeCart 4. The issue concerns a possible SQL injection vulnerability on the shipping method selection drop down box during the checkout process.

This will be patched in CubeCart 4.4.0 which will be released later today. Two fix methods are available below to patch any CubeCart v4 store for those who do not wish to upgrade to 4.4.0. ”

2 Solutions have been posted here:
A. File replace with the upgraded file.
B. Code Fix.
Solution A seems to the most simple one. However, just in case you have some mods done to the cart, you might want to go for solution B. Solution B works just fine in case you have other custom modifications done to the cart. If you have modified the code of the cart in anyway, you could simply apply the same fix ( as applicable ).

Feel free to contact us if you need any help with the fix. To avail the code check for free, mail us here.