/** * Provides access to an attribute of the current brand * * @param array $params * @param \Smarty $smarty * @return string the value of the requested attribute */ public function brandDataAccess($params, &$smarty) { $brandId = $this->getRequest()->get('brand_id'); if ($brandId === null) { $productId = $this->getRequest()->get('product_id'); if ($productId !== null) { if (null !== ($product = ProductQuery::create()->findPk($productId))) { $brandId = $product->getBrandId(); } } } if ($brandId !== null) { return $this->dataAccessWithI18n("Brand", $params, BrandQuery::create()->filterByPrimaryKey($brandId)); } return ''; }
public function brandDataAccess($params, &$smarty) { $brandId = $this->request->get('brand_id'); if ($brandId !== null) { $search = BrandQuery::create()->filterById($brandId); return $this->dataAccessWithI18n("Brand", $params, $search); } }