Skip to content

Collection filtering does not work with eloquent #416

Open
@sdussaut

Description

@sdussaut

Bug description

Hello!

I am trying to filter some product collection on my site using:

{{ collection:products as="products" paginate="24" price:gt="2000" }}

and it seems broken. Some products with a lower price than the conditon still appear in the results.

It also seems that the collection ordering in the CP is broken too (if I order items by price, the result is… interesting :-) )

Image

You can see the initial discussion about this here: duncanmcclean/simple-commerce#1216

How to reproduce

  • Have a statamic installed with eloquent driver and simple commerce installed (products must be stored in DB)
  • Try filtering product collection by price on the front-end

Logs

Environment

Environment
Application Name: SiteName
Laravel Version: 12.6.0
PHP Version: 8.4.4
Composer Version: 2.8.6
Environment: local
Debug Mode: ENABLED
URL: site-name.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Simple Commerce
Currencies: EUR
Gateways: Dummy
Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EloquentCustomerRepository
Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EloquentOrderRepository
Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Shipping
Tax Engine: DuncanMcClean\SimpleCommerce\Tax\Standard\TaxEngine

Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.52.0 PRO

Statamic Addons
duncanmcclean/simple-commerce: 7.8.1
statamic-rad-pack/runway: 8.3.1
statamic/eloquent-driver: 4.20.2

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: file
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: file

Additional details

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions