Problem integrating ElasticPress and Dokan Multivendor
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start by reproducing the Dokan vendor product-listing and product-creation flows with ElasticPress's WooCommerce option enabled and disabled, using Query Monitor, Debug Bar, and the supplied SQL and cURL requests. Compare the WordPress query results with the Elasticsearch response; done means vendor dashboards show all applicable product statuses and new-product submission no longer reaches a soft 404.
Written by the indexing model from the issue text.
Description
Hey there!
I've been having trouble integrating ElasticPress and Dokan Multivendor plugins. This is not specific to the new v3.5, I've been having this problem since I first installed ElasticPress, which was the previous version, 3.4.3. I've opened a ticket to Dokan support as well, so they can help me out on their end, I'll keep you updated on their responses.
Dokan is a Marketplace plugin for Woocommerce, and it enables, among other things, the ability to sell user related products (Vendor role), splits commissions and so on. It has a dashboard, so vendors can manage their own products and orders.
We have almost 2k products by now and growing, so we needed a better search engine, that's when I came across ElasticPress (I'll call it EP from now on), which has been a great addition to our site, and I'm very grateful for that, thx!
I'm running my own ElasticSearch server, both locally for development and in live environments, under ubuntu servers in Digital Ocean.
The problem I've been facing is that when I have the Woocoomerce option enabled in EP's settings, Dokan's vendor's product dashboard won't display all products they have, it seems to be a problem filtering products with different status, also the can't add new products because the form redirects to a soft 404, when it should at least validate required fields, show validation messages or save a new product. With Woocommerce option disabled, everything works.
I've done some debugging, using both Query Monitor plugin (which is great because there's an option to set a cookie and have access to the debug tool logged in with a different user role other than admin, comes in handy with my multi vendor login) and EP recommendation, Debug Bar + 10up custom addition to EP debug. I was able to isolate a query that was once done in MySQL with EP disabled, and then moved to ElasticSearch query with EP enabled, that seems to be the problem with the product listing missing some products with different status.
This query:
SELECT SQL_CALC_FOUND_ROWS hAA_posts.ID
FROM hAA_posts
WHERE 1=1
AND hAA_posts.post_author IN (140)
AND hAA_posts.post_type = 'product'
AND ((hAA_posts.post_status = 'publish'
OR hAA_posts.post_status = 'future'
OR hAA_posts.post_status = 'draft'
OR hAA_posts.post_status = 'pending'))
GROUP BY hAA_posts.ID
ORDER BY hAA_posts.post_date DESC
LIMIT 0, 15
It returns 3 posts, being 2 published and 1 pending:
id
20486
20481
20480
Is converted to this cURL request:
curl -XPOST -H 'Content-Type: application/json' -d '{"from":0,"size":15,"sort":[{"post_date":{"order":"desc"}}],"query":{"match_all":{"boost":1}},"post_filter":{"bool":{"must":[{"bool":{"must_not":[{"terms":{"terms.product_type.slug":[]}}]}},{"term":{"post_author.id":"140"}},{"terms":{"post_type.raw":["product"]}},{"terms":{"post_status":["publish","draft","pending","future"]}}]}}}' 'http://localhost:9200/localhostcityshoppe-post-1/_search'
It returns 2 posts, both published:
{
"took":15,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"skipped":0,
"failed":0
},
"hits":{
"total":{
"value":2,
"relation":"eq"
},
"max_score":null,
"hits":[
{
"_index":"localhostcityshoppe-post-1",
"_type":"_doc",
"_id":"20486",
"_score":null,
"_source":{
"post_id":20486,
"ID":20486,
"post_author":{
"raw":"bsanborn",
"login":"bsanborn",
"id":140
},
"post_date":"2020-10-20 13:56:12",
"post_date_gmt":"2020-10-20 20:56:12",
"post_title":"test",
"post_excerpt":"",
"post_content_filtered":"",
"post_content":"",
"post_status":"publish",
"post_name":"test",
"post_modified":"2020-10-20 13:56:20",
"post_modified_gmt":"2020-10-20 20:56:20",
"post_parent":0,
"post_type":"product",
"post_mime_type":"",
"permalink":"http:\/\/localhost\/cityshoppe\/product\/test\/",
"terms":{
"product_cat":[
{
"term_id":2316,
"slug":"earrings",
"name":"Earrings",
"parent":25,
"term_taxonomy_id":2316,
"term_order":0
},
{
"term_id":25,
"slug":"jewelry",
"name":"Jewelry",
"parent":0,
"term_order":0
}
],
"product_tag":[
{
"term_id":3994,
"slug":"guilherme",
"name":"guilherme",
"parent":0,
"term_taxonomy_id":3994,
"term_order":0
},
{
"term_id":3993,
"slug":"test",
"name":"test",
"parent":0,
"term_taxonomy_id":3993,
"term_order":0
}
],
"product_type":[
{
"term_id":2,
"slug":"simple",
"name":"simple",
"parent":0,
"term_taxonomy_id":2,
"term_order":0
}
]
},
"meta":{
"_regular_price":[
{
"value":"10",
"raw":"10",
"long":10,
"double":10,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price_dates_from":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price_dates_to":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_price":[
{
"value":"10",
"raw":"10",
"long":10,
"double":10,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_visibility":[
{
"value":"visible",
"raw":"visible",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"total_sales":[
{
"value":"0",
"raw":"0",
"long":0,
"double":0,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_tax_status":[
{
"value":"taxable",
"raw":"taxable",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_tax_class":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_manage_stock":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_backorders":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sold_individually":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_virtual":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_downloadable":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_stock":[
{
"value":null,
"raw":null,
"boolean":false
}
],
"_stock_status":[
{
"value":"instock",
"raw":"instock",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_wc_average_rating":[
{
"value":"0",
"raw":"0",
"long":0,
"double":0,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_product_version":[
{
"value":"4.4.1",
"raw":"4.4.1",
"boolean":false,
"date":"2020-10-27",
"datetime":"2020-10-27 04:04:01",
"time":"04:04:01"
}
],
"more_about_product_content":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"additional_details":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
]
},
"date_terms":{
"year":2020,
"month":10,
"week":43,
"dayofyear":293,
"day":20,
"dayofweek":2,
"dayofweek_iso":2,
"hour":13,
"minute":56,
"second":12,
"m":202010
},
"comment_count":0,
"comment_status":"open",
"ping_status":"closed",
"menu_order":0,
"guid":"http:\/\/localhost\/cityshoppe\/?post_type=product&p=20486"
},
"sort":[
1603202172000
]
},
{
"_index":"localhostcityshoppe-post-1",
"_type":"_doc",
"_id":"20481",
"_score":null,
"_source":{
"post_id":20481,
"ID":20481,
"post_author":{
"raw":"bsanborn",
"login":"bsanborn",
"id":140
},
"post_date":"2020-10-15 18:54:58",
"post_date_gmt":"2020-10-16 01:54:58",
"post_title":"glass",
"post_excerpt":"",
"post_content_filtered":"",
"post_content":"",
"post_status":"publish",
"post_name":"glass",
"post_modified":"2020-10-15 18:55:09",
"post_modified_gmt":"2020-10-16 01:55:09",
"post_parent":0,
"post_type":"product",
"post_mime_type":"",
"permalink":"http:\/\/localhost\/cityshoppe\/product\/glass\/",
"terms":{
"product_cat":[
{
"term_id":3843,
"slug":"drop-earrings",
"name":"Drop Earrings",
"parent":2316,
"term_taxonomy_id":3843,
"term_order":0
},
{
"term_id":2316,
"slug":"earrings",
"name":"Earrings",
"parent":25,
"term_order":0
},
{
"term_id":25,
"slug":"jewelry",
"name":"Jewelry",
"parent":0,
"term_order":0
}
],
"product_tag":[
{
"term_id":3991,
"slug":"asd",
"name":"asd",
"parent":0,
"term_taxonomy_id":3991,
"term_order":0
},
{
"term_id":3992,
"slug":"asdasd",
"name":"asdasd",
"parent":0,
"term_taxonomy_id":3992,
"term_order":0
},
{
"term_id":2282,
"slug":"glass",
"name":"glass",
"parent":0,
"term_taxonomy_id":2282,
"term_order":0
}
],
"product_type":[
{
"term_id":2,
"slug":"simple",
"name":"simple",
"parent":0,
"term_taxonomy_id":2,
"term_order":0
}
]
},
"meta":{
"_regular_price":[
{
"value":"19",
"raw":"19",
"long":19,
"double":19,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price_dates_from":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sale_price_dates_to":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_price":[
{
"value":"19",
"raw":"19",
"long":19,
"double":19,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_visibility":[
{
"value":"visible",
"raw":"visible",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"total_sales":[
{
"value":"0",
"raw":"0",
"long":0,
"double":0,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_tax_status":[
{
"value":"taxable",
"raw":"taxable",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_tax_class":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_manage_stock":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_backorders":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_sold_individually":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_virtual":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_downloadable":[
{
"value":"no",
"raw":"no",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_stock":[
{
"value":null,
"raw":null,
"boolean":false
}
],
"_stock_status":[
{
"value":"instock",
"raw":"instock",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_wc_average_rating":[
{
"value":"0",
"raw":"0",
"long":0,
"double":0,
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"_product_version":[
{
"value":"4.4.1",
"raw":"4.4.1",
"boolean":false,
"date":"2020-10-27",
"datetime":"2020-10-27 04:04:01",
"time":"04:04:01"
}
],
"more_about_product_content":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"additional_details":[
{
"value":"",
"raw":"",
"boolean":false,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
],
"pageview":[
{
"value":"1",
"raw":"1",
"long":1,
"double":1,
"boolean":true,
"date":"1971-01-01",
"datetime":"1971-01-01 00:00:01",
"time":"00:00:01"
}
]
},
"date_terms":{
"year":2020,
"month":10,
"week":42,
"dayofyear":288,
"day":15,
"dayofweek":4,
"dayofweek_iso":4,
"hour":18,
"minute":54,
"second":58,
"m":202010
},
"comment_count":0,
"comment_status":"open",
"ping_status":"closed",
"menu_order":0,
"guid":"http:\/\/localhost\/cityshoppe\/?post_type=product&p=20481"
},
"sort":[
1602788098000
]
}
]
}
}
Product id 20480 is missing, which is the one with Pending status.
Now that's only half of the problem, as it only covers why pending products are not being shown in vendors dashboards. But I still need to figure out why I'm getting a soft 404 after I submit the new product form, but I'm still debugging and trying to figure it out. I'll get back to you when I have something.
Any help is appreciated! Thanks!
WP 5.5.1
Dokan Lite 3.0.11 (latest as of today)
Dokan Pro 3.0.8 (latest as of today)
ElasticPress 3.5 (latest as of today)
Woocommerce 4.4.1
- Dominant language
- PHP
- Stars
- 1.3k
- Forks
- 325
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 10up/ElasticPress
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
10up/ElasticPress#4402 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
10up/ElasticPress#4390 ·
Maintainers usually reply within 1 day
-
[Release] 5.3.6Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
10up/ElasticPress#4388 ·
Maintainers usually reply within 1 day
-
Move AI Features from ElasticPress Labs to the ElasticPress PluginPossibly taken @ZacharyRener claimed this 124 days ago. Openenhancement
10up/ElasticPress#4316 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Convert Pointers class to functional componentPossibly taken @ZacharyRener claimed this 288 days ago. Openenhancement
10up/ElasticPress#4261 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in 10up/ElasticPress
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#5444 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/static-site-importer#2869 ·
Maintainers usually reply within 1 day
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug command:plugin-update scope:documentation
Difficulty 1/5 Under an hour Newbie friendliness 83/100
wp-cli/extension-command#572 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100