Here is a little summary of what I had to do to add a new product type. This only covers the catalog section. Everything seems to be working OK. I've not tested it extensively by any means, so YMMV.
These are the files that I had to create in order to setup a new product_magnet type. 'TEMPLATE', of course, refers to your custom template directory.
includes/extra_datafiles/magnet_type_database_names.php
includes/languages/english/extra_definitions/product_magnet.php
includes/languages/english/product_magnet_info.php
includes/languages/english/TEMPLATE/product_magnet_info.php
includes/modules/pages/product_magnet_info/header_php.php
includes/modules/pages/product_magnet_info/jscript_main.php
includes/modules/pages/product_magnet_info/main_template_vars.php
includes/modules/pages/product_magnet_info/main_template_vars_attributes.php
includes/modules/pages/product_magnet_info/main_template_vars_images.php
includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php
includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php
1. includes/extra_datafiles/magnet_type_database_names.php
Code:
define('TABLE_PRODUCT_MAGNET_EXTRA', DB_PREFIX . 'product_magnet_extra');
define('TABLE_MAGNET_PLATE', DB_PREFIX . 'magnet_plate');
define('TABLE_MAGNET_GRADE', DB_PREFIX . 'magnet_grade');
These three definitions are tables that I created in my database. Only the first definition is necessary. It, among other things, holds the id references for the other tables. The other two tables contain supporting data that you will have to design and input manually. You can probably use the other tables for the music genre as templates.
2. includes/languages/english/extra_definitions/product_magnet.php
Code:
define('BOX_HEADING_SPECS', 'Magnet Specifications');
This was the only definition that I needed. Pretty self explanitory. This is the extra english text that goes on your product_info page.
3. includes/languages/english/product_magnet_info.php
-OR-
includes/languages/english/YOUR_TEMPLATE/product_magnet_info.php
Copy the file product_music_info.php from the same directory and begin editing to your taste. Don't add any extra definitions... just change the ones that are there. If you need to add more definitions, then do it in step #2.
4. Copy the entire directory includes/modules/pages/product_music_info
to
includes/modules/pages/product_YOURTYPE_info/
5. includes/modules/pages/product_magnet_info/header_php.php
includes/modules/pages/product_magnet_info/jscript_main.php
NOTHING TO DO!!!
6. includes/modules/pages/product_magnet_info/main_template_vars.php
This file needs some serious consideration. This is where you will be grabbing all of your special information from the DB regarding this specific product. If you are database challenged, this is going to be difficult.. but not impossible!
Fortunately our friendly Zen Admin's have given us a good template in the product_music type. Read through it a few times.
7. includes/modules/pages/product_magnet_info/main_template_vars_attributes.php
Very few changes here. Only two lines changed to add the music product type.
This line (110):
Code:
if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $_SESSION['customers_authorization'] != 0)) {
Code:
was changed to:
if ((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) {
And this line (170):
Code:
if ((SHOW_PRODUCT_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
was changed to:
Code:
if ((SHOW_PRODUCT_MUSIC_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
I didn't have to change any of this since my product type doesn't use attributes.
8. includes/modules/pages/product_magnet_info/main_template_vars_images.php
includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php
NOTHING TO DO!!!
9. includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php
This is the file to customize how the product is displayed. You will want to make sure you are displaying all of the special information out of the database.
THE END
Hopefully this will do more good than harm. Let me know if anything is unclear, missing, or just plain wrong. I'll try to put the instructions for the admin section up later on.
Bookmarks