Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 2.0 Support Thread


defender39

Recommended Posts

For some reason, everytime i try to add a product to my wishlist i get a 404 error, however, when i hit the refresh button - it will load fine but i get no product in my wishlist? Any suggestions?

 

site is at www.quirksofart.com

Link to comment
Share on other sites

Phobos,

 

I know I have this same problem on my test server (my local machine, running easyphp1-7.) but when I upload to my webserver everything works just fine.  All I can think of is it has something to do with a server configuration. As it works on my website I really haven't looked into it much.  Are you getting this problem on your "live" site, or just on a testing site?

 

RW

 

The problem, for now, is only on my test server, my local machine running wmservertools. Sincerely I have not tried the pack online yet, I hope that work then also well online, thanks RavenWulf for the reply.

 

tnx, jo

Link to comment
Share on other sites

catalog\includes\configure.php

 

define('MAX_DISPLAY_WISHLIST_BOX', '6'); // How many wishlist items to display in the infobox before it changes to a counter

 

Thanks for your reply Mike!

 

I have checked and this line is already defined in this file. Actually, in my sql base in the configuration table, I can't found the entries :

 

-MAX_DISPLAY_WISHLIST_BOX'

-MIN_DISPLAY_WISHLIST_BOX'

 

Maybe I have deleted them ?! :'( I had some problems with my sql DB two days ago so....

 

Do you know which query I have to run to have them put into the DB?

 

Thank you :D

 

Mujina

OSC2.2

Link to comment
Share on other sites

this is the sql i used

 

#

# Database table for customers_wishlist`

#

 

CREATE TABLE customers_wishlist (

products_id int(13) NOT NULL default '0',

customers_id int(13) NOT NULL default '0',

products_model varchar(13) default NULL,

products_name varchar(64) NOT NULL default '',

products_price decimal(8,2) NOT NULL default '0.00',

final_price decimal(8,2) NOT NULL default '0.00',

products_quantity int(2) NOT NULL default '0',

wishlist_name varchar(64) default NULL

) TYPE=MyISAM;

 

i am pretty sure this is where i define the output "define('MAX_DISPLAY_WISHLIST_BOX', '6'); "

 

note, i do not have those settings in the admin panel either.

Link to comment
Share on other sites

Sorry, that must have been something I added. You can use the below inserts to add the values to your configuration table.

 

INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Items per Wishlist Page', 'MAX_DISPLAY_WISHLIST_PRODUCTS', '9', 'How many wishlist items to show per page on the main wishlist.php file', 3, 100, '2004-10-08 23:44:48', '2004-06-14 21:22:21', NULL, NULL);
INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Items in Wishlist Infobox', 'MAX_DISPLAY_WISHLIST_BOX', '5', 'How many wishlist items to display in the infobox before it changes to a counter', 3, 101, '2004-06-14 21:33:24', '2004-06-14 21:26:42', NULL, NULL);

 

Be sure to delete the define statements for these values 'MAX_DISPLAY_WISHLIST_PRODUCTS', 'MAX_DISPLAY_WISHLIST_BOX' from your configure.php.

Link to comment
Share on other sites

Thanks Mike!

 

I have the same settings thus try BearHappy code it works for me!!! :D

 

 

----

 

Thanks BearHappy for your post! It's pretty usefull to change the number items displayed in the wishlist box from the admin panel! :thumbsup:

Edited by mujina

OSC2.2

Link to comment
Share on other sites

Joker,

You might try the below code in your application_top.php. With this code, the only way to remove an item from your wishlist is to select the delete radio in the actual wishlist.  :thumbsup:

4. in /catalog/includes/application_top.php

Find:
-----
? ? ?// performed by the 'buy now' button in product listings and review page
? ? ?case 'buy_now' : ? ? ? ?if (isset($HTTP_GET_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
Replace with
------------

? ? ?// performed by the 'buy now' button in product listings and review page
? ? ?case 'buy_now' : ? ? ? ?if (isset($HTTP_GET_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
5. in /catalog/includes/application_top.php

Find:
-----

? ? ?case 'cust_order' : ? ? if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
? ?}
?}

// include the who's online functions

Replace with
------------

? ? ?case 'cust_order' : ? ? if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
// Wish List 2.3 Start
// *****************************************
? ? ?// Remove item from the Wish List
? ? ?case 'remove_wishlist':
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link(FILENAME_WISHLIST));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
? ?} // end switch $HTTP_GET_VARS['action']
?} // end if is set $HTTP_GET_VARS['action']

?// Shopping cart actions through POST variables from forms
?if (isset($HTTP_POST_VARS['wishlist_action'])) {
? ?// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
? ?if ($session_started == false) {
? ? ?tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
? ?}

? ?$goto = basename($PHP_SELF);
? ?switch ($HTTP_POST_VARS['wishlist_action']) {
? ? ?// Customer wants to update the product quantity in their shopping cart
? ? ?case 'add_wishlist' : ?if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($HTTP_POST_VARS['products_id']) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($customer_id > 0) {
? ? ? ? ? ?// Queries below replace old product instead of adding to queatity.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// Read array of options and values for attributes in id[]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (isset ($id)) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?foreach($id as $att_option=>$att_value) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// Add to customers_wishlist_attributes table
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;

? ? ?case 'wishlist_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($HTTP_POST_VARS['products_id']) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($customer_id > 0) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// Read array of options and values for attributes in id[]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;

? ? ? // Wishlist Checkboxes
? ? ? case 'add_delete_products_wishlist': 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (isset($HTTP_POST_VARS['add_wishprod'])) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ($HTTP_POST_VARS['borrar'] == 0) { 
? ? ? ? ? ? ? ? // 'borrar' form variable refers to deleting products in array $add_wishprod[] from wishlist
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (ereg('^[0-9]+$', $value)) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ($HTTP_POST_VARS['borrar'] == 1) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (ereg('^[0-9]+$', $value)) { ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tep_redirect(tep_href_link(FILENAME_WISHLIST));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;

? ?} // end switch ($HTTP_POST_VARS['wishlist_action'])
?} // end isset($HTTP_POST_VARS)
// *****************************************
// Wish List 2.3 End

// include the who's online functions

I have modified the original code to do what I think your looking for. Let me know if this works for you...

 

Th for the time on this fix, but it didnt wrk for me sorry, I have a very heavily modded osc and tried to put the snippets where they should go but all i got was nothing added to wishlist at all, any thoughts on this one?

 

Many thx for the help, been away so couldnt respond sooner sorry. :thumbsup:

Link to comment
Share on other sites

Thanks Mike!

 

I have the same settings thus try BearHappy code it works for me!!! :D

----

 

Thanks BearHappy for your post! It's pretty usefull to change the number items displayed in the wishlist box from the admin panel! :thumbsup:

 

 

OK

 

How do you get it into the admin panel?

Link to comment
Share on other sites

OK

 

How do you get it into the admin panel?

 

Hi Mike!

 

Go to catalog\includes\configure.php an delete both lines related to:

 

'MAX_DISPLAY_WISHLIST_PRODUCTS', 'MAX_DISPLAY_WISHLIST_BOX' from your configure.php.

 

Next goto your SQL data base and run this code :

INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Items per Wishlist Page', 'MAX_DISPLAY_WISHLIST_PRODUCTS', '9', 'How many wishlist items to show per page on the main wishlist.php file', 3, 100, '2004-10-08 23:44:48', '2004-06-14 21:22:21', NULL, NULL);

INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Items in Wishlist Infobox', 'MAX_DISPLAY_WISHLIST_BOX', '5', 'How many wishlist items to display in the infobox before it changes to a counter', 3, 101, '2004-06-14 21:33:24', '2004-06-14 21:26:42', NULL, NULL);

 

 

Next step : goto to your panel admin and check in configuration box/Max values

See at the bottom of the table the two lines for wishlist are displayed!

 

Sorry for my bad english :blush: , hope you understand it!

OSC2.2

Link to comment
Share on other sites

Joker,

 

 

Sorry for the incomplete post, try the below. I have modified the below with what you should be seeing in your application_top.php.

 

Find:
-----

     // performed by the 'buy now' button in product listings and review page
     case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                               // Wish List 2.3 Start
                               if (tep_session_is_registered('customer_id')) {
                                 tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$products_id");
                                 tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id=$products_id");
                               }
                               // Wish List 2.3 End
                               if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

Replace with
------------

    // performed by the 'buy now' button in product listings and review page
    case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                              if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                              } else {
                                $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                              }
                            }
                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                            break;

Find:
-----

     case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                               // Wish List 2.3 Start
                               tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
                               tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id='" . $HTTP_GET_VARS['pid']."'");
                               // Wish List 2.3 End
                               if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
// Wish List 2.3 Start
// *****************************************
     // Remove item from the Wish List
     case 'remove_wishlist':
                             tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
                             tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");
                             tep_redirect(tep_href_link(FILENAME_WISHLIST));
                             break;
   } // end switch $HTTP_GET_VARS['action']
 } // end if is set $HTTP_GET_VARS['action']

 // Shopping cart actions through POST variables from forms
 if (isset($HTTP_POST_VARS['wishlist_action'])) {
   // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   if ($session_started == false) {
     tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
   }

   $goto = basename($PHP_SELF);
   switch ($HTTP_POST_VARS['wishlist_action']) {
     // Customer wants to update the product quantity in their shopping cart
     case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                               if ($HTTP_POST_VARS['products_id']) {
                                 if ($customer_id > 0) {
           // Queries below replace old product instead of adding to queatity.
                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   // Read array of options and values for attributes in id[]
                                   if (isset ($id)) {
                                     foreach($id as $att_option=>$att_value) {
                                       // Add to customers_wishlist_attributes table
                                       tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                     }
                                   }
                                 }
                               }
                             }
                             break;

     case 'wishlist_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                                 if ($HTTP_POST_VARS['products_id']) {
                                 if ($customer_id > 0) {
                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   // Read array of options and values for attributes in id[]
                                   if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                                      $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                                   }
                                   tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                                   break;
                                 }
                               }
                             }
                             break;

      // Wishlist Checkboxes
      case 'add_delete_products_wishlist': 
                                     if (isset($HTTP_POST_VARS['add_wishprod'])) {
                                        if ($HTTP_POST_VARS['borrar'] == 0) { 
                // 'borrar' form variable refers to deleting products in array $add_wishprod[] from wishlist
                                              foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
                                                   if (ereg('^[0-9]+$', $value)) {
                                                   $cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);
                                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
                                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
                                                   }
                                              }
                                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                                        }
                                        if ($HTTP_POST_VARS['borrar'] == 1) {
                                              foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
                                                   if (ereg('^[0-9]+$', $value)) {    
                                                    tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
                                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
                                                  }
                                             }
                                            tep_redirect(tep_href_link(FILENAME_WISHLIST));
                                        }
                                     }
                                     break;

   } // end switch ($HTTP_POST_VARS['wishlist_action'])
 } // end isset($HTTP_POST_VARS)
// *****************************************
// Wish List 2.3 End

// include the who's online functions

Replace with
------------

    case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                              if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                              } else {
                                $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                              }
                            }
                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                            break;
// Wish List 2.3 Start
// *****************************************
    // Remove item from the Wish List
    case 'remove_wishlist':
                            tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
                            tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");
                            tep_redirect(tep_href_link(FILENAME_WISHLIST));
                            break;
  } // end switch $HTTP_GET_VARS['action']
} // end if is set $HTTP_GET_VARS['action']

// Shopping cart actions through POST variables from forms
if (isset($HTTP_POST_VARS['wishlist_action'])) {
  // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
  if ($session_started == false) {
    tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
  }

  $goto = basename($PHP_SELF);
  switch ($HTTP_POST_VARS['wishlist_action']) {
    // Customer wants to update the product quantity in their shopping cart
    case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                              if ($HTTP_POST_VARS['products_id']) {
                                if ($customer_id > 0) {
          // Queries below replace old product instead of adding to queatity.
                                  tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                  tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
                                  tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                  // Read array of options and values for attributes in id[]
                                  if (isset ($id)) {
                                    foreach($id as $att_option=>$att_value) {
                                      // Add to customers_wishlist_attributes table
                                      tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                    }
                                  }
                                }
                              }
                            }
                            break;

    case 'wishlist_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                                if ($HTTP_POST_VARS['products_id']) {
                                if ($customer_id > 0) {
                                  // Read array of options and values for attributes in id[]
                                  if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                                     $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                                  }
                                  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                                  break;
                                }
                              }
                            }
                            break;

     // Wishlist Checkboxes
     case 'add_delete_products_wishlist': 
                                    if (isset($HTTP_POST_VARS['add_wishprod'])) {
                                       if ($HTTP_POST_VARS['borrar'] == 0) { 
               // 'borrar' form variable refers to deleting products in array $add_wishprod[] from wishlist
                                             foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
                                                  if (ereg('^[0-9]+$', $value)) {
                                                  $cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);
                                                  }
                                             }
                                           tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                                       }
                                       if ($HTTP_POST_VARS['borrar'] == 1) {
                                             foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
                                                  if (ereg('^[0-9]+$', $value)) {    
                                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
                                                  tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
                                                 }
                                            }
                                           tep_redirect(tep_href_link(FILENAME_WISHLIST));
                                       }
                                    }
                                    break;

  } // end switch ($HTTP_POST_VARS['wishlist_action'])
} // end isset($HTTP_POST_VARS)
// *****************************************
// Wish List 2.3 End

// include the who's online functions

 

 

Basically what I did was to remove the SQL delete queries from the code which removed items from the wishlist. This means that the only way to remove items from your wishlist is to actually select remove...

Link to comment
Share on other sites

Thx for that redo on the wishlist problem I have, but I have done the changes and it works someways but it just wont add a product to the wishlist now, all i get now after clcking add is this on the page:

 

No products are in your Wishlist

 

Thx for your time/help great work. :thumbsup:

Link to comment
Share on other sites

Thx for that redo on the wishlist problem I have, but I have done the changes and it works someways but it just wont add a product to the wishlist now, all i get now after clcking add is this on the page:

 

No products are in your Wishlist

 

Thx for your time/help great work. :thumbsup:

 

I have it working now great, thx for all the help :thumbsup:

Link to comment
Share on other sites

Hello all:

 

Well, I am the designated register_globals = off OSC test monkey as it is giving me all sorts of problems. I am cross posting to the Register Globals Contribution Support thread as more often than not the "big guns" aka "real coders" tend to stick to the contribution threads they work on and may miss issues that affect both:

 

As it stands now, the WISHLIST 2.3 contribution (aka 2.0 aka 2.0 Extended aka who-knows-what-else) does not seem to work well with the Register Globals contribution. It seems none of the form variables are making it through: I can't add anything to either the wishlist nor the cart. The problem MUST be a register_globals issue because the behavior of the forms is similar to problems I had with other contributions.

 

One things I DID fix using a little piece of code from another Register Globals issue in another contribution: The "buy now" button code in the application_top.php; It was ginving me the SQL delete syntax error some of you got. Adding the fix took care of it, WHICH tells me it definetily must be a REGISTER GLOBALS = off problem. (By the way this fix only applies if you are using the REGISTER GLOBALS contribution. If you need this fix, head to the Register Globals topic in the Contribution Support and look it up as it is posted there.

 

So...Any of you running wishlist with Register Globals Contribution (register_globals=off) and got it running?

 

If not...any ideas on how to take care of this?

 

Upon fixing/testing this problem I will upload a TXT file to the contribution so the next person that runs into this can fix it. If you look up the contributions you will see I have been posting teh fixes given (and tested) for the Register Globals = off.

 

Thanks in advance.

 

Luis

Link to comment
Share on other sites

Hi there !

 

I'm beginning to discover contributions. The wishlist feature interests me, so i tried to install it. Unfortunately, i have an error answer...

 

Warning: Division by zero in /web/editions-oriflam.com/tresors/includes/classes/split_page_results.php on line 59
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-0, MAX_DISPLAY_WISHLIST_PRODUCTS' at line 1

select * from customers_wishlist where customers_id = '2' order by products_name limit -0, MAX_DISPLAY_WISHLIST_PRODUCTS

 

I followed the vanilla instructions of the 2.3 version (run the SQL file, install the main files and the vanilla mods). The OSC version i used is osCommerce 2.2-MS2.

Link to comment
Share on other sites

When I try to add an item to my wishlist. My user is logged out and I am asked to log back in. When I log in there is no item in my wishlist.

 

I am experiencing this on both my testing machine and production server. Is there a fix for this issue?

 

Thanks.

Link to comment
Share on other sites

Ok, I finally solved the "no wishlist in email" problem by using the wishlist_email.php file from v2.01 and modifying it slightly.

 

 

Can you maybe post the file here, so everyone can benefit from it?

I'm having that problem right now, the email just says

 

Hi James,

 

Julie Andrews has created a Wishlist at Absinthe-Fairy Creations which they would like to share with you.

 

does this work yet? <-- memo the customer types in

 

Regards,

 

Absinthe-Fairy Creations

http://www.absinthe-fairy.com/shopping/ <-- my testing site

with no wishlist items or anything.

Edited by Taipa
Link to comment
Share on other sites

Never thought of doing that ... here you go

 

NOTE: I'm still looking for a way to display "Qty" or "Product Status" in the wishlist. Anybody???

 

<?php

/*

$Id: wishlist.php,v 2.0 2003/11/22 Jesse Labrocca

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

if (tep_session_is_registered('customer_id')) {

$account = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$account_values = tep_db_fetch_array($account);

} elseif (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false') {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST_SEND);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_WISHLIST_SEND, 'send_to=' . $HTTP_GET_VARS['send_to'] . '&products_id=' . $HTTP_GET_VARS['products_id']));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<script LANGUAGE="JavaScript1.2" SRC="includes/menu_animation.js"></SCRIPT>

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

<?

$wishliststring = "My Wishlist is: \n\n";

$wishlist_query_raw = "select tab2.products_id, tab1.products_name from " . TABLE_WISHLIST . " as tab2, products_description as tab1 WHERE tab2.customers_id=$customer_id and tab1.products_id = tab2.products_id order by products_name";

$wishlist_query = tep_db_query($wishlist_query_raw);

while ($resultarray=mysql_fetch_row($wishlist_query)) {

$wishliststring .= $resultarray[1]."\n" . HTTP_SERVER ."/product_info.php/products_id/".$resultarray[0] . "\n\n";

}

?>

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

 

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf(HEADING_TITLE, $product_info['products_name']); ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', sprintf(HEADING_TITLE, $product_info['products_name']), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

$error = false;

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && !tep_validate_email(trim($HTTP_POST_VARS['friendemail']))) {

$friendemail_error = true;

$error = true;

} else {

$friendemail_error = false;

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && empty($HTTP_POST_VARS['friendname'])) {

$friendname_error = true;

$error = true;

} else {

$friendname_error = false;

}

 

if (tep_session_is_registered('customer_id')) {

$from_name = $account_values['customers_firstname'] . ' ' . $account_values['customers_lastname'];

$from_email_address = $account_values['customers_email_address'];

} else {

$from_name = $HTTP_POST_VARS['yourname'];

$from_email_address = $HTTP_POST_VARS['from'];

}

 

if (!tep_session_is_registered('customer_id')) {

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && !tep_validate_email(trim($from_email_address))) {

$fromemail_error = true;

$error = true;

} else {

$fromemail_error = false;

}

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && empty($from_name)) {

$fromname_error = true;

$error = true;

} else {

$fromname_error = false;

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && ($error == false)) {

$email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);

$email_body = sprintf(TEXT_EMAIL_INTRO, $HTTP_POST_VARS['friendname'], $from_name, $HTTP_POST_VARS['products_name'], STORE_NAME) . "\n\n";

 

if (tep_not_null($HTTP_POST_VARS['yourmessage'])) {

$email_body .= $HTTP_POST_VARS['yourmessage'] . "\n\n";

}

 

$email_body .= sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n"). "<A HREF=\"".

HTTP_SERVER . DIR_WS_CATALOG ."\"><h3><i>".STORE_NAME."</A> "."\n";

"\n\n" . $mywishlist .= $wishlist_query_array[1] ."\n";

 

 

tep_mail($HTTP_POST_VARS['friendname'], $HTTP_POST_VARS['friendemail'], $email_subject, stripslashes($email_body), '', $from_email_address);

?>

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, stripslashes($HTTP_POST_VARS['products_name']), $HTTP_POST_VARS['friendemail']); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

</tr>

<?php

} else {

if (tep_session_is_registered('customer_id')) {

$your_name_prompt = $account_values['customers_firstname'] . ' ' . $account_values['customers_lastname'];

$your_email_address_prompt = $account_values['customers_email_address'];

} else {

$your_name_prompt = tep_draw_input_field('yourname', (($fromname_error == true) ? $HTTP_POST_VARS['yourname'] : $HTTP_GET_VARS['yourname']));

if ($fromname_error == true) $your_name_prompt .= ' ' . TEXT_REQUIRED;

$your_email_address_prompt = tep_draw_input_field('from', (($fromemail_error == true) ? $HTTP_POST_VARS['from'] : $HTTP_GET_VARS['from']));

if ($fromemail_error == true) $your_email_address_prompt .= ENTRY_EMAIL_ADDRESS_CHECK_ERROR;

}

?>

<tr>

<td><?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_WISHLIST_SEND, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])) . tep_draw_hidden_field('products_name', $product_info['products_name']); ?><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="formAreaTitle"><?php echo FORM_TITLE_CUSTOMER_DETAILS; ?></td>

</tr>

<tr>

<td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">

<tr>

<td class="main"><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo FORM_FIELD_CUSTOMER_NAME; ?></td>

<td class="main"><?php echo $your_name_prompt; ?></td>

</tr>

<tr>

<td class="main"><?php echo FORM_FIELD_CUSTOMER_EMAIL; ?></td>

<td class="main"><?php echo $your_email_address_prompt; ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td class="formAreaTitle"><br><?php echo FORM_TITLE_FRIEND_DETAILS; ?></td>

</tr>

<tr>

<td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">

<tr>

<td class="main"><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo FORM_FIELD_FRIEND_NAME; ?></td>

<td class="main"><?php echo tep_draw_input_field('friendname', (($friendname_error == true) ? $HTTP_POST_VARS['friendname'] : $HTTP_GET_VARS['friendname'])); if ($friendname_error == true) echo ' ' . TEXT_REQUIRED;?></td>

</tr>

<tr>

<td class="main"><?php echo FORM_FIELD_FRIEND_EMAIL; ?></td>

<td class="main"><?php echo tep_draw_input_field('friendemail', (($friendemail_error == true) ? $HTTP_POST_VARS['friendemail'] : $HTTP_GET_VARS['send_to'])); if ($friendemail_error == true) echo ENTRY_EMAIL_ADDRESS_CHECK_ERROR; ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td class="formAreaTitle"><br><?php echo FORM_TITLE_FRIEND_MESSAGE; ?></td>

</tr>

<tr>

<td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">

<tr>

<!-- hacked by chuck

<td><?php echo tep_draw_textarea_field('yourmessage', 'soft', 40, 8);?></td>

-->

<td><textarea name="yourmessage" cols=40 rows=8><?=$wishliststring;?></textarea></td>

</tr>

</table></td>

</tr>

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

</tr>

</table></td>

</tr>

</table></form></td>

</tr>

<?php

}

 

?>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Hi everybody!

 

Need some help with this contribution! I have installed it twice as I use it as a wishlist and as a favourite list.

 

The problem is that when I put an item to my wishlist it is registered to the the wishlist AND to the favourite list! :'(

 

It works the same way when I add a product to my favourite list it is registered both to the favourite list & the wishlist.

 

Here's the piece of code from my application top.

 

      case 'cust_order' :    if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

                              if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

                                } else {

                                  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

                                }

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                              break;

                             

                              //// module viewed products

    case 'viewed_remove' : $viewed->remove();

          break;

 

/// contrib buy two

  case 'buy_tinn' :   

        if (isset($HTTP_GET_VARS['products_id'])) {

        if (BUY_TWO_DISCOUNT_BUNDLE == 'normal') {

        if ($HTTP_GET_VARS['buy_tinn_add']) {

        $cart->add_cart($HTTP_GET_VARS['buy_tinn_add'],  $cart->get_quantity($HTTP_GET_VARS['buy_tinn_add']) +1);

      }

        if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

        tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .$HTTP_GET_VARS['products_id']));

      } else {

        $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id']) +1);

      }

        } elseif (BUY_TWO_DISCOUNT_BUNDLE =='discount') {

        $bundle_products_id = tep_set_bundle($HTTP_GET_VARS['products_id'],$HTTP_GET_VARS['buy_tinn_add'],BUY_TWO_BUNDLE_DISCOUNT_RATE);

        $cart->add_cart($bundle_products_id, $cart->get_quantity($bundle_products_id) +1);

      }

      }

        tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

      break;

     

/// contrib buy two

 

// Wish List 2.3 Start

// *****************************************

      // Remove item from the Wish List

      case 'remove_wishlist':

                              tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");

                              tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");

                              tep_redirect(tep_href_link(FILENAME_WISHLIST));

                              break;

                             

        // Remove item from the Favoris List

      case 'remove_favoris':

                              tep_db_query("delete from " . TABLE_FAVORIS . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");

                              tep_db_query("delete from " . TABLE_FAVORIS_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");

                              tep_redirect(tep_href_link(FILENAME_FAVORIS));

                              break;

                             

    } // end switch $HTTP_GET_VARS['action']

  } // end if is set $HTTP_GET_VARS['action']

 

 

  // Shopping cart actions through POST variables from forms

  if (isset($HTTP_POST_VARS['wishlist_action'])) {

    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled

    if ($session_started == false) {

      tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

    }

 

    $goto = basename($PHP_SELF);

    switch ($HTTP_POST_VARS['wishlist_action']) {

   

     

      // Customer wants to update the product quantity in their shopping cart

      case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

                                if ($HTTP_POST_VARS['products_id']) {

                                  if ($customer_id > 0) {

            // Queries below replace old product instead of adding to queatity.

                                    tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                    tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");

                                    tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                    // Read array of options and values for attributes in id[]

                                    if (isset ($id)) {

                                      foreach($id as $att_option=>$att_value) {

                                        // Add to customers_wishlist_attributes table

                                        tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");

                                      }

                                    }

                                  }

                                }

                              }

                              break;

                             

                             

                             

 

      case 'wishlist_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

                                if ($HTTP_POST_VARS['products_id']) {

                                if ($customer_id > 0) {

                                  // Read array of options and values for attributes in id[]

                                    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                                      $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

                                    }

                                    tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                                    break;

                                  }

                                }

                              }

                              break;

                             

     

                             

 

      // Wishlist Checkboxes

      case 'add_delete_products_wishlist':

                                      if (isset($HTTP_POST_VARS['add_wishprod'])) {

                                        if ($HTTP_POST_VARS['borrar'] == 0) {

                // 'borrar' form variable refers to deleting products in array $add_wishprod[] from wishlist

                                              foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {

                                                    if (ereg('^[0-9]+$', $value)) {

                                                    $cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);

                                                    }

                                              }

                                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                                        }

                                        if ($HTTP_POST_VARS['borrar'] == 1) {

                                              foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {

                                                    if (ereg('^[0-9]+$', $value)) {   

                                                    tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");

                                                    tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");

                                                  }

                                              }

                                            tep_redirect(tep_href_link(FILENAME_WISHLIST));

                                        }

                                      }

                                      break;

                                     

       

    }

  }

// end switch ($HTTP_POST_VARS['wishlist_action'])

 

// *****************************************

// Wish List 2.3 End

 

// Favoris begin

  //////////////////////////////

 

  // Shopping cart actions through POST variables from forms

  if (isset($HTTP_POST_VARS['favoris_action'])) {

    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled

    if ($session_started == false) {

      tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

    }

 

    $goto = basename($PHP_SELF);

    switch ($HTTP_POST_VARS['favoris_action']) {

   

     

      // Customer wants to update the product quantity in their shopping cart

      case 'add_favoris' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

                                if ($HTTP_POST_VARS['products_id']) {

                                  if ($customer_id > 0) {

            // Queries below replace old product instead of adding to queatity.

                                    tep_db_query("delete from " . TABLE_FAVORIS . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                    tep_db_query("insert into " . TABLE_FAVORIS . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");

                                    tep_db_query("delete from " . TABLE_FAVORIS_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                    // Read array of options and values for attributes in id[]

                                    if (isset ($id)) {

                                      foreach($id as $att_option=>$att_value) {

                                        // Add to customers_favoris_attributes table

                                        tep_db_query("insert into " . TABLE_FAVORIS_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");

                                      }

                                    }

                                  }

                                }

                              }

                              break;

                             

                             

                             

 

      case 'favoris_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

                                if ($HTTP_POST_VARS['products_id']) {

                                if ($customer_id > 0) {

                                  // Read array of options and values for attributes in id[]

                                    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                                      $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

                                    }

                                    tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                                    break;

                                  }

                                }

                              }

                              break;

                             

     

                             

 

      // favoris Checkboxes

      case 'add_delete_products_favoris':

                                      if (isset($HTTP_POST_VARS['add_favorisprod'])) {

                                        if ($HTTP_POST_VARS['borrar'] == 0) {

                // 'borrar' form variable refers to deleting products in array $add_favorisprod[] from favoris

                                              foreach ($HTTP_POST_VARS['add_favorisprod'] as $value) {

                                                    if (ereg('^[0-9]+$', $value)) {

                                                    $cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);

                                                    }

                                              }

                                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                                        }

                                        if ($HTTP_POST_VARS['borrar'] == 1) {

                                              foreach ($HTTP_POST_VARS['add_favorisprod'] as $value) {

                                                    if (ereg('^[0-9]+$', $value)) {   

                                                    tep_db_query("delete from " . TABLE_FAVORIS . " where products_id = $value and customers_id = '" . $customer_id . "'");

                                                    tep_db_query("delete from " . TABLE_FAVORIS_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");

                                                  }

                                              }

                                            tep_redirect(tep_href_link(FILENAME_FAVORIS));

                                        }

                                      }

                                      break;

                                     

       

    }

  }

 

// favoris End

 

// include the who's online functions[/color]

 

... and also the piece of code I use in my product_info, hope someone would be able to bring me some help. Thanks in advance :

 

product info

<tr>

                  <td>

                  <div align="right">

                    <?php echo tep_draw_hidden_field('favoris_action', 'add_favoris')

                    . tep_image_submit('button_bookmark.gif', IMAGE_BUTTON_ADD_FAVORIS, 'onClick="document.cart_quantity.action=\''

                    . FILENAME_FAVORIS . '\';document.cart_quantity.submit();"'. ' action=add_favoris'); ?></div>

                  </td>

                </tr>

                <tr>

                  <td>

                  <div align="right">

                    <?php echo tep_draw_hidden_field('wishlist_action', 'add_wishlist')

                    . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST, 'onClick="document.cart_quantity.action=\''

                    . FILENAME_WISHLIST . '\';document.cart_quantity.submit();"'. ' action=add_wishlist'); ?></div>

                  </td>

                </tr>

 

I really don't find out what's wrong ! :blink:

Edited by mujina

OSC2.2

Link to comment
Share on other sites

Hi,

 

I had a problem with the above contributions and I sincerely hope that anyone can help me. I installed the product attributes option type feature and wishlist contributions. They all work fine except that when I log-in as a member to add a product into the wishlist, the attributes with text are not show in the wishlist and not showing in the shopping cart if you move the product from wishlist. Product attributes with drop down selection are shown correctly but not for text option and text area option.

 

Can anyone help me on this? Thank you.

 

The partial wishlist.php is shown below:

 

<td width="50%" valign="top" align="center" class="smallText"><div align="center"><b><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?>"><?php echo $products['products_name']; ?></a></b></div><br>

<a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?>"><?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?></a><br>

<?php

// Begin Wish List Code w/Attributes

$attributes_addon_price = 0;

 

// Now get and populate product attributes

if ($customer_id > 0) {

$wishlist_products_attributes_query = tep_db_query("select products_options_id as po, products_options_value_id as pov from " . TABLE_WISHLIST_ATTRIBUTES . " where customers_id='" . $customer_id . "' and products_id = '" . $products['products_id'] . "'");

while ($wishlist_products_attributes = tep_db_fetch_array($wishlist_products_attributes_query)) {

// We now populate $id[] hidden form field with product attributes

echo tep_draw_hidden_field('id['.$products['products_id'].']['.$wishlist_products_attributes['po'].']', $wishlist_products_attributes['pov']);

// And Output the appropriate attribute name

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . $products['products_id'] . "'

and pa.options_id = '" . $wishlist_products_attributes['po'] . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $wishlist_products_attributes['pov'] . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'");

$attributes_values = tep_db_fetch_array($attributes);

if ($attributes_values['price_prefix'] == '+')

{ $attributes_addon_price += $attributes_values['options_values_price']; }

else if ($attributes_values['price_prefix'] == '-')

{ $attributes_addon_price -= $attributes_values['options_values_price']; }

// Display product attributes

echo '<br><small><i>- ' . $attributes_values['products_options_name'] . ':<b> ' . $attributes_values['products_options_values_name'] . '</b></i></small>'; } // end while attributes for product

Edited by akkinmore
Link to comment
Share on other sites

Make sure you've declared TABLE_FAVORIS, TABLE_FAVORIS_ATTRIBUTES and TABLE_WISHLIST, TABLE_WISHLIST_ATTRIBUTES to be two different tables (in includes/database_tables.php). Example:

 

// Wishlist

define('TABLE_WISHLIST', 'customers_wishlist');

// Wish List w/Attributes

define('TABLE_WISHLIST_ATTRIBUTES', 'customers_wishlist_attributes');

// Favorites

define('TABLE_FAVORIS', 'customers_favorite');

// Favorites w/Attributes

define('TABLE_FAVORIS_ATTRIBUTES', 'customers_favorite_attributes');

 

To actually create the tables in OsCommerce, modify the sql file replacing the names of the database table to customers_favorite and customers_favorite_attributes. Good luck!

 

~Jorge

 

Hi everybody!

 

Need some help with this contribution! I have installed it twice as I use it as a wishlist and as a favourite list.

 

The problem is that when I put an item to my wishlist  it is registered to the the wishlist AND to the favourite list! :'(

 

It works the same way when I add a product to my favourite list it is registered both to the favourite list & the wishlist.

 

Here's the piece of code from my application top.

... and also the piece of code I use in my product_info, hope someone would be able to bring me some help. Thanks in advance :

 

product info

I really don't find out what's wrong ! :blink:

Link to comment
Share on other sites

Hi Jorgeo! thanks for your reply.

 

It seems that I made no mistake as my "DEFINE" are ok. Do you see something strange in my files? Or maybe it is a contribution that can't be installed twice as it generates conflicts within application top file :huh:

 

Thanks!

 

mujina

OSC2.2

Link to comment
Share on other sites

Hello!!!

 

Well, I've decided to try to permit the wishlist to be shared between customers or visitors logged. I'll need some help with php code as I'm a real real newbie. :-"

 

Here's how I think we could proceed :

 

- create an entry in the customer account : ask customers if they want their wishlist to be shared when they'll create one. Thus, when a customer create an account he is asked for his name, his address etc AND if he accepts to share its wishlist.

 

 

- create a new entry in customers table : show_wishlist with binarie value (0 or 1).

0 for he refuses

1 for he accepts

 

- create a new page wich can only be accessed if the visitor or customer is logged : for instance wishlist_share.php

-> query : $share_query = call for c.customers_id, c.customers_firstname, cw.customers_id etc from c.customers_table & cw.customers_wishlist_table...

 

sorry I don't know how to build it :blush:

 

Next : call for all products with the same customers_id in customers_wishlist TABLE

 

Then in wishlist_share we'll have:

 

If the entry show_wishlist from CUSTOMERS_TABLE = 1 (ie the customer accept to have its wishlist displayed on the shared page.) DISPLAY :

 

CUSTOMER1 FIRST NAME == LIST OF PRODUCTS (linked to its product_info.php page)

CUSTOMER2 FIRST NAME == LIST OF PRODUCTS

CUSTOMER3 FIRST NAME == LIST OF PRODUCTS

CUSTOMERXXX FIRST NAME == LIST OF PRODUCTS

CUSTOMERXXX FIRST NAME == LIST OF PRODUCTS

 

I'll be glad to work on it if some masters of PHP are ready to help. This is a very good contribution it would be great to enhance it! :thumbsup:

 

Waiting for your replies! :D

 

mujina

OSC2.2

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...