In basic desi themes CUSTOM, Sidebar, and Clear, the slider in the home page by default displays the main (first) image of each product added to the bestsellers
set. If you would like to change this default behavior and display a different (e.g., second or last) product image in the slider, you need to modify the original design theme as described in this article.
Displaying product image with specified index number
The HTML code for displaying product image in the slider is generated by means of the following function in the home.html
template:
{$wa->shop->productImgHtml($p, '970', ['itemprop' => 'image', 'alt' => $p.name, 'default' => "`$wa_theme_url`img/dummy200.png"])}
If you need to have the second product image displayed instead of the first one, add the following extra code before that line:
{$_product = $wa->shop->product($p.id)} {$product_image_ids = array_keys($_product.images)} {$slider_image = $_product.images[$product_image_ids[1]]} {$p.image_id = $slider_image.id} {$p.ext = $slider_image.ext}
In this code, the 1 number indicates that the second product image should be displayed (numeration begins with zero). Hence, to have the 3rd image displayed in the slider, specify 2 instead of 1 in this example.
Displaying last product image
To have the last product image displayed in the slider regardless of the total number of images uploaded for each specific product, add the following code instead of that suggested in the previous example:
{$_product = $wa->shop->product($p.id)} {$slider_image = end($_product.images)} {$p.image_id = $slider_image.id} {$p.ext = $slider_image.ext}
4 comments
I need this feature to use the second image.
Please, help
best regards
{$wa->shop->productImgHtml($p, '400', ['itemprop' => 'image', 'alt' => $p.name, 'default' => "`$wa_theme_url`img/dummy200.png"])}
http://www.swansonarabia.com/
I didn't embed it