Zen Cart Logo
Forums / General Questions / products table master_categories_id set to zero when updating master cats from admin

products table master_categories_id set to zero when updating master cats from admin

Locked

Views: 958

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
8 May 2008, 2:46 AM
#1
desimo avatar

desimo

New Zenner

Join Date:
Sep 2005
Posts:
16
Plugin Contributions:
0

products table master_categories_id set to zero when updating master cats from admin

Hello, I occasionally use a page I created to "batch add" attributes and products. When I am inserting a product into the products table, I just insert the number of the master_categories_id:

Actually, now that I look, I am using zen_db_insert()...

<form method=post>
<input type="text" name="master_categories_id" />
<input type="submit">
</form>
// add posted master_categories_id to my_array
$my_array(
'products_id' => 'null',
'master_categories_id' => $_POST['master_categories_id']
);
zen_db_perform($my_array, TABLE_PRODUCTS);

Now, here's the thing- the category id seems to be inserted into the database just like any other category id would (I make sure to choose good categories, i.e, they have no subcategories, other products are able to be inserted into them just fine)

However, in admin > Tools > Store Manager > Reset ALL Products Master Categories IDs, when I reset them, any IDs I have manually added are set to zero.

I even have other products with identical master_categories_id values that don't get reset!

How can I avoid this behavior?

As a note: the categories do NOT work before the master_categories_reset, either. I they show up fine in the store under "New Products," for example, but do not appear to be associated with the category that I chose for them...

TIA,
-desimo

8 May 2008, 8:40 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: products table master_categories_id set to zero when updating master cats from admin

You need to add corresponding records to the products_to_categories table.

8 May 2008, 1:45 PM
#3
desimo avatar

desimo

New Zenner

Join Date:
Sep 2005
Posts:
16
Plugin Contributions:
0

Re: products table master_categories_id set to zero when updating master cats from admin

That makes perfect sense. I see now that those links need to exist for master categories as well as supplemental. Thank you for the quick reply.