Jump to content
Bobber

BS Slick Image Gallery Question - 2.3.4.1 CE Compatible Image Gallery Module for Product Info

Recommended Posts

For all who are looking to change their gallery in 2.3.4.1 CE I would definitely suggest this add-on by @wHiTeHaT https://apps.oscommerce.com/6V87X&bs-slick-image-gallery

The formatting is clean and orderly... very nicely done!

I do have a question I hope someone can help with...

How do I change this add-on so it Does Not display the "main image"...

This way it would only display the "Large Images" as the standard gallery does by default in 2.3.4.1 CE?

I know changes need to be made in: /includes/modules/content/product_info/cm_pi_slick.php

I am just not having any luck with this change...

Thank you in advance for your help!

Share this post


Link to post
Share on other sites
1 hour ago, Bobber said:

Do you have any ideas @oscoMMarket?

 

 

Apparently this is the solution:

Just replace:
 

		$slicks[] = array('image' => $product_info['products_image'],
		                  'htmlcontent' => null
		);

with:
 

		$slicks[] = '';

on line 42


Let's make things easier for new osCommerce users http://forums.oscommerce.com/topic/402638-discussion-about-hard-coded-database-tables/?p=1718900  Getting there with osCommerce 2.4! :thumbsup:

Share this post


Link to post
Share on other sites
39 minutes ago, frankl said:

 

Apparently this is the solution:

Just replace:
 


		$slicks[] = array('image' => $product_info['products_image'],
		                  'htmlcontent' => null
		);

with:
 


		$slicks[] = '';

on line 42

Thank you for the help @frankl!

This results in:

Quote

Warning: Illegal string offset '' in /home/public_html/includes/modules/content/product_info/cm_pi_slick.php on line 54

Warning: Illegal string offset '' in /home/public_html/includes/modules/content/product_info/cm_pi_slick.php on line 57

Warning: Illegal string offset '' in /home/public_html/includes/modules/content/product_info/cm_pi_slick.php on line 66

 

Share this post


Link to post
Share on other sites

In that case try this:

Replace:
 

		$slicks[] = array('image' => $product_info['products_image'],
		                  'htmlcontent' => null
		);

with:
 

		$slicks[] = array();

on line 42


Let's make things easier for new osCommerce users http://forums.oscommerce.com/topic/402638-discussion-about-hard-coded-database-tables/?p=1718900  Getting there with osCommerce 2.4! :thumbsup:

Share this post


Link to post
Share on other sites
17 minutes ago, frankl said:

In that case try this:

Replace:
 


		$slicks[] = array('image' => $product_info['products_image'],
		                  'htmlcontent' => null
		);

with:
 


		$slicks[] = array();

on line 42

Thank you for the help @frankl!

This results in:

Quote

Parse error: syntax error, unexpected '$Qslick' (T_VARIABLE) in /home/public_html/includes/modules/content/product_info/cm_pi_slick.php on line 43

This add-on is a great update... displaying the "main image" really stinks 😕

Attached #1 is the default add-on... ( displays the "main image"... ).

Attached #2 is based off your suggestion with:

Quote

$slicks[] = array('' => null
        );

Attached #3 is what I am working towards 🙂

Capture.JPG

Capture2.JPG

Capture3.JPG

Edited by Bobber

Share this post


Link to post
Share on other sites
7 minutes ago, clustersolutions said:

@Bobber , I hope no one minds me tell you this. @oscoMMarket had shared with me that his posts are being moderated from this point forward. So, I think be patience and if he had responded it may take a while for it to become available.

Thank you @clustersolutions!

I have sent him a message...

Share this post


Link to post
Share on other sites

I haven't played with this addon, I'm merely relaying a message.

What happens if you comment out that line entirely?

 


Let's make things easier for new osCommerce users http://forums.oscommerce.com/topic/402638-discussion-about-hard-coded-database-tables/?p=1718900  Getting there with osCommerce 2.4! :thumbsup:

Share this post


Link to post
Share on other sites

Ah...hello...you can't have such associative array...

 

21 minutes ago, Bobber said:

$slicks[] = array('' => null
        ); 

 

This is ok.

$slicks = []; 

 

This append to the array..

$slicks[] = [];

 

I would just comment out those lines and see what happens. Yeah, I took one look at the stock image gallery and went to bxslider and never looked back...

 

 

Share this post


Link to post
Share on other sites

I want to Very Much Thank:

@frankl

@clustersolutions

@oscoMMarket

Below is the complete code solution... should anyone else ever need this solution in the future:

<?php
/*
  osCompose, E-Commerce Solutions
  https://oscompose.com

  Copyright (c) 2018 osCompose
  Contact: Henry Withoot
  Email: osc2nuke@gmail.com
*/

  class cm_pi_slick {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_PI_SLICK_TITLE;
      $this->description = MODULE_CONTENT_PI_SLICK_DESCRIPTION;
      $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>';

      if ( defined('MODULE_CONTENT_PI_SLICK_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_PI_SLICK_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_PI_SLICK_STATUS == 'True');
      }
    }

	function execute() {
		global $oscTemplate, $product_info;

		$content_width = (int)MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH;		
		$slick_width = (int)MODULE_CONTENT_PI_SLICK_WIDTH;		
		
		$output = null;
		if (tep_not_null($product_info['products_image'])) {
		
$slicks = [];

			$Qslick = tep_db_query("select image, htmlcontent from products_images where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
			while($Qresult = tep_db_fetch_array($Qslick)){
				$slicks[] = $Qresult;
			}
			
			$output .= '<div class="col-sm-'.$slick_width.'">';  
			
			$output .= '	<section class="slider-for slider">';
			//Main images and htmlcontent
			foreach($slicks as $slick){
				if(tep_not_null($slick['htmlcontent'])){
					$output .= '		<div class="item"><div class="embed-container"><iframe src="'.$slick['htmlcontent'].'" frameborder="0" allowfullscreen></iframe></div></div>';
				}else{
					$output .= '		<div class="item">'. tep_image('images/' . $slick['image'], htmlspecialchars($product_info['products_name']), '', '').'</div>';					
				}
			}
			$output .= '	</section>';	
			
			//thumbnails
			$output .= '	<div class="col-sm-10 col-sm-push-1">';
			$output .= '		<section class="slider-nav slider">';
			foreach($slicks as $slick){
				$output .= '			<div class="thumbnail">'. tep_image('images/' . $slick['image'], htmlspecialchars($product_info['products_name']), '', '').'</div>';
			}
			$output .= '		</section>';
			$output .= '	</div>';
			
			$output .= '</div>';	
		}		
		
		ob_start();
        include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
		$template = ob_get_clean();

		$oscTemplate->addContent($template, $this->group);
	}

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_CONTENT_PI_SLICK_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Slick Gallery', 'MODULE_CONTENT_PI_SLICK_STATUS', 'True', 'Should this module be shown on the product info page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH', '4', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gallery Width', 'MODULE_CONTENT_PI_SLICK_WIDTH', '12', 'The width of the gallery itself?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PI_SLICK_SORT_ORDER', '65', 'Sort order of display. Lowest is displayed first.', '6', '3', now())");
   }

    function remove() {
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_CONTENT_PI_SLICK_STATUS', 'MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH', 'MODULE_CONTENT_PI_SLICK_WIDTH', 'MODULE_CONTENT_PI_SLICK_SORT_ORDER');
    }
  }
  

I have tested this on 2.3.4.1 CE and it worked perfectly for me 🙂

Share this post


Link to post
Share on other sites
On 8/2/2018 at 4:04 AM, Bobber said:

I want to Very Much Thank:

@frankl

@clustersolutions

@oscoMMarket

Below is the complete code solution... should anyone else ever need this solution in the future:


<?php
/*
  osCompose, E-Commerce Solutions
  https://oscompose.com

  Copyright (c) 2018 osCompose
  Contact: Henry Withoot
  Email: osc2nuke@gmail.com
*/

  class cm_pi_slick {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_PI_SLICK_TITLE;
      $this->description = MODULE_CONTENT_PI_SLICK_DESCRIPTION;
      $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>';

      if ( defined('MODULE_CONTENT_PI_SLICK_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_PI_SLICK_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_PI_SLICK_STATUS == 'True');
      }
    }

	function execute() {
		global $oscTemplate, $product_info;

		$content_width = (int)MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH;		
		$slick_width = (int)MODULE_CONTENT_PI_SLICK_WIDTH;		
		
		$output = null;
		if (tep_not_null($product_info['products_image'])) {
		
$slicks = [];

			$Qslick = tep_db_query("select image, htmlcontent from products_images where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
			while($Qresult = tep_db_fetch_array($Qslick)){
				$slicks[] = $Qresult;
			}
			
			$output .= '<div class="col-sm-'.$slick_width.'">';  
			
			$output .= '	<section class="slider-for slider">';
			//Main images and htmlcontent
			foreach($slicks as $slick){
				if(tep_not_null($slick['htmlcontent'])){
					$output .= '		<div class="item"><div class="embed-container"><iframe src="'.$slick['htmlcontent'].'" frameborder="0" allowfullscreen></iframe></div></div>';
				}else{
					$output .= '		<div class="item">'. tep_image('images/' . $slick['image'], htmlspecialchars($product_info['products_name']), '', '').'</div>';					
				}
			}
			$output .= '	</section>';	
			
			//thumbnails
			$output .= '	<div class="col-sm-10 col-sm-push-1">';
			$output .= '		<section class="slider-nav slider">';
			foreach($slicks as $slick){
				$output .= '			<div class="thumbnail">'. tep_image('images/' . $slick['image'], htmlspecialchars($product_info['products_name']), '', '').'</div>';
			}
			$output .= '		</section>';
			$output .= '	</div>';
			
			$output .= '</div>';	
		}		
		
		ob_start();
        include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
		$template = ob_get_clean();

		$oscTemplate->addContent($template, $this->group);
	}

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_CONTENT_PI_SLICK_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Slick Gallery', 'MODULE_CONTENT_PI_SLICK_STATUS', 'True', 'Should this module be shown on the product info page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH', '4', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gallery Width', 'MODULE_CONTENT_PI_SLICK_WIDTH', '12', 'The width of the gallery itself?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PI_SLICK_SORT_ORDER', '65', 'Sort order of display. Lowest is displayed first.', '6', '3', now())");
   }

    function remove() {
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_CONTENT_PI_SLICK_STATUS', 'MODULE_CONTENT_PI_SLICK_CONTENT_WIDTH', 'MODULE_CONTENT_PI_SLICK_WIDTH', 'MODULE_CONTENT_PI_SLICK_SORT_ORDER');
    }
  }
  

I have tested this on 2.3.4.1 CE and it worked perfectly for me 🙂

Does this require any thumbnailer plugin like kissitthumbnailer? 

Share this post


Link to post
Share on other sites
On 4/3/2019 at 4:37 AM, vampirehunter said:

Does this require any thumbnailer plugin like kissitthumbnailer? 

No it does not...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×