Jump to content
Sign in to follow this  
varesin73@aim.com

Script properly fixes category counts when the database is populated manually or loaded with a CSV file

Recommended Posts

Hi all, there used to be a simple script required to fix the category counts when the database was populated manually or loaded with a CSV file. The categories have been created/added and now I have about 11000 products to add and all have their allocated category/sub category number. However, after adding a few products as a test the CubeCart_category_index stays empty and all products need to be manually allocated to their individual category. 

Is the following work around still the same as at https://swscripts.com/cubecart-mods/fixcatcount.html ?

I looked in the forum and to my amazement I could not find anything about this.

 

Thank you for your direction,

Pippo

Share this post


Link to post
Share on other sites

I actually found the answer. Yes the mod remains the same :

TRUNCATE TABLE CubeCart_category_index;

INSERT INTO CubeCart_category_index (product_id, cat_id) SELECT product_id, cat_id FROM CubeCart_inventory;

On a different note, what does the primary field do in CubeCart_category_index ?

Thank you

 

Share this post


Link to post
Share on other sites

In CubeCart, one can associate a product to more than one category, with one of those categories designated as the Primary category. This designation is indicated by a true-ish value in the 'primary' column.

The Primary category (cat_id) is also recorded in each product's record in CubeCart_inventory.

The Primary category is what will construct the breadcrumb path when viewing that product, regardless of the path of pages one took to get there (Sale Items, Searches, or secondary category path). Also, if using Shipping by Category, only the Primary category contributes to the list of available shipping options.

When deciding to show what products are visible (a logged-in admin overrides this), if any of the associated categories is enabled and not hidden, then the product will be shown.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...