????
| Current Path : /home2/morganrand/www/store/includes/modules/boxes/ |
| Current File : /home2/morganrand/www/store/includes/modules/boxes/bm_wishlist.php |
<?php
/*
$Id: wishlist.php
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Released under the GNU General Public License
*/
/*******************************************************************
****** QUERY THE DATABASE FOR THE CUSTOMERS WISHLIST PRODUCTS ******
*******************************************************************/
class bm_wishlist {
var $code = 'bm_wishlist';
var $group = 'boxes';
var $title;
var $description;
var $sort_order;
var $enabled = false;
function bm_wishlist() {
$this->title = MODULE_BOXES_WISHLIST_TITLE;
$this->description = MODULE_BOXES_WISHLIST_DESCRIPTION;
if ( defined('MODULE_BOXES_WISHLIST_STATUS') ) {
$this->sort_order = MODULE_BOXES_WISHLIST_SORT_ORDER;
$this->enabled = (MODULE_BOXES_WISHLIST_STATUS == 'True');
$this->group = ((MODULE_BOXES_WISHLIST_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
}
}
function execute() {
global $wishList, $currencies, $languages_id, $oscTemplate;
if (is_array($wishList->wishID) && !empty($wishList->wishID)) {
reset($wishList->wishID);
$counter = count($wishList->wishID);
$wishlist_box = '';
if ($counter <= MAX_DISPLAY_WISHLIST_BOX) {
$wishlist_box = '<ul style="list-style:inside disc; padding: 0px;">';
/*******************************************************************
*** LOOP THROUGH EACH PRODUCT ID TO DISPLAY IN THE WISHLIST BOX ****
*******************************************************************/
while (list($wishlist_id, ) = each($wishList->wishID)) {
$wishlist_id = tep_get_prid($wishlist_id);
$products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd ) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = '" . (int)$wishlist_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_name");
$products = tep_db_fetch_array($products_query);
$wishlist_box .= '<li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'], 'NONSSL') . '">' . $products['products_name'] . '</a></li>';
}
$wishlist_box .= '</ul>';
}
$wishlist_box .= sprintf(TEXT_WISHLIST_COUNT, $counter);
} else {
$wishlist_box = MODULE_BOXES_WISHLIST_BOX_CART_EMPTY;
}
$data = '<div class="ui-widget infoBoxContainer">' .
' <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . MODULE_BOXES_WISHLIST_BOX_TITLE . '</a></div>' .
' <div class="ui-widget-content infoBoxContents">' . $wishlist_box .
'</div></div>';
$oscTemplate->addBlock($data, $this->group);
}
function isEnabled() {
return $this->enabled;
}
function check() {
return defined('MODULE_BOXES_WISHLIST_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 Shopping Cart Module', 'MODULE_BOXES_WISHLIST_STATUS', 'True', 'Do you want to add the module to your shop?', '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, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_WISHLIST_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', 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_BOXES_WISHLIST_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_BOXES_WISHLIST_STATUS', 'MODULE_BOXES_WISHLIST_CONTENT_PLACEMENT', 'MODULE_BOXES_WISHLIST_SORT_ORDER');
}
}
?>