Jump to content
  • 0
Kerm

How to get full product link rewrite with category name in php?

Question

This:
 

$url = $this->context->link->getProductLink($product);

Or this: 

$product = new Product((int)$id_product);			
$link = new Link();
$url = $url = $link->getProductLink($product);

Show product link with out category name in url....

 

I need some link like that:

site.com/category-name/22[spam-filter]product-link.html

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

In product.php, I see that they first fill the 'category' array as well, and add it to the getProductLink function:

 

$row['category'] = Category::getLinkRewrite((int)$row['id_category_default'], (int)$id_lang);
$row['link'] = $context->link->getProductLink((int)$row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
 
 
Maybe this helps?
pascal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×