Permalink
Browse files

Replace tell a friend box with a modular social bookmarks box

  • Loading branch information...
1 parent 3e6b5f7 commit 338c46ed6efbcfff1991ac3de0c13eee9247c802 @haraldpdl haraldpdl committed Aug 8, 2010
Showing with 496 additions and 36 deletions.
  1. +2 −1 catalog/admin/includes/boxes/modules.php
  2. +1 −0 catalog/admin/includes/languages/english.php
  3. +1 −0 catalog/admin/includes/languages/english/modules.php
  4. +6 −0 catalog/admin/modules.php
  5. BIN catalog/images/social_bookmarks/digg.png
  6. BIN catalog/images/social_bookmarks/email.png
  7. BIN catalog/images/social_bookmarks/facebook.png
  8. BIN catalog/images/social_bookmarks/google_buzz.png
  9. BIN catalog/images/social_bookmarks/twitter.png
  10. +56 −0 catalog/includes/boxes/product_social_bookmarks.php
  11. +0 −31 catalog/includes/boxes/tell_a_friend.php
  12. +1 −1 catalog/includes/column_right.php
  13. +2 −3 catalog/includes/languages/english.php
  14. +16 −0 catalog/includes/languages/english/modules/social_bookmarks/sb_digg.php
  15. +16 −0 catalog/includes/languages/english/modules/social_bookmarks/sb_email.php
  16. +16 −0 catalog/includes/languages/english/modules/social_bookmarks/sb_facebook.php
  17. +16 −0 catalog/includes/languages/english/modules/social_bookmarks/sb_google_buzz.php
  18. +16 −0 catalog/includes/languages/english/modules/social_bookmarks/sb_twitter.php
  19. +67 −0 catalog/includes/modules/social_bookmarks/sb_digg.php
  20. +67 −0 catalog/includes/modules/social_bookmarks/sb_email.php
  21. +67 −0 catalog/includes/modules/social_bookmarks/sb_facebook.php
  22. +67 −0 catalog/includes/modules/social_bookmarks/sb_google_buzz.php
  23. +67 −0 catalog/includes/modules/social_bookmarks/sb_twitter.php
  24. +12 −0 catalog/install/oscommerce.sql
@@ -24,7 +24,8 @@
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_MODULES, 'set=payment', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_PAYMENT . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_MODULES, 'set=shipping', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_MODULES, 'set=ordertotal', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_ORDER_TOTAL . '</a><br>' .
- '<a href="' . tep_href_link(FILENAME_MODULES, 'set=actionrecorder', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_ACTION_RECORDER . '</a>');
+ '<a href="' . tep_href_link(FILENAME_MODULES, 'set=actionrecorder', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_ACTION_RECORDER . '</a><br>' .
+ '<a href="' . tep_href_link(FILENAME_MODULES, 'set=social_bookmarks', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MODULES_SOCIAL_BOOKMARKS . '</a>');
}
$box = new box;
@@ -69,6 +69,7 @@ function tep_date_raw($date, $reverse = false) {
define('BOX_MODULES_SHIPPING', 'Shipping');
define('BOX_MODULES_ORDER_TOTAL', 'Order Total');
define('BOX_MODULES_ACTION_RECORDER', 'Action Recorder');
+define('BOX_MODULES_SOCIAL_BOOKMARKS', 'Social Bookmarks');
// categories box text in includes/boxes/catalog.php
define('BOX_HEADING_CATALOG', 'Catalog');
@@ -14,6 +14,7 @@
define('HEADING_TITLE_MODULES_SHIPPING', 'Shipping Modules');
define('HEADING_TITLE_MODULES_ORDER_TOTAL', 'Order Total Modules');
define('HEADING_TITLE_MODULES_ACTION_RECORDER', 'Action Recorder Modules');
+define('HEADING_TITLE_MODULES_SOCIAL_BOOKMARKS', 'Social Bookmark Modules');
define('TABLE_HEADING_MODULES', 'Modules');
define('TABLE_HEADING_SORT_ORDER', 'Sort Order');
@@ -34,6 +34,12 @@
$module_key = 'MODULE_ACTION_RECORDER_INSTALLED';
define('HEADING_TITLE', HEADING_TITLE_MODULES_ACTION_RECORDER);
break;
+ case 'social_bookmarks':
+ $module_type = 'social_bookmarks';
+ $module_directory = DIR_FS_CATALOG_MODULES . 'social_bookmarks/';
+ $module_key = 'MODULE_SOCIAL_BOOKMARKS_INSTALLED';
+ define('HEADING_TITLE', HEADING_TITLE_MODULES_SOCIAL_BOOKMARKS);
+ break;
case 'payment':
default:
$module_type = 'payment';
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,56 @@
+<?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($HTTP_GET_VARS['products_id']) && defined('MODULE_SOCIAL_BOOKMARKS_INSTALLED') && tep_not_null(MODULE_SOCIAL_BOOKMARKS_INSTALLED) ) {
+ $sbm_array = explode(';', MODULE_SOCIAL_BOOKMARKS_INSTALLED);
+
+ $social_bookmarks = array();
+
+ foreach ( $sbm_array as $sbm ) {
+ $class = substr($sbm, 0, strrpos($sbm, '.'));
+
+ if ( !class_exists($class) ) {
+ include(DIR_WS_LANGUAGES . $language . '/modules/social_bookmarks/' . $sbm);
+ include(DIR_WS_MODULES . 'social_bookmarks/' . $class . '.php');
+ }
+
+ $sb = new $class();
+
+ if ( $sb->isEnabled() ) {
+ $social_bookmarks[] = $sb->getOutput();
+ }
+ }
+
+ if ( !empty($social_bookmarks) ) {
+?>
+<!-- product_social_bookmarks //-->
+ <tr>
+ <td>
+<?php
+ $info_box_contents = array();
+ $info_box_contents[] = array('text' => BOX_HEADING_SOCIAL_BOOKMARKS);
+
+ new infoBoxHeading($info_box_contents, false, false);
+
+ $info_box_contents = array();
+ $info_box_contents[] = array('align' => 'center',
+ 'text' => implode(' ', $social_bookmarks));
+
+ new infoBox($info_box_contents);
+?>
+ </td>
+ </tr>
+<!-- product_social_bookmarks_eof //-->
+<?php
+ }
+ }
+?>
@@ -1,31 +0,0 @@
-<?php
-/*
- $Id$
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2003 osCommerce
-
- Released under the GNU General Public License
-*/
-?>
-<!-- tell_a_friend //-->
- <tr>
- <td>
-<?php
- $info_box_contents = array();
- $info_box_contents[] = array('text' => BOX_HEADING_TELL_A_FRIEND);
-
- new infoBoxHeading($info_box_contents, false, false);
-
- $info_box_contents = array();
- $info_box_contents[] = array('form' => tep_draw_form('tell_a_friend', tep_href_link(FILENAME_TELL_A_FRIEND, '', 'NONSSL', false), 'get'),
- 'align' => 'center',
- 'text' => tep_draw_input_field('to_email_address', '', 'size="10"') . '&nbsp;' . tep_image_submit('button_tell_a_friend.gif', BOX_HEADING_TELL_A_FRIEND) . tep_draw_hidden_field('products_id', (int)$HTTP_GET_VARS['products_id']) . tep_hide_session_id() . '<br>' . BOX_TELL_A_FRIEND_TEXT);
-
- new infoBox($info_box_contents);
-?>
- </td>
- </tr>
-<!-- tell_a_friend_eof //-->
@@ -33,7 +33,7 @@
}
if (isset($HTTP_GET_VARS['products_id'])) {
- if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
+ include(DIR_WS_BOXES . 'product_social_bookmarks.php');
} else {
include(DIR_WS_BOXES . 'specials.php');
}
@@ -126,9 +126,8 @@ function tep_date_raw($date, $reverse = false) {
define('BOX_INFORMATION_SHIPPING', 'Shipping & Returns');
define('BOX_INFORMATION_CONTACT', 'Contact Us');
-// tell a friend box text in includes/boxes/tell_a_friend.php
-define('BOX_HEADING_TELL_A_FRIEND', 'Tell A Friend');
-define('BOX_TELL_A_FRIEND_TEXT', 'Tell someone you know about this product.');
+// social bookmarks box
+define('BOX_HEADING_SOCIAL_BOOKMARKS', 'Share Product');
// checkout procedure text
define('CHECKOUT_BAR_DELIVERY', 'Delivery Information');
@@ -0,0 +1,16 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ define('MODULE_SOCIAL_BOOKMARKS_DIGG_TITLE', 'Digg');
+ define('MODULE_SOCIAL_BOOKMARKS_DIGG_DESCRIPTION', 'Share products on Digg.');
+ define('MODULE_SOCIAL_BOOKMARKS_DIGG_PUBLIC_TITLE', 'Share on Digg');
+?>
@@ -0,0 +1,16 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ define('MODULE_SOCIAL_BOOKMARKS_EMAIL_TITLE', 'E-Mail');
+ define('MODULE_SOCIAL_BOOKMARKS_EMAIL_DESCRIPTION', 'Share products via e-mail.');
+ define('MODULE_SOCIAL_BOOKMARKS_EMAIL_PUBLIC_TITLE', 'Share via E-Mail');
+?>
@@ -0,0 +1,16 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ define('MODULE_SOCIAL_BOOKMARKS_FACEBOOK_TITLE', 'Facebook');
+ define('MODULE_SOCIAL_BOOKMARKS_FACEBOOK_DESCRIPTION', 'Share products on Facebook.');
+ define('MODULE_SOCIAL_BOOKMARKS_FACEBOOK_PUBLIC_TITLE', 'Share on Facebook');
+?>
@@ -0,0 +1,16 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ define('MODULE_SOCIAL_BOOKMARKS_GOOGLE_BUZZ_TITLE', 'Google Buzz');
+ define('MODULE_SOCIAL_BOOKMARKS_GOOGLE_BUZZ_DESCRIPTION', 'Share products on Google Buzz.');
+ define('MODULE_SOCIAL_BOOKMARKS_GOOGLE_BUZZ_PUBLIC_TITLE', 'Share on Google Buzz');
+?>
@@ -0,0 +1,16 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ define('MODULE_SOCIAL_BOOKMARKS_TWITTER_TITLE', 'Twitter');
+ define('MODULE_SOCIAL_BOOKMARKS_TWITTER_DESCRIPTION', 'Share products on Twitter.');
+ define('MODULE_SOCIAL_BOOKMARKS_TWITTER_PUBLIC_TITLE', 'Share on Twitter');
+?>
@@ -0,0 +1,67 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class sb_digg {
+ var $code = 'sb_digg';
+ var $title;
+ var $description;
+ var $sort_order;
+ var $icon = 'digg.png';
+ var $enabled = false;
+
+ function sb_digg() {
+ $this->title = MODULE_SOCIAL_BOOKMARKS_DIGG_TITLE;
+ $this->public_title = MODULE_SOCIAL_BOOKMARKS_DIGG_PUBLIC_TITLE;
+ $this->description = MODULE_SOCIAL_BOOKMARKS_DIGG_DESCRIPTION;
+
+ if ( defined('MODULE_SOCIAL_BOOKMARKS_DIGG_STATUS') ) {
+ $this->sort_order = MODULE_SOCIAL_BOOKMARKS_DIGG_SORT_ORDER;
+ $this->enabled = (MODULE_SOCIAL_BOOKMARKS_DIGG_STATUS == 'True');
+ }
+ }
+
+ function getOutput() {
+ global $HTTP_GET_VARS;
+
+ return '<a href="http://digg.com/submit?url=' . urlencode(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL', false)) . '" target="_blank"><img src="images/social_bookmarks/' . $this->icon . '" border="0" title="' . tep_output_string_protected($this->public_title) . '" /></a>';
+ }
+
+ function isEnabled() {
+ return $this->enabled;
+ }
+
+ function getIcon() {
+ return $this->icon;
+ }
+
+ function getPublicTitle() {
+ return $this->public_title;
+ }
+
+ function check() {
+ return defined('MODULE_SOCIAL_BOOKMARKS_DIGG_STATUS');
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Digg Module', 'MODULE_SOCIAL_BOOKMARKS_DIGG_STATUS', 'True', 'Do you want to allow products to be shared through Digg?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SOCIAL_BOOKMARKS_DIGG_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('MODULE_SOCIAL_BOOKMARKS_DIGG_STATUS', 'MODULE_SOCIAL_BOOKMARKS_DIGG_SORT_ORDER');
+ }
+ }
+?>
@@ -0,0 +1,67 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class sb_email {
+ var $code = 'sb_email';
+ var $title;
+ var $description;
+ var $sort_order;
+ var $icon = 'email.png';
+ var $enabled = false;
+
+ function sb_email() {
+ $this->title = MODULE_SOCIAL_BOOKMARKS_EMAIL_TITLE;
+ $this->public_title = MODULE_SOCIAL_BOOKMARKS_EMAIL_PUBLIC_TITLE;
+ $this->description = MODULE_SOCIAL_BOOKMARKS_EMAIL_DESCRIPTION;
+
+ if ( defined('MODULE_SOCIAL_BOOKMARKS_EMAIL_STATUS') ) {
+ $this->sort_order = MODULE_SOCIAL_BOOKMARKS_EMAIL_SORT_ORDER;
+ $this->enabled = (MODULE_SOCIAL_BOOKMARKS_EMAIL_STATUS == 'True');
+ }
+ }
+
+ function getOutput() {
+ global $HTTP_GET_VARS;
+
+ return '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $HTTP_GET_VARS['products_id']) . '"><img src="images/social_bookmarks/' . $this->icon . '" border="0" title="' . tep_output_string_protected($this->public_title) . '" /></a>';
+ }
+
+ function isEnabled() {
+ return $this->enabled;
+ }
+
+ function getIcon() {
+ return $this->icon;
+ }
+
+ function getPublicTitle() {
+ return $this->public_title;
+ }
+
+ function check() {
+ return defined('MODULE_SOCIAL_BOOKMARKS_EMAIL_STATUS');
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable E-Mail Module', 'MODULE_SOCIAL_BOOKMARKS_EMAIL_STATUS', 'True', 'Do you want to allow products to be shared through e-mail?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SOCIAL_BOOKMARKS_EMAIL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('MODULE_SOCIAL_BOOKMARKS_EMAIL_STATUS', 'MODULE_SOCIAL_BOOKMARKS_EMAIL_SORT_ORDER');
+ }
+ }
+?>
Oops, something went wrong.

0 comments on commit 338c46e

Please sign in to comment.