kilbot / WooCommerce-POS

:bangbang: All development now at https://github.com/wcpos.
http://wcpos.com
GNU General Public License v3.0
353 stars 125 forks source link

Missing require_once template.php & screen.php - Fix Included! #77

Closed kilakewe closed 9 years ago

kilakewe commented 9 years ago

/wp-content/plugins/woocommerce-pos/includes/class-wc-pos-gateways.php causes error's in 0.4RC.

Impacting:

Missing the following:

require_once(ABSPATH . 'wp-admin/includes/template.php' );

if( ! class_exists('WP_Screen') ) {
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
};
kilbot commented 9 years ago

Hi @kilakewe, can you give me your WP version, WC version and PHP version so I can try to replicate.

kilakewe commented 9 years ago

@kilbot Here you go.

WC Version2.3.10 WC REST APIAPI is active WP 4.2.2–en_GB

PHP Version 5.3.29

Shop URL: http://swanky.nz * Browser Info * Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36; js flexbox no-touch indexeddb smil

kilbot commented 9 years ago

And do you happen to have your PHP version. It's just that this error didn't show in beta testing with that config so I'll have to try and reproduce it.

Also, I am literally just about to update the Pro plugin and the website. I'll come back to this issue when I'm finished. If anyone else experiences this problem I will certainly put out a patch later today.

kilakewe commented 9 years ago

@kilbot PHP Version 5.3.29

It seems to allow me to activate pro but it still comes up with an error message in POS view. error

kilbot commented 9 years ago

I see ... something is calling the woocommerce_payment_gateways action unexpectedly. A possible fix would be edit line 40 to: if( is_admin() && function_exists('get_current_screen') ){, rather than load extra files.

Are you on a test server? I'd love to get a debug_backtrace() at that point to see what is triggering woocommerce_payment_gateways.

kilakewe commented 9 years ago

I'm not sadly, but I'm fine if you want to have a look around on my server. I've swapped the code you'd recommended but I'm still getting the error.

kilakewe commented 9 years ago

I take it back. the code seems to work now. How odd. Let me know if you'd still like to take a look around

kilakewe commented 9 years ago

It may have had something to do with WP Super Cache not making woo pos an exception.

kilbot commented 9 years ago

I've updated GitHub and the WordPress.org repo with the function_exists check, it should have been there anyway so good catch! :)

I'll close this issue for now.