Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Setting Up Categories, Products, Attributes / Creating a new General Product Type

Creating a new General Product Type

Locked

Started by timps on 25 Sep 2007, 4:54 PM · Views: 9,545

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
25 Sep 2007, 4:54 PM
#1
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Creating a new General Product Type

My goal is to duplicate product_general so that I can add a few extra fields. There is another much more recent thread about creating fields, which I tried and works well, but it alters core files which I don't like.

I found the following exchange in an old thread:

I need to duplicate the general product type many times. Is there an easy way to do this? I looked at the book example in the download sections and WOW! :blink:, it was a lot to handle.

I don't want all of the new fields this example demonstrates. I just want the generic, general template.

Any help would be much appreciated!

Thanks!That pretty sums up my situation as well. Ajeh then replied:

                                                                                              > I would use Beyond Compare ...

On the left is the full version
On the right an empty directory
Then find all the peices and parts to product_general or product_info
As you copy from left to right it makes the subdirectories for you.
Now you have a full complete set for the Admin and the Catalog for a clean Product General.
Now, find the chunk of code for the product types in the mysql_zencart.sql that makes up a product type for the product_type_layout and product_types table
This will be the insert set. Note the pattern of the names.
Next copy that clean set to another directory ...
Now run through and rename all peices and parts to the new product type name
Once you can use a set and just change the names ... you can make gangs of them.

Note: the admin uses an override system ... there are the default files for the product types, then directories with overrides for the differences. You may or may not need to make many of these as they can use the defaults unless you need customization somewhere.
__________________
Linda McGrathThe key line being this one:
Then find all the peices and parts to product_general or product_infoAjeh also wrote:
A 100% true Product Type would have all of the settings that you see in Product General ... this allows the settings to be 100% unique per product type so you can configure all the little nuances of a Product Type separately from another Product Typs ... :)This begs the question, how does one identify "all the pieces and parts to product_general..."? Searching the entire cart directory for product_general doesn't reveal much at all.

While I would much prefer to duplicate product_general, in the mean time I'm trying to follow advice in the first few posts of another old thread "Adding new Product_types", which identifies files used in the music product type. I'm documenting the entire process as I go so that:1. I can easily locate errors and make corrections.
2. I can post the exact refined procedure (pdf?) so that others can easily follow it. In the interest of simplicity, I would only add a single field.I'm thinking of a much simpler contrib than the book product types. One that contains all the necessary files in their appropriate directories, explicit instructions on naming and editing those files to create a new product type, and to add a single new field and database table/field. From this, most of us lesser types can surmise how to expand on that to add additional fields as needed.

So...what was my question again? :cry: Oh yeah, how to identify all the parts of product_general?

26 Sep 2007, 7:39 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Creating a new General Product Type

Technical documentation on Product Types:
https://www.zen-cart.com/tutorials/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

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

26 Sep 2007, 3:24 PM
#3
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Re: Creating a new General Product Type

Thanks for the reply DrB, but I've read all of those. I don't mind doing the research, rolling up my sleeves, and then climbing under the hood to get the job done, but unfortunately I have a very limited range of brain cells. Trust me, I'll never be one of world's great programmers.

Even the music type is FAR more complex then I and, I suspect, many others need or desire. I don't need anything like genre, record companies, filter side boxes, etc. Trying to sort through all that and decide what CAN be eliminated is just too much, makes my head spin. Just a few extra fields is all that is needed, period. Nothing special. No sorting, filtering, or any other options necessary.

As I mentioned in my OP, I did successfully use the steps in the thread "How-To: Add new properties to your products". Here is a screen shot:

Screenshot
(Sorry couldn't hotlink to it.)

Sku:, Color:, Content:, etc are the additional fields added. This suits my needs perfectly. However, this alters core files which I anticipate will result in a future disaster come upgrade time. Thus my desire to duplicate product_general with those additional fields. K.I.S.S. How hard can it be?

I'm aware that the zen team has worked hard voluntarily to produce a very fine shopping cart, and I certainly do appreciate it. However, this lack of user createable fields is the one thing that prevents us from using zencart for this product. We are currently using it for our sewing classes though.

I don't know what the policy is on mentioning other carts here, but there is one for purchase in the UK that begins with J that I would grab in a heartbeat if only I could getting funding approval. It does provide user createable fields per product from within the admin area. Oh well. Sigh...

26 Sep 2007, 3:31 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Creating a new General Product Type

Using the Developers Tool Kit ...

Do a search on:
product_general
product_free_shipping
document_product

What that does is give you an idea of how the product types vary while still using the same database tables for products and products_description ...

product_music uses additional tables ...

So, you can decide which is easier, the extra fields in products and products_description or the extra database table(s) as product_music does it ...

As long as the extra fields default to the right values so that other product types are not affected by the new fields, you only have to address the new fields in your new product type files ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

26 Sep 2007, 3:54 PM
#5
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Re: Creating a new General Product Type

Thanks Ajeh, I'll check it out. I imagine that it is preferable to use tables. I expect my needs would be for a single table with just those fields I want to add plus a product_id field, yes? Next question would be how to populate that id field as each new product is created? (I can probably figure this out though)

I don't know if this makes any difference but, one of the challenges I have is transferring well over 1000 products from an existing database to the zencart database. We have roughly 10 fields. I currently enter all products into an Access database and output to a pipe delimited file for use by our antique perl cart. From Access, I also need to print sheets of labels for each product as they are created. This system allows me single data entry. Zencart's single description field is unacceptable for the separate fields I have. I did actually develop a method to convert from access to zen's description field, but it was such a Rube Goldberg affair and not easily repeatable, I sent it to /dev/null.

26 Sep 2007, 4:19 PM
#6
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Re: Creating a new General Product Type

Well, I was able to come up with all kinds of stuff for document_product and product_free_shipping, but absolutely nothing for product_general.

27 Sep 2007, 12:31 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Creating a new General Product Type

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.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Sep 2007, 12:32 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Creating a new General Product Type

timps:

Well, I was able to come up with all kinds of stuff for document_product and product_free_shipping, but absolutely nothing for product_general.

"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.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Sep 2007, 1:39 PM
#9
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Re: Creating a new General Product Type

Thank you very much DrByte, I'll be working on this. I did try searching for "product" but nearly every file in the system comes up.

30 Sep 2007, 4:38 PM
#10
timps avatar

timps

New Zenner

Join Date:
Apr 2005
Posts:
54
Plugin Contributions:
0

Re: Creating a new General Product Type

So far I've found everything but the file named tpl_product_no_products.php. I did find tpl_product_info_noproduct.php though, so I assume that's what you meant DrByte.

1 Oct 2007, 2:11 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Creating a new General Product Type

Try the file name:
tpl_product_info_noproduct.php

Little typo there ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!