amandakirk24 Posted June 1, 2015 Share Posted June 1, 2015 I was wondering if there is anything that will note favorite products or like them? I've found some older add ons but nothing much. Quote Link to comment Share on other sites More sharing options...
burt Posted June 1, 2015 Share Posted June 1, 2015 You should explain more what it is that you need. You should also always state which version of osCommerce you use. Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 1, 2015 Author Share Posted June 1, 2015 (edited) I have version 2.3.4. I found an add on that is a couple of years old called Facebook Like Button on products listing and new products. There doesn't seem to be an updated version of this one. Some of the files appear to be a bit out dated. I don't know the difference between the version 2.2rc2a this was using and the one I have. The instructions say to add a script to /head of /catalog/index.php. I can't seem to find it. Edited June 1, 2015 by amandakirk24 Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 in includes\template_top.php, find: Â </head> Â and place this above it: Â <script>(function(d, s, id) { Â var js, fjs = d.getElementsByTagName(s)[0]; Â if (d.getElementById(id)) return; Â js = d.createElement(s); js.id = id; Â js.src = "//connect.facebook.net/pt_PT/all.js#xfbml=1"; Â fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Â Then you will be able to place the code for the like button wherever you want it. Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 1, 2015 Author Share Posted June 1, 2015 (edited) Alright, thank you. The code in the example for placing the like button on the product info page would be the same code I would use for the placing it in the product listing page? It says to modify www.your_web_site.com with your real web site.... Where would I find the website address to my website coming from my local host local host? I'm running a little low on sleep. Edited June 1, 2015 by amandakirk24 Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 (edited) That should simply be your domain name. Yes, the code appears to be the same for product listing and new_products.php Edited June 1, 2015 by Hotclutch Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 1, 2015 Author Share Posted June 1, 2015 Hmm I added the code to the template header and to new product, nothing showed up. Â My code:Â Â Â Â Â Â $new_prods_content .= '<td width="33%" align="center" valign="top"><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><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>'; Â Add on: <br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a> Â Replace with: Â <br><div style="margin-left:20px;margin-top:10px;margin-bottom:10px;"><div class="fb-like" data-href="http://www.your_web_site.com'.'>http://www.your_web_site.com'. $_SERVER['PHP_SELF']."?products_id=".$new_products['products_id'] . '" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false"></div></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a> Â Code after replacing and combining to two: Â Â Â Â Â $new_prods_content .= '<td width="33%" align="center" valign="top"><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><br /><div style="margin-left:20px;margin-top:10px;margin-bottom:10px;"><div class="fb-like" data-href="http://www.your_web_site.com' . $_SERVER['PHP_SELF']."?products_id=".$new_products['products_id'] . '" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false"></div></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>'; Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 If nothing is showing up then maybe there's a mistake with the way you added the script in post #4. Post your template_top.php file. Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 1, 2015 Author Share Posted June 1, 2015 (edited) I suspected I missed something. The button itself isn't showing up. Everything else appears to be working fine. <script>(function(d, s, id) { Â var js, fjs = d.getElementsByTagName(s)[0]; Â if (d.getElementById(id)) return; Â js = d.createElement(s); js.id = id; Â js.src = "//connect.facebook.net/pt_PT/all.js#xfbml=1"; Â fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> </head> is what i used. the add on had this: <div id="fb-root"></div> <script>(function(d, s, id) { Â var js, fjs = d.getElementsByTagName(s)[0]; Â if (d.getElementById(id)) return; Â js = d.createElement(s); js.id = id; Â js.src = "//connect.facebook.net/pt_PT/all.js#xfbml=1"; Â fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> </head> Edited June 1, 2015 by amandakirk24 Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 (edited) So does it work now? You have to use what's in the addon. Â I made a mistake as well, you need to place this before the </head> Â <div id="fb-root"></div> <script>(function(d, s, id) { Â var js, fjs = d.getElementsByTagName(s)[0]; Â if (d.getElementById(id)) return; Â js = d.createElement(s); js.id = id; Â js.src = "//connect.facebook.net/pt_PT/all.js#xfbml=1"; Â fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Edited June 1, 2015 by Hotclutch Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 1, 2015 Author Share Posted June 1, 2015 I tried it and I got parsing error for the area of code I just put in new products. It says unexpected style.   if ($col === 0) {     $new_prods_content .= '<tr>';    }      $new_prods_content .= '<td width="33%" align="center" valign="top"><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><br /><a href="' <div style="margin-left:20px;margin-top:10px;margin-bottom:10px;"><div class="fb-like" data-href="http://www.your_web_site.com' . $_SERVER['PHP_SELF']."?products_id=".$new_products['products_id'] . '" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false"></div></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>';     $col ++;     if (($col > 2) || ($counter == $num_new_products)) {     $new_prods_content .= '</tr>';      $col = 0;    }   }    $new_prods_content .= '</table>'; ?>   <h2><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h2>   <div class="contentText">   <?php echo $new_prods_content; ?>  </div>  <?php  } ?> Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 Here is the entire file modified, backup your old one and replace it with this: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ 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, pd.products_name, 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_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_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 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_DESCRIPTION . " pd, " . 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 and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $num_new_products = tep_db_num_rows($new_products_query); if ($num_new_products > 0) { $counter = 0; $col = 0; $new_prods_content = '<table border="0" width="100%" cellspacing="0" cellpadding="2">'; while ($new_products = tep_db_fetch_array($new_products_query)) { $counter++; if ($col === 0) { $new_prods_content .= '<tr>'; } $new_prods_content .= '<td width="33%" align="center" valign="top"><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><br /><div style="margin-left:20px;margin-top:10px;margin-bottom:10px;"><div class="fb-like" data-href="http://www.your_web_site.com' . $_SERVER['PHP_SELF']."?products_id=".$new_products['products_id'] . '" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false"></div></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>'; $col ++; if (($col > 2) || ($counter == $num_new_products)) { $new_prods_content .= '</tr>'; $col = 0; } } $new_prods_content .= '</table>'; ?> <h2><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h2> <div class="contentText"> <?php echo $new_prods_content; ?> </div> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 template_top.php should look like this if you have not modified it with anything before: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ $oscTemplate->buildBlocks(); if (!$oscTemplate->hasBlocks('boxes_column_left')) { $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth()); } if (!$oscTemplate->hasBlocks('boxes_column_right')) { $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth()); } ?> <!DOCTYPE html> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" /> <title><?php echo tep_output_string_protected($oscTemplate->getTitle()); ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>" /> <link rel="stylesheet" type="text/css" href="ext/jquery/ui/redmond/jquery-ui-1.10.4.min.css" /> <script type="text/javascript" src="ext/jquery/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="ext/jquery/ui/jquery-ui-1.10.4.min.js"></script> <?php if (tep_not_null(JQUERY_DATEPICKER_I18N_CODE)) { ?> <script type="text/javascript" src="ext/jquery/ui/i18n/jquery.ui.datepicker-<?php echo JQUERY_DATEPICKER_I18N_CODE; ?>.js"></script> <script type="text/javascript"> $.datepicker.setDefaults($.datepicker.regional['<?php echo JQUERY_DATEPICKER_I18N_CODE; ?>']); </script> <?php } ?> <script type="text/javascript" src="ext/photoset-grid/jquery.photoset-grid.min.js"></script> <link rel="stylesheet" type="text/css" href="ext/colorbox/colorbox.css" /> <script type="text/javascript" src="ext/colorbox/jquery.colorbox-min.js"></script> <link rel="stylesheet" type="text/css" href="ext/960gs/<?php echo ((stripos(HTML_PARAMS, 'dir="rtl"') !== false) ? 'rtl_' : ''); ?>960_24_col.css" /> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> <?php echo $oscTemplate->getBlocks('header_tags'); ?> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/pt_PT/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> </head> <body> <div id="bodyWrapper" class="container_<?php echo $oscTemplate->getGridContainerWidth(); ?>"> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>"> Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 I tested this quickly on a bootstrap version, no reason why it won't also work on v2.3.4 Quote Link to comment Share on other sites More sharing options...
burt Posted June 1, 2015 Share Posted June 1, 2015 I tested this quickly on a bootstrap version, no reason why it won't also work on v2.3.4 You should not be hacking at template_top.php, you should be hooking or header_tag module. Why did we bother coding in modularity? 14steve14 1 Quote Link to comment Share on other sites More sharing options...
Hotclutch Posted June 1, 2015 Share Posted June 1, 2015 You should not be hacking at template_top.php, you should be hooking or header_tag module. Why did we bother coding in modularity? Â When i have time i'll make a module, but maybe this will serve the user's purpose for now. Quote Link to comment Share on other sites More sharing options...
amandakirk24 Posted June 2, 2015 Author Share Posted June 2, 2015 Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.