fborille Posted August 24, 2006 Posted August 24, 2006 Hi All, I'm new to the forum, and i'm having some trouble on a OSCommerce 2.2. install with a template. My Buy it now (on index page) do not work, it points to nothing, i tried to search on all codes, but i really can't find it, if someone can point me, it would be great. Another problem is, my shopping cart "if i have something added on it" should display on header how many items, but it never changes from 0. my store is in test mode at http://www.slaveinformatica.com.br/lojavirtual Thanks in advance, Fabio
fborille Posted August 24, 2006 Author Posted August 24, 2006 Anyone ?? still trying to figure what's up with it :/ Fabio
rick-b Posted August 24, 2006 Posted August 24, 2006 Could you paste the code that produces to product list... I think it will be the file /catalog/includes/modules/new_products.php The Coral Room ...store coming soon! 56 contibs added 28 custom creations + additions 6 future contribs 10+ tasks to complete
fborille Posted August 29, 2006 Author Posted August 29, 2006 Sure, here's the code. sorry the delay to post it, but the email notifications was been caught by spam killer :/ Hope it helps. Fabio <?php ?> <!-- new_products //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => '<table width="100%" border="0" cellpadding="0" cellspacing="0" height="24"> <tr> <td><img src="images/left_header.gif" width="4" height="24" alt="" /></td> <td width="100%" style="background-image:url(images/header_bg.gif); color:#FFF; font-weight:bold; padding-left:5px;" align="left">'.TABLE_HEADING_NEW_PRODUCTS.'</td> <td><img src="images/right_header.gif" width="4" height="24" alt="" /></td> </tr> </table>'); new contentBoxHeading($info_box_contents); ?> <div style="border:1px solid #9FA0A6;margin-top:1px; height:333px;"> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 65); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; if ( ($col == 1 && $row == 0) || ($col == 1 && $row == 2) ){ $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'width="1" height="100%" valign="middle"', 'text' => '<table height="" width="100%" border="0" cellspacing="0" cellpadding="0" > <tr> <td><div style="width:1px"></div></td> </tr> </table>'); } elseif (($col == 0 && $row == 1) || ($col == 2 && $row == 1)) { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'height="1"', 'text' => '<table width="90%" border="0" cellspacing="0" cellpadding="0" > <tr> <td style="border-top:1px solid #A7A9AC; font-size:1px;"> </td> </tr> </table>'); } elseif ($col == 1 && $row == 1) { $info_box_contents[$row][$col] = array('align' => '', 'params' => '', 'text' => ' '); } else { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="main" width="235" valign="top" align="center"', 'text' => '<table width="235" cellpadding=0 cellspacing=0 border=0 style="margin:5px 1px 5px 0px;"> <tr> <td colspan="2" class="productName">'.$new_products['products_name'].'</td> </tr> <tr> <td colspan="2" height="1" background="images/points.gif"><img src="images/points.gif" width="3" height="1" /></td> </tr> <tr> <td height="98" rowspan="3"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="absmiddle"') . '</a></td> <td height="65" align="left">'.$description['products_description'].'</td> </tr> <tr> <td height="1" background="images/points.gif"><img src="images/points.gif" width="3" height="1" /></td> </tr> <tr> <td height="32" style="font-size:11px; font-weight:bold;">Price:<span style="color:#C70000; font-size:14px; font-weight:bold;"> ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span></td> </tr> <tr> <td colspan="2" class="main" valign=top align="right" style="padding-right:10px; >'. tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).' <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="padding-top:10px; padding-right:1px;" ><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td><td style="padding-top:10px;">'.tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('button_add_to_cart.gif', IMAGE_BUTTON_BY_NOW).'</td> </tr> </table></form> </td> </tr> </table>'); } $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents, 0); ?> </div> </td> </tr> <!-- new_products_eof //-->
PD_Steve Posted August 29, 2006 Posted August 29, 2006 I don't know if its just me, or its the way templatemonster have coded that, but I don't see a link at all from those buttons. There is no opening anchor to show that those buttons are linking. I could not see it in the direct source either. Very strange. Could you link the header.php also from your includes directory. From the HTML source it looks like '0 items' is hardcoded, but that cannot be true. Would help to see the actual source of that file. Cheers Steve My Toolbox: Crimson Editor, Adobe Photoshop CS2.0, Expression Web, Macromedia Suite 8.0, Cinema 4D, Nvu.
fborille Posted August 29, 2006 Author Posted August 29, 2006 I don't know much of php, but it seems to be just some text wrote there :/ here is the code that u asked for. Fabio <?php // check if the 'install' directory exists, and warn of its existence if (WARN_INSTALL_EXISTENCE == 'true') { if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) { $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning'); } } // check if the configure.php file is writeable if (WARN_CONFIG_WRITEABLE == 'true') { if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) { $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning'); } } // check if the session folder is writeable if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') { if (STORE_SESSIONS == '') { if (!is_dir(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning'); } elseif (!is_writeable(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning'); } } } // check session.auto_start is disabled if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) { if (ini_get('session.auto_start') == '1') { $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning'); } } if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) { if (!is_dir(DIR_FS_DOWNLOAD)) { $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning'); } } if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } ?> <center> <table border="0" cellpadding="0" cellspacing="0" width="693"> <tr> <td width="693" colspan="2" > <table border="0" cellpadding="0" cellspacing="0" width="100%" > <tr> <td width="100%" style="padding:0px 0px 5px 5px; " height="54" align="left" valign="bottom"><?php if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { include(DIR_WS_BOXES . 'languages.php'); } ?></td> </tr> <tr> <td height="91" width="100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td rowspan="2" width="184"><img src="images/logo.gif" width="184" height="91" alt=""></td> <td width="375" height="51" align="left"><div id="topmenu"> <div class="column"> <ul> <li><a href="<?php echo tep_href_link(FILENAME_ABOUT_US) ?>" class="atopmenu">Empresa</a></li> <li><a href="<?php echo tep_href_link(FILENAME_SPECIALS) ?>" class="atopmenu">Promo??es</a></li> <li><a href="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH) ?>" class="atopmenu">Busca Avan?ada</a></li> </ul> </div> <div class="column"> <ul> <li><a href="<?php echo tep_href_link(FILENAME_CREATE_ACCOUNT) ?>" class="atopmenu">Criar uma conta</a></li> <li><a href="<?php echo tep_href_link(FILENAME_LOGIN) ?>" class="atopmenu">Fazer login</a></li> <li><a href="<?php echo tep_href_link(FILENAME_CONTACT_US) ?>" class="atopmenu">Contato</a></li> </ul> </div></div> </td> <td width="134" align="left" valign="middle" height="51" background="images/shopping_bg.gif"><img src="images/shopping_cart_im.gif" width="37" height="37" alt="" align="left" style=" margin:2px 3px 2px 4px;; " /><b>Carrinho</b><br/>no seu carrinho<br/> 0 itens<br/></td> </tr> <tr> <td colspan="2" height="40" width="509"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><a class="menu" style="width:97px; background-image:url(images/home_bg.gif)" href="<?php echo tep_href_link(FILENAME_DEFAULT) ?>"><center>In?cio</center></a></td> <td><a class="menu" href="<?php echo tep_href_link(FILENAME_PRODUCTS_NEW) ?>"><center>Novos Produtos</center></a></td> <td><a class="menu" href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL') ?>"><center>Minha conta</center></a></td> <td><a class="menu" href="<?php echo tep_href_link(FILENAME_SHOPPING_CART) ?>"><center>Carrinho</center></a></td> <td><a class="menu" style="width:106px; background-image:url(images/checkout_bg.gif)" href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') ?>"><center>Finalizar compra</center></a></td> </tr> </table> </td> </tr> <tr> <td width="174" height="110" valign="top" align="left" style="padding-left:10px; padding-top:20px; background-image:url(images/search_bg.jpg) "> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_manufacturers_box(); } else { include(DIR_WS_BOXES . 'manufacturers.php'); }?> <?php require(DIR_WS_BOXES . 'search.php'); ?> </table> </td> <td colspan="2" width="509"><img src="images/main.jpg" width="509" height="130" alt="" /></td> </tr> </table> </td> </tr> <tr> <td style="border-top:1px solid #FFF; border-bottom:2px solid #FFF; font-size:1px; background-color:#777777;" > </td> </tr> </table> </td> <?php if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="headerError"> <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td> </tr> </table> <?php } if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="headerInfo"> <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td> </tr> </table> <?php } ?> </tr> <tr> <td width="693" align="center" colspan="2"> <table border="0" width="693" cellpadding="0" cellspacing="0">
fborille Posted August 31, 2006 Author Posted August 31, 2006 Yea, it's probbably something with this, i put an <a href ... to test but it didn't work ok.. it's on this code: <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="padding-top:10px; padding-right:1px;" ><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">'.tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS).'</a></td> <td style="padding-top:10px;">'.tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('button_add_to_cart.gif', IMAGE_BUTTON_BY_NOW).'</td> </tr> </table></form> </td> </tr> </table> Anyone ???? Fabio
PD_Steve Posted August 31, 2006 Posted August 31, 2006 Yeps, there is no actual link there. You need to do this Find this part in the second listing of code you supplied <td style="padding-top:10px;">'.tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('button_add_to_cart.gif', IMAGE_BUTTON_BY_NOW).'</td> Replace with <td style="padding-top:10px;"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_add_to_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a></td> Cheers Steve My Toolbox: Crimson Editor, Adobe Photoshop CS2.0, Expression Web, Macromedia Suite 8.0, Cinema 4D, Nvu.
fborille Posted August 31, 2006 Author Posted August 31, 2006 Solved! :) REEEEAAALLY THANK YOU :)) Steve!! also the shopping cart itens count is done too, i found that in oscommerce manual. Best regards.. Fabio
clementwong Posted September 2, 2006 Posted September 2, 2006 Hi Fabio, I have the same problem like yours, so how did you solve the cart count problem? Can you share the solution with me please? Clement
Guest Posted September 14, 2006 Posted September 14, 2006 same template, same problem with the shopping cart - fborille please post your solution!!
Guest Posted September 14, 2006 Posted September 14, 2006 same template, same problem with the shopping cart - fborille please post your solution!! by the way, special thanks to PD_Steve for the solution - you rock! :D
Guest Posted September 14, 2006 Posted September 14, 2006 got it - as fabio pointed out, in the manual. in header.php, replace this: <b>Shopping cart</b><br/>now in your cart <br/> 0 items<br/></td> with this: <b>Shopping cart</b><br/>now in your cart <br/> <?php echo $cart-> count_contents() ?> items<br/></td>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.