bishar Developer Fra United Kingdom Medlem siden okt. 2018 bishar aug. 19 2024 05:11 p.m. 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 Fra Sweden Medlem siden mai 2013 tim aug. 19 2024 07:30 p.m. 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 Fra United Kingdom Medlem siden okt. 2018 bishar aug. 19 2024 07:36 p.m. 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 Fra Sweden Medlem siden mai 2013 tim aug. 19 2024 09:43 p.m. 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 Fra United Kingdom Medlem siden okt. 2018 bishar aug. 20 2024 09:55 a.m. Thank you Tim. That worked!