Raise a 404 error instead of Fatal error: Call to undefined method stdClass::getForm()

sohopros

Member
We are having an issue with some unpublished Fabrik menu items. When trying to access these menu items by pasting the url in the address bar we are getting a Fatal Error when a 404 would be expected. See the procedure to reproduce below.

Procedure
1. Enable SEF settings "Search Engine Friendly URLs" & "Use URL rewriting"
2. Copy the URL for a Fabrik details page
3. Disable (un-publish) menu item related with the Fabrik Details Page
4. The following message at the url above: Fatal error: Call to undefined method stdClass::getForm() in /home/davis33d/public_html/components/com_fabrik/views/form/view.base.php on line 56

Our website uses a Rocketheme template and the 404 page was defined following this documentation. We are using Fabrik 3.2 (Github Version)

Questions:
1 - Can a 404 error be raised in this situation?
2 - What is the best way to accomplish it?
3 - Can you, please, point us to some documentation explaining the process?

Thank you,
Rodrigo Kammer
 
If you unpublish the menu item, then the results of trying to use it are "undefined", as obviously Fabrik can no longer access the details associated with the itemid.

If you simply wish to have a Fabrik menu item on a hidden menu, do just that - put them on a hidden menu. Create a new menu, and don't assign it to any module positions.

-- hugh
 
Thanks Hugh,
We are using Fabrik as a directory and want to be able to present our 404 page to visitors that click a link associated with an expired entry (an entry that was once valid, but now removed). Can you suggest the best way to do that? So far we have tried:
  1. un-publishing the menu item - results noted above
  2. entering a Redirect from the old URL to the 404 page - fatal error as above
  3. changing the menu item alias - same fatal error as above
  4. deleting the entry from Fabrik - this result depends on whether the menu item is un-published or not, if the menu item is left published, then an error page is served by Fabrik - "We are unable to find this record." . If the menu item is unpublished, then we get the same fatal error as above.

Is there any simple way to serve a 404 page for the urls of expired entries?
 

Attachments

  • fabrik-error.png
    fabrik-error.png
    5.2 KB · Views: 167
I can't replicate.

On my site with SEF&URL rewrite on an unpublished (or not existing) menu item link is redirected to 404 page and afterwards the link can be found in Components/Redirect.

A details link (opened via list menu item, which now is disabled) is redirected to the default page.

So I assume something is incorrect in your URL rewrite.
Which file is throwing the fatal error?
 
Ah, OK, I see what you want to do. So by:

an expired entry (an entry that was once valid, but now removed)

You mean a detail or form view, for a row which has been removed from the table (list)?

Off the top of my head, the only way I could think of to do that would be to have a form PHP plugin, running onBeforeLoad, which looks up the requested rowid in the table by running a select query, and if it doesn't exist, manually throw a 404.

-- hugh
 
Hi Hugh!
These are detail pages. We want to delete the menu item, but keep the record in the Fabrik List. And we need the link to return a 404. The menu item might become available again. Then the menu item will be publish and we expect to url to return the details page.

Can you, please, guide us on how to accomplish it?

Thank you,
Rodrigo Kammer
 
I don't seem to be able to replicate this:

http://screencast.com/t/ymYtgw119Jc

When I unpublish the menu link and try to revisit it, I get a 404, exactly as expected.

This is on a relatively new J! 3.3 system, just updated to 3.4, with the latest Fabrik github, and pretty much no extensions installed other than Fabrik and JomSocial.

Let me know if I'm still misunderstanding what you are trying to do.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top