[Skip to main content](#vessel-content)

#   Image Rotator on Product Page

##

- **[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")**
- [![bonzomedia's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1859-bonzomedia "View bonzomedia's Profile") Topic Author
- [ Offline](/forum/user/1859-bonzomedia)

Less More

- Posts: 131
- Thank you received: 7
-
-

13 years 2 months ago [\#121389](#121389) by [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")  *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#121389 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")* was created by *[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")*

Hello,

I'm using 2.2.1 on Joomla 2.5

My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.

I found this plug-in : [ www.orware.com/products/very-simple-image-rotator-plugin](http://www.orware.com/products/very-simple-image-rotator-plugin)

Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show_block_img.php to call it with the path to the product images using:-

{vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 &lt;?php $image-&gt;file_path ?&gt;}

However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with "prepare content".

I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.

Is there a solution?

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

13 years 2 months ago [\#121468](#121468) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#121468 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

Hi,

Content plugins are called on the content. In the case of the hikashop product page, the content plugins are called for the product description, and not for the whole page, as it should be.
So the solution in your case is to call the content plugins your self on your tag:
&lt;?php echo JHTML::_('content.prepare','{vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 '. $image-&gt;file_path.'}'); ?&gt;

The following user(s) said Thank You: [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile"), [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")**
- [![bonzomedia's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1859-bonzomedia "View bonzomedia's Profile") Topic Author
- [ Offline](/forum/user/1859-bonzomedia)

Less More

- Posts: 131
- Thank you received: 7
-
-

13 years 2 months ago [\#121483](#121483) by [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")  Replied by *[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#121483 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

NIcolas

Beautiful! Plug-in gets called and works a treat!

BUT I now realise that the images for each product are not handily stored in a subdirectory but instead are referenced from all of the images of that particular size in the uploads/thumbnails directory. This means that I can't simply point the vsir plugin at a subdirectory.

So, to make it work I have to create a seperate images directory for each of the products that need to use the rotator. I'm using the product_code (which Hikashop forces to be unique) as the directory name and my code checks to see if this directory exists. If it does, the image rotator is called, if not, the normal hikashop single image display is called.

Although it's manageable, ideally it would be really good if hikashop shipped with an image rotator that can be enabled or disable on a per product basis.

If anyone else would like to use the technique I've used, I'm happy to share the code that I implemented in the View -&gt; show_block_img.php

At the top of the file, set up the path (I'm using the [root]/images directory with subdirectories using the same name as the Product Code
Code:

/** * bonzomedia - image rotator path set up */ $rotator_image_path = 'images/'.$this-&gt;element-&gt;main-&gt;product_code; ?&gt;

Further down in show_block_img.php I test to see if the subdirectory exists, if it does I assume that the product images for the rotator have been placed in this directory and call the plug-in. If the directory does not exist I revert back to the standard Hikashop display.
Code:

&lt;div class="hikashop_product_main_image_thumb" id="hikashop_image_main_thumb_div&lt;?php echo $variant_name;?&gt;" &lt;?php echo $style;?&gt; &gt; &lt;div style="&lt;?php if(!empty($divHeight)){ echo 'height:'.($divHeight+20).'px;'; } ?&gt;text-align:center;clear:both;" class="hikashop_product_main_image"&gt; &lt;div style="position:relative;text-align:center;clear:both;&lt;?php if(!empty($divWidth)){ echo 'width:'.$divWidth.'px;'; } ?&gt;margin: auto;" class="hikashop_product_main_image_subdiv"&gt; &lt;?php if (file_exists($rotator_image_path)) echo JHTML::_('content.prepare','{vsir '.$rotator_image_path .'}'); else echo $this-&gt;image-&gt;display(@$image-&gt;file_path,true,@$image-&gt;file_name,'id="hikashop_main_image'.$variant_name.'" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"','id="hikashop_main_image_link"', $width, $height); if(!empty($this-&gt;element-&gt;badges)) $this-&gt;classbadge-&gt;placeBadges($this-&gt;image, $this-&gt;element-&gt;badges, '0', '0'); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile"), [DeeEmm](/forum/user/26410-deeemm "View DeeEmm's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")**
- [![bonzomedia's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1859-bonzomedia "View bonzomedia's Profile") Topic Author
- [ Offline](/forum/user/1859-bonzomedia)

Less More

- Posts: 131
- Thank you received: 7
-
-

13 years 2 months ago [\#122338](#122338) by [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")  Replied by *[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#122338 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

I am continuing to build out the product catalog for this project.

However, I am seeing an issue with a few products whereby the following PHP statement is not obtaining the product code:-
Code:

$rotator_image_path = 'images/'.$this-&gt;element-&gt;main-&gt;product_code;

This is despite the product code being shown in the backend in the product listing, in these circumstances the method is returning NULL.

Am I using the correct method in show_block_img.php to get the product code? Why is it working for some (most) and not others?

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

13 years 2 months ago [\#122402](#122402) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#122402 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

Hi,

"$this-&gt;element-&gt;main" is for accessing to the main product when you have characteristics/variants.
If the product does not have variants/characteristics, so there won't have any "$this-&gt;element-&gt;main" or "$this-&gt;element-&gt;main-&gt;product_code" and you have to get the product_code in the product itself "$this-&gt;element-&gt;product_code".

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")**
- [![bonzomedia's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1859-bonzomedia "View bonzomedia's Profile") Topic Author
- [ Offline](/forum/user/1859-bonzomedia)

Less More

- Posts: 131
- Thank you received: 7
-
-

13 years 2 months ago [\#122423](#122423) by [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")  Replied by *[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#122423 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

Thanks Jerome - that explains it, but seems a little illogical - surely that data element should contain the main product_code irrespective of whether it has variants or not?!

Anyway, looks like I'll need to make a test to see if there are zero or more variants and use the different data elements to build my path.

Is there a function/data element that returns the number of variants for a product?

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")**
- [![bonzomedia's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1859-bonzomedia "View bonzomedia's Profile") Topic Author
- [ Offline](/forum/user/1859-bonzomedia)

Less More

- Posts: 131
- Thank you received: 7
-
-

13 years 2 months ago [\#122429](#122429) by [bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")  Replied by *[bonzomedia](/forum/user/1859-bonzomedia "View bonzomedia's Profile")* on topic *[Image Rotator on Product Page](/forum/32-content-creation/861592-image-rotator-on-product-page#122429 "Hello,  I'm using 2.2.1 on Joomla 2.5  My client has asked me to implement a customisation to the product page that will automatically rotate through the images (with a fade effect) for the product.  I found this plug-in :   www.orware.com/products/very-simple-image-rotator-plugin  Which would appear to be so simple to use with Hikashop, so I installed, enabled it and modified the show&#95;block&#95;img.php to call it with the path to the product images using:-  {vsir randomizeImagesNo directImageLinksNo setDelay 5000 setTransitionDelay 2000 file&#95;path ?&gt;}  However the plug-in never gets called. I am wondering whether this is because the product page does not automatically call content plug-ins with &quot;prepare content&quot;.  I know that I can use system plug-ins as I also use Modules Anywhere, but clearly in this case I need to be able to supply the path to the images for the product.  Is there a solution?  Thanks")*

OK got it!
Code:

sizeof($this-&gt;element-&gt;variants);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODYxNTkyLWltYWdlLXJvdGF0b3Itb24tcHJvZHVjdC1wYWdlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.082 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
