Jump to content
Sign in to follow this  
acedave

Wish list setup using MYWishList 1.03 in osComm 2.3

Recommended Posts

Hello All,

 

my manager wants me to add a wish list function to our site.

We are using 2.3 - the module MyWishList 1.03 was recommended to me, but it was designed for 2.2.

http://addons.oscommerce.com/info/2581

(my manager doesn't like how GiftMe work, so it is not an option)

 

I am reviewing the instructions for MyWishList and it asks for the "column_right.php" file in the "includes" folder.

I am aware that the "column_right.php" was made redundant in the 2.3.

I sort of understand that and it's functions are taken over by "/includes/modules/boxes/" and that I would have to make a new box module.

Is this correct?

 

If I create a box module, how will this affect how I edit the other files?

 

Any help is most welcome

 

Thanks

Share this post


Link to post
Share on other sites

not many problems - this is the box im using for 2.3.1/2

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 class bm_wish_list {
   var $code = 'bm_wish_list';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;
   function bm_wish_list() {
  $this->title = MODULE_BOXES_WISH_LIST_TITLE;
  $this->description = MODULE_BOXES_WISH_LIST_DESCRIPTION;
  if ( defined('MODULE_BOXES_WISH_LIST_STATUS') ) {
    $this->sort_order = MODULE_BOXES_WISH_LIST_SORT_ORDER;
    $this->enabled = (MODULE_BOXES_WISH_LIST_STATUS == 'True');
    $this->group = ((MODULE_BOXES_WISH_LIST_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
  }
   }
   function execute() {
  global $wishList,$oscTemplate,$languages_id;
  $wish_list_contents_string = '';

  if ($wishList->count_wishlist() > 0) {
   reset($wishList->wishID);
    $wish_list_contents_string = '<table class="ui-widget-content infoBoxContents">';


 $counter = 1;

    while (list($wishlist_id, ) = each($wishList->wishID)) {

  $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image,p.products_master_status,p.products_master , 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 = '" . $wishlist_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");
   $products = tep_db_fetch_array($products_query);

	    $wish_list_contents_string .= '<tr><td>';
	  // Master Products

	   $wish_list_contents_string .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . tep_master_link($products['products_master_status'], $products['products_master'], $products['products_id'])) . '">';
// Master Products EOF
  $wish_list_contents_string .=$products['products_name'];
	   $wish_list_contents_string .= '</a></td></tr>';

  $counter++;
    }
    //$wish_list_contents_string .= '<tr><td colspan="2">' . $currencies->format($cart->show_total()) . '</td></tr>' .
							 //'</table>';
 $wish_list_contents_string .= '</table>';
  } else {
    $wish_list_contents_string .= '<div class="ui-widget-content infoBoxContents">' . MODULE_BOXES_WISH_LIST_BOX_EMPTY . '</div>';
  }

  $data = '<div class="ui-widget infoBoxContainer">' .
		  '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . MODULE_BOXES_WISH_LIST_BOX_TITLE . '</a></div>' .
		  '  ' . $wish_list_contents_string .
		  '</div>';
  $oscTemplate->addBlock($data, $this->group);
   }
   function isEnabled() {
  return $this->enabled;
   }
   function check() {
  return defined('MODULE_BOXES_WISH_LIST_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_WISH_LIST_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_WISH_LIST_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_WISH_LIST_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_WISH_LIST_STATUS', 'MODULE_BOXES_WISH_LIST_CONTENT_PLACEMENT', 'MODULE_BOXES_WISH_LIST_SORT_ORDER');
   }
 }
?>

 

should get you started - and in application_top.php you need to also test for an object being present namely

 

// wishlist data
 if(!tep_session_is_registered('wishList') || !is_object($wishList)) {

  tep_session_register('wishList');
  $wishList = new wishlist;
 }

 

cant remember offhand if i had many problems ( appart from changing the layouts to use 2.3 styling)

 

Jules

Share this post


Link to post
Share on other sites

Hi Jules,

 

I tried this (with OSC 2.3.3) and I got this Error:

 

Fatal error: Class 'wishlist' not found in ../catalog/includes/application_top.php on line 318 (this ist where I added the application_top.php part)

 

Any ideas what I did wrong?

 

Thanks in advance,

 

Thalia

Share this post


Link to post
Share on other sites

you have installed the rest of the contribution i assume

 

above what i posted already should be somewhere in application_top.php

 

require(DIR_WS_CLASSES . 'wishlist.php');

 

which needs includes/classes/wishlist.php uploading to your server

 

 

Jules

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×