Skip to content

Conversation

Jade-GG
Copy link
Collaborator

@Jade-GG Jade-GG commented Jul 24, 2025

See #942, this is my alternative version, which includes attribute options and uses joins for attribute data & option values (but a relation for the options themselves).

Based on better benchmarks and cleaner relations, we have chosen to keep this approach as opposed to #942. I've taken some of the extra functionality from there and have implemented into this PR.


With this PR we end up having 13 queries in total for products (regardless of how many products you query):

  • 1 for the product itself
  • 1 for the stock status
  • 1 for the super attributes
  • 2 for the category info (do we need this eager loaded?)
  • 5 for each type of entity value
  • 3 for the option relations, as 3 of the types (int, varchar, text) could have a custom option value, as far as I'm aware.

I've also made a small backend_model thing to parse data that may be in a weird format but I don't really know if this is a worthwhile thing to have abstracted like this. This is currently only used for comma separated values.

This also includes #944 currently, to add support for querying based on attributes. This is necessary to filter products based on the status attribute.


Current to do list:

  • Optimizations where possible
  • Functionality that came from the scopes
    • Super attributes
    • Stock information
    • Upsells
    • Grouped products
    • Category information
    • Selecting for specific use cases, e.g. selectForProductPage
  • Attributes
    • URL attribute
    • Images (all types)
    • Special price
    • Price (including configurable and grouped products)
    • Min sale qty
    • Breadcrumbs
  • Relations
    • Product options
    • categoryProducts (is this necessary?)
    • reviewSummary (is this necessary?)
  • Package updates
    • rapidez/reviews
    • ...finish this list
  • Check the data that enters the indexer
  • Optimize the indexer data because it is currently unacceptably slow
  • Tier pricing
  • Update and fix unit tests
  • Compatibility with Runway
  • Frontend
    • Update product page
    • ...finish this list
  • Anything else I'm missing? Test everything and finish this list

@Jade-GG Jade-GG changed the title [4.x] Implement EAV structure for product entity Implement EAV structure for product entity Aug 6, 2025
@Jade-GG Jade-GG force-pushed the feature/flat-tables branch from b167b96 to 2240d05 Compare August 26, 2025 11:22
->sortBy('store_id')
->keyBy('option_id')
);
return Attribute::get(function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants