bishar Developer Depuis United Kingdom Membre depuis oct. 2018 bishar 19 août 2024 17:11 Hi Tim, This add-on has been working well for me. It does however create duplicate links to the same product page. For example a product can have multiple URLs if it exists in multiple categories: https://www.abc.com/ducks https://www.abc.com/ducks?category_id=20 https://www.abc.com/ducks?category_id=5 What I want is to remove the parameter "?category_id=#" overall so that a product will only have 1 URL (https://www.abc.com/ducks). Please can you help? Bishar
tim Founder Depuis Sweden Membre depuis mai 2013 tim 19 août 2024 19:30 So ?category_id is used to refer to a location in the category tree other than default category. You will no longer have a pleasant result viewing a product found in more than one category if we remove this.
bishar Developer Depuis United Kingdom Membre depuis oct. 2018 bishar 19 août 2024 19:36 Hi Tim, Well apart from the url containing the category_id and the breadcrumb showing the category name, the rest of the page is exactly the same. I don't really think I will miss much if we removed the category_id from the url. Please can you guide me through it?
tim Founder Depuis Sweden Membre depuis mai 2013 tim 19 août 2024 21:43 In vmods/permalinks.xml. Find the directive for url_product.inc.php: <operation method="after" type="multiline" onerror="warning"> <find><![CDATA[ if (empty($link->query['product_id'])) return; ]]></find> <insert><![CDATA[ $permalinks_query = database::query( "select * from ". DB_TABLE_PREFIX ."permalinks where entity = 'product' and entity_id = ". (int)$link->query['product_id'] ." and language_code = '". database::input($language_code) ."' limit 1;" ); if ($permalink = database::fetch($permalinks_query)) { $link->unset_query('product_id'); $link->path = $permalink['permalink']; return $link; } ]]></insert> </operation> </file>``` After $link->unset_query('product_id'); Add $link->unset_query('category_id');
bishar Developer Depuis United Kingdom Membre depuis oct. 2018 bishar 20 août 2024 09:55 Thank you Tim. That worked!