title = "Product" url = "/product/:slug/:variant?" layout = "default" is_hidden = 0 [viewBag] localeUrl[en] = "/product/:slug/:variant?" [product] product = ":slug" variant = ":slug" [products relatedProducts] setPageTitle = 0 includeVariants = 1 includeChildren = 0 perPage = 4 paginate = 0 sort = "random" [wishlistButton] == use OFFLINE\Mall\Models\Category; function onStart() { // Fetch the category from the product component. $productComponent = $this->findComponentByName('product'); $item = optional($productComponent)->item; if (!$item) { return; } $category = optional($item->categories)->first(); if (!$category) { return; } // If a category is available, use it for the products component. $this->findComponentByName('relatedProducts')->category = $category; } ==
{% component 'product' %}

Other products from this category

{% component 'relatedProducts' %}
{% put styles %} {% endput %} {% put scripts %} {% endput %}