Jump to content

[SOLVED] Link Rewrite in Cross Selling


Recommended Posts

Hi,

I have the module cross selling installed but i found an small error in link rewrite. The problem is that the link that appear when we click on product shown in cross selling module is without the category in url, and all other modules insert category name in url.

This is duplicate url for google.

Ex.: my products have this url: example.com/category-name/product-name.html.

In cross selling the url is: example.com/product-name.html

Hope someone can help me

Regards

Mozack

Link to comment
Share on other sites

It looks like you've found a bug! Try changing line 57 of modules/crossselling/crossselling.php from:

$orderProduct['link'] = $link->getProductLink(intval($orderProduct['product_id']), $orderProduct['link_rewrite']);



to:

$product = new Product(intval($orderProduct['product_id']), false, intval($cookie->id_lang));
$category = new Category(intval($product->id_category_default), intval($cookie->id_lang));
$orderProduct['link'] = $link->getProductLink(intval($orderProduct['product_id']), $orderProduct['link_rewrite'], $category->link_rewrite);



If this work for you, I will post it on the bug tracker.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

I have problem to show and get manufacturer_name in module “cross selling”, that relational database is not found. Could you tell me this problem ?

in .php

$orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)($cookie->id_lang).' AND cl.id_lang = '.(int)($cookie->id_lang).'
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
ORDER BY RAND()
LIMIT 10');

in .tpl

{$orderProducts.manufacturer_name|escape:'htmlall':'UTF-8'}

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...