PDA

View Full Version : Creating a new General Product Type


Wallins Creek
2016-08-16, 07:44 AM
Technical documentation on Product Types:
http://tutorials.zen-cart.com/index.php?article=114

A wiki article with similar content:
http://www.zen-cart.com/wiki/index.php/Product_Types

A related Forum Thread: http://www.zen-cart.com/forum/showthread.php?t=6888

Walnut Grove
2016-08-16, 07:45 AM
The files that the general Product Type uses are:

/admin/product.php
/admin/includes/modules/product/collect_info.php
/admin/includes/modules/product/collect_info_metatags.php
/admin/includes/modules/product/preview_info.php
/admin/includes/modules/product/preview_info_meta_tags.php
/admin/includes/modules/***/update_product.php
/admin/includes/modules/***/update_product_meta_tags.php
/admin/includes/modules/***/copy_to_confirm.php
/admin/includes/modules/***/delete_product_confirm.php
/admin/includes/modules/***/move_product_confirm.php
(and other files in the /admin/includes/modules/ folder as necessary)
/includes/modules/pages/product_info/header_php.php
/includes/modules/pages/product_info/jscript_main.php
/includes/modules/pages/product_info/jscript_textarea_counter.js
/includes/modules/pages/product_info/main_template_vars.php
/includes/modules/pages/product_info/main_template_vars_product_type.php
/includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php
/includes/templates/YOURTEMPLATE/templates/tpl_product_noproducts.php


The collect_info script is used to display the input fields to add/edit products.
The preview_info script is for ... previewing the content for submission.
The update_product script is for saving the information after preview.
The other scripts are used for manipulating data.
The various files in the /admin/includes/modules folder are shared among all product types. If a given product type needs to "override" the default behavior, the original can be copied into the subdirectory named for that product type.

The product_music type is an example of using external tables to store related data, allowing the collection/editing of that data in the admin, and the display of that data in the storefront template.

Your case may not need the several different tables that the music stuff does, but if you pared it down to just one table, you'd be set.

Walworth
2016-08-16, 07:46 AM
"product_general" is actually named "product". General is just a friendly name, not an actual word used in filenames/scripts.

It's all keyed from the type-handler defined in the product_types table for that product type entry.