Prestashop Link :: getProductLink()返回错误的链接(其中没有类别)

问题描述 投票:0回答:2

Link :: getproductLink()返回错误的URL,打开此URL后,在开发模式下可能是重定向或错误消息。

这里某人(PrestaShop $link -> getProductLink($product) gives incorrect URL)遇到了同样的问题,人们回答他以禁用DEV模式,然后消息([Debug]此页面已移动,请改用以下URL:...),因为.htaccess消失了重定向到在SEO选项中设置的URL。

$product = new Product(123)
$link = new Link();
$product_link = $link -> getProductLink($product, null, null, null, 2);
$product_link returns: http://my.domain/de/123-product-name

虽然应该是:http://my.domain/de/category-name/123-product-name

php hyperlink prestashop product prestashop-1.7
2个回答
0
投票

在[设置商店]标签中查找-> [流量和SEO->阻止“ URL格式”,您可以选择产品URL的格式

问候


0
投票

尝试使用:

$product = new Product(123)
$link = new Link();
$product_link = $link->getProductLink(
    $product,
    $product->link_rewrite[2],
    Category::getLinkRewrite($product->id_category_default, 2),
    null, 
    2
);
© www.soinside.com 2019 - 2024. All rights reserved.