Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Please help with scrolling "specials" box!


snowrabbit

Recommended Posts

I found an add-on for scrolling "what is new" box, which I installed and felt quite nice. Just replaced what's new php in includes_boxes with follows:

 

 

<?php 
/* 
 $Id: whats_new.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 distinct products.products_id,products_description.products_name, products.products_image, products.products_tax_class_id, products.products_price from " . TABLE_PRODUCTS . ",products_description where products.products_status = '1' AND language_id = $languages_id AND products_description.products_id = products.products_id order by products_date_added desc limit 10"); 


 if (tep_db_num_rows($whats_new_query) >= 5) { 
?> 
<!-- whats_new_scroll //--> 
         <tr> 
           <td> 
<?php 


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

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


   $rows = 0; 
   $bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">'; 
   while ($whats_new = tep_db_fetch_array($whats_new_query)) { 
     $rows++; 
     $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">';   
     $bestsellers_list .= '</td><td class="infoBoxContents" align="center">'; 
     $bestsellers_list .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whats_new['products_id']) . '">' . $whats_new['products_name'] . '</a><br>'; 
     $bestsellers_list .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whats_new['products_id']) . '">'; 
     $bestsellers_list .= tep_image(DIR_WS_IMAGES . $whats_new['products_image'], $whats_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
     $bestsellers_list .= '<br><br>'; 
     $bestsellers_list .= '</td></tr>'; 
   } 
   $bestsellers_list .= '</table>'; 

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


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

I want do the same for "specials" box. I knew there is scrolling specials box add-on as well, I tried, it wasn't that nice.

 

I post the original specials.php below. Anybody who knows php, please help! Thanks.

 

 

<?php 
/* 
 $Id: specials.php 1739 2007-12-20 00:52:16Z hpdl $ 

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

 Copyright (c) 2003 osCommerce 

 Released under the GNU General Public License 
*/ 

 if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) { 
?> 
<!-- specials //--> 
         <tr> 
           <td> 
<?php 
   $info_box_contents = array(); 
//    $info_box_contents[] = array('text' => BOX_HEADING_SPECIALS); 
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SPECIALS) . '" class="textbox">' . BOX_HEADING_SPECIALS . '</a><br>' ); 

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS)); 

   $info_box_contents = array(); 
   $info_box_contents[] = array('align' => 'center', 
                                'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . 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'])) . '</span>'); 

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...