Jump to content

Products / Cat_id's


Guest tommiesguides

Recommended Posts

Guest tommiesguides

Hi,

I have 'successfully' added products via uploadling a CSV file to cubecart v3.

All the right number of products appear, and you can search for them but where I added one item manually per category to get the right file strucutre for the DB (spreadsheet) when I import the items themselves only the original one shows per category folder and it lists number of items as 1.

Why would this be so? I have emptied the table and reuploaded it with the correct cat_id per item yet still only the first item is 'listed'

I have even tried adding the father_id in case that was the problem.

Any ideas? I must be missing something v.simple right?

http://www.archerytools.co.uk/cubecart/index.php

Thanks

Ryan

Link to comment
Share on other sites

Guest tommiesguides

:wacko: Arghh! no no - I have no idea. All the products have a cat_id yet the folder only shows 1 item (the one I entered using the cubecart interface) - why the ones do not show uploaded via CSV I just do not know. Maybe there is a bug?

Link to comment
Share on other sites

No, it's no bug. There are TWO tables that need to be modified when you add products. You have to also put your products into the CubeCart_cats_idx table. If you have access to PHPMyAdmin, you can easily just execute the following SQL statement and it *should* fix your problem.

INSERT INTO CubeCart_cats_idx (cat_id, productId) SELECT CubeCart_inventory.cat_id, CubeCart_inventory.productId FROM CubeCart_inventory WHERE 1;




If you have images with your newly imported items already assigned, you may need to run this SQL command:


INSERT INTO CubeCart_img_idx (productId, img) SELECT CubeCart_inventory.productId, CubeCart_inventory.image FROM CubeCart_inventory WHERE 1;

Good luck!

Link to comment
Share on other sites

  • 2 weeks later...
Guest tommiesguides

Thanks for the reply Sir William. I don't seem to be getting msg posting emails so only just picked this up (I'll recheck my settings in cp)

I have done what you say below and still the folders on the homepage containing the items show for examples "Brickwork (1)" although when you click on the folder all the right products show up.

Any ideas?

Link to comment
Share on other sites

Yeah, the number of products doesn't seem to work no matter what you do (including the index fix Sir William came up with). I finally just removed it altogether so it doesn't look like there are no products in a category.

Just go into the viewcat.tpl for whatever skin you are using and delete the part of the line that says something like ({TEXT_PRODUCT_NO}) or something like that. I don't remember the exact wording, but it was pretty obvious when I looked at the file.

Link to comment
Share on other sites

Ok, you guys keep coming up with problems and I keep coming up with solutions. :(

I'm not even loading my DB with CSV, but for those who have, I have built a script which will parse your database and update it accordingly so your number of products will be correct.

I've only tested it 4 levels deep, but it should work to an indefinite depth of sub-categories. It will work on both the main category assignment and any category assignment made with the "Manage Categories" feature. This means that if you have one product in 5 categories and sub-categories, it will still update the counts accordingly.

Oh, and unlike my other mods, I did this one strictly in English. I wasn't going to go through the trouble to add stuff to the lang.inc.php for a file you'd likely only run once or twice. :D

I submitted it to the mods section, but it hasn't been approved yet. For those who can't wait, you can download it here:

http://www.swscripts.com/downloads/fixCatCount.zip

You'll need to download, extract the PHP file (fixCatCount.php) and upload it to your /admin/categories/ directory. Then just call the file in your browser and it should fix your problems.

As always....Backup your database first! Use at your own risk.

Please let me know if it works or doesn't work for you. I always want other people's opinions on such things.

Link to comment
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.

×
×
  • Create New...