Commit 6bfb0f75 by lmf

shopline版本产品链接修改

parent 01bd53c2
...@@ -266,7 +266,8 @@ class AbstractProduct extends \Magento\Framework\View\Element\Template ...@@ -266,7 +266,8 @@ class AbstractProduct extends \Magento\Framework\View\Element\Template
if (!isset($additional['_escape'])) { if (!isset($additional['_escape'])) {
$additional['_escape'] = true; $additional['_escape'] = true;
} }
return $product->getUrlModel()->getUrl($product, $additional); return $product->getUrlKey();
//return $product->getUrlModel()->getUrl($product, $additional);
} }
return '#'; return '#';
......
...@@ -182,12 +182,13 @@ class Url extends \Magento\Framework\DataObject ...@@ -182,12 +182,13 @@ class Url extends \Magento\Framework\DataObject
if (!empty($requestPath)) { if (!empty($requestPath)) {
$routeParams['_direct'] = $requestPath; $routeParams['_direct'] = $requestPath;
} else { } else {
$routePath = 'catalog/product/view'; $routeParams['_direct'] = "products/".$product->getUrlKey();
$routeParams['id'] = $product->getId(); // $routePath = 'catalog/product/view';
$routeParams['s'] = $product->getUrlKey(); // $routeParams['id'] = $product->getId();
if ($categoryId) { // $routeParams['s'] = $product->getUrlKey();
$routeParams['category'] = $categoryId; // if ($categoryId) {
} // $routeParams['category'] = $categoryId;
// }
} }
// reset cached URL instance GET query params // reset cached URL instance GET query params
......
...@@ -113,7 +113,10 @@ class CategoryUrlPathGenerator ...@@ -113,7 +113,10 @@ class CategoryUrlPathGenerator
if ($storeId === null) { if ($storeId === null) {
$storeId = $category->getStoreId(); $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 ...@@ -110,7 +110,10 @@ class ProductUrlPathGenerator
*/ */
public function getUrlPathWithSuffix($product, $storeId, $category = null) 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