Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to make a scrolling best seller box?


izack1981

Recommended Posts

Hi.. I have a problem.. I don't know how to make the scrolling bestseller. I have tried the contribution but its not working. Can anyone help me?

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

Just now.. I have been able to put price in the bestseller box..it would be very neat.. if I can display product picture and it scrolls from bottom upwards..anyone? B) :rolleyes:

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

still no clue..I don't know where to start.. :(

any help would be much appreciated. ;)

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

<?php

/*

BestSellers - Vertical Scroll on Internet Explorer

Free module replace by sirarthur

[email protected]

2004

*/

if (isset($current_category_id) && ($current_category_id > 0)) {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);

} else {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);

}

 

if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {

?>

<!-- best_sellers //-->

<tr>

<td>

<?php

//If the user come with a Gecko browser, such as Mozilla, Netscape or FireFox we show him the original version of the list

//Once Gecko browsers can't show the Vertical Scroll

if(stristr($_SERVER['HTTP_USER_AGENT'], "Gecko")){

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

 

new infoBoxHeading($info_box_contents, false, false);

 

$rows = 0;

$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox"><tr><td><table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBoxContents">';

while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {

$rows++;

$bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>';

}

$bestsellers_list .= '</table>';

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $bestsellers_list);

 

new infoBox($info_box_contents);

}else{

//If it's an Internet Explorer or Opera let's show the Vertical Scroll then

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

 

new infoBoxHeading($info_box_contents, false, false);

 

$rows = 0;

$bestsellers_list = '<table border=0 width=100% cellspacing=0 cellpadding=1 class=infoBoxContents>';

while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {

$rows++;

if($rows <= 19){

$imagem = $best_sellers['products_image'];

if($imagem == NULL){

$imagem = "no_image.jpg";

}

//If the product doen's have an image associated and it is on top 3 it will show a "no_image.jpg"

$bestsellers_list .= '<tr class=infoBoxContents align=center>' . tep_row_number_format($rows) . '.<br><a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '><center><img width=150 height=150 border=0 src='. HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . $imagem . '></center><br>' . $best_sellers['products_name'] . '</a><hr></tr>';

}else{

$bestsellers_list .= '<tr class=infoBoxContents>' . tep_row_number_format($rows) . '.<br><a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '>' . $best_sellers['products_name'] . '</a><hr></tr>';

}

}

$bestsellers_list .= '</table>';

?>

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td>

<script language="JavaScript1.2">

//marquee width

var marqueewidth=160

//marquee height

var marqueeheight=320

//marquee scroll speed

var speed=2

//marquee contents

var marqueecontents="<?php echo $bestsellers_list; ?>"

if (document.all)

document.write('<marquee id="bs" direction="up" scrollAmount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'" onmouseover="java script:bs.stop()" onmouseout="java script:bs.start()">'+marqueecontents+'</marquee>')

function regenerate(){

window.location.reload()

}

function regenerate2(){

if (document.layers){

setTimeout("window.onresize=regenerate",450)

twdmarquee()

}

}

function twdmarquee(){

document.cmarquee01.document.cmarquee02.document.write(marqueecontents)

document.cmarquee01.document.cmarquee02.document.close()

thelength=document.cmarquee01.document.cmarquee02.document.height

scrollmarquee()

}

function scrollmarquee(){

if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){

document.cmarquee01.document.cmarquee02.top-=speed

setTimeout("scrollmarquee()",100)

}

else{

document.cmarquee01.document.cmarquee02.top=marqueeheight

scrollmarquee()

}

}

window.onload=regenerate2

</script>

<!-- --><ilayer width=&{marqueewidth}; height=&{marqueeheight};

name="cmarquee01">

<layer name="cmarquee02" width=&{marqueewidth}; height=&{marqueeheight};></layer>

</ilayer><!-- -->

<?php

}

?>

</tr>

</td>

</table>

</td>

</tr>

<!-- best_sellers_eof //-->

<?php

}

?>

Link to comment
Share on other sites

<?php

/*

BestSellers - Vertical Scroll on Internet Explorer

Free module replace by sirarthur

[email protected]

2004

*/

if (isset($current_category_id) && ($current_category_id > 0)) {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);

} else {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);

}

 

if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {

?>

<!-- best_sellers //-->

<tr>

<td>

<?php

//If the user come with a Gecko browser, such as Mozilla, Netscape or FireFox we show him the original version of the list

//Once Gecko browsers can't show the Vertical Scroll

if(stristr($_SERVER['HTTP_USER_AGENT'], "Gecko")){

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

 

new infoBoxHeading($info_box_contents, false, false);

 

$rows = 0;

$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox"><tr><td><table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBoxContents">';

while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {

$rows++;

$bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></td></tr>';

}

$bestsellers_list .= '</table>';

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $bestsellers_list);

 

new infoBox($info_box_contents);

}else{

//If it's an Internet Explorer or Opera let's show the Vertical Scroll then

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

 

new infoBoxHeading($info_box_contents, false, false);

 

$rows = 0;

$bestsellers_list = '<table border=0 width=100% cellspacing=0 cellpadding=1 class=infoBoxContents>';

while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {

$rows++;

if($rows <= 19){

$imagem = $best_sellers['products_image'];

if($imagem == NULL){

$imagem = "no_image.jpg";

}

//If the product doen's have an image associated and it is on top 3 it will show a "no_image.jpg"

$bestsellers_list .= '<tr class=infoBoxContents align=center>' . tep_row_number_format($rows) . '.<br><a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '><center><img width=150 height=150 border=0 src='. HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . $imagem . '></center><br>' . $best_sellers['products_name'] . '</a><hr></tr>';

}else{

$bestsellers_list .= '<tr class=infoBoxContents>' . tep_row_number_format($rows) . '.<br><a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '>' . $best_sellers['products_name'] . '</a><hr></tr>';

}

}

$bestsellers_list .= '</table>';

?>

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td>

<script language="JavaScript1.2">

//marquee width

var marqueewidth=160

//marquee height

var marqueeheight=320

//marquee scroll speed

var speed=2

//marquee contents

var marqueecontents="<?php echo $bestsellers_list; ?>"

if (document.all)

document.write('<marquee id="bs" direction="up" scrollAmount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'" onmouseover="java script:bs.stop()" onmouseout="java script:bs.start()">'+marqueecontents+'</marquee>')

function regenerate(){

window.location.reload()

}

function regenerate2(){

if (document.layers){

setTimeout("window.onresize=regenerate",450)

twdmarquee()

}

}

function twdmarquee(){

document.cmarquee01.document.cmarquee02.document.write(marqueecontents)

document.cmarquee01.document.cmarquee02.document.close()

thelength=document.cmarquee01.document.cmarquee02.document.height

scrollmarquee()

}

function scrollmarquee(){

if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){

document.cmarquee01.document.cmarquee02.top-=speed

setTimeout("scrollmarquee()",100)

}

else{

document.cmarquee01.document.cmarquee02.top=marqueeheight

scrollmarquee()

}

}

window.onload=regenerate2

</script>

<!-- --><ilayer width=&{marqueewidth}; height=&{marqueeheight};

name="cmarquee01">

<layer name="cmarquee02" width=&{marqueewidth}; height=&{marqueeheight};></layer>

</ilayer><!-- -->

<?php

}

?>

</tr>

</td>

</table>

</td>

</tr>

<!-- best_sellers_eof //-->

<?php

}

?>

 

Thanks .. I'll give it a try :rolleyes:

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

I have tried that code vanhoangthang. It only works on I.E. I have seen the best seller scroll in action (both in I.E and firefox) somewhere. I will paste the link here later :rolleyes:

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

Hello,

IT may sounds stupid? But can you tell me where to paste the code to?

Thanks.

I am also trying what you are trying.

but i know very little about the codes things. :lol:

 

Whenever i download the contributions, i do not know what to do................lol

 

Please help me. Tks.

 

Rachal

Link to comment
Share on other sites

Hello,

IT may sounds stupid? But can you tell me where to paste the code to?

Thanks.

I am also trying what you are trying.

but i know very little about the codes things. :lol:

 

Whenever i download the contributions, i do not know what to do................lol

 

Please help me. Tks.

 

Rachal

 

Dear Rachal,

 

Copy the code to catalog/includes/boxes/best_sellers.php

 

By the way.. Here is the link to the scrolling best seller box with image in action. It works great both on I.E and Firefox. Can anyone point me to that contribution? Thanks a lot for help :)

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...