Hi,
I just upgraded to 2.0.21g from 2.0.21f and now get "Category id 0 not published" when I display my top level categories page. To see the error, please go to http://zclientdev.net/solfairtrade and click on the Products image.
VM 2.0.21g
PHP 5.3.16
Joomla 2.5.11
Please advise.
Thank you!
thanks.
search in the view.html.php of your category/categories view for
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just complete it with
if($category->virtuemart_id!==0 and !$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
Will be in the final then.
Hi Max,
I replaced the code as you indicated but still get the same error. :(
nice page, really! try the attached file, is for the categories view.
[attachment cleanup by admin]
Thank you for the site compliment Milbo!
I uploaded your file but still get the same error. Is there something else I should be looking at?
Thanks,
Tim
Did you give Virtuemart a menu item in joomla menu system?
I put the file in..
public_html/components/com_virtuemart/views/categories
I can't see any change.
Is there any other thing I must do?
Strange for me it works
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
This is just a check to prevent unpublished categories to be shown if someone is changing the id in the link or so. The problem is just that I forgot that category_id= 0 means, "show all". So an exception should be enough. I just sent the file, in case you did not understand what to replace. I dont know your skill :-)
Hi,
I can publish the menu link in my top menu and if I set it to "virtuemart categories layout" and set as "top level" then the error is:
Category id 0 not published
index.php?option=com_virtuemart&view=categories&virtuemart_category_id=0
I can link to specific category and the images appear, but if clicked I am taken back to template front page.
hellboardriders.com
So I am not sure what I have set wrong.
Any advice appreciated.
Regards Lee
franzpeter: yes, I gave the top level category a joomla menu option. If you go to my test site, http://zclientdev.net/solfairtrade, then click on any image, then click on Products in the top menu you will get the same error.
milbo: you said that your fix works for you but on which site does it work? does my site display properly for you?
thank you!
Maybe you replaced the view.html.php in the category view, but is for the categories view,..
y, ies
Thank you for your concern Milbo however the file was correctly placed.
I did try it out and if I add the VM categories layout to a Joomla menu and select that in the frontend, I receive the same message: category id 0 not published.
Hi,
I posted my path above, it is in:
public_html/components/com_virtuemart/views/categories
If I turn off Joomla SEF on configuration.
I can find my products Eg:
http://hellboardriders.com/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=12&virtuemart_category_id=2&Itemid=198
My Main Menu shop url does not work:
http://hellboardriders.com/index.php?option=com_virtuemart&view=categories&virtuemart_category_id=0&Itemid=198
Error is :
Category id 0 not published
Your help is appreciated
Regards Lee
you can also just remove the info message and the return. The fix works 100%. Franzpeter got a new version and has not anylonger the problem.
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just remove this in your view.html.php.
Thanks, Milbo! I just removed the info message and now the page displays. I look forward to the next VM release.
Thanks so much Milbo!
Perfect fix for me :D
Just deleted that line and now my categories display is beautiful once again.
Thank you thank you
Regards Lee
It seems that this did not make the 2.0.22 !!
But the code is different from what is shown here. After upgrading to 2.0.22 it still shows the error message. I searched the code and I see it is embedded in another if statement.
An addition to my previous message: it is the view.html.php from the categories directory that is the problem. I commented out the code as given earlier in this thread and now it works.
The extra "if" construction is in the view.html.php from the category directory.
facepalm. So you say I did it for category but not for categories? grmbl.
I double checked it in the download version of 2.0.22. In the categories view.html.php line 57-60 still has the code as described before. I did not change the file in the category directory.
In fact I dont like the categories view anyway. I think we should remove it and add an extra layout to the category view. The categories view was created as we had no layout controll.
Quote from: Milbo on June 29, 2013, 17:39:02 PM
you can also just remove the info message and the return. The fix works 100%. Franzpeter got a new version and has not anylonger the problem.
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just remove this in your view.html.php.
In 2.0.22 the problem still exist. This fix wokrs...
Thank you
I fix this problem in 2.0.22 version by deleting one of the two sign "=" in line 57 of file site\components\com_virtuemart\views\categories\view.html.php
Code before fix:$category = $categoryModel->getCategory($categoryId);
if($category->virtuemart_id!==0 and !$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
Code after fix:$category = $categoryModel->getCategory($categoryId);
if($category->virtuemart_id!=0 and !$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
and now it works :)
worked for me too - thank you - using 2.0.22
Quote from: Milbo on June 29, 2013, 17:39:02 PM
you can also just remove the info message and the return. The fix works 100%. Franzpeter got a new version and has not anylonger the problem.
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just remove this in your view.html.php.
Quote from: Snake 60 on July 13, 2013, 23:23:24 PM
I fix this problem in 2.0.22 version by deleting one of the two sign "=" in line 57 of file site\components\com_virtuemart\views\categories\view.html.php
Code before fix:$category = $categoryModel->getCategory($categoryId);
if($category->virtuemart_id!==0 and !$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
Code after fix:$category = $categoryModel->getCategory($categoryId);
if($category->virtuemart_id!=0 and !$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
and now it works :)
Snake, simple well explained answer for me as a beginner. Sometimes the answers put up are ok for experienced coders but it's nice to know exactly where the file is and even the line number of the code. IG Thumbs up to Snake!
Regards
FP
Hey Guys
When I enter my URL address 4markets.com.au the code is coming up
Category id 0 not published
Now, I am a beginner and not sure how to implement the above fix, could someone explain the exact steps in lay mans terms of how to resolve this?
Thanks in advance
Gregg
Hi Gregg,
What version of VirtueMart are you using? The update of 2.0.22a, which I tested this morning, does not have the problem anymore.
Hey Jan
Oh OK, I seem to have the 2.0.22 version.
I have tried to install the update but am getting the following error when I click on the 'update' link:
Invalid Token, in store config
Any reason this is happening?
Thanks
Gregg
I am sorry, I dont know, what happens, when you download the file and use the joomla extension manager and install it there?
Quote from: Milbo on June 29, 2013, 17:39:02 PM
you can also just remove the info message and the return. The fix works 100%. Franzpeter got a new version and has not anylonger the problem.
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just remove this in your view.html.php.
Hi Milbo,
I try all things which you suggest but nothing work & see error "Category id 0 not published". Now tell me how to fix it... Please :(.
This is fixed in the new versions, please update or check yourself the view.html.php of hte category view in the FE.
Quote from: Milbo on June 29, 2013, 17:39:02 PM
you can also just remove the info message and the return. The fix works 100%. Franzpeter got a new version and has not anylonger the problem.
if(!$category->published){
vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL',$category->category_name,$categoryId);
return false;
}
just remove this in your view.html.php.
Worked for me too ! Thanks !
Hello,
I just updated Virtuemart to 2.0.24c from 2.0.20b with com_virtuemart.2.0.24c_extract_first.targz and got the same Category id 0 not published.
I fixed that one or two month ago on the test installation of the site, when another update came, so I could just use the view.html.php file for categories, since nothing else was changed.
But it would be really helpful, if the updates would include the fixed file.
So long
Stefan
Also written in the news. your error is very likely coming from the categories view, which is obsolete, please read here http://forum.virtuemart.net/index.php?topic=120433.0