Question

I've added extra columns for my module in the product grid. Within the columns, I'm inserting some of my own icons that contain anchor tag links. When I click on the icons, I'm taken to the product edit page instead of the link I've specified in the icon, which is the default behavior when you click on a row in the product grid.

How do we override the product grid's default links so I can use my own specified links?

I've tried the JavaScript preventDefault() method to no avail, but I'm sure I'm using it correctly.

Était-ce utile?

La solution

You can override this file to made your changes:

From:

vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml

To:

app/design/frontend/YourPackage/YourTheme/Magento_Catalog/templates/product/list/toolbar/viewmode.phtml

If you want to change or increase a new method you need create a module or a plugin that change the class:

vendor/magento/module-catalog/Model/Product/ProductList/Toolbar.php
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top