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/Product.php +9 -20 1.6.0 → 1.7.0 View file →
@@ -176,14 +176,8 @@
176 176 return get_the_terms($this->ID, 'product-categories');
177 177 }
178 178
179 179
180 - public function getTags()
181 - {
182 - return get_the_terms($this->ID, 'product-tags');
183 - }
184 -
185 -
186 180 public function getMediaUrl($size = 'thumbnail')
187 181 {
188 182 return get_the_post_thumbnail_url($this->ID, $size);
189 183 }
@@ -192,14 +186,8 @@
192 186 /*
193 187 * Transforming old getters with accessor
194 188 * Todo check
195 189 */
196 - public function getTagsAttribute($value)
197 - {
198 - return get_the_terms($this->ID, 'product-tags');
199 - }
200 -
201 -
202 190 public function getCategoriesAttribute($value)
203 191 {
204 192 return get_the_terms($this->ID, 'product-categories');
205 193 }
@@ -207,9 +195,9 @@
207 195
208 196 public function getThumbnailAttribute()
209 197 {
210 198 if (empty($this->detail) || empty($this->detail->featured_media)) {
211 - return Vite::getAssetUrl('images/placeholder.svg');
199 + return Helper::getProductPlaceholderUrl();
212 200 }
213 201 return Arr::get($this->detail->featured_media, 'url');
214 202 }
215 203
@@ -259,14 +247,8 @@
259 247 return $this->getTermByType('product-categories');
260 248 }
261 249
262 250
263 - public function tags()
264 - {
265 - return $this->getTermByType('product-tags');
266 - }
267 -
268 -
269 251 /*
270 252 * Todo: Discuss on below relation
271 253 */
272 254 public function thumbUrl(): HasOne
@@ -509,9 +491,9 @@
509 491
510 492 public function images(): array
511 493 {
512 494 $images = [];
513 - $thumbnailImage = $this->thumbnail ?? Vite::getAssetUrl('images/placeholder.svg');
495 + $thumbnailImage = $this->thumbnail ?? Helper::getProductPlaceholderUrl();
514 496
515 497 $galleryImages = get_post_meta($this->ID, 'fluent-products-gallery-image', true);
516 498
517 499
@@ -821,6 +803,13 @@
821 803
822 804 public function integrations(): \FluentCart\Framework\Database\Orm\Relations\HasMany
823 805 {
824 806 return $this->hasMany(ProductMeta::class, 'object_id')->where('object_type', 'product_integration');
807 + }
808 +
809 + public function reviews(): \FluentCart\Framework\Database\Orm\Relations\HasMany
810 + {
811 + return $this->hasMany(ProductReview::class, 'post_id', 'ID')
812 + ->whereNull('parent_id')
813 + ->where('status', Status::REVIEW_APPROVED);
825 814 }
826 815 }