Product features with specified values are displayed in a list in product-viewing pages in the storefront. Basic design themes of Shop-Script 5 by default display all features with non-empty values. However, you may want to use product features to store some additional information about your products which should not be shown to customers. For example, supplier name or product's location within the store (row & shelf No.), and other similar internal data.
To hide internally used product features from being displayed in product-viewing pages in the storefront, you need to slightly modify design theme template product.html
by choosing one of the methods suggested below.
Method 1
The list of displayed product features is generated in design theme template product.html
by means of the following cycle:
{foreach $product.features as $f_code => $f_value} ... {/foreach}
In order to hide product features with certain codes (feature codes are displayed in gray color in backend screen "Settings → Product types & Features"), add an extra condition inside the cycle:
{foreach $product.features as $f_code => $f_value} {if !in_array($f_code, ['code1', 'code2'])} ... {/if} {/foreach}
This example shows how you can hide product features with codes code1
and code2
. You can specify your own feature code list in a similar fashion, i.e. with quotation marks and separated by commas. Specify feature codes rather than their names in this list!
Method 2
The condition shown in the above example can be modified to become more "all-purpose" so that it can hide all features whose codes are formed in a special way; e.g., have an underscore character "_" at the beginning: _code1
, _code2
, etc.
To do so, change the condition suggested above as shown below:
{foreach $product.features as $f_code => $f_value}
{if strpos($f_code, '_') !== 0}
...
{/if}
{/foreach}
In this case you do not need to list the codes of all "hidden" features, it is enough to ensure that their codes begin with an underscore.
0 comments
No comments yet.