Need help from anyone that understands virtuemart!
Posted 18 years 3 weeks ago
Posting here because I am trying to figure something out with the categories in Virtuemart, and the VM site and forums are down for the last few days:( So I started wondering if anyone here had done some customizing to virtuemart for there site. There is something strange with the categories and showing the number of items in the categories. It seems that sometimes the parent categories will show the total number of products included in them from all of the subcategories underneath them, and sometimes they don't. One category shows 8 products in it, and when you click on it, there are 4 subs underneath it with 2 products each in them. However, there is also the main category "City Water Softeners", and it shows 0 products in it, when really there is more like 600, they are just in sub categories that are underneath the main. So I am trying to figure out why sometimes a parent category will count the total number of items from in the children subcategories underneath it, but some parents show 0 products even though there are hundreds of products underneath it in the children categories. It looks like it may just show one parent above. Like if there are products in some children categories, and there is a parent category one above those children, it will show the total number of items for all the children one category below it if the actual product is in those categories. However, if the actual products are in a said category, that category will show the number of products in it, then one parent category up from that will show the total number of products in any children one level below it, however, if there is another parent above that, it will not show the total number of products in the categories more than one level below it. So what I am trying to do is cause the total count to work all the way through to the top parent category, no matter how many levels deep it is. Any one have any ideas?
Re: Need help from anyone that understands virtuemart!
Posted 18 years 3 weeks ago
I had this happen to me. I only use VM as a catalog so I don't know if it will work for you or not. What worked for me was to unpublish all of the categories and unpublish the products. Then republish them and it refreshes the counts. Turn off site cache when you do it, I thought it didn't work but the correct numbers showed up later.
Re: Need help from anyone that understands virtuemart!
Posted 18 years 3 weeks ago
Hmm that's odd, are you sure your problem was the same as what I am describing? I had to go into the ps_product_category.php file and modify the area that was commented "Shows the Number of Products in category $category_id". The original code was only counting the items that where directly in that category and the ones that are directly in any categories one level below. If any products where in subcategories that are more than one level below, it wouldn't count them. However, after modifying the code in the area I pointed out earlier, all is good, the top parent category shows any items at all listed anywhere in the category, no matter how far down the products are. If anyone else has this problem, or wants to make this change, let me know and I'll post the code.
Re: Need help from anyone that understands virtuemart!
Posted 18 years 3 weeks ago
what I amrefering to is if you have a parent category, with no prducts in it. Then you have a some children categories under that, still with no products in them. Then you have children under the children, and that's where the products are. The children-clidren will show the number of products in each category. The Children category will show the accumulated number of products of all of the children-children category products below it. However, the parent category will not total up the number of products into it's total. So while there may be hundreds of products in that category, 2 or more levels below, the parent shows 0. Thismodification fixes that:)