Just Final Step Finishing
This commit is contained in:
parent
549df39875
commit
8fbb1faea3
|
|
@ -51,15 +51,21 @@ class Product extends JsonResource
|
||||||
'super_attributes' => Attribute::collection($product->super_attributes),
|
'super_attributes' => Attribute::collection($product->super_attributes),
|
||||||
]),
|
]),
|
||||||
'special_price' => $this->when(
|
'special_price' => $this->when(
|
||||||
$product->getTypeInstance()->haveSpecialPrice(),
|
$product->getTypeInstance()->haveSpecialPrice(),
|
||||||
$product->getTypeInstance()->getSpecialPrice()
|
$product->getTypeInstance()->getSpecialPrice()
|
||||||
),
|
),
|
||||||
'formated_special_price' => $this->when(
|
'formated_special_price' => $this->when(
|
||||||
$product->getTypeInstance()->haveSpecialPrice(),
|
$product->getTypeInstance()->haveSpecialPrice(),
|
||||||
core()->currency($product->getTypeInstance()->getSpecialPrice())
|
core()->currency($product->getTypeInstance()->getSpecialPrice())
|
||||||
),
|
),
|
||||||
'regular_price' => data_get($prices, 'regular_price.price'),
|
'regular_price' => $this->when(
|
||||||
'formated_regular_price' => data_get($prices, 'regular_price.formated_price'),
|
$product->getTypeInstance()->haveSpecialPrice(),
|
||||||
|
data_get($prices, 'regular_price.price')
|
||||||
|
),
|
||||||
|
'formated_regular_price' => $this->when(
|
||||||
|
$product->getTypeInstance()->haveSpecialPrice(),
|
||||||
|
data_get($prices, 'regular_price.formated_price')
|
||||||
|
),
|
||||||
'reviews' => [
|
'reviews' => [
|
||||||
'total' => $total = $this->productReviewHelper->getTotalReviews($product),
|
'total' => $total = $this->productReviewHelper->getTotalReviews($product),
|
||||||
'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0,
|
'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue