bebeboutik-api/app/Models/Product/ProductDetail.php
Christophe LATOUR dbe268c561 Handling images
2017-08-14 12:39:19 +02:00

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;
}
}