PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | app/Models/OrderItem.php +18 -11 1.5.1 → 1.7.0 View file →
@@ -155,8 +155,18 @@
155 155 {
156 156 return $this->belongsTo(ProductDownload::class, 'post_id', 'post_id');
157 157 }
158 158
159 + /**
160 + * All reviews of the product this line item points to — keyed on
161 + * post_id, not on the item itself, so whereDoesntHave() over it
162 + * expresses "the customer never reviewed this product".
163 + */
164 + public function product_reviews()
165 + {
166 + return $this->hasMany(ProductReview::class, 'post_id', 'post_id');
167 + }
168 +
159 169 public function createItem($orderItems)
160 170 {
161 171 return $this->belongsTo(ProductVariation::class, 'variation_id', 'id');
162 172 }
@@ -257,17 +267,14 @@
257 267 * @return string
258 268 */
259 269 public function getVariationDisplayTitleAttribute()
260 270 {
261 - $itemAttributes = Arr::get($this->other_info, 'item_attributes', []);
262 - $attributesTitle = \FluentCart\App\Helpers\AttributeHelper::getDisplayAttributesString($itemAttributes, $this, 'order_item');
263 -
264 - if (!$attributesTitle) {
265 - if ($this->post_title === $this->title) {
266 - return '';
267 - }
268 - return (string)$this->title;
269 - }
270 -
271 - return $attributesTitle;
271 + // Order items carry the item_attributes snapshot (written at order
272 + // creation), so resolve directly — getDisplayAttributesString renders
273 + // the labeled combination and falls back to the variation title.
274 + return \FluentCart\App\Helpers\AttributeHelper::getDisplayAttributesString(
275 + Arr::get($this->other_info, 'item_attributes', []),
276 + $this,
277 + 'order_item'
278 + );
272 279 }
273 280 }