Forums / Setting Up Categories, Products, Attributes / Weird issue with product types

Weird issue with product types

Locked

Views: 2,598

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
18 Jul 2008, 1:20 PM
#1
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Weird issue with product types

Dunno if this is the right place for this, but I ran to a odd issue with product types.

I have the basic product types in my shop and have not ever touched them.

For some reason 11 products in my database have had their product type id set to 0 (zero) and there is no product type with an id of 0 in the database... the first product type is "general" with id 1.

I noticed this as I could not edit the products in admin, as it just kept giving me a "page not found" or that require() function could not open a file (because the product type directory could not be found)

I have not touched the products in question in a long time, but they have worked just fine in the past.

How can the product type change without touching them, and why only 11 products of the 166 products change?

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

18 Jul 2008, 1:34 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,666
Plugin Contributions:
0

Re: Weird issue with product types

Are you using something other than Zen Cart to add products to the Database?

To fix them change the 0 to 1 directly in the database using phpMyAdmin.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

18 Jul 2008, 3:31 PM
#3
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Kim:

Are you using something other than Zen Cart to add products to the Database?

To fix them change the 0 to 1 directly in the database using phpMyAdmin.

I have used easy populate something like 6 months ago, but the products were fine after that.

I did an UPDATE query to the database to set the product types back... I was just wondering how this could have happened...

someone SQL injecting me :shocking:

Well maybe not :smile:

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

16 Aug 2008, 10:57 AM
#4
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Since my last post, again 3 products have had their product types set to 0.

Fixed with:

mysql> update zen_products set products_type=1 where products_type=0;
Query OK, 3 rows affected (0.05 sec)
Rows matched: 3  Changed: 3  Warnings: 0

This time 1 of the products was the same as before, but 2 were different and such products that I had not touched since the last occurance of this "malfunction"

Since the last time, all I have done is updated stock numbers of some products, added few new products and moved a few products to new categorys. :blink:

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

16 Aug 2008, 10:59 AM
#5
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Just wondering... is there a way to log all admin side queries?

this way I could go through the log and see where the products type gets changed...

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

7 Sep 2008, 4:25 PM
#6
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Since my last post, 6 products has had their product types set to 0 !!!!!!!

Again the products seem "random", and non of them had been edited etc...!

This is really starting to be annoying as the products do not work correctly if the type is 0 !!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

24 Sep 2008, 8:51 AM
#7
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Again... since my last post, 6 products have been set to type 0

mysql> select products_id,products_type,products_quantity from zen_products where products_type=0;
+-------------+---------------+-------------------+
| products_id | products_type | products_quantity |
+-------------+---------------+-------------------+
|          53 |             0 |                 0 | 
|         206 |             0 |                 5 | 
|          74 |             0 |                10 | 
|         137 |             0 |                 6 | 
|         192 |             0 |                 3 | 
+-------------+---------------+-------------------+

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

24 Sep 2008, 9:00 AM
#8
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

Is there any builtin log-all-queries thingy in zencart... it slows things down but with it I could see where this happens!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

30 Sep 2008, 12:19 PM
#9
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Weird issue with product types

Hi Pasi,

I have had this same problem a couple of times too, and in my case it seems to be related to editing a product while the cPath is not set (or maybe also when it's value is invalid?).

Normally, when you edit a product using your Zen Cart admin, the url looks like this for example:

admin/product.php?page=1&product_type=1&cPath=90&pID=681&action=new_product

But when cPath is missing, like this:

admin/product.php?page=1&product_type=1&pID=681&action=new_productand the product is updated, the product_type is set to 0.

I haven't had time yet to look into it further and do more testing, hopefully I will have time later today or tomorrow.

30 Sep 2008, 12:39 PM
#10
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Weird issue with product types

I think I spoke to soon! It probably was the product_type itself that was not set.

5 Nov 2008, 7:16 AM
#11
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Weird issue with product types

paulm:

I think I spoke to soon! It probably was the product_type itself that was not set.

Yes, this was the problem... one link in a custom report didn't have the products_type set and after "updating" the product the type was set to 0...

I think the default behaviour should be to leave the type setting alone and not just assume it's always passed to the product edit page.

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

5 Nov 2008, 7:46 AM
#12
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Weird issue with product types

In my case the absent product_type link was caused by a bug in a script I wrote myself (admin notes advanced).

Thus the absent product_type was converted by Zen Cart to an int value of 0, and then passed to the database.

pasi:

I think the default behaviour should be to leave the type setting alone and not just assume it's always passed to the product edit page.Indeed. And also a check if the products_type exists, before storing it's value to the database, would be nice :smile: