Guest Posted July 2, 2004 Posted July 2, 2004 Hi all I am probably doing this wrong but I am not a coder so I can only try things, but this has me beat, right here is the original line this work ok. Original Line: <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td> Here is my line which I have put a buy button in: <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a> . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART). '</td> The bold bit is the bit I have added from product info page :blink: All I am after is a details button instead of the read text and buy button underneath that. Here is a link to my test site for this project: My Webpage I also want a stock status in the box but thats a diff story for now.
♥yesudo Posted July 2, 2004 Posted July 2, 2004 try: <td class="ourtexthere"> echo ($products_description . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART)); </td> Your online success is Paramount.
Guest Posted July 2, 2004 Posted July 2, 2004 Thx for that yesudo but no fix gave me another error, Parse error: parse error, expecting `','' or `';'' in /home/sites/supaosc.com/public_html/supasites/supadownloads/includes/modules/new_products.php on line 72
♥bruyndoncx Posted July 2, 2004 Posted July 2, 2004 In your original file; I think all you are missing is an end 'single quote' character before you start . tep_draw_hidden_field ... so it becomes ' . tep_draw_hidden_field KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
Guest Posted July 2, 2004 Posted July 2, 2004 bruyndoncx, thx but no fix still the same: Parse error: parse error, expecting `','' or `';'' in /home/sites/supaosc.com/public_html/supasites/supadownloads/includes/modules/new_products.php on line 70
Guest Posted July 2, 2004 Posted July 2, 2004 Right I have a button now with this but when I click it no details are taken to the cart. :unsure: <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></td>
Guest Posted July 2, 2004 Posted July 2, 2004 My newest attempt no fix, blooming pain in the ass not knowing enough about stuff. <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a><br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) 'action=buy_now&products_id=' . $new_products['products_id'])) tep_image_submit('button_small_buy_now.gif', IMAGE_BUTTON_BUY_NOW . ': ' . $new_products['products_name']) . '</a></td>
Acheron Posted July 2, 2004 Posted July 2, 2004 I did this kind of quickly so no guarantees it'll work, didn't have time to check it over very well. Anyway, give it a shot: <td class="ourtexthere"><?php echo $products_description . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
Guest Posted July 2, 2004 Posted July 2, 2004 Acheron thx but no joy still getting an error in there somwhere: http://www.supaosc.com/supasites/supadownloads/ Parse error: parse error, expecting `','' or `';'' in /home/sites/supaosc.com/public_html/supasites/supadownloads/includes/modules/new_products.php on line 70
burt Posted July 2, 2004 Posted July 2, 2004 Though the message says that the error is on line 70, this is not always the case. Please post the full contents of the file: /includes/modules/new_products.php for further help.
Guest Posted July 2, 2004 Posted July 2, 2004 yeah I have 2 lines 1 at 70 and 1 at 144 I have restored the original code for 70 to back track a little and line 144 is above code by Acheron, sorry for the confusion but I am trying various things to get it sorted.
Guest Posted July 2, 2004 Posted July 2, 2004 Full file code as requested line 70 is original and works now, parse is where edit is at line 144. <?php $limit = 170; /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select pd.products_id, pd.products_description, 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_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_id, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 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' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser"> <tr> <td> <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td><font size="2"><font color="#000000"><center><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</center></font></b></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td>'; while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } echo ' <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><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). '</a></td> <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a></td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td>' ?> <?php $new_products = tep_db_fetch_array($new_products_query); $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } // if(empty($new_products['products_name'])) // { // exit; // }else{ if (empty($new_products['products_name'])){ echo ' <td width="50%" valign="top"> <table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"></td> <td class="ourtexthere" align="right" width="10%"></td> </tr> </table> </td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } else{ ?> <?php echo ' <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><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). '</a></td> <td class="ourtexthere"><?php echo $products_description . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } } echo '</td> </tr> </table>'; ?> <!-- new_products_eof //--> Thx for the help.
burt Posted July 2, 2004 Posted July 2, 2004 here is one error: line 170, you are already inside the php tag, so you do not need to have more php tags: PORTION OF CODE: ourtexthere"><?php echo $products_description . '<a Should be: <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). '</a></td>' . $products_description . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
Guest Posted July 2, 2004 Posted July 2, 2004 Thx Burt great one, I have me button wahoo, now I have a table problem its basically thrown everything to the wind lol, many thx for the help great stuff, a but further with that anyways.
Guest Posted July 2, 2004 Posted July 2, 2004 Ok closer now thx to Burt, a cut down version of his above code has given me a new button now but it doesnt work also a few minor glitches which I will track down in time but why doesnt it work. <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><font color="red">...Read More</font></a>' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
Guest Posted July 2, 2004 Posted July 2, 2004 Well I am lost I cannot see what to do next I have done all the fixes and no change done burts no change cut burts up a little and I get the page up but link doesnt work so I dono. Here is link to see output. http://www.supaosc.com/supasites/supadownloads/ All help wlcomed and gratefully accepted.
Guest Posted July 2, 2004 Posted July 2, 2004 Subject Closed I have fixed it thx for the help people, for all that want to see the output here is a link: Website: http://www.supaosc.com/supasites/supadownloads/ And here is the code for the whole thing clean osc so use if you dare. <?php $limit = 170; /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select pd.products_id, pd.products_description, 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_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_id, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd 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' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser"> <tr> <td> <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td><font size="2"><font color="#000000"><center><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</center></font></b></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td>'; while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } echo ' <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><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). '</a></td> <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><br><font color="red"><b> More..</b></font></a><br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW). '</a></td> </tr> <tr> <td colspan="2">'. tep_draw_separator('pixel_trans.gif', '100%', '10'). '</td> </tr> </table></td>' ?> <?php $new_products = tep_db_fetch_array($new_products_query); $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } // if(empty($new_products['products_name'])) // { // exit; // }else{ if (empty($new_products['products_name'])){ echo ' <td width="50%" valign="top"> <table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"></td> <td class="ourtexthere" align="right" width="10%"></td> </tr> </table> </td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } else{ ?> <?php echo ' <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><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). '</a></td> <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><br><font color="red"><b> More..</b></font></a><br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW). '</a></td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } } echo '</td> </tr> </table>'; ?> <!-- new_products_eof //--> Hope this helps others, Next job stock availability in here also. :D
burt Posted July 2, 2004 Posted July 2, 2004 I'm kind of at a loss to see what you are trying to do. The code that I sent to you a couple of days back creates a new_products module like this: http://www.seen-online.net/ms2/retro/index.php which as you can see does add to the cart. Why don't you just use the code I sent ? All you then need to do is think about adding in your VAT/Non VAT price.
Guest Posted July 2, 2004 Posted July 2, 2004 I needed a boxes around each product like it is now, your code is great juts didnt go far enough, Thx for you help though much appreciated.
burt Posted July 2, 2004 Posted July 2, 2004 To add a box, is just add 1 line to the stylesheet file: .borderbox { ? border: 1px solid black; } for example... Anyway, no worries, you got it working yourself in the end :)
Guest Posted July 3, 2004 Posted July 3, 2004 Plz note all if you use the code above there is a small bug useing the rand feature to make random products on front also causes the product description to become random also making a description and name mismatch, If anyone can help let me know.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.