craft_ prefix compatibility and limiting to availableForPurchase#1
craft_ prefix compatibility and limiting to availableForPurchase#1jmauzyk wants to merge 2 commits intoethercreative:v1from jmauzyk:v1
Conversation
|
Also wanted to find a way to limit results to only products that are available for purchase. This is important for us because although we do not sell products after they are continued, we keep the pages enabled for documentation purposes. Filtering out products that are not purchasable would allow us to provide users with only products that are relevant and available. |
|
I'd really appreciate this being merged in as we'd love to use this on our site but can't while it's coming up with this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'purchase_counts.order_count' in 'field list' |
|
Closing this as I've manually merged the fix into the next release. I haven't merged the limit to available part since you can already do this. Both {% set products = craft.purchasePatterns.related(myProduct).availableForPurchase().all() %} |
Changes proposed in this pull request:
innerJoinused inProductQueryExtendedIn its current form,
ProductQueryExtendedproduces the following error on Craft 3 installs using databases migrated from Craft 2 with thecraft_table prefix:Adding a table alias to the
innerJoinresolves this issue.