Slider for images on product page

  • Posts: 162
  • Thank you received: 0
8 years 4 months ago #222719

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.4

Hi,

is there any way I can change the images pop-up effect on product page to a slider?

thanks!

Last edit: 8 years 4 months ago by info@vesica.org.

Please Log in or Create an account to join the conversation.

  • Posts: 81508
  • Thank you received: 13064
  • MODERATOR
8 years 4 months ago #222720

Hi,

I'm not sure what you mean by a slider ?
Something like that ? :
www.magictoolbox.com/magicscroll/modules/hikashop/

Please Log in or Create an account to join the conversation.

  • Posts: 162
  • Thank you received: 0
8 years 4 months ago #222798

Hi,

yes, but I would like this to work on the product page images and not in a module assigned to a page.

On the product page when you click on a thumbnail, the big image will change. I want the big image to change inside a slider and remove the thumbnails entirely if possible.

thanks!

Last edit: 8 years 4 months ago by info@vesica.org.

Please Log in or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
8 years 4 months ago #222799

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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: info@vesica.org

Please Log in or Create an account to join the conversation.

  • Posts: 162
  • Thank you received: 0
8 years 4 months ago #222952

Hi,

that is a good solution also, but I'm more interested to slide the images if it's possible. Please see attached screenshot

thanks!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81508
  • Thank you received: 13064
  • MODERATOR
8 years 4 months ago #222971

Hi,

I don't know of a ready made solution for that.

Please Log in or Create an account to join the conversation.

  • Posts: 162
  • Thank you received: 0
8 years 4 months ago #223111

Hi,

OK. It would be great in a future version of Hikashop if you can allow users to change effects on this page(product page), specially for this images. For example we need the images to slide on smartphones since it's easier to see them. The thumbnails are to small on smartphones as they are, if I make them bigger there are no longer thumbnails.

thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 81508
  • Thank you received: 13064
  • MODERATOR
8 years 4 months ago #223115

Hi,

Well, there already exist solutions which change the display of the images on the product page, like some of the magictoolbox extensions for HikaShop.
And if you want to adapt the size of the images based on the size of the screen, it's possible with some simple CSS code you can add on your website using @media CSS queries.

Please Log in or Create an account to join the conversation.

  • Posts: 223
  • Thank you received: 26
  • Hikashop Business
3 years 3 months ago #328439

Hi,
I have a solution for this, but this is in BETA :silly: . Why? Cuz it can be better, maybe hikashop is gonna help us to improve this solution.

So, what you have to do is to go in administrator, Hikashop > Views , and edit "show_block_img.php" that is currently used by your template.
In "show_block_img.php" you delete everything.
Just copy and paste the next lines to "show_block_img.php"

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2020 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<div class="slideshow-container">
    <?php
    $dotscounter = 0;
    if (!empty($this->element->images) && count($this->element->images) >= 1) {
        $height = (int) $this->config->get('product_image_y');
        $width = (int) $this->config->get('product_image_x');
        foreach ($this->element->images as $image) {
            $image_options = array('default' => true, 'forcesize' => $this->config->get('image_force_size', true), 'scale' => $this->config->get('image_scale_mode', 'inside'));
            $img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
            $dotscounter++; {
                ?>
                <div class="mySlides">
                    <img src="<?php echo $img->url; ?>">
                </div>
                <?php
            }
        }
    }
    ?>
    <a class="slide-prev" onclick="plusSlides(-1)">❮</a>
    <a class="slide-next" onclick="plusSlides(1)">❯</a>
</div>
<div class="slide-dot-control">
    <?php for ($i = 0; $i < $dotscounter; $i++) { ?>
        <span class="slide-dot" onclick="currentSlide(<?php echo $i; ?>)"></span>
    <?php } ?>
</div>

<script>
    var slideIndex = 0;
    function showSlides() {
        var slides = document.getElementsByClassName("mySlides");
        if (slideIndex > (slides.length - 1)) {
            slideIndex = 0;
        }
        if (slideIndex < 0) {
            slideIndex = (slides.length - 1);
        }
        for (var i = 0; i < slides.length; i++) {
            slides[i].style.display = "none";
        }
        slides[slideIndex].style.display = "block";
        var dots = document.getElementsByClassName("slide-dot");
        for (var i = 0; i < dots.length; i++) {
            dots[i].className = dots[i].className.replace(" slide-dot-active", "");
        }
        dots[slideIndex].className += " slide-dot-active";
    }
    function plusSlides(n) {
        slideIndex += n;
        showSlides();
    }
    function currentSlide(n) {
        slideIndex = n;
        showSlides();
    }
    window.onload = showSlides;
</script>
Save and close. Now, paste the next code to your .css file
.mySlides {
	display: none;
	height: 100%;
	font-family: Arial,Helvetica,sans-serif;
}
.mySlides img {
	width: 100%;
	height: 100%;
}
.slideshow-container {
	overflow: hidden;
	position: relative;
	margin: auto;
	width: 250px;
	height: 400px;
}
.slide-prev, .slide-next {
	cursor: pointer;
	position: absolute;
	top: 50%;
	width: auto;
	padding: 16px;
	margin-top: -22px;
	color: white;
	font-weight: bold;
	font-size: 18px;
	transition: 0.6s ease;
	border-radius: 0 3px 3px 0;
}
.slide-next {
	right: 0;
	border-radius: 3px 0 0 3px;
}
.slide-prev:hover, .slide-next:hover {
	background-color: rgba(0,0,0,0.8);
}
.slide-dot-control {
	text-align: center;
	margin-top: 10px;
}
.slide-dot {
	cursor:pointer;
	height: 13px;
	width: 13px;
	margin: 0 2px;
	background-color: #bbb;
	border-radius: 50%;
	display: inline-block;
	transition: background-color 0.6s ease;
}
.slide-dot-active, .slide-dot:hover {
	background-color: #717171;
}

Attachments:
Last edit: 3 years 2 months ago by oxido. Reason: Fix for image slider - If there was more then 1 image, when the page was loaded, the slider was setting the last image as the active one, and not the first image from the slider.
The following user(s) said Thank You: Philip

Please Log in or Create an account to join the conversation.

  • Posts: 4508
  • Thank you received: 610
  • MODERATOR
3 years 2 months ago #328463

Hello,

Thanks all for your support, your returns and code suggestion are really relevant and appreciated !
All of this, will allow us quite soon to provide a new feature for our future release...
;)

Thanks all for this discussion.
Regards

Last edit: 3 years 2 months ago by Philip.
The following user(s) said Thank You: oxido

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum