Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
6bfb0f75
Commit
6bfb0f75
authored
Mar 02, 2023
by
lmf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shopline版本产品链接修改
parent
01bd53c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
app/code/Magento/Catalog/Block/Product/AbstractProduct.php
+2
-1
app/code/Magento/Catalog/Model/Product/Url.php
+7
-6
app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
+4
-1
app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php
+4
-1
No files found.
app/code/Magento/Catalog/Block/Product/AbstractProduct.php
View file @
6bfb0f75
...
@@ -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
'#'
;
...
...
app/code/Magento/Catalog/Model/Product/Url.php
View file @
6bfb0f75
...
@@ -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
...
...
app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php
View file @
6bfb0f75
...
@@ -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
);
}
}
/**
/**
...
...
app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php
View file @
6bfb0f75
...
@@ -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
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment