shopware 6 Energy efficiency class product Single view customer

50 views Asked by At

I'm fairly new to Shopware 6, stackoverflow & also GitHub and need support. in case there is already a discussion on this which I have overlooked I am sorry. However, I have not found anything.

I have set up my store correctly so far, but we need certain things for Germany which are currently not feasible. We need a so-called energy efficiency class data sheet for light bulbs. Which is simply named "Energy efficiency class data sheet" with the name linked to the actual document and also has a small mini icon / graphic in front of it. The documents and icon are already uploaded in the uploaded in the Shopware backend. However, I have not found a way to place them directly next to the product price Or in the vicinity don’t need to be next to price. Preferably below the article number.

I have seen that there are plugins for this, but they are very expensive for our small business and therefore not feasible.

Therefore my question in which file can I create a link here e.g. with properties or an additional field that places the graphic + the text accordingly near the product price (single product view only)?

I would be very grateful for your help

I have attached a picture of WordPress though. It should look similar for Shopware. Doesn't have to be identical. Important only near the price

enter image description here

Github checking, google, check some files but could not find something

1

There are 1 answers

0
Gerrit On

This is a typical case for an additional field. In Shopware 6, you can create additional fields via the administration interface, among other things. In your case, the additional field of type Media is the right one. You can find more information on how to create these here: https://docs.shopware.com/en/shopware-6-en/settings/custom-fields#media

Then it is "only" a matter of reading the content of your additional field and outputting it in the correct place. If you don't already have one, you will need a custom theme for this. The basics are explained here: https://developer.shopware.com/docs/guides/plugins/themes/create-a-theme.html

Next, you need to determine the appropriate Twig file and the Twig block it contains. If you want to display it around the price, the buy-widget should be the right place (see vendor/shopware/storefront/Resources/views/storefront/component/buy-widget/buy-widget.html.twig).

You can find out how to extend Twig templates correctly here: https://developer.shopware.com/docs/guides/plugins/plugins/storefront/customize-templates.html

For the additional media field, please note that you only get one ID, a MediaID, back. You can find out how to access the media object and thus also the URL and the like here: https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/custom-fields-of-type-media.html

As you can see from this, some developer knowledge is required.

Finally, I can only recommend the Template Designer Training. Here, the steps mentioned above are explained and carried out in detail - the installation routine is somewhat outdated, but that shouldn't make any difference here. You can find it here: https://academy.shopware.com/courses/shopware-6-template-training-english