簡體   English   中英

刪除Drupal Commerce空產品

[英]Remove Drupal Commerce Empty Products

在搜尋器為產品導入數據的前幾輪之后,最近我的視圖中出現了空產品。 不幸的是,在刪除了除兩個之前已存在的所有產品之后,這些“空”產品仍然存在。 我還確保沒有多余的變體類型,並清除了commerce_line_item表。 有人知道我在哪里可以找到並擺脫這些無名的產品嗎?

這是供參考的照片: http : //i.imgur.com/bISsCmB.png [1]

我注意到可以選擇和編輯此標題(此產品是由創建的)。 這是唯一顯示的標題: http : //i.imgur.com/xwZKRBJ.png

不幸的是,嘗試對其進行編輯后,這是我得到的錯誤: http : //i.imgur.com/e0sbwsT.png

運行@Clive的腳本后,我無法刷新緩存,並且收到以下錯誤:

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.

我從幾個小時前恢復了備份,以使站點恢復原狀。

編輯:12/18還在尋找答案。 我必須清除一個表才能刪除此信息。

如果您確定應該刪除所有沒有標題的產品,則可以嘗試以下操作:

$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']));
}

在運行刪除功能之前,最好先檢查查詢結果,以確保您不會刪除任何要錯誤保留的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM