I am working with WooCommerce for the first time and I am currently implementing WC filters on the shop page. The filters show up but are not functional, and the console is throwing the following errors:
ERROR 1: woocommerce_shared_settings filter in Blocks is deprecated. See https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/docs/contributors/block-assets.md
ERROR 2: deprecated.min.js?ver=932d8bb37da8bbb396a7a3f754345e08:2 select control in #wordpress/data-controls is deprecated since version 5.7. Please use built-in resolveSelect control in #wordpress/data instead.
The errors disappear when I remove the filters.
I have located the file where the deprecated code exists. I also read the WC docs about how to fix the issue and it presented this code:
use Automattic\WooCommerce\Blocks\Package;
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
Package::container()->get( AssetDataRegistry::class )->add( $key, $value )
It doesn't say where to put this code, though. Where should I put it to solve this issue?
I have the same problem.
Which is the file you located?
Here also says you have to add, on the "client side", this code:
wc.wcSettings.getSetting( 'key' );
Related
I keep getting this same error from bugsnag for my site, and I'm unsure how to fix it/why it's popping up in the first place.
User Warning · The following theme is missing from the file system: <em class="placeholder">Theme_Name</em>. For information about how to fix this, see the documentation page.
The theme that it claims it is missing is the only theme I have for the site and is the one it is currently using. Besides overloading my bugsnag reporting, it's not causing any issues. Is there a way to resolve this? I checked the documentation page and all the articles I found only refer to modules.
It's likely that the there is an old reference of Theme_Name in the systems table of your database.
You can look for the references that your Drupal instance is checking against by running this query:
SELECT name, status, filename FROM system WHERE type = 'theme' AND name = 'Theme_Name';
Find the reference that doesn't look quite right, preferably by the name of "Theme_Name", and delete it.
DELETE FROM system WHERE type = 'theme' AND name = 'Theme_Name' AND status = 0 AND filename = 'path/to/Theme_Name.info' LIMIT 1;
Once deleted, flush your Drupal caches.
Well this is embarrassing. The source of the problem was that I was adding an image using:
src="<?= drupal_get_path('theme','Theme_Name'); ?>/sites/all/themes/theme_name/img/image.png">
The first problem is that the theme name I was calling was using capitals when the actual theme was all in lower case. But to actually resolve the problem I changed the image call to:
src="<?= drupal_get_path('theme',$GLOBALS['theme']); ?>/img/image.png">
Unsure if this turns out to be the same problem others have had, but that's what fixed it for me. If you're getting this error I'd suggest double checking how your src's are being called. Thanks to everyone that answered/responded!
I`m updating from 6.x to 7.x. I have updated core, modules and now working on updating a theme. For this purpose I downloaded ZEN as a base theme and started to develop a new sub-theme (from the theme of previous version). And with this new "sub-theme" selected I get this errors:
Recoverable fatal error: Argument 2 passed to db_query() must be an array, null given, called in ~modules/php/php.module(80) : eval()'d code on line 11 and defined in db_query() (line 2342 of ~includes/database/database.inc).
I tried to switch to garland - on garland everything is ok.
I tried to switch to bartik - and get same error.
So the problem is not in theme (I checked my new sub-theme couple times).
I checked all blocks (to find PHP with error code), corrected some problems, but still got this error.
I also tried to switch off almost all blocks in bartik (except for 'navigation' and 'Main page content'), but still got this error.
I can`t find out there is problem. Is there any method how can I detect problem place to be able to fix it?
For now I checked all blocks, all themes, all content with php filter. After that I cleared cache and still got this error. And the most amazing thing that I get no error with garland.
What can I do to find out where is problem?
Drupal 6's db_query function expects the first argument to be a parameterized query, and the rest of the arguments to be replacements for them in the correct order.
Drupal 7, however has PDO support and ye db_query function's second argument should be an array of placeholder => value pattern.
db_query('SELECT * from somewhere where something = :that ', array(':that' => 'beer'));
Now you know what is wrong so find this in your theme.
i have a template with list of input-elements. their value is the title-element of an document. The input-elemnts have an keyup-event, so that when i wrote in the input-element, the title will updated. when i focus the input-elemnt, the Session-variable selectedDoc is set with the id of the document. until then it works. In another template i have a following function:
Template.content.isSelected = function () {
return !Session.equals("selectedDoc",null) ? 'small' : '';
}
When i used the function above in my code, the following error occurs.
when i focus an input-element and write something, after the first letter the the focus disappeared. the error occurs only by the first time, i focus an input-element.
what am I doing wrong? with Version 0.3.9 everything worked well.
thanks
What am I doing wrong?
You're not following Meteor or reading the changelog, so you haven't noticed the API changes.
If you read them, especially Spark, and adapt your code accordingly; your code will work on 0.4.
This error suddenly occurred when Pressflow was added to our Drupal installation. It is coming from a custom module that, prior to Pressflow seemed to work fine. After the addition of Pressflow, running Drush causes this error to display on screen.
The function that is identified as the source of the error looks like this:
function user_search_location_get(&$user) {
if (count($user->user_location_pref)) { // This line is causing the error.
return $user->user_location_pref;
}
// …
}
The error message is the following:
WD php: Notice: Undefined property: stdClass::$user_location_pref in user_search_location_get()
Short answer, in your custom module, you should check if that property exists before you count it. That, or make sure the $user object has that property before you use it.
if (isset($user->user_location_pref) && count($user->user_locaion_pref) > 0) {
return $user->user_locaion_pref;
}
While it is a little more work, when you start developing with notices turned on, you will find errors in your code that otherwise would have not appeared till later, and would have been more difficult to track down.
In your previous environment or install, the PHP error reporting was probably set to not show notices. While I recommend keeping notices on and making your code work with them, you can turn them off through the Drupal 7 UI. Configuration -> Development -> Logging and Errors. Then set the value to 'Errors and Warnings' ... Otherwise, you can set your error reporting level in your php.ini to report all except notices.
Note that Drupal 6 did not force notice reporting on, while Drupal 7 does. That prompts this type of question a lot.
If this is your only notice issue though, it makes more sense to just correct your custom module.
What is the correct way to force the system to send an invoice to a client. I'm trying to use:
uc_order_action_email($order, $settings);
But I keep getting:
Fatal error: Call to undefined function uc_price() in C:\xampp\htdocs\YourEstablishment\src\sites\all\modules\ubercart\payment\uc_payment\uc_payment.module on line 149
It might be a flaw in the module. The function that it's complaining about, uc_price, is defined in
ubercart/uc_store/includes/uc_price.ini
Since it's located in a ini file, that means that drupal wont include it by it self. I'm not familiar with ubercart, since I've never used it, but it seems like this could be a bug in the module. If no one here can come up with an explanation, you should go to the issue tracker.
A quick fix to your problem would be to add this before you call the function
require_once(drupal_get_path('module', 'uc_store') . '/includes/uc_price.inc');
it will include the needed file.