Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Scrolling New Products with images?


dailce

Recommended Posts

How can I change this contribution to apply to new products?

 

http://www.oscommerce.com/community/contributions,2881/

 

It makes a bestsellers scrolling marquee, I want it to be a new products scrolling marquee.

 

I checked the contributions but couldn't find one for new products.

 

Thanks

 

I did modify the scrolling specials for new products. I am not sure if its the best implementation but it may do what you want. You can check it under the products here:

Scroll new products

 

and the code for whats_new.php in boxes directory:

<?php
 $rp2='';
 $rp_query2 = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);
 $num_rows = tep_db_num_rows($rp_query2);
 if($num_rows) {
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

   new infoBoxHeading($info_box_contents, true, true, tep_href_link(FILENAME_PRODUCTS_NEW));

   $total_products = array();
   while ($random_product = tep_db_fetch_array($rp_query2)) {
     $total_products[count($total_products)] = $random_product;
   }

   while( count($total_products) > 0 ) {
     $random_row = tep_rand(0, ($num_rows - 1));
     $random_product = $total_products[$random_row];

     $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
     $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

     if (tep_not_null($random_product['specials_new_products_price'])) {
       $rp2 .= '<center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '" class="imageFrame">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
    $rp2 .= "</SPAN><BR>\n---------\n";
     }
     else {
       $rp2 .= '<center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '" class="imageFrame">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
       $rp2 .= "<BR>\n---------\n";
     }

     unset($total_products[$random_row]);
     $total_products = array_values($total_products);
     $num_rows--;
   }

   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'center',
                                'text' => '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp2.'</MARQUEE>');

   new infoBox($info_box_contents);

?>
           </td>
         </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

 

I dont remember if there was dependent code other than this its quite sometime since I integrated this. If you have any trouble let me know.

Link to comment
Share on other sites

There is something I forgot in this code:

near the beginning, right after line that reads:

 

if($num_rows) {

 

add this code:

?>
<!-- whats_new //-->
         <tr>
           <td>
<?php

Link to comment
Share on other sites

THANK YOU!

 

I managed to use the bestseller code along with the first part of yours.

 

I think you will find this better.

 

Below I created a smaller folder 'images/img_50x38/' to store smaller images, the files in this folder must have the same name as the products listed.

 

<?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
*/

$whats_new_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);

?>
<!-- best_sellers_scroll //-->
         <tr>
           <td>
<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

   new infoBoxHeading($info_box_contents, false, false);

   $rows = 0;
   $whats_new_list = '<div id="list-menu"><table border="0" width="100%" cellspacing="0" cellpadding="1">';
   while ($whats_new = tep_db_fetch_array($whats_new_query)) {
     $rows++;
     $whats_new_list .= '<tr><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whats_new['products_id']) . '">' .tep_image('images/img_50x38/' . $whats_new['products_image'], $whats_new['products_name']).'<br><br>'. tep_row_number_format($rows) . '.  '. $whats_new['products_name'] . '</a><hr></td></tr>';
   }
   $$whats_new_list .= '</table></div>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$whats_new_list.'</MARQUEE>');

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- best_sellers_scroll_eof //-->

Link to comment
Share on other sites

THIS IS THE CORRECT CODE THERE WAS A TINY ERROR IN THE LAST ONE I POSTED.

 

<?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
*/

$whats_new_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);

?>

<!-- best_sellers_scroll //-->
<tr>
   <td>
 <?php
	 $info_box_contents = array();
	 $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

	 new infoBoxHeading($info_box_contents, false, false);

	 $rows = 0;
	 $whats_new_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
	 while ($whats_new = tep_db_fetch_array($whats_new_query)){
   $rows++;
   $whats_new_list .= '<tr><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whats_new['products_id']) . '">' .tep_image('images/img_50x38/' . $whats_new['products_image'], $whats_new['products_name']).'<br><br>'. tep_row_number_format($rows) . '.  '. $whats_new['products_name'] . '</a><hr></td></tr>';
	 }
	 $whats_new_list .= '</table>';

	 $info_box_contents = array();
	 $info_box_contents[] = array('text' => '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$whats_new_list.'</MARQUEE>');
   new infoBox($info_box_contents);
 ?>
</td>
</tr>

Link to comment
Share on other sites

  • 2 years later...

I know this is an old post, (i've just stumbled across the contrib) but did anyone get this working on IE6 PC?

Works fine everywhere except IE6 - I think it's something to do with the overflow.

I've tried everything that I can think of but nothing fixes this problem:

Product scrolls up and displays in correct window.

In IE6 both divs are showing, therefore 2 products are shown at the same time.

 

http://addons.oscommerce.com/info/5669

SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Link to comment
Share on other sites

I get the same problem in above contrib... Starts with 1 product then scrolls same product, then a new product scrolls and repeats itself again. 2-2-2 pattern. They updated the Scrolling Specials, someone update this one :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...