0

I created a module for custom items similar to products and showing on frontend as a listing and detail page. I want to show the listing page on this URL: storeurl.com/custom which is loading fine but the detail page is not showing up on the desirable URL which should be: storeurl.com/custom/url_key

Routes.xml <route frontName="custom" id="custom">

list.phtml where I added anchor tag for detail page:

<a class="product-item-link" href="<?php echo $block->getUrl('custom/index/view/', ['id' => $_item->getUrlKey()]); ?>"> View More </a>

This is what my detail page URL looks like: storeurl.com/custom/index/view/id/item_1/ instead of storeurl.com/custom/item_1

I do not want to add view as controller but custom/index/index.php I am using it for the listing page so I am not how can I use also for detail page or is there any other way to modify/trim URL?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.