Zen Cart Logo
Forums / General Questions / Error can not add product wrong product type

Error can not add product wrong product type

Locked

Views: 3,467

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
8 Oct 2006, 2:51 AM
#1
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Error can not add product wrong product type

I have setup the database added lots of products, edited can move between folders, but can not add new product.

The error comes up in pink after you click new product and says "The pecified product type cannot be added to this category. The category in question can take products _ general and that is what it is setup for. But no matter what and I have tried to fixed the tables. I can not add a new product.

What to do to be able to add product to the category???

Thanks,
C

8 Oct 2006, 2:55 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

  1. Admin->Catalog->Product Types ... which product types are listed?
    Have you made any changes to these settings anywhere? If so, what?
    Have you deleted any of the defaults?

  2. Admin->Catalog->Categories/Products ... edit the category you're getting the error with. Which categories does it show as restricted to (at bottom of category edit details)?

8 Oct 2006, 2:55 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Error can not add product wrong product type

Could you check your product_types table via phpMyAdmin and post the settings that you have in there?

8 Oct 2006, 3:20 AM
#4
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Re: Error can not add product wrong product type

Ajeh:

Could you check your product_types table via phpMyAdmin and post the settings that you have in there?
Product_types
Product-General product
Product-Music product_music
Document-General document_general
Document-Product document_product
Product-Free Shippping product_free_shipping

Attached find Product Type to Category which is making no sense at all to me. What is this suppose to have in it. This looks like it might be the problem.

Thanks,

C

8 Oct 2006, 3:23 AM
#5
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

What is the structure of your product_types_to_category table ?

Is there an auto-increment on one of the fields? In this case, there should not be...

8 Oct 2006, 3:30 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Error can not add product wrong product type

If I go to phpMyAdmin and browse the product_types table I see the following:

type_id type_name type_handler type_master_type allow_add_to_cart default_image date_added last_modified
1 Product - General product 1 Y 2006-09-20 22:32:57 2006-09-20 22:32:57
2 Product - Music product_music 1 Y 2006-09-20 22:32:57 2006-09-20 22:32:57
3 Document - General document_general 3 N 2006-09-20 22:32:57 2006-09-20 22:32:57
4 Document - Product document_product 3 N 2006-09-20 22:32:57 2006-09-21 17:02:52
5 Product - Free Shipping product_free_shipping 1 Y 2006-09-20 22:32:57 2006-09-20 22:32:57

What do you see?

8 Oct 2006, 3:35 AM
#7
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Re: Error can not add product wrong product type

DrByte:

What is the structure of your product_types_to_category table ?

Is there an auto-increment on one of the fields? In this case, there should not be...

There is no auto increment, but shouldn't the table consist of
product-general 's number and all the categories it has and the only other product type I am using is Document_Product.

So whatever number is applied to product_general in my case should be opposite all the catergories that are in that category

and

document-product has only two categories in it that would be Memberships and Donations.

So is there a way to edit this by hand to reflect what should really be there?

I do write my own tables and database driven sites so I am somewhat familiar with populating tables, but I am not sure in this case what numbers are applied to the product_type or categories. Where exactly would I find those???

Do only the main categories go in here or the sub categories also???

C

8 Oct 2006, 3:38 AM
#8
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

In your product_types table, do you have only 5 records, or do you have 35 records? And what are they?

8 Oct 2006, 3:50 AM
#9
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

As far as database-layout goes ...

if a category has a restriction enforcing only certain product-types to be allowed within in, then a record for that category and the prod-type-restriction should be in the product_type_to_category table.

8 Oct 2006, 3:52 AM
#10
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Re: Error can not add product wrong product type

DrByte:

In your product_types table, do you have only 5 records, or do you have 35 records? And what are they?

In my products types table I have 5 records in my products types to categories table I have 143 records and they seemed to be auto incremented even though auto increment is not turned on.

I only have 28 categories some of which are null. So it seems to be I should only have 38 product_type to categories entries.

Is that right??

C

8 Oct 2006, 4:03 AM
#11
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

You should only have product_type_to_category records for categories that have restrictions on them.

So ... fastest way to fix ....

  1. truncate the product_type_to_category table
    ..... actually, check the table structure in your database vs the original in the mysql_zencart.sql file in the zc_install folder. Perhaps even drop and recreate it.

  2. Now go and rebuild all your product-type restrictions on each of your categories.

  3. Be sure to do good backups.

  4. Go back and look at all your code-customizations to find out if anything you've changed could affect that table in any way.

8 Oct 2006, 6:15 PM
#12
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Re: Error can not add product wrong product type

DrByte:

You should only have product_type_to_category records for categories that have restrictions on them.

So ... fastest way to fix ....

  1. truncate the product_type_to_category table
    ..... actually, check the table structure in your database vs the original in the mysql_zencart.sql file in the zc_install folder. Perhaps even drop and recreate it.

  2. Now go and rebuild all your product-type restrictions on each of your categories.

  3. Be sure to do good backups.

  4. Go back and look at all your code-customizations to find out if anything you've changed could affect that table in any way.

Lost my DSL last night so am just getting back to this today.

Where do I rebuild the product-type restrictions? Are you saying if the product uses the default template when there is no category in the table for them???

If the category document product has a special template then the two categories I have using that template SHOULD be in the product_type to categories table??? and all others not???

Thanks for the help.

C

8 Oct 2006, 6:24 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

I think there needs to be some clarification on functionality.

Category "restrictions" ONLY restrict which product-types you can use to CREATE NEW products within said category.

Whatever product type you use to create a product ... is what will be used to display that product. It has NOTHING to do with the restrictions in the admin related to a given category.

Categories can contain products of any product type. But the restrictions affect creation of NEW products.

8 Oct 2006, 6:26 PM
#14
drbyte avatar

drbyte

Sensei

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

Re: Error can not add product wrong product type

This is how you set up restrictions related to creating new products in a given category:

DrByte:

  1. Admin->Catalog->Categories/Products ... edit the category you're getting the error with. t bottom of category edit details you see the product types which this category has been restricted to create?
8 Oct 2006, 7:20 PM
#15
cshart avatar

cshart

Zen Follower

Join Date:
Mar 2005
Posts:
370
Plugin Contributions:
0

Re: Error can not add product wrong product type

Success --- dumped the table and put the new data in and voila things are working again.

Thanks for the help.

C