EXWE Blog
News about Shopware from the EXWE Blog
Subscribe to articles about digitalization, software development and e-commerce
  Show all news (72)

Show Shopware Custom Products under Variant Selection

Banner Shopware

A big problem with Shopware's Custom Products plugin is that it doesn't inherently allow you to set whether the variant selection should appear above or below the Custom Products options.

Often it makes more sense from the user flow to first select a product variant and then make the extras or adjustments. The necessary adjustments are also very limited, so we want to give you a short guide here:

CUSTOMIZATION IN THE THEME

In your theme you have to overwrite two template files: frontend/detail/data.tpland frontend/detail/content/buy_container.tpl.

If these files do not already exist in your theme, please create them.

Then make sure that the appropriate template file is extended at the very beginning (e.g. {extends file='parent:frontend/detail/data.tpl'}).

Now it's time to get down to the nitty gritty: In the data.tpl you add the following block:

{* Custom products frontend hook *}
{block name="frontend_detail_data_swagcustomproducts"}
    {* Custom products will be rendered elsewhere -- see detail/content/buy_container *}
{/block}

As mentioned in the comment, we're overriding a block from the Custom Products plugin here to prevent the Custom Products options from being rendered where it actually happens -- above the variants.

Next, we need to put them in the right place. To do this, insert the following block in the buy_container.tpl:

{* Show custom products after variants but before quantity box *}
{block name="frontend_detail_index_buybox"}
    {if !$customProductsIsEmotionAdvancedQuickView}
            {include file="frontend/swag_custom_products/detail/wrapper.tpl"}
    {/if}

    {$smarty.block.parent}
{/block}

Now just save everything, clear template cache and you should see the desired result on the corresponding product pages!


Basics to create a Shopware Theme

To create a Shopware Theme you need a Shopware Shop and a server with Shopware 5 (or even Shopware 6) installation. If you want to work on your theme locally first, get the server environment MAMP. With Shopware 5 there is already a bare theme, which contains important files that are used as the basis of each theme - this can be found in the folder themes . If you want to create a new theme, go to the backend of Shopware on the Theme Manager. Now go to Create Theme and fill in all fields like name, short description, license and author and save the whole thing. With the command assign you can assign the theme to a shop.

The first step to create your theme is done. If you need more information about creating an online shop with Shopware, please visit our website. If you have any further questions, we at EXWE will of course be happy to help you as a professional Shopware agency and offer you support from online shop creation to monthly support and monitoring. Feel free to contact us!

 

Meike
Meike
from 17.01.20 um 18:07

Hello, my name is Meike. I take care of the EXWE back office and am responsible for our social media channels. All of our articles are meant to make your life easier and help you make decisions. Nevertheless, it can happen that something remains unclear, so: If you have questions about this article you can easily reach me at +49 231 93149827.

We also have the following interesting posts from our tech blog for you on this topic
Shopware 6 Migration: How to move your online shop to Shopware

You want to make a Shopware 6 migration? We'll show you what to look out for and how to make the move a success.

Shopware USA or American States

Here you can find the list for the american states (USA) for Shopware

Use Shopware plugins for your online store - The 5 best plugins 2021

Optimize your Shopware online store - Use the five best webshop plugins 2021 for inventory management systems, customer service or personalized products.




Schreibe EXWE auf WhatsApp