Jump to content

getProductLink for combinations' product


Recommended Posts

hi, i'm trying to generate and list url of all combinations of a product....but it doesn't work!

i do this 

$prodottoFeed['link'] = $link->getProductLink($product->id, $product->link_rewrite, null, null, null, null, $combinazione['id_attribute'],Configuration::get('PS_REWRITING_SETTINGS'), false, true);

but generate an url that doesn't work

Share this post


Link to post
Share on other sites

How I did it:

$context = Context::getContext();
$product = new Product ($id_product, $id_lang);
$combinations = $product->getAttributeCombinations($id_lang);
//and for urls something like
$link = new Link();
$url = $link->getProductLink($product);

 

Edited by Amantha Bill (see edit history)

Share this post


Link to post
Share on other sites

it return url of product father and not correct url for every combinations; i have solved this: 

with this for product without combinations:

Context::getContext()->link->getProductLink( $product->id );

and for every combinations:

Context::getContext()->getProductLink($product, null, null, null, null, null, $combination['id_product_attribute']);

 

this work!

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
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More