public function getShopDetailLink($view, $canonical = false) { $params = is_array($view->params) ? $view->params : $view->getAllParams(); unset($params['controller']); unset($params['action']); unset($params['module']); unset($params['document']); unset($params['pimcore_request_source']); unset($params['ajax-call']); unset($params['infinite-scroll']); unset($params['view']); unset($params['cartId']); if ($canonical) { unset($params['category']); } $params = array_merge((array) $params, array('name' => strtolower(Website_Tool_Text::toUrl($this->getName() ? $this->getName() : $this->getDesc1())), 'product' => $this->getId())); if (!$params['country']) { $params['country'] = $view->document->getProperty("country"); } $urlCategory = $this->getFirstCategory(); if ($urlCategory) { $params['name'] = $urlCategory->getNavigationPath() . '/' . $params['name']; } $params['country'] = str_replace('/', '', $params['country']); return $view->url($params, "shop-detail"); }
public function getNavigationPath() { $topLevel = $this; $categories = array(); $root = Object_Abstract::getById(47); //Pimcore_Config::getWebsiteConfig()->shopCategoriesFolder; while ($topLevel && $topLevel->getId() != $root->getId()) { $categories[] = $topLevel; $topLevel = $topLevel->getParent(); } $categories = array_reverse($categories); $path = ''; foreach ($categories as $category) { $path .= Website_Tool_Text::toUrl($category->getText()) . '/'; } $path = substr($path, 0, strlen($path) - 1); return $path; }