PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 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 All 51 releases
← All changes | app/Models/ProductDetail.php +3 -16 1.3.27 → 1.7.1 View file →
@@ -6,9 +6,9 @@
6 6 use FluentCart\App\Models\Concerns\CanSearch;
7 7 use FluentCart\App\Models\Concerns\CanUpdateBatch;
8 8 use FluentCart\Framework\Database\Orm\Relations\BelongsTo;
9 9 use FluentCart\Framework\Database\Orm\Relations\HasMany;
10 -use FluentCart\Framework\Database\Orm\Relations\hasOne;
10 +use FluentCart\Framework\Database\Orm\Relations\HasOne;
11 11 use FluentCart\App\Models\WpModels\PostMeta;
12 12 use FluentCart\Framework\Support\Arr;
13 13
14 14 /**
@@ -121,22 +121,8 @@
121 121 {
122 122 return $this->hasMany(ProductVariation::class, 'post_id', 'post_id')->orderBy('serial_index', 'asc');
123 123 }
124 124
125 - public function attrMap(): HasMany
126 - {
127 - return $this->hasMany(AttributeRelation::class, 'object_id', 'id');
128 - }
129 -
130 -
131 - public static function boot()
132 - {
133 - parent::boot();
134 - static::deleting(function ($model) {
135 - $model->attrMap()->delete();
136 - });
137 - }
138 -
139 125 public function setDefaultMediaAttribute($value)
140 126 {
141 127 if (is_array($value) || is_object($value)) {
142 128 $this->attributes['default_media'] = json_encode($value);
@@ -156,8 +142,9 @@
156 142 }
157 143
158 144 public function getStockAvailability($variationId = null)
159 145 {
146 +
160 147 if (!$this->manage_stock) {
161 148 $availability = [
162 149 'manage_stock' => false,
163 150 'availability' => __('In Stock', 'fluent-cart'),
@@ -163,9 +150,9 @@
163 150 'availability' => __('In Stock', 'fluent-cart'),
164 151 'class' => 'in-stock',
165 152 'available_quantity' => null
166 153 ];
167 - } else if ($this->stock_availability) {
154 + } else if ($this->stock_availability === 'in-stock') {
168 155 $availability = [
169 156 'manage_stock' => true,
170 157 'availability' => __('In Stock', 'fluent-cart'),
171 158 'class' => 'in-stock',