Sorry if this may sound like a dumb question. Yesterday I've updated my Wordpress Plugins and suddenly everything crashed, returning a fatal error. I'm trying to reactivate the website via recovery mode, but I can't resume the activity of the core plugin of my theme, because it returns this error
An error of type E_COMPILE_ERROR was caused in line 130 of the file /var/www/wptbox/wp-content/plugins/lastudio/includes/extensions/swatch/class-lastudio-swatch-widget.php. Error message: Cannot make non static method WC_Widget_Layered_Nav::get_main_search_query_sql() static in class LaStudio_Swatch_Widget
While in safe mode, my website footer disappeared, and so did every product that was showcased in every page of the website. The products are still present in WooCommerce, but the showcase grid were completely deleted.
What can I do?
Thank you so much in advance for your kind help.
Possible Duplicate with Fatal error: Cannot make non static method
The Code Refference is : https://woocommerce.github.io/code-reference/files/woocommerce-includes-widgets-class-wc-widget-layered-nav.html#source-view.429
You could contact the plugin developer to handle this error.
Temporary solutions is :
go to line 130 on file /var/www/wptbox/wp-content/plugins/lastudio/includes/extensions/swatch/class-lastudio-swatch-widget.php
change {class name}::get_main_search_query_sql() to \WC_Query::get_main_search_query_sql()
Related
A few days ago I noticed that I could no longer access the admin dashboard in WordPress. I would log in with my normal admin username/password but then I get redirected to the website homepage instead of the WordPress dashboard. And the admin bar at the top of the page did not display the usual options to go to the dashboard or edit the page, etc. When I then tried to go to wp-admin after that, I got an error saying "Sorry, you are not allowed to access this page."
When I enabled wp_debug, I started seeing the following error message:
Warning: array_keys() expects parameter 1 to be array, string given in /var/www/wp-includes/class-wp-roles.php on line 291
Warning: Invalid argument supplied for foreach() in /var/www/wp-includes/class-wp-roles.php on line 291
Warning: array_keys() expects parameter 1 to be array, string given in /var/www/wp-includes/class-wp-roles.php on line 291
Warning: Invalid argument supplied for foreach() in /var/www/wp-includes/class-wp-roles.php on line 291
This error displays even when I have disabled all plugins, and it displays no matter which theme is currently active. I couldn't find much about this error in my searching, and the few threads about class-wp-roles are specific to certain plugins which I don't use.
I did the normal first-checks, like turning off all my plugins, checking wp-config.php, checking file permissions, checking the account role/privileges in phpmyadmin and I even created a new admin user using phpmyadmin. I also loaded the site in "Safe mode" which disables all plugins and defaults to the "Twenty twenty" theme in WordPress. Still no luck accessing the WordPress dashboard ie. wp-admin.php.
Some additional information, my site uses the Storefront theme and WooCommerce, but since this error displays even when both of those are not active, that shouldn't matter, right? My site is hosted on GoDaddy and when I first encountered this error, the site was using WordPress 6.0.3 but yesterday it automatically upgraded to 6.1.1, but I'm still having the same problem. (I was really hoping the upgrade would fix this issue.) Everything else with the website seems to be working fine. I just cannot access the admin dashboard! Any help with this is greatly appreciated.
Wow that was fast. I basically created a Stack Overflow account today just to post this question, after days of banging my head against the desk trying to figure this out, and I got the solution in a few hours.
For those who are experiencing a similar issue, definitely go through the regular checks to rule those out first, but then, go to phpmyadmin for your site and then the wp_options table. Look for the wp_user_roles entry. Make sure it has something like this:
a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:61:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}
My wp_user_roles literally just had this set as the value:
AOK
It turns out that's the wrong value! I have no idea how that happened. Before this issue, I was not messing around in phpmyadmin at all. It must have been a plugin or something. When I replaced that AOK with the correct list of roles and capabilities, I was immediately able to access the WordPress admin dashboard again.
If you are using WooCommerce, there is one additional step: You need to de-activate and then re-activate the WooCommerce plugin. This is because that list of roles above is missing a role specific to WooCommerce called "Shop Manager" which gives you access to WooCommerce's Products, Orders, Analytics, Coupons, etc pages.
That was it! Huge props to #VijayHardaha for their help in resolving this issue! I hope this thread helps somebody else out someday.
I migrated from Magento 1.9.1.0 to Magento 2.3.1...the migration was completed with warnings and after I reindexed and flushed cache and also set upgrade, compile, and deploy, Clicking on All Customers at admin backend displays error, can't view all customers and some customer information like the shipping address, billing address, contact, and name is missing from the order page.
I have remigrated countless times with different solutions but I still get the same error.
{"0":"Type Error occurred when creating object:
Magento\Eav\Model\Entity\Attribute\Source\Config","1":"#1
Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\Eav\Mode...',
array()) called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:56]\
I was expecting the customer page should load properly and also view all customers shouldn't be giving errors cos I have really gone through hell trying to solve this. I would be grateful for any assistance.
Try to find the customer_eav_attribute that fronted_input column value is select in eav_attribute, make sure the column source_model is not NULL or empty or the value which refers to a specific class is correct.
If it's empty or NULL, you must be skip/ignore the error warning while migrating. You can solve this by changing the fronted_input column value to int until you finish creating the source_model class
Try to debug this class \Magento\Customer\Model\Metadata\CustomerMetadata specifically in the method getAttributeMetadata using xDebug. There you will find out which attribute_code that caused this error. And then as per #Idham Choudry, change the frontend_input value of that attribute in eav_attribute table. On my end, I changed it to text.
Is anyone can help me to solve my problems? im really new to php
i always get this error message when i try to purchase from my shop.
Im using API Shipping module From KurirQ
everytime i click purchase on my shop
I always get this error
Here are the Codes
CODES1
CODES2
Sorry for my bad English
I am currently trying to extend Place (custom dataobject) with silverstripe addressable module. However, I got the below error:
[User Error] collateDataFields() I noticed that a field called 'LatLngOverride' appears twice in your form: '(unknown form)'. One is a 'CheckboxField' and the other is a 'CheckboxField'
Addressable module works for Page class object but not dataobject class.
Does anyone have any idea what is this error about?
Thanks.
For people who is facing this problem, the author has fixed it in the latest commit.
https://github.com/silverstripe-australia/silverstripe-addressable/commit/2dbd6f7013561e4135850ee81999ece22ca73498
I'm working on a Magento site which has drop down menus to select different product variations.
However, it recently stopped working and now displays the following error along with Item Cannot Be Added to Cart when trying to add an item to the cart.
Fatal error: Call to undefined method Mage_Catalog_Helper_Product::initProductLayout()
in
/home4/wisestor/public_html/app/code/core/Mage/Catalog/controllers/ProductController.php on line 67
I'm afraid given the information you provide this is a little like fishing in the dark without a lamp. Like, what Magento version are you using?
That said, since Magento 1.5 that method is implemented on the catalog/product_view helper, (as opposed to the catalog/product helper referenced in the error message you posted).
I believe you must have somehow hacked the core code, messing up the Mage::helper() factory method call in the Mage/Catalog/controllers/ProductController.php controller around line 67 to produce that error.
So instead of
Mage::helper('catalog/product')->initProductLayout($product, $this); you want
Mage::helper('catalog/product_view')->initProductLayout($product, $this);