Hi,
Rereading everything here, I think I understand what's going on.
There is a check when HikaShop requests the SEF URL. This check makes sure that the Itemid used in the URL corresponds to the view and layout parameters of the non SEF URL. And to do this, the system look at the menu item ids with the format index.php?option=com_hikashop&view=category&layout=listing in the database.
But in your case, since you made a custom layout, this won't match. And in that case, the system will automatically use another menu item which matches. This is done in order to avoid 404 errors when menu items are not configured properly by the admin.
For example, if I configure a module to use the menu item with the id 100, but later on I delete that menu item, the module will still try to generate links for the menu item with the id 100. That would result in 404 errors. So HikaShop automatically correct the Itemid in the URL to use another one.
This backfires in your case because the link in the database doesn't correspond to what HikaShop expects.
Try adding the code:
}elseif(!empty($id)){
$filters[] = 'a.link LIKE \'index.php?option=com_hikashop&view='.($view=='manufacturer'?'category':$view).'&layout=%\'';
after the code:
$filters[] = 'a.link LIKE \'index.php?option=com_hikashop&view=%\'';
in the file administrator/components/com_hikashop/classes/menus.php
This way, the system will ignore the layout parameter when doing this check. This will still effectively prevent 404 errors with menu items not configured properly, while still allow for custom layouts.