Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 04-26-2017 02:01:35

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Randomise Splash Featured Product Listing

How can we randomise and auto scroll the splash page featured product listing like the code changing provided for CCP8 at https://forum.kryptronic.com/viewtopic.php?id=30457?

Last edited by sdn (04-26-2017 02:03:31)


Simon

Offline

 

#2 04-26-2017 07:21:46

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Randomise Splash Featured Product Listing

In the file {private}/apps/ecom/ECOM_Prod/ECOM_Prod.php, in the prodlist() function, look for:

Code:

// +--
// | Piece together our SQL statement and execute it.
// +--

if (empty($count))    {$count  = 10;}
if (!(empty($where))) {$sql   .= ' WHERE ' . $where;}

if (!(empty($limitresult))) {

     $result = $this->CORE_DB->sql_do(array('sql'    => $sql,
                                            'table'  => 'ecom_prod',
                                            'order'  => array($sortfield => $sorttype, 'id' => 'ASC'),
                                            'count'  => $limitresult,
                                            'offset' => 0));

Change to:

Code:

// +--
// | Piece together our SQL statement and execute it.
// +--

if (empty($count))    {$count  = 10;}
if (!(empty($where))) {$sql   .= ' WHERE ' . $where;}

if ((!(empty($limitresult))) && (preg_match('/^FEAT/',$callerref))) {

     $result = $this->CORE_DB->sql_do_raw($sql . ' ORDER BY RAND() LIMIT 0,25');

} elseif (!(empty($limitresult))) {

     $result = $this->CORE_DB->sql_do(array('sql'    => $sql,
                                            'table'  => 'ecom_prod',
                                            'order'  => array($sortfield => $sorttype, 'id' => 'ASC'),
                                            'count'  => $limitresult,
                                            'offset' => 0));

Nick Hendler

Offline

 

#3 04-28-2017 02:49:19

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: Randomise Splash Featured Product Listing

Thanks for the code. To autoscroll in CCP8 you said we could do the following but that line is not present in K9 so is there a way to add that feature?

At the bottom of the file {private}/apps/ecom/ECOM/includes/prodlist.php, find:

Code:

Code:

$js_windowload = 'jQuery(\'#' . $wrapid . '\').jshowoff({cssClass: \'' . $class . '\', effect: \'fade\', links: false, autoPlay: false});';

And change the 'false' to 'true' for the autoPlay array key.

Last edited by sdn (04-28-2017 02:55:33)


Simon

Offline

 

#4 04-28-2017 07:32:03

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Randomise Splash Featured Product Listing

Missed the auto-scroll part.  Are you presenting these in a slider display and you automatically want it to advance the slider spot at an interval?  If so, it might be as easy as something like:

setInterval(function () {jQuery('.kslidecontr').click();},3000);

The above simulates a click on the righthand slider arrow every 3 seconds.


Nick Hendler

Offline

 

Board footer