sw_product_detail_content_tabs, which seems to contain all available tabs. It starts by creating a new
<sw-tabs>element to contain all the tabs available. Here you can see excerpt of this block:
<sw-tabs>element. Instead, you can choose the last available block inside the element, which is
sw_product_detail_content_tabs_reviewsat this moment.
index.js, which then contains the following code:
sw-product-detailcomponent with a new template. The new template does not exist yet though, so create a new file
sw-product-detail.html.twigin the same directory as your
index.jsfile. It then has to use the block we figured out earlier and override it by adding a new tab element:
sw-tabs-itemelement, which, as the name suggests, represents a new tab item. We want this tab to have a custom route, so we're also adding this route directly. Don't worry, we'll explain this custom route in a bit. The product detail page's route contain the product's ID, which you also want to have in your custom tab: So make sure to also pass the ID in, like shown in the example above.
main.jsfile. And that's also the file you need to adjust now, so it loads your
main.jsshould look like in order to load your override:
routeMiddlewareof a module. It gets called for each and every route that is called in the administration. Once the
sw.product.detailroute is called, you want to add your new child route to it.
main.jsfile, which could then look like this:
routeMiddlewaremethod. In there, you're listening for the current route, that got called. If the current route matches
sw.product.detail, you want to add your new child route to it, and that's what's done here.
/sw/product/detail/:id/baseJust replace the
customor anything you like.
view/sw-product-detail-custom, so create this directory in your plugin now. The directory structure inside of your administration directory should then look like this:
index.js, create such a new file in the
sw-product-detail-custom.html.twignext to your