Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Enhanced BestSeller box with admin


Guest

Recommended Posts

  • Replies 55
  • Created
  • Last Reply

Ok I feel silly asking this...

 

but I see you said:

Ok heres a version for use with the STS Template System.

 

If you haven't got STS then don't use this version.

 

Well I have not added any STS contribution, but I noticed a while and ..just double cheched in my /catalog/includes folder I have files called sts_xxxxx etc .... several of them ...even one called sts_template

 

........so I guess I have STS Template Stystem.........?

 

I am running latest version of osC Milestone 2

Link to comment
Share on other sites

  • 2 weeks later...

Just wondering I installed this and it displays the full sized images in the box, and therefore you only see the very corner of the image. I also had a question about this line

 

Step 5:
Add the following line to /catalog/admin/includes/boxes/catalog.php, right before the line that contains <a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 
ADD:
'<a href="' . tep_href_link(FILENAME_BESTSELLERS2, '', 'NONSSL') . '" class="menuBoxContentLink">' . 'Best Sellers' . '</a><br>' .

We I did the above step it worked fine, now in the later contribs there is a different readme file:

 

Step 5:
Add the following line to /catalog/admin/includes/boxes/catalog.php, right before the line that contains 
<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 


#ADD:
'<a href="' . tep_href_link(FILENAME_BESTSELLERS2, '', 'NONSSL') . '" class="menuBoxContentLink">' . 'Best Sellers' . '</a><br>');

##Also, be sure to replace:

<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 

##With:

<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' .

 

When I do it this way I get a parse error

Link to comment
Share on other sites

  • 2 weeks later...
Just wondering I installed this and it displays the full sized images in the box, and therefore you only see the very corner of the image.  I also had a question about this line

 

Step 5:
Add the following line to /catalog/admin/includes/boxes/catalog.php, right before the line that contains <a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 
ADD:
'<a href="' . tep_href_link(FILENAME_BESTSELLERS2, '', 'NONSSL') . '" class="menuBoxContentLink">' . 'Best Sellers' . '</a><br>' .

We I did the above step it worked fine, now in the later contribs there is a different readme file:

 

Step 5:
Add the following line to /catalog/admin/includes/boxes/catalog.php, right before the line that contains 
<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 
#ADD:
'<a href="' . tep_href_link(FILENAME_BESTSELLERS2, '', 'NONSSL') . '" class="menuBoxContentLink">' . 'Best Sellers' . '</a><br>');

##Also, be sure to replace:

<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); 

##With:

<a href="'. tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' .

 

When I do it this way I get a parse error

 

Make sure that the last line in that block of code ends in

 '</a>');

and that the other lines above end in

 '</a>' .

 

That should solve the parse error

Link to comment
Share on other sites

  • 1 month later...

Hey fred,

 

I want to know if this contribbutiion can be modified so that it will work with mozilla browers. I am not a coder, but would like to know if its possible, and how long it would take?

 

Thanks

Danny

Link to comment
Share on other sites

Sorry computerwiz,

 

I'm not a coder myself, I just got this contribution to work with sts and started the forum topic for the contribution. You'd be better asking the guy who wrote the origional contribution. Sorry I can't help you out.

 

Hey fred,

 

I want to know if this contribbutiion can be modified so that it will work with mozilla browers. I am not a coder, but would like to know if its possible, and how long it would take?

 

Thanks

Danny

Link to comment
Share on other sites

  • 2 weeks later...

Hi Fred,

 

I installed the contribution and have the same problem as Jason (above) does:

 

I installed this and it displays the full sized images in the box, and therefore you only see the very corner of the image.

 

Where did I go wrong?

 

Also is it possible to speed up the images?

 

Many Thanks,

 

Taosan.

Link to comment
Share on other sites

Hi Lee,

 

Yesterday, I've got a couple of other contributions installed, maybe this makes the error....who knows..

 

Hi Andreas,

 

I think I might found our problem... Did you also have contribution big_images 1.25 - 2.2MS2.zip By Author: Jan Skopek installed before you install Bestsellers admin????

 

I know, I did.......if you also have big_images 1.25 - 2.2MS2.zip then that is our bottle-neck for sure.

 

Lee.

Link to comment
Share on other sites

  • 2 weeks later...

i fix this problem(big image)

 

orignal code in catalog/includes/boxs/bestseller2.php

    while ($best_sellers = tep_db_fetch_array($bestseller_products_query)) {
     $rows++;
     $info_box_contents[] = array('align' => 'center',
                                  'text'  => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name') . '</a><br>' .  ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id'], 'NONSSL') . '">' . $best_sellers['products_name'] . '</a><b><br>' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'] . '</b>')));
   }

 

changed:

    while ($best_sellers = tep_db_fetch_array($bestseller_products_query)) {
     $rows++;
     $info_box_contents[] = array('align' => 'center',
                                  'text'  => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>' .  ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id'], 'NONSSL') . '">' . $best_sellers['products_name'] . '</a><b><br>' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'] . '</b>')));
   }

 

add the SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT in query

then fix the problem.

 

but i have other problem. i don't know why the bestseller box only display one item.i already set 5 item in admin page.

 

who can help me.

thx^^

Link to comment
Share on other sites

Hi Andreas,

 

I think that no one can tell us why the image display full size.  Have you found another substitute for this contribution? If so, which one are you gonna to install?

 

Lee.

 

Hi Lee

 

Yeah, you might have right! Unfortunately I didn't find any substitute yet. So I have to be happy with the standard one!

 

Andreas

Link to comment
Share on other sites

Hi Andreas,

 

I think that no one can tell us why the image display full size.  Have you found another substitute for this contribution? If so, which one are you gonna to install?

 

Lee.

 

hey Lee,

 

I just seen this:

 

i fix this problem(big image)

 

orignal code in catalog/includes/boxs/bestseller2.php

CODE while ($best_sellers = tep_db_fetch_array($bestseller_products_query)) {

$rows++;

$info_box_contents[] = array('align' => 'center',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name') . '</a><br>' . ' <a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id], 'NONSSL') . '">' . $best_sellers['products_name'] . '</a><b><br>' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'] . '</b>')));

}

 

changed:

CODE while ($best_sellers = tep_db_fetch_array($bestseller_products_query)) {

$rows++;

$info_box_contents[] = array('align' => 'center',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>' . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id'], 'NONSSL') . '">' . $best_sellers['products_name'] . '</a><b><br>' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'] . '</b>')));

}

 

add the SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT in query

then fix the problem.

 

but i have other problem. i don't know why the bestseller box only display one item.i already set 5 item in admin page.

 

who can help me.

thx^^

Link to comment
Share on other sites

  • 6 months later...

I am having trouble with firefox, A coder tied to help me, he got it to work but something happened, its not displying anymore, heres the code:

 

<?php
/*
 $Id: best_sellers.php,v 1.21 2003/06/09 22:07:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// BOF Enable - Disable Categories Contribution--------------------------------------
/*
 if (isset($current_category_id) && ($current_category_id > 0)) {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name 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 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 (isset($current_category_id) && ($current_category_id > 0)) {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_tax_class_id, p.products_price, p.products_retail_price, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and c.categories_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, p.products_tax_class_id, p.products_price, p.products_retail_price, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c  where p.products_status = '1' and c.categories_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);
 }
// EOF Enable - Disable Categories Contribution--------------------------------------

 if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
?>
<!-- best_sellers //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

new infoBoxHeading($info_box_contents, false, false);



$bestsellers_list = <<< End_of_Quote
<script language="JavaScript1.2" type="text/javascript">

/*
Up down slideshow Script
By Dynamic Drive (www.dynamicdrive.com)
For full source code, terms of use, and 100's more scripts, visit http://www.dynamicdrive.com
*/

///////configure the below four variables to change the style of the slider///////
//set the scrollerwidth and scrollerheight to the width/height of the LARGEST image in your slideshow!
var scrollerwidth='156px'
var scrollerheight='256px'
//3000 miliseconds=3 seconds
var pausebetweenimages=3000

//configure the below variable to change the images used in the slideshow. If you wish the images to be clickable, simply wrap the images with the appropriate <a> tag
var slideimages=new Array();

End_of_Quote;

 $rows = 0;
while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
  $src = DIR_WS_IMAGES . $best_sellers['products_image'];
  $max_length=250;


  if ($image_size = @getimagesize($src)) {
	if ($image_size[0] >= $image_size[1] && $image_size[0] >= $max_length) {
	  // shrink width
	  $width = $max_length;
	  $ratio = $width / $image_size[0];
	  $height = $image_size[1] * $ratio;
	} elseif ($image_size[1] > $image_size[0] && $image_size[1] >= $max_length) {
	  // shrink height
	  $height = $max_length;
	  $ratio = $max_length / $image_size[1];
	  $width = $image_size[0] * $ratio;
	} else {
	  $width = $image_size[0];
	  $height = $image_size[1];
	}
  }

  if (($best_sellers['products_retail_price'] != 0)) {
	$retail_price = $currencies->display_price($best_sellers['products_retail_price'], tep_get_tax_rate($best_sellers['products_tax_class_id']));
	$retail = '<br /><style="main"><s> Retail: ' . $retail_price . '</s>';
	$saving_price = $best_sellers['products_retail_price'] - $best_sellers['products_price'];
	$saving = '<br /><style="main"><font color="#ff0000"> Save: ' . $currencies->display_price($saving_price, tep_get_tax_rate($best_sellers['products_tax_class_id'])) . '</font>'; 


  } else {
	$retail = '<br />';
  }




  $bestsellers_list .= 'slideimages[' . $rows . ']=\'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers["products_id"], 'NONSSL') . '"><img border="0" src="' . tep_output_string($src) .'" alt="'. $best_sellers['products_name'] .'" width="'.$width.'" height="'.$height.'"><br>' . $best_sellers['products_name'] . '</a>' . $retail . $saving . '<b><br> Price: ' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'])) . '</b>'.'\';'."\n";
  $rows++;


}

$bestsellers_list .= <<< End_of_Quote
//extend this list

///////Do not edit pass this line///////////////////////

var ie=document.all
var dom=document.getElementById

if (slideimages.length>2)
i=2
else
i=0

function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2_obj)",pausebetweenimages)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2_obj)",pausebetweenimages)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}

function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById("first2")
second2_obj=ie? second2 : document.getElementById("second2")
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}

window.onload=startscroll

</script>


<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; visibility=hide>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2" type="text/javascript">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[dyndetermine=(slideimages.length==1)? 0 : 1])
</script>
</layer>
</ilayer>

<script language="JavaScript1.2" type="text/javascript">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;text-align:center;">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')
document.write(slideimages[dyndetermine=(slideimages.length==1)? 0 : 1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>
End_of_Quote;

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

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- best_sellers_eof //-->
<?php
 }
?>

Link to comment
Share on other sites

  • 2 weeks later...

hi,

my bestseller admin link under catalog box for adding the bestsellers doesnt show up.

i have bts installed, this is my catalog box link for bestseller:

tep_admin_files_boxes(FILENAME_BESTSELLERS2, BOX_CATALOG_BESTSELLERS2) .

help appreciated, thanks.

Link to comment
Share on other sites

  • 2 months later...

any ideas how to make this box scroll horizontally into an infobox?

i tried using marquee direction=left instead of "up", but this made all products scroll together in a long infobox one under the other instead of one next to the other.

thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...