Category images

Category images for Shop-Script

Allows to upload category images.

How to use in the design themes?
Simply edit the template in your design theme by adding the following code to where you want to show the image:
{if $category.image}
<img src="{$wa_url}wa-data/public/shop/categories/{$category.id}/{$category.id}{$category.image}">
{/if}
Here $category is a variable with information about the category. In different templates it can be called in different ways.
You can also set the size of the thumbnail (one of those which are saved in the plugin settings):
<img src="{$wa_url}wa-data/public/shop/categories/{$category.id}/{$category.id}.200{$category.image}">

How to place categories with images on the main page?
You need to open the «Storefront» tab in your backend. There you need to find the template "home.html" of your design theme and to put the following code in any place where you want to show the list of categories.
{$categories = $wa->shop->categories(0, 0)}
{if $categories}
<div class="sub-categories">
{foreach $categories as $sc}
{if $sc.image}
<img src="{$wa_url}wa-data/public/shop/categories/{$sc.id}/{$sc.id}.96{$sc.image}">
{/if}
<a href="{$sc.url}">{$sc.name|escape}</a>
{/foreach}
</div>
{/if}

How to change the size of category images?
You must first add the needed size in the plugin settings, and then write this size in the template.
For size 96 pixels:
<img src="{$wa_url}wa-data/public/shop/categories/{$sc.id}/{$sc.id}.96{$sc.image}">

For example, we added the image size Max (width, height) = 200 px.
Then we should write this in the image template like that:
<img src="{$wa_url}wa-data/public/shop/categories/{$sc.id}/{$sc.id}.200{$sc.image}">

Another example, we added the following image size: width = 200 px, height = auto.
In this case we should write in the template:
<img src="{$wa_url}wa-data/public/shop/categories/{$sc.id}/{$sc.id}.200x0{$sc.image}">