1. Goto admin/store
2. Click "View customers"

Will cause fatal error:

The website encountered an unexpected error. Please try again later.

Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Customers[uc_customers]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lifestyle2.uc_countries_zones' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT uc_orders_users.billing_first_name AS uc_orders_users_billing_first_name, uc_orders_users.billing_last_name AS uc_orders_users_billing_last_name, uc_orders_users.billing_city AS uc_orders_users_billing_city, uc_orders_users_billing_zones.zone_code AS uc_orders_users_billing_zones_zone_code, uc_orders_users_billing_countries.country_name AS uc_orders_users_billing_countries_country_name, 1 AS expression FROM {users_field_data} users_field_data INNER JOIN {users} users ON users_field_data.uid = users.uid INNER JOIN {uc_orders} uc_orders_users ON users.uid = uc_orders_users.uid LEFT JOIN {uc_countries_zones} uc_orders_users_billing_zones ON uc_orders_users.billing_zone = uc_orders_users_billing_zones.zone_id LEFT JOIN {uc_countries} uc_orders_users_billing_countries ON uc_orders_users.billing_country = uc_orders_users_billing_countries.country_id GROUP BY uc_orders_users_billing_first_name, uc_orders_users_billing_last_name, uc_orders_users_billing_city, uc_orders_users_billing_zones_zone_code, uc_orders_users_billing_countries_country_name) subquery; Array ( ) in Drupal\views\Plugin\views\query\Sql->execute() (line 1457 of core/modules/views/src/Plugin/views/query/Sql.php).

Drupal\views\ViewExecutable->execute(NULL)
Drupal\views\ViewExecutable->render()
Drupal\views\Plugin\views\display\Page->execute()
Drupal\views\ViewExecutable->executeDisplay('admin_page', Array)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func(Array, Array)
Drupal\Core\Render\Renderer->doRender(Array, )
Drupal\Core\Render\Renderer->render(Array, )
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

Comments

jian he created an issue. See original summary.

jian he’s picture

Issue tags: +Needs tests

Should add testing code.

tr’s picture

Category: Bug report » Task
Priority: Major » Normal
Issue tags: -Needs tests

There's not really anything to test, OrderViewsData just hasn't been fully ported yet. Countries and zones are no longer in a database table, they are configuration entities. Country data is now access through the country_manager service - you can see the available service methods at uc_country/src/CountryManagerInterface.php. The country_manager service has tests to make sure it does the right thing, but OrderViewsData isn't using the new service yet, it still has code to access the old no-longer-used table.

jian he’s picture

Status: Active » Needs review
StatusFileSize
new1.1 KB

Yes I agree this issue is caused by OrderViewsData hasn't been full ported yet. So next is to fix this problem. I have added the testing code first, the next step is making the testing pass :)

Status: Needs review » Needs work

The last submitted patch, 4: 2625082-customers-3.patch, failed testing.

jian he’s picture

jian he’s picture

Status: Needs work » Needs review
StatusFileSize
new5.98 KB
new6.3 KB

fix table does not exists.

Status: Needs review » Needs work

The last submitted patch, 7: 2625082-customers-7.patch, failed testing.

tr’s picture

Entity is named 'uc_order', not 'order'.

jian he’s picture

Status: Needs work » Needs review
StatusFileSize
new18 KB
new23.13 KB

Implement uc_country views field plugin.

Status: Needs review » Needs work

The last submitted patch, 10: 2625082-customers-10.patch, failed testing.

jian he’s picture

Status: Needs work » Needs review
StatusFileSize
new11.46 KB
new31.91 KB

1. Implemented the uc_zone views field plugin.
2. fixed user name field.
3. clean up the uc_customers view.
4. fixed testing issue.

Status: Needs review » Needs work

The last submitted patch, 12: 2625082-customers-12.patch, failed testing.

jian he’s picture

Status: Needs work » Needs review
StatusFileSize
new2.97 KB
new33.25 KB

1. fixed testing issue.
2. fixed missing schema.

tr’s picture

Why define "storage" = "Drupal\uc_country\CountryStorage" if it's the same as ConfigEntityStorage (the default if there is no storage annotation) ?

jian he’s picture

StatusFileSize
new4.45 KB
new31.97 KB

Remove the empty CountryStorage class.

longwave’s picture

Status: Needs review » Needs work
$data['uc_orders']['primary_email']['field']['id'] = 'user_mail';

I don't seem to have the user_mail plugin, so the primary email field does not work for me. Also, there are errors if the country or zone in an order is not set. Working on this and will post a patch soon.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new36.3 KB
new14.54 KB

- Fixed the country and zone field plugins when there is no country or zone set in the order
- Simplified the zone field plugin
- Fixed the country and zone filters to use options lists, and fixed the zone options list method
- Linked the number of orders to /admin/store/customers/orders/UID (this is how it worked in Drupal 7)
- Made the field names and descriptions more consistent

I am not sure we need the /admin/store/customers/orders/UID view when we could just link to /user/UID/orders instead (which doesn't work at the moment either).

jian he’s picture

greate, I have learned the usage of "additional fields" from your patch :)

longwave’s picture

Status: Needs review » Fixed

Committed, thanks for working on this!

  • longwave committed 81d90d7 on 8.x-4.x authored by jian he
    Issue #2625082 by jian he, longwave: View customers fatal error: Table...
tr’s picture

  • TR committed b29dc8d on 8.x-4.x
    Issue [#2625082] by TR: entity.manager service replaced by entity_type....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.