Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2013 at 15:37 UTC
Updated:
7 Mar 2013 at 12:20 UTC
Attached patch makes it possible to re-use the existing "add to cart button" views field with other views query engines, e.g. search api views. That works via the views_handler_field_entity which allows for rendering any entity fields via a loaded entity regardless of the back-end.
| Comment | File | Size | Author |
|---|---|---|---|
| d7_commerce_product_search_api_views.patch | 2.82 KB | fago |
Comments
Comment #1
giorgio79 commentedUsing Commerce Kickstart, applied patch, cleared cache, but when I go to Fields in Views admin for the Products search api view the Add to Cart form is not available
Comment #2
jwilson3Patch in OP worked brilliantly for me. Thanks!
Comment #3
rszrama commentedI'm not sure I understand the move from the base entity tables to the views_entity_* tables for these two fields. Is that a requirement, or would using the handler be sufficient?
Comment #4
fagoThe handler takes care of loading the entity via the used Views query class, while the changed base table makes sure the field is available for every Views base table that declares itself to list the given entity type.
Thus, it would work without moving the base table if you manually take care of registering the field. But that's hard to do generally, and Views has a built-in mechanism for that instead. So let's better use that - thanks to the "moved to" features it's totally BC.
Comment #5
giorgio79 commentedPS : Nevermind, after adding the Product relationship, the Add to Cart form appeared.
@jwilson3 and @fagoCare to share the steps one should take to get this going? I applied the patch but even after clearing cache I am only seeing the regular Search API indexed product fields in the Views Field list like:No Shopping cart or Add to Cart...Comment #6
rszrama commentedOk, cool. This worked fine for me, and I love the Views "moved to" feature. Feel free to point out other areas you think we can use such an improvement.
Comment #7
jwilson3Nice (crucial) improvement. Thanks Fago for the patch and Ryan for the commit!