Remove Drupal Commerce Empty Products - drupal

I am getting empty products in my views recently after the first few rounds of having a crawler import the data for the products. Unfortunately, after deleting all but two products that existed beforehand, These "empty" products still exist. I also made sure there were no extra variation types, and cleared the commerce_line_item table. Does anybody know where I can find and get rid of these nameless products?
Here is a photo for reference: http://i.imgur.com/bISsCmB.png [1]
I noticed this title (this product was created by the) was able to be selected and edited. This is the only title that shows up: http://i.imgur.com/xwZKRBJ.png
Unfortunately, after trying to edit it, this is the error I get: http://i.imgur.com/e0sbwsT.png
After running #Clive's script, I couldn't flush the cache and I received these errors:
Notice: Undefined index: label in entity_views_field_definition() (line 191 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/entity/views/entity.views.inc).
Notice: Undefined index: search_api_views_fulltext in views_handler_filter->accept_exposed_input() (line 1260 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/views/handlers/views_handler_filter.inc).
Notice: Undefined index: table in entity_views_plugin_row_entity_view->init() (line 20 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/entity/views/plugins/entity_views_plugin_row_entity_view.inc).
SearchApiException: Unknown or invalid item type node. in search_api_get_datasource_controller() (line 1506 of /home/accuairt/public_html/profiles/commerce_kickstart/modules/contrib/search_api/search_api.module).
STATUS MESSAGE Operating in maintenance mode. Go online.
The website encountered an unexpected error. Please try again later.
I restored a backup from a few hours ago to get the site back where it was.
edit: 12/18 Still looking for an answer. There has to be a table I can clear to get rid of this information.

If you know for definite that all products without a title should be deleted you can try something like this:
$query = new \EntityFieldQuery();
$query->entityCondition('entity_type', 'commerce_product')
->propertyCondition('title', '');
$results = $query->execute();
if (!empty($results['commerce_product'])) {
commerce_product_delete_multiple(array_keys($results['commerce_product']));
}
It might be wise to inspect the results of the query before you run the delete function, just to make sure you're not deleting anything you want to keep by mistake.

Related

getting Trying to get property 'count' of non-object after wp_delete_object_term_relationships

I'm trying to delete a term from a post. I have tried different approaches, and all work:
wp_delete_object_term_relationships($post_id, 'tax_name');
wp_set_post_terms($post_id, null, 'tax_name');
wp_set_post_terms($post_id, '', 'tax_name' )
It is a custom post type and it all looks great. Also the database shows the right values.
But when I call the detail page of any of the posts from that post type, it shows this notice:
Notice: Trying to get property 'count' of non-object in
\wp-includes\class-wp-term-query.php on line 806
I have checked the code as far as possible. The results of the queries are all okay. So I really have no idea where that notice come from. Any ideas how to trace this one?

Errors in Drupal 7 - Trying to get property of non-object in taxonomy_overview_terms()

I would love to get some help here. I enabled the forums module which is part of Drupal core. When I go to add a container, I get the following error:
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 279 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 403 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 405 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
I have tried to delete the tables and reinstall the module. I have the same module enabled on another one of our sites (which is identical in structure). But I do not get these errors on it. Anyone know how to fix this?
Thanks!
FWIW I debugged a similar issue and found that the 'forum' vocabulary nav variable (forum_nav_vocabulary) was not set in my installation, and that just plain breaks things. In the forum module there are a number of calls to variable_get('forum_nav_vocabulary', ''), but unfortunately if it is not set, using an empty vid has not been properly catered for.
If you set it, make sure to use the vid and not the machine name (i.e. the number, not the name). You will need to do this with drush, via the db, or using devel module's variable editor.

Stucked with error: Argument 2 passed to db_query() must be an array

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.

Error when adding a new cck field

For some reason I get error on lots of pages after adding a simple text field to a content type. And error on pages that doesn't use the content type, and hasn't any relation to the modified content type.
The content type is just a regular form where customers can add some simple data that is later displayed in a view.
The new field is addad to a contenttype that already has som data stored with it.
In the log I found this error message:
Warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 1811 in ctools_cleanstring() (line 157 of /home/u/u4144602/www/profiles/nodestream/modules/ctools/includes/cleanstring.inc).
Does anyone know?
It's a drupal 6 installation, a nodestream distribution.
I too got this problem earlier.I've replaced
'\x{a80b}\x{a823}-\x{a82b}\x{d800}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}\x{fd3f}'.
with
'\x{a80b}\x{a823}-\x{a82b}\x{e000}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}\x{fd3f}'.
Hope this link might help u... :)
http://drupal.org/node/1878284
http://drupal.org/node/1444006

Drupal Themes getting "unselected"

Sometimes, at least 1 time a month +-, when I visit my site, there is no theme selected and I get a lot of error code.
Notice: Undefined index: highlighted em include() (linha 120 de /var/www/novoportal.faccat.br/htdocs/portal/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_first em include() (linha 132 de /var/www/novoportal.faccat.br/htdocs/portal/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_second em include() (linha 138 de /var/www/novoportal.faccat.br/htdocs/portal/modules/system/page.tpl.php).
Notice: Undefined index: genesis em drupal_theme_initialize() (linha 100 de /var/www/novoportal.faccat.br/htdocs/portal/includes/theme.inc).
Notice: Trying to get property of non-object em _drupal_theme_initialize() (linha 145 de /var/www/novoportal.faccat.br/htdocs/portal/includes/theme.inc).
Notice: Trying to get property of non-object em _theme_load_registry() (linha 321 de /var/www/novoportal.faccat.br/htdocs/portal/includes/theme.inc).
Notice: Undefined index: genesis em theme_get_setting() (linha 1316 de /var/www/novoportal.faccat.br/htdocs/portal/includes/theme.inc).
I always need to select the theme again and clear the cache.
Also I used the Devel theme rebuild tool, but I keep getting these errors.
Any Ideas?
This is what I suggest:
1) First check the .info file and make sure the regions are there as per page.tpl.php. Your error is based on that .
2) If the the above is true then the next thing I would do is make a new fresh installation and only move the sites/all/themes/ folder to it and the db I would then test it to make sure the error does not occur.
Hope it helps.
From your description I think it might be a weird bug in Drupals theme discovery - try calling:
_system_rebuild_theme_data()
One call to it should be enough so don't leave it permanent - as it will cripple your site load times.
I've filed a bug and description.
Edit
The above will probably not fix your problem permanently, I just thought it would at the time of writing.
I believe this may be caused in some cases by a failed cron run.
I was observing this problem on a dev site where I was basically the only person interacting with it. The problem would surface after a couple of hours of inactivity. The only events in the log would be related to cron runs.
I was able to determine that a normal, user-initiated cron run would not cause the problem.
One type of cron entry was an 'invalid key' error. I investigated and determined that there was a cron job set up to run without a key. After eliminating that cron job, I wasn't able to observe the error any longer.
i also had faced similar issue and after installing nucleus https://www.drupal.org/project/nucleus theme (which is required to install any custom theme on drupal7) and secondly I deleted cache entry for my custom theme(drupal_cache table), then above issue resolved.I could see modules now then i went to appearance tab and set my custom theme as Default theme.
Hope this would help
Though I have no answer to this problem, I thought it might come in handy to add some cross links:
"Theme is randomly disabled" at drupal.org
"Themes (custom/derived/new) are disabled at random intervals" at drupal.org
If you find more links, please add them here!
EDIT (2014-10-22): In a multisite environment we had not installed the default site at first. Because of this Drush occasionally generated warnings or errors, so we added a settings.php file to the default site's directory with database credentials of a test site's database. Since we installed the default site with it's own database, the problem fortunately has not occurred anymore. :-)
It might have had something to do with multiple crons being executed on the same database at the same time...?

Resources