You can get the plugin via the Shopware Store. I very much appreciate your comments and reviews.
Installation manual for Shopware plugin „Extended, individual display of article variants in cart, checkout, emails, documents and other“
Install the plugin, fill in the settings and go ahead!
Simple to use and thanks to predefined default values you can see the improvement in no time.
The only thing you have to do manually is, if desired, to adapt the templates of the order confirmation e-mails and PDF documents. We are happy to support you installing and configuring the plugin.
Configuring the order confirmation e-mail template
In order to change the order confirmation e-mail appearance, take a look at Settings -> Email templates -> System emails -> sORDER in the Shopware backend. This plugin provides a variety of placeholders and variables you can use within the template:
$sOrderDetails.n.brainImprovedVariantDisplay.OrderMail | The plugin’s extended product data (documentation see below) |
$sOrderDetails.n.brainImprovedVariantDisplay.OrderMail.bShow | Additional boolean value, whether order mail placeholders are enabled. |
An example of how the e-mail template can be modified to display the variant details is included in the screenshots.
Don’t forget to switch the template editor to HTML or plain text depending on your requirements.
Configuring the PDF document creation
Congruently to the order confirmation e-mail you need to adapt your PDF document templates as well. The corresponding settings can be found in the Shopware backend under Settings -> Basic settings -> Shop settings -> PDF document creation. The templates themselves need to be edited on your server’s file system under [shopware folder]/themes/Frontend/[your theme]/documents. See also: https://community.shopware.com/Customise-PDF-documents_detail_1221.html and https://developers.shopware.com/designers-guide/edit-newsletter-and-document-templates/#edit-document-templates. Don’t forget to change your shop’s documents template as well in the shop settings to your own theme/template!
This plugin provides you the following placeholders and variables:
$brainImprovedVariantDisplay.Documents | The containing variable for plugin configuration variables (see „The plugin’s configuration data“). |
$Pages.n.brainImprovedVariantDisplay ($Pages.n is referred to by $position within the document views) | The containing variable for the plugin’s extended article variant information (documentation see „The plugin’s extended product data“). |
Here is an example of what your own index.tpl template could look like in order to display additional variant information:
{extends file='parent:documents/index.tpl'} {block name="document_index_table_name"} <td align="left" width="48%" valign="top"> {if $position.name == 'Versandkosten'} {s name="DocumentIndexPositionNameShippingCosts"}{$position.name}{/s} {else} {if $brainImprovedVariantDisplay.Documents.bShow && $position.brainImprovedVariantDisplay && $brainImprovedVariantDisplay.Documents.bArticleNameModification} {if $brainImprovedVariantDisplay.Documents.bArticleNameAppendVariants} {$position.name = $position.brainImprovedVariantDisplay.Documents.sArticleNameLong} {else} {$position.name = $position.brainImprovedVariantDisplay.Documents.sArticleNameShort} {/if} {/if} {s name="DocumentIndexPositionNameDefault"}{$position.name|nl2br|wordwrap:65:"<br />\n"}{/s} {/if} {if $brainImprovedVariantDisplay.Documents.bShow && $position.brainImprovedVariantDisplay} {$position.brainImprovedVariantDisplay.Documents.sVariantPrepend} {foreach $position.brainImprovedVariantDisplay.Documents.aArticleConfigurations as $configuration} {$configuration.formattedString} {/foreach} {$position.brainImprovedVariantDisplay.Documents.sVariantAppend} {/if} </td> {/block}
The plugin’s extended product data
For every configurable article this plugin stores additional information in variables and, if configured so, overwrites existing variables provided by the Shopware backend such as the article name.
$[article].brainImprovedVariantDisplay.bIsVariantArticle | Boolean value which indicates whether [article] is a variant article or not. Not available in PDF documents. |
$[article].brainImprovedVariantDisplay.[view].aArticleConfigurations | An array containing the article’s variant configuration data (see „The plugin’s variant configuration array“). |
$[article].brainImprovedVariantDisplay.[view].sVariantPrepend | HTML code preceding the variant list (e.g. starting tag of a ul list). |
$[article].brainImprovedVariantDisplay.[view].sVariantAppend | HTML code following the variant list (e.g. ending an ul list). |
$[article].brainImprovedVariantDisplay.[view].sArticleNameShort | The article name without variant info. |
$[article].brainImprovedVariantDisplay.[view].sArticleNameLong | The article name with variant info appended, formatted according to your configuration. |
[article] must be replace by the variable containing the article data (e.g. $sBasketItem for cart views or $position for PDF documents) and [view] by the corresponding plugin configuration section (e.g. Cart or Documents; see „The plugin’s configuration variables“).
The plugin’s variant configuration array
aArticleConfigurations is storage to the various variant details each article has. Every element of aArticleConfigurations contains three children as described below:
$[view].aArticleConfigurations.n.variantName | The name of the nth variant (e.g. „Size“) |
$[view].$aArticleConfigurations.n.variantText | The value of the nth variant (e.g. „XL“) |
$[view].aArticleConfigurations.n.formattedString | The formatted string according to your configuration (e.g. „Size? XL!“) |
The „n“ stands for the index of an array element where array means the list of articles of an order or each article’s variant configuration. With three articles or variant configurations, for example, n can be 0, 1 and 2 for the first, second or third article or variant information.
The plugin’s configuration variables
This plugin stores its configuration parameters in each view for you to be accessible as well. Replace [view] by Cart, OffCanvasCart, OrderConfirmation, Notes, Orders, OrderMail or Documents, depending which configuration you want to access.
$brainImprovedVariantDisplay.[view].bShow | Boolean value, whether variant processing is enabled. |
$brainImprovedVariantDisplay.[view].sVariantFormat | The HTML for each variant line, e.g. „<li>{$variantName}: {$variantText}</li>“ |
$brainImprovedVariantDisplay.[view].sVariantPrepend | The HTML preceding the variant list. |
$brainImprovedVariantDisplay.[view].sVariantAppend | The HTML following the variant list. |
$brainImprovedVariantDisplay.[view].iVariantSorting | Index of the chosen sorting method (0 = off, 1 = ascending, 2 = descending). |
$brainImprovedVariantDisplay.[view].bArticleNameModification | Boolean value, whether the original article name variable shall be overwritten. |
$brainImprovedVariantDisplay.[view].bArticleNameAppendVariants | Boolean value, whether the variants shall be appended to the original article name variable. |
$brainImprovedVariantDisplay.[view].sArticleNameFormat | The formatting of variant information within the article name. |
$brainImprovedVariantDisplay.[view].sArticleNameDelimiter | The delimiter between article name and variant information. |
$brainImprovedVariantDisplay.[view].sArticleNameDelimiterConfiguration | The delimiter between variant information within the article name. |
Having trouble? Debug logging
If something is not working as expected and you might want to contact me, it is always good to have some log files.
Since version 1.2.2 there is the possibility to let the plugin create some. As per default, this option is disabled, since it literally will store everything processed by the plugin, resulting in log files possibly growing to several megabytes after a few requests.
You can configure the folder to store the files in, as well as an option to delete log files after your desired timespan (e.g. seven days). Nonetheless you should not forget to disable the logging after you’re done. Per default, the log files will be created in [shopware root]/log/, named like brainImprovedVariantDisplay-[year-month-day].log.
Please bear in mind that the logging will also include all the personal data of your customers and their orders as well.