VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: kaiserdom on October 12, 2018, 19:59:52 PM

Title: 404 Error Handling: 0 - Using $this when not in object context
Post by: kaiserdom on October 12, 2018, 19:59:52 PM
I'm running Virtuemart 3.4.2 and when I click to link of a product that has been deleted, the system brings this error "0 - Using $this when not in object context" instead of redirecting to "404 Error-Product Not Found".

Virtuemart 3.4.2
Joomla 3.8.13
PHP 7.1.22
Title: Re: 0 - Using $this when not in object context
Post by: GJC Web Design on October 12, 2018, 20:39:17 PM
just tested here  -- I get a proper message

you need to turn on Joomla debug and full error to find where this error is
Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 12, 2018, 22:28:59 PM
Unfortunately I'm not a developer. Could someone please take a look at the link?

https://www.everhome.gr/products/υπνοδωμάτιο/σετ-πάπλωμα-satin-printed-205tc-1428-heidi-detail (https://www.everhome.gr/products/%CF%85%CF%80%CE%BD%CE%BF%CE%B4%CF%89%CE%BC%CE%AC%CF%84%CE%B9%CE%BF/%CF%83%CE%B5%CF%84-%CF%80%CE%AC%CF%80%CE%BB%CF%89%CE%BC%CE%B1-satin-printed-205tc-1428-heidi-detail)
Title: Re: 0 - Using $this when not in object context
Post by: GJC Web Design on October 13, 2018, 10:48:29 AM
link helps no one .. without full error reporting on to say WHERE this error is occurring

http://forum.virtuemart.net/index.php?topic=121692.0

Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 19, 2018, 19:47:17 PM
I'm receiving the existing errors

Notice: Trying to get property of non-object in /var/www/vhosts/everhome.gr/httpdocs/components/com_virtuemart/views/productdetails/view.html.php on line 81

Warning: Declaration of & CustomfieldsForAllFilter::getInstance($tagsArray = Array, $attrArray = Array, $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) should be compatible with & Joomla\CMS\Filter\InputFilter::getInstance($tagsArray = Array, $attrArray = Array, $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1, $stripUSC = -1) in /var/www/vhosts/everhome.gr/httpdocs/plugins/vmcustom/customfieldsforall/helpers/filter.php on line 0

Notice: Trying to get property of non-object in /var/www/vhosts/everhome.gr/httpdocs/plugins/vmcustom/customfieldsforall/customfieldsforall.php on line 815
Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 19, 2018, 19:55:48 PM
The code inside view.html.php
$product_model->withRating = $this->showRating = $ratingModel->showRating($virtuemart_product_id);
$product = $product_model->getProduct($virtuemart_product_id,TRUE,TRUE,TRUE,$quantity);
$this->assignRef('product', $product);

$last_category_id = shopFunctionsF::getLastVisitedCategoryId();

$customfieldsModel = VmModel::getModel ('Customfields');

line 81: if ($product->customfields){
$customfieldsModel -> displayProductCustomfieldFE ($product, $product->customfields);
}
Title: Re: 0 - Using $this when not in object context
Post by: GJC Web Design on October 19, 2018, 22:51:55 PM
they are only warnings/notices and 2 are not from VM

this has nothing to do with the subject of your post
Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 19, 2018, 23:24:52 PM
Ok thanks.
Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 20, 2018, 11:13:11 AM
Is there a way to download VM 3.4.0 where everything worked just fine?
Title: Re: 0 - Using $this when not in object context
Post by: kaiserdom on October 20, 2018, 16:08:45 PM
It seems that the problem is coming from Virtuemart 3.4.2 «404 Error Handling». So I disabled it and created a custom Joomla 3.8.13 «404 redirection page».
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: Milbo on October 26, 2018, 13:24:22 PM
Please use this package http://dev.virtuemart.net/attachments/download/1146/com_virtuemart.3.4.3.9973_package_or_extract.zip
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: kaiserdom on October 28, 2018, 19:01:01 PM
Hello Max

Thank you for your help. This solution brings up the right message, but it redirects wrongly. The redirection page is something like a mix of non-found-product category view and product details view. Very weird.
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: Milbo on October 29, 2018, 08:59:37 AM
which is not possible. It should call the last correctly opened category
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: kaiserdom on March 21, 2019, 14:43:49 PM
For example, If I load https://www.mysite.com/products/category/product-detail the 404 error handling produces the proper message and redirects me to the same url https://www.mysite.com/products/category/product-detail and not the desired one which is https://www.mysite.com/products/category/. Thus the outcome is a weird page view. How can I omit the product-detail part on the redirections?
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: kaiserdom on April 22, 2019, 13:46:08 PM
Anybody?
Title: Re: 404 Error Handling: 0 - Using $this when not in object context
Post by: Milbo on April 23, 2019, 20:05:32 PM
I just can say, that it works in my case
404 The requested product does not exist.

for index.php/en/product-attributes/default-pro45duct-detail with the sample data.

and I opened first the category index.php/en/product-attributes and then the product default-product-detail