Tsimi

cm_footer_wishlist.php

Feb 11th, 2015
18
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.   $Id$
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2014 osCommerce
  9.  
  10.   Released under the GNU General Public License
  11. */
  12.  
  13.  
  14.   class cm_footer_wishlist {
  15.     var $code;
  16.     var $group;
  17.     var $title;
  18.     var $description;
  19.     var $sort_order;
  20.     var $enabled = false;
  21.  
  22.     function cm_footer_wishlist() {
  23.       $this->code = get_class($this);
  24.       $this->group = basename(dirname(__FILE__));
  25.      
  26.       $this->title = MODULE_CONTENT_FOOTER_WISHLIST_TITLE;
  27.       $this->description = MODULE_CONTENT_FOOTER_WISHLIST_DESCRIPTION;
  28.  
  29.       if ( defined('MODULE_CONTENT_FOOTER_WISHLIST_STATUS') ) {
  30.         $this->sort_order = MODULE_CONTENT_FOOTER_WISHLIST_SORT_ORDER;
  31.         $this->enabled = (MODULE_CONTENT_FOOTER_WISHLIST_STATUS == 'True');
  32.       }
  33.     }
  34.  
  35.     function execute() {
  36.       global $wishList, $currencies, $languages_id, $oscTemplate;
  37.  
  38.       $content_width = (int)MODULE_CONTENT_FOOTER_WISHLIST_CONTENT_WIDTH;
  39.  
  40.       $counter = $wishList->count_contents();
  41.       if ($counter > 0) {
  42.             $wishlist_content = '';
  43.         $wish_products = $wishList->get_wishlist_products();
  44.         $n=sizeof($wish_products);
  45.         if ($n <= MAX_DISPLAY_WISHLIST_BOX) {
  46.         for ($i=0; $i<$n; $i++) {
  47.             $wishlist_content .= '<li>';
  48.             $wishlist_content .= $wish_products[$i]['quantity'] . '&nbsp;x&nbsp;';
  49.             $wishlist_content .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wish_products[$i]['id']) . '">';
  50.             $wishlist_content .= $wish_products[$i]['name'];
  51.             $wishlist_content .= '</a></li>';
  52.           }
  53.           $wishlist_content .= '<li><span class="col-xs-6 col-xs-offset-6" style="border-bottom:solid 1px;">&nbsp;</span></li>';
  54.           $wishlist_content .= '<li class="text-right">' . TEXT_WISHLIST_TOTAL . $currencies->format($wishList->show_total()) . '</li>';
  55.             }
  56.             $wishlist_content .= '<a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . sprintf(TEXT_FOOTER_WISHLIST_COUNT, $counter) . '</a>';
  57.         } else {
  58.             $wishlist_content = '<p>' . MODULE_CONTENT_FOOTER_WISHLIST_EMPTY . '</p>';
  59.         }
  60.      
  61.         ob_start();
  62.         include(DIR_WS_MODULES . 'content/' . $this->group . '/templates/wishlist.php');
  63.         $template = ob_get_clean();
  64.  
  65.         $oscTemplate->addContent($template, $this->group);
  66.     }
  67.  
  68.     function isEnabled() {
  69.       return $this->enabled;
  70.     }
  71.  
  72.     function check() {
  73.       return defined('MODULE_CONTENT_FOOTER_WISHLIST_STATUS');
  74.     }
  75.  
  76. function install() {
  77.       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 Account Footer Module', 'MODULE_CONTENT_FOOTER_WISHLIST_STATUS', 'True', 'Do you want to enable the Wishlist content module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  78.       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 ('Content Width', 'MODULE_CONTENT_FOOTER_WISHLIST_CONTENT_WIDTH', '3', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
  79.       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_CONTENT_FOOTER_WISHLIST_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
  80.     }
  81.  
  82.     function remove() {
  83.       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  84.     }
  85.  
  86.     function keys() {
  87.       return array('MODULE_CONTENT_FOOTER_WISHLIST_STATUS', 'MODULE_CONTENT_FOOTER_WISHLIST_CONTENT_WIDTH', 'MODULE_CONTENT_FOOTER_WISHLIST_SORT_ORDER');
  88.     }
  89.   }
RAW Paste Data