VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: z-analysts on June 26, 2013, 23:06:14 PM

Title: [fixed]VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 26, 2013, 23:06:14 PM
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!
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Milbo on June 27, 2013, 11:17:51 AM
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.
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 27, 2013, 16:10:04 PM
Hi Max,

I replaced the code as you indicated but still get the same error. :(

Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Milbo on June 28, 2013, 02:01:19 AM
nice page, really! try the attached file, is for the categories view.

[attachment cleanup by admin]
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 28, 2013, 02:18:13 AM
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
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: franzpeter on June 28, 2013, 10:30:20 AM
Did you give Virtuemart a menu item in joomla menu system?
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Lee2008 on June 28, 2013, 11:07:48 AM
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?


Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Milbo on June 28, 2013, 13:10:53 PM
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 :-)
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Lee2008 on June 28, 2013, 14:28:25 PM
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
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 28, 2013, 16:16:07 PM
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!
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Milbo on June 28, 2013, 16:52:10 PM
Maybe you replaced the view.html.php in the category view, but is for the categories view,..

y, ies
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 28, 2013, 17:11:02 PM
Thank you for your concern Milbo however the file was correctly placed.
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: franzpeter on June 28, 2013, 18:57:32 PM
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.
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: Lee2008 on June 28, 2013, 23:44:57 PM
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

Title: Re: VM 2.0.21g: Category id 0 not published
Post by: 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.
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: z-analysts on June 29, 2013, 17:51:47 PM
Thanks, Milbo! I just removed the info message and now the page displays. I look forward to the next VM release.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Lee2008 on July 02, 2013, 13:13:59 PM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: jkrabbenbos on July 10, 2013, 10:26:14 AM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: jkrabbenbos on July 10, 2013, 10:36:33 AM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Milbo on July 10, 2013, 12:45:16 PM
facepalm. So you say I did it for category but not for categories? grmbl.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: jkrabbenbos on July 10, 2013, 16:17:54 PM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Milbo on July 10, 2013, 16:46:27 PM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: servlet on July 13, 2013, 12:31:35 PM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: 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 :)
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: ecopure on July 14, 2013, 12:26:32 PM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: fastpat27 on July 15, 2013, 13:51:52 PM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Greggo25 on July 23, 2013, 09:50:21 AM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: jkrabbenbos on July 24, 2013, 12:46:19 PM
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.
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Greggo25 on July 24, 2013, 15:15:11 PM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Milbo on July 25, 2013, 22:23:10 PM
I am sorry, I dont know, what happens, when you download the file and use the joomla extension manager and install it there?
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: alicacasaligi on October 22, 2013, 14:38:40 PM
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 :(.

Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Milbo on October 23, 2013, 11:47:27 AM
This is fixed in the new versions, please update or check yourself the view.html.php of hte category view in the FE.
Title: Re: VM 2.0.21g: Category id 0 not published
Post by: evephoto on November 15, 2013, 10:48:23 AM
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 !
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: StefanSTS on December 02, 2013, 07:10:30 AM
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
Title: Re: [fixed]VM 2.0.21g: Category id 0 not published
Post by: Milbo on December 02, 2013, 11:25:41 AM
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