protected static $_productTypes = null;
protected static $_specificationFields = null;
+ /**
+ * @var array
+ */
+ protected $_slugFields = ['slug', 'reference+name'];
+
protected $table = 'catalog_products';
protected $_options = ['name' => 'product',
} else if ($specEntity->type == 'text') {
$specValue = trim($val);
} else if ($specEntity->type == 'range') {
-
+ if (!$val['first'] && !$val['second']) {
+ continue;
+ }
$specValue = $val['first'] . ' ' . __('à') . ' ' . $val['second'] . ' ' . $specEntity->unit;
} else if ($specEntity->type == 'list') {
$option = Json::decodeRecursive($specEntity->options, Json::TYPE_ARRAY)[$val];
* Custom accessor to return fallback image
* by accessing $product->image_fallback...
*/
- public function getImageFallbackAttribute() {
+ public function getImageFallbackAttribute()
+ {
return asset('images/product-details/product-placeholder.svg');
}
* Custom accessor to return main product image (or fallback)
* by accessing $product->image...
*/
- public function getImageAttribute() {
+ public function getImageAttribute()
+ {
if ($this->images) {
$image = $this->getFirstMediaUrl($this->images);
* Fetch selected product data for use in cart Vue component
* @return array
*/
- public static function getCartData() {
+ public static function getCartData()
+ {
$cart_items = session('cart_items', []);
$category = new Item();
$category->setTitle($productType->name);
- $category->setHref($productType->slug);
+ $category->setHref($productType->getSlugOrTitleAttribute());
$category->setId('product_type_' . $productType->id);
$category->setController(['controller' => 'ProductController', 'action' => 'productList', 'params' => ['id' => $productType->id]]);
}
$detail = new Item();
$detail->setTitle($product->name);
- $detail->setHref($product->slug);
+ $detail->setHref($product->getSlugOrTitleAttribute());
$detail->setId('product/' . $product->id);
$detail->setController(['controller' => 'ProductController', 'action' => 'productDetails', 'params' => ['id' => $product->id]]);
$category->addChild($detail);