Commit 6bfb0f75 by lmf

shopline版本产品链接修改

parent 01bd53c2
......@@ -266,7 +266,8 @@ class AbstractProduct extends \Magento\Framework\View\Element\Template
if (!isset($additional['_escape'])) {
$additional['_escape'] = true;
}
return $product->getUrlModel()->getUrl($product, $additional);
return $product->getUrlKey();
//return $product->getUrlModel()->getUrl($product, $additional);
}
return '#';
......
......@@ -182,12 +182,13 @@ class Url extends \Magento\Framework\DataObject
if (!empty($requestPath)) {
$routeParams['_direct'] = $requestPath;
} else {
$routePath = 'catalog/product/view';
$routeParams['id'] = $product->getId();
$routeParams['s'] = $product->getUrlKey();
if ($categoryId) {
$routeParams['category'] = $categoryId;
}
$routeParams['_direct'] = "products/".$product->getUrlKey();
// $routePath = 'catalog/product/view';
// $routeParams['id'] = $product->getId();
// $routeParams['s'] = $product->getUrlKey();
// if ($categoryId) {
// $routeParams['category'] = $categoryId;
// }
}
// reset cached URL instance GET query params
......
......@@ -113,7 +113,10 @@ class CategoryUrlPathGenerator
if ($storeId === null) {
$storeId = $category->getStoreId();
}
return $this->getUrlPath($category) . $this->getCategoryUrlSuffix($storeId);
//return $this->getUrlPath($category) . $this->getCategoryUrlSuffix($storeId);
$name = $this->getUrlPath($category);
$names = explode("/",$name);
return "collections/".array_pop($names) . $this->getCategoryUrlSuffix($storeId);
}
/**
......
......@@ -110,7 +110,10 @@ class ProductUrlPathGenerator
*/
public function getUrlPathWithSuffix($product, $storeId, $category = null)
{
return $this->getUrlPath($product, $category) . $this->getProductUrlSuffix($storeId);
//return $this->getUrlPath($product, $category) . $this->getProductUrlSuffix($storeId);
$name = $this->getUrlPath($product, $category);
$names = explode("/",$name);
return "products/".array_pop($names) . $this->getProductUrlSuffix($storeId);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment