37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Product;
|
|
|
|
use Antadis\API\Front\Models\Product\ProductDetail as BaseProductDetail;
|
|
use App\Classes\ImageTrait;
|
|
/**
|
|
* @rest\model Product
|
|
* @rest\property integer id_product
|
|
* @rest\property string name
|
|
* @rest\property string description
|
|
* @rest\property string description_short
|
|
* @rest\property string price
|
|
* @rest\property string price_wo_reduction
|
|
* @rest\property integer quantity
|
|
* @rest\property boolean on_sale
|
|
* @rest\property string reduction
|
|
* @rest\property string ecotax
|
|
* @rest\property array attributes
|
|
* @rest\property array imgs
|
|
*/
|
|
class ProductDetail extends BaseProductDetail {
|
|
use ImageTrait;
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toArray() {
|
|
global $cookie;
|
|
$product = parent::toArray();
|
|
$images = $this->getImages($cookie->id_lang);
|
|
foreach ($images as $image) {
|
|
$product['imgs'][] = $this->getProductImage($image['id_image'], $this->link_rewrite, 'product_carre');
|
|
}
|
|
return $product;
|
|
}
|
|
}
|