My first impression is that Oscommerce version 3 is far better than version 2. Version 3 had employed template, using object oriented, better installation process, and many more improvements. But I feel that the files are (still) scattered in the designed directory structure. Compared to other cms framework (such as Joomla, Drupal, even Wordpress), IMHO, they provide better way to manage template files.
It seems, Oscommerce customization is intended for developers. Not end user.
What I do first, as I learning by doing, is copy and rename downloaded template files.
I need to:
- make a folder under oscommerce's root folder, like this: [oscommerce3_root]/templates/[my_template]
- create [my_template].php, also in [oscommerce3_root]/templates/
- create [my_template].php inside [oscommerce3_root]/admin/includes/templates/
Then inside [oscommerce3_root]/admin/includes/templates/[my_template].php, I need to edit class osC_Template_batik_lovers_01 to define groups. Groups is term for content area in pages. I made it like this:
class osC_Template_batik_lovers_01 {
var $_id,
$_title = 'batik_lovers_01',
$_code = 'batik_lovers_01',
$_author_name = 'freeoscommerce.com',
$_author_www = 'http://www.freeoscommerce.com',
$_markup_version = 'XHTML 1.0 Transitional',
$_css_based = '1', /* 0=No; 1=Yes */
$_medium = 'Screen',
$_groups = array('boxes' =>
array(
'search-box', 'language-box',
'user-menu', 'sidebar-top', 'sidebar-bottom',
'content-top', 'content-bottom',
'left', 'top_right'),
'content' => array('before', 'after')),
This php file also serve as template installer. There is $data in function install(), and I made it look like this:
$data = array('categories' => array('products/*', 'content-top', '100'),
'manufacturers' => array('products/*', 'content-top', '200'),
'whats_new' => array('*', 'sidebar-bottom', '300'),
'search' => array('*', 'search-box', '300'),
'information' => array('*', 'content-bottom', '500'),
'shopping_cart' => array('*', 'left', '400'),
'manufacturer_info' => array('products/info', 'right', '200'),
'order_history' => array('*', 'right', '300'),
'test_sellers' => array('*', 'left', '500'),
'product_notifications' => array('products/info', 'right', '500'),
'tell_a_friend' => array('products/info', 'right', '600'),
'specials' => array('*', 'content-top', '700'),
'reviews' => array('*', 'left', '800'),
'languages' => array('*', 'left', '900'),
'currencies' => array('*', 'left', '1000'),
'new_products' => array('index/category_listing', 'after', 400),
'new_products' => array('index/index', 'after', 400),
'upcoming_products' => array('index/index', 'after', 450),
'recently_visited' => array('*', 'after', 500),
'also_purchased_products' => array('products/info', 'after', 100));
This is a cool feature, the template installer can also define default box's location.
That's it for now.

No comments:
Post a Comment