404 Error Handling: 0 - Using $this when not in object context

Started by kaiserdom, October 12, 2018, 19:59:52 PM

Previous topic - Next topic

kaiserdom

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

GJC Web Design

just tested here  -- I get a proper message

you need to turn on Joomla debug and full error to find where this error is
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation


GJC Web Design

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

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kaiserdom

#4
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

kaiserdom

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);
}

GJC Web Design

they are only warnings/notices and 2 are not from VM

this has nothing to do with the subject of your post
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kaiserdom


kaiserdom

Is there a way to download VM 3.4.0 where everything worked just fine?

kaiserdom

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».

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

kaiserdom

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.

Milbo

which is not possible. It should call the last correctly opened category
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

kaiserdom

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?