J'essaie d'obtenir à rewrite product urlpartir du load productmodule personnalisé. Je reçois l'URL au http://localhost/m2/catalog/product/view/id/1401/category/23/format.
Mais je veux http://localhost/m2/juno-jacket.html
Voici le code
en constructeur
public function __construct(
\Magento\Catalog\Helper\Product $catalogProductHelper,
) {
$this->catalogProductHelper = $catalogProductHelper;
}
Fonction personnalisée
public function abc(){
$product_id = '123';
return $this->catalogProductHelper->getProductUrl($product_id);
}
abc() method renvoyer l'URL comme http://localhost/m2/catalog/product/view/id/1401/category/23/
getProductUrl()est censé renvoyer l'URL réécrite si l'entrée existe dans url_rewrite. Avez-vous supprimé manuellement les enregistrements de ce tableau?