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)
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | interdiff-2625082.txt | 14.54 KB | longwave |
| #18 | country-views.patch | 36.3 KB | longwave |
Comments
Comment #2
jian he commentedShould add testing code.
Comment #3
tr commentedThere'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.
Comment #4
jian he commentedYes 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 :)
Comment #6
jian he commentedComment #7
jian he commentedfix table does not exists.
Comment #9
tr commentedEntity is named 'uc_order', not 'order'.
Comment #10
jian he commentedImplement uc_country views field plugin.
Comment #12
jian he commented1. Implemented the uc_zone views field plugin.
2. fixed user name field.
3. clean up the uc_customers view.
4. fixed testing issue.
Comment #14
jian he commented1. fixed testing issue.
2. fixed missing schema.
Comment #15
tr commentedWhy define "storage" = "Drupal\uc_country\CountryStorage" if it's the same as ConfigEntityStorage (the default if there is no storage annotation) ?
Comment #16
jian he commentedRemove the empty CountryStorage class.
Comment #17
longwaveI 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.
Comment #18
longwave- 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).
Comment #19
jian he commentedgreate, I have learned the usage of "additional fields" from your patch :)
Comment #20
longwaveCommitted, thanks for working on this!
Comment #22
tr commentedModified patch to account for #2625410: Replace the deprecated entity manager