Category Mixup

Locked

Views: 1,893

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
13 Aug 2009, 7:44 PM
#1
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Category Mixup

Please help...

I am using Zen Cart 1.3.8a

my site is under development at: http://centaurhorseshop.co.za/shop/

Occasionally, if you navigate to saddles ( a category) and then click on a subcategory, the breadcrumb at the top indicates that the subcategory is a subcategory of Veterinary, another category.

I have tried moving the products around, and it seems to be related to the one category, Saddles. The products are not linked to other categories.

It does not seem to happen with other another test product that I have put under Clothing > Gloves

Any ideas would be helpful!:smile:

13 Aug 2009, 8:16 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Category Mixup

It also highlights the Veterinary category in the sidebox. What happens if you delete the Vet category, check the navigation, then re-create it?

15 Aug 2009, 1:17 PM
#3
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

AARRGH! now it highlights training aids... very wierd. am going to delete saddles rather...

15 Aug 2009, 1:21 PM
#4
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

Hmmm

Just moved the products in saddles, and now the category they are in is becoming mixed up. so I think it is the products... will delete products, and try again..
ho hum...

15 Aug 2009, 1:23 PM
#5
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

or perhaps not - it appears that clothing > gloves now also has this problem. Very wierd, because it is intermittent...

15 Aug 2009, 2:11 PM
#6
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

OK

If I do this:
admin > config > product info > Previous Next - Navigation Includes Category Position > set to "0" off

the breadcrumbs are correct. Very confused.

15 Aug 2009, 2:37 PM
#7
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

The problem seems to be when you click on a subcategory from a category page (where the subcategory is listed, sometimes with a thumbnail). How can possibly fix this as I would like this page to work. Other wise I must remove the link to it.

Can someone please help?:lamo:

15 Aug 2009, 8:06 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Category Mixup

What version of Zen Cart?

Clean or Fresh Install?

What Add-Ons?

Do you Manually add Products and Categories or do you Import?

categories_id 60 is somehow not behaving correctly on your site ...

Either you have bad code or bad data ...

The question is, which one is causing this? :blink:

In your database table:
categories

how many categories_id have the parent_id of 60 ...

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!

16 Aug 2009, 9:55 AM
#9
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

Thank you so much for looking at this.

What version of Zen Cart?:
Zen Cart 1.3.8a
Database Patch Level: 1.3.8
v1.3.8 [2009-07-02 14:34:11] (Fresh Installation)
v1.3.8 [2009-07-02 14:34:11] (Fresh Installation)

Clean or Fresh Install?
Developed locally and then uploaded according to instructions, using fix_cache_key. But now I see the problem exists on the local version as well. I deleted all the categories on the local version, and put new ones in, but it does the same thing, if you navigate from the top level of the ctegory page ( the one with thumbnails and text links of the subcategories)

What Add-Ons?
Manufacturers box modifaction to display manufacturers as list and not drop downs (but I can't think that would affect the categories). I also used the following solution ```

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $ */ $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n"; for ($i=0;$i<sizeof($box_categories_array);$i++) { $cPath_array = explode('_', $box_categories_array[$i]['path']); $level = count($cPath_array); switch(true) { // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday // uncomment the select below and set the cPath=3 to the cPath= your_categories_id // many variations of this can be done // case ($box_categories_array[$i]['path'] == 'cPath=3'): // $new_style = 'category-holiday level'.$level; // break; case ($box_categories_array[$i]['top'] == 'true'): $new_style = 'category-top level'.$level; break; case ($box_categories_array[$i]['has_sub_cat']): $new_style = 'category-subs level'.$level; break; default: $new_style = 'category-products level'.$level; } if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) { // skip if this is for the document box (==3) } else { $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">'; if ($box_categories_array[$i]['current']) { if ($box_categories_array[$i]['has_sub_cat']) { $content .= '<span class="category-subs-parent level'.$level.'">' . $box_categories_array[$i]['name'] . '</span>'; } else { $content .= '<span class="category-subs-selected level'.$level.'">' . $box_categories_array[$i]['name'] . '</span>'; } } else { $content .= $box_categories_array[$i]['name']; } if ($box_categories_array[$i]['has_sub_cat']) { $content .= CATEGORIES_SEPARATOR; } $content .= '</a>'; if (SHOW_COUNTS == 'true') { if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) { $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX; } } $content .= '' . "\n"; } } if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') { // display a separator between categories and links if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') { $content .= '<hr id="catBoxDivider" />' . "\n"; } if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') { $show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<a class="category-links level'.$level.'" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . '' . "\n"; } } if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') { // display limits // $display_limit = zen_get_products_new_timelimit(); $display_limit = zen_get_new_date_range(); $show_this = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p where p.products_status = 1 " . $display_limit . " limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '' . "\n"; } } if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') { $show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1"); if ($show_this->RecordCount() > 0) { $content .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '' . "\n"; } } if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') { $content .= '<a class="category-links level'.$level.'" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n"; } } $content .= '</div>'; ?>

 Do you Manually add Products and Categories or do you Import?
I manually added the products on the local installation, and then imported into the www version. But the problem is also on the local version.

 categories_id 60 is somehow not behaving correctly on your site ...
I added another one that will go below it, (Veterinary, or  categories_id 62) and now category 60 is behaving properly, and 62 is not. 

how many categories_id have the parent_id of 60 ...
none, it looks like to me (or 62) but I am not sure if I am checking correctly. But, if I go to phpMyAdmin, I see the following warning:

The following indexes appear to be equal and one of them  should be removed: PRIMARY, categories_id

I am sooooooooooo confused!
16 Aug 2009, 3:12 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Category Mixup

For the indexes on the products_to_categories table you should have 2 of them ...

You can rebuild them by deleting the ones that are there and then running these SQL commands:

ALTER TABLE products_to_categories ADD PRIMARY KEY ( products_id , categories_id );

ALTER TABLE products_to_categories
ADD INDEX idx_cat_prod_id_zen ( categories_id , products_id );

Have you applied the Known Bug Fixes for v1.3.8 ...
http://www.zen-cart.com/forum/showthread.php?p=610860#post610860

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!

17 Aug 2009, 7:18 AM
#11
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

Tried that on my local installation and got this:

Error

SQL query:

ALTER TABLE products_to_categories ADD PRIMARY KEY ( products_id , categories_id ) ;

MySQL said: Documentation
#1068 - Multiple primary key defined

no idea wha tto do now.

17 Aug 2009, 9:51 AM
#12
tinkerdesign avatar

tinkerdesign

New Zenner

Join Date:
Jul 2009
Posts:
26
Plugin Contributions:
0

Re: Category Mixup

Thank you everyone for your help - you are probably going towant to ban me from the forum, but I eventually found the problem: I wanted to use indented styles for my meu in the side box, so I altered: tpl_categories.php. When I reloaded the original file, the navigation breadcrumbs are correct, but I have lost some of the styling. So that must have been it! Will have to figure out another way to style navigation.

Thank you so much Stevesh and Ajeh for your patience and time.

17 Aug 2009, 1:32 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Category Mixup

Thanks for the update and glad things are working ... :smile:

On the Indexes, delete the ones that are there on the:
products_to_categories

then run the SQL commands to rebuild them correctly ...

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!