Merge remote-tracking branch 'dummy/patch-1' into dummy-1
Merged
This commit is contained in:
commit
43457b225e
|
|
@ -30,6 +30,8 @@ class Product extends JsonResource
|
|||
public function toArray($request)
|
||||
{
|
||||
$product = $this->product ? $this->product : $this;
|
||||
|
||||
$prices = $product->getTypeInstance()->getProductPrices();
|
||||
|
||||
return [
|
||||
'id' => $product->id,
|
||||
|
|
@ -56,6 +58,8 @@ class Product extends JsonResource
|
|||
$product->getTypeInstance()->haveSpecialPrice(),
|
||||
core()->currency($product->getTypeInstance()->getSpecialPrice())
|
||||
),
|
||||
'regular_price' => data_get($prices, 'regular_price.price'),
|
||||
'formated_regular_price' => data_get($prices, 'regular_price.formated_price'),
|
||||
'reviews' => [
|
||||
'total' => $total = $this->productReviewHelper->getTotalReviews($product),
|
||||
'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0,
|
||||
|
|
@ -67,4 +71,4 @@ class Product extends JsonResource
|
|||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue