Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
841685b
Implement EAV structure for product entity
Jade-GG Jul 24, 2025
78a47ec
Apply fixes from Duster
Jade-GG Jul 24, 2025
77c9a41
Fix model name
Jade-GG Jul 24, 2025
42a1a7e
Get store specific values
Jade-GG Jul 24, 2025
ee340e9
Apply fixes from Duster
Jade-GG Jul 24, 2025
9cfed19
Allow for values to be queried on, filter products based on website a…
Jade-GG Jul 24, 2025
30c975e
Apply fixes from Duster
Jade-GG Jul 24, 2025
573f3bf
Rename EavAttribute to AbstractAttribute
Jade-GG Jul 24, 2025
9184a38
Apply fixes from Duster
Jade-GG Jul 24, 2025
0cda5c0
Add stock data to products
Jade-GG Jul 24, 2025
9766b95
Apply fixes from Duster
Jade-GG Jul 24, 2025
dbe6403
Rename Datetime
Jade-GG Jul 24, 2025
e6b9338
Delete src/Models/AttributeDateTime.php
Jade-GG Jul 24, 2025
22b4949
Cast value properly when getting
Jade-GG Jul 24, 2025
521423d
Apply fixes from Duster
Jade-GG Jul 24, 2025
b6fef4c
Small fixes
Jade-GG Jul 24, 2025
24c785d
Add parent, children, super attributes & super attribute values
Jade-GG Jul 24, 2025
b72b189
Apply fixes from Duster
Jade-GG Jul 24, 2025
f5fcd82
Add consts
Jade-GG Jul 24, 2025
1ec5263
Fix sorting on super attributes & change whereValue to whereAttribute
Jade-GG Jul 24, 2025
8594af0
Apply fixes from Duster
Jade-GG Jul 24, 2025
46f1854
Rename product, use config rapidez.model, add callbacks, abstractify …
Jade-GG Aug 6, 2025
ab8aeda
Still return falsy values
Jade-GG Aug 6, 2025
0bab9eb
Remove old scopes, update HasAlternates to include rewrites relation
Jade-GG Aug 6, 2025
3f25db8
Apply fixes from Duster
Jade-GG Aug 6, 2025
98aacc5
Remove unnecessary casts
Jade-GG Aug 6, 2025
052ba64
Add URL, images, price for configurable/grouped products, move stuff …
Jade-GG Aug 6, 2025
7e934b7
Apply fixes from Duster
Jade-GG Aug 6, 2025
f310cc7
Simplify price & add specialPrice
Jade-GG Aug 6, 2025
baae5d8
Merge branch 'feature/flat-tables' of https://github.com/rapidez/core…
Jade-GG Aug 6, 2025
e42bdc5
Apply fixes from Duster
Jade-GG Aug 6, 2025
c7c4da2
Make custom attributes trait slightly more abstract, add product link…
Jade-GG Aug 7, 2025
7faf8d3
Apply fixes from Duster
Jade-GG Aug 7, 2025
0830d95
Add inverted product links
Jade-GG Aug 7, 2025
c13f98c
Add category info & use config models
Jade-GG Aug 7, 2025
f3e8018
Add minSaleQty
Jade-GG Aug 7, 2025
9c0f104
Add breadcrumb categories
Jade-GG Aug 7, 2025
c8499d0
Add reviewSummary
Jade-GG Aug 7, 2025
b50ce36
Fix bug & add toArray for indexing
Jade-GG Aug 7, 2025
d265943
Allow indexing (but slow)
Jade-GG Aug 8, 2025
5262dcf
Apply fixes from Duster
Jade-GG Aug 8, 2025
2240d05
Formatting
Jade-GG Aug 8, 2025
3947219
Add tier pricing
Jade-GG Aug 26, 2025
1097b17
Apply fixes from Duster
Jade-GG Aug 26, 2025
16993dc
Merge pull request #985 from rapidez/feature/flat-tables-tier-pricing
royduin Aug 27, 2025
9602fe3
Fix performance
Jade-GG Sep 1, 2025
cdb4c9b
Apply fixes from Duster
Jade-GG Sep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/Models/Traits/HasAttributeOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,29 @@
trait HasAttributeOptions
{
protected static $hasAttributeOptions = true;
protected static $attributeCache = [];

protected function options(): Attribute
{
// Sort by store_id first to always get the higher store id if there are two.
return Attribute::get(fn () => $this->attributeOptions
->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.

$store = config('rapidez.store');
$key = "store_$store.$this->attribute_code";

$value = data_get(static::$attributeCache, $key);
if ($value) {
return $value;
}

$value = $this->attributeOptions->keyBy('option_id');
data_set(static::$attributeCache, $key, $value);

return $value;
});
}

public function attributeOptions(): HasMany
{
return $this->hasMany(config('rapidez.models.attribute_option'), 'attribute_id', 'attribute_id');
// Sort by store_id first to always get the higher store id if there are two.
return $this->hasMany(config('rapidez.models.attribute_option'), 'attribute_id', 'attribute_id')->orderBy('store_id');
}
}
Loading