You are here:  » Error 500 - deprecated constructor method


Error 500 - deprecated constructor method

Submitted by PS on Tue, 2019-04-02 08:40 in

Hi David,

Getting the following after migrating a site with PT. Any help appreciated! :)

Notice: The called constructor method for WP_Widget in pto_atoz_widget is deprecated since version 4.3.0! Use __construct() instead.

{code saved}

Submitted by support on Tue, 2019-04-02 08:57

Hi,

The patch required is in this comment

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Wed, 2019-04-03 13:43

Thanks - sorry I realise now I should have posted on the .org site.

I did those amends but it resulted in the following error:

Notice: Undefined index: index.php?pagename=&pto_module=merchant in {code saved} on line 448

NB: I couldn't find a 'search.php' file - only pto_search.php. Many of the line numbers didn't correlate either, although I did find the references in the other files. So not sure if that comment is possibly out of date?

Any help appreciated! :)

Submitted by PS on Wed, 2019-04-03 13:45

Also - is there a reason the code fires on pages where widgets/tables etc aren't used? It would be great to add a function that allows it to fire only on certain pages or when the shortcode is used.

Submitted by support on Thu, 2019-04-04 08:56

Hi,

Thanks for the note - I've updated the line numbers in the linked post for plugin v3 (beta).

That code refers to the rewrite rule set-up hook of the plugin which is required since WordPress uses an internal rewrite mechanism - I'll check the reason for that to occur on my test server but in the mean time, if you edit pto.php and look for the following code beginning at line 445:

    if (
       (!isset($rules[$k]))
       ||
       ($rules[$k] <> $rules[$v])
       )

...and REPLACE with:

    if (
       (!isset($rules[$k]))
       ||
       (!isset($rules[$v]))
       ||
       ($rules[$k] <> $rules[$v])
       )

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Thu, 2019-04-04 15:04

Thanks David.

Seems to have fixed the former issue but when I re-activated the plugin, it said the there were excess lines of code generated that it didn't expect. (Sorry, didn't grab the error text).

On the page with tables, it now shows:

{code saved}

Submitted by support on Mon, 2019-04-08 09:46

Hi,

To add $html initiation for that case edit pto_product.php and look for the following code at line 384:

  global $pto_html_product;

...and REPLACE with:

  global $pto_html_product;
  $html = "";

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Tue, 2019-04-09 13:30

That's worked! Thanks so much...