Guest Posted February 4, 2005 Posted February 4, 2005 I've found that my scrolling bets sellers box has stopped working and generating an eror on the page. I've tracked this down to the fact that a product has been sold that is called Anti-Glare Filter 14" - 15" this is causing an error due to the " character. Is there a way that the best sellers box can ignore that character when used in a product title, or some other work around? I have a lot of products that use inches and would take for ever to change them all. This would also create problems when updating products and prices from an import file. Any help would be much apreciated. Thanks
boxtel Posted February 4, 2005 Posted February 4, 2005 I've found that my scrolling bets sellers box has stopped working and generating an eror on the page. I've tracked this down to the fact that a product has been sold that is called Anti-Glare Filter 14" - 15" this is causing an error due to the " character. Is there a way that the best sellers box can ignore that character when used in a product title, or some other work around? I have a lot of products that use inches and would take for ever to change them all. This would also create problems when updating products and prices from an import file. Any help would be much apreciated. Thanks <{POST_SNAPBACK}> depends on how your bestseller box is coded. Normally php has no problems with double quote characters as long as strings are limited by single quotes. $string1 = 'Hello " how are you'; works fine $string2 = "Hello " how are you"; obviously does not. Treasurer MFC
Guest Posted February 7, 2005 Posted February 7, 2005 depends on how your bestseller box is coded. Normally php has no problems with double quote characters as long as strings are limited by single quotes.$string1 = 'Hello " how are you'; works fine $string2 = "Hello " how are you"; obviously does not. <{POST_SNAPBACK}> Well heres my code :) <?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 <= 10){ $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=100 height=100 border=0 src='. 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=125 //marquee height var marqueeheight=155 //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="javascript:bs.stop()" onmouseout="javascript: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 } ?> I wouldnt know how to alter it to be compatable with " Any help would be appreciated
boxtel Posted February 7, 2005 Posted February 7, 2005 Well heres my code :) <?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 <= 10){ $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=100 height=100 border=0 src='. 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=125 //marquee height var marqueeheight=155 //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="javascript:bs.stop()" onmouseout="javascript: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 } ?> I wouldnt know how to alter it to be compatable with " Any help would be appreciated <{POST_SNAPBACK}> and what if you try this : var marqueecontents='<?php echo $bestsellers_list; ?>' instead of this : var marqueecontents="<?php echo $bestsellers_list; ?>" Treasurer MFC
Recommended Posts
Archived
This topic is now archived and is closed to further replies.