Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save factoryhr/95ce0d29ba51609b1d303aef00fb5535 to your computer and use it in GitHub Desktop.
Save factoryhr/95ce0d29ba51609b1d303aef00fb5535 to your computer and use it in GitHub Desktop.
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Pimcore\Model\DataObject\Brand;
use Pimcore\Model\DataObject\Product;
class BrandController extends AbstractController
{
/**
* @Route("/en/brandpages/{id}", name="brand")
*/
function detailAction(Request $request, $id) {
// Get brand by id
$brand = Brand::getById($id);
// Get products by brand id
$productList = new Product\Listing();
$productList->setCondition("Brand__id = ?", $id);
$products = $productList->getObjects();
$this->view->products = $products;
$this->view->brand = $brand;
}
}
@factoryhr
Copy link
Author

factoryhr commented Apr 18, 2019

Blog post - Pimcore learning experience - brand detail action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment