dblake Posted March 4, 2005 Share Posted March 4, 2005 (edited) Why dont you do this instead. Your code should be somehting like this: if (tep_session_is_registered('customer_id')) { require(wishlist); } Right? Just make a new box., we will call it, please login box. Anyway add this to your code like so: if (tep_session_is_registered('customer_id')) { require(wishlist); } else { require(please-login-box); } Then make the box look and say whatever you want. Edited March 4, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
Guest Posted March 4, 2005 Share Posted March 4, 2005 Ahhhh good idea...I'l give it a go tomorrow...thanks for your help Dennis... ~Danny Quote Link to comment Share on other sites More sharing options...
dblake Posted March 4, 2005 Share Posted March 4, 2005 No prob. Have fun ;) Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 6, 2005 Share Posted March 6, 2005 NOW AVAILABLE: v2.4 Changes and clean up on the layout of the wish list page to a more streamlined and easier to view list (or so I think) most noticebly when you have two or more wish items. It also moves the configuration values to admin instead of admin/configure.php, and adds my wish list link to My Account page. Upgrade instructions from 2.3.0 & 2.3.1 included. A minor thing thing that still needs to be fixed and it existed in all prior versions as well; maybe someone else can come up with a solution to this? -> Fix My wish list so when you click on an item and have to log in it does not loose the item you clicked on and instead adds it to your wish list. Another feature that would be nice if anyone has the time to code it is: -> Move send wish list email page entirely to bottom of wish list page to make it one step less for the customer (more likely to use). Enjoy! :D Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
dblake Posted March 7, 2005 Share Posted March 7, 2005 (edited) -> Fix My wish list so when you click on an item and have to log in it does not loose the item you clicked on and instead adds it to your wish list.Another feature that would be nice if anyone has the time to code it is: <{POST_SNAPBACK}> I posted this fix a while back. It really needs to be moved from app_top but its a fix nonetheless. Paste this on wishlist.php underneathe the check to see if the user is logged in like so... if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } //ADDED FOR WHEN USERS ARE NOT LOGGED IN TO KEEP THE PRODUCT_ID if ($HTTP_POST_VARS['products_id']) { if ($customer_id > 0) { // Queries below replace old product instead of adding to quantity. 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 . "' )"); } } } } //END OF ADDITION -> Move send wish list email page entirely to bottom of wish list page to make it one step less for the customer (more likely to use). <{POST_SNAPBACK}> I don't think this is necessary. It would just be adding more to that page that really isn't necessary. IF they want to send it to there friend, the extra step won't bother them. Edited March 7, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 7, 2005 Share Posted March 7, 2005 That fix worked like a charm dblake. I'm posting an update to the contrib now as its definately worth including! Thanks! Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
homewetbar Posted March 7, 2005 Share Posted March 7, 2005 I guess I spoke to soon, upon further testing it does not seem to be working the fix for unregistered users.... Paste in wishlist.php right? Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
dblake Posted March 7, 2005 Share Posted March 7, 2005 Yes you are right. Well a variable needs to be registered as the product id, basically. If you want to be my test bunny, I'll give you some code that I think will work. Quote Link to comment Share on other sites More sharing options...
dblake Posted March 7, 2005 Share Posted March 7, 2005 (edited) Try this, I think I am doing this right, guess we will find out eh? if (!tep_session_is_registered('customer_id')) { $SESSION_WISHLIST = $HTTP_POST_VARS['products_id']; tep_session_register('SESSION_WISHLIST'); $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } //ADDED FOR WHEN USERS ARE NOT LOGGED IN TO KEEP THE PRODUCT_ID if(tep_session_is_registered('SESSION_WISHLIST') { if ($customer_id > 0) { // Queries below replace old product instead of adding to quantity. tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )"); tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $att_option . "', '" . $att_value . "' )"); } } } tep_session_unregister('SESSION_WISHLIST'); } //END OF ADDITION Edited March 7, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
dblake Posted March 7, 2005 Share Posted March 7, 2005 Wait let me revise that Quote Link to comment Share on other sites More sharing options...
dblake Posted March 7, 2005 Share Posted March 7, 2005 (edited) Ok try that. Make sure it adds the right product each time. Edited March 7, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
Guest Posted March 7, 2005 Share Posted March 7, 2005 (edited) why if i try to add a product in wish list i alway receive login box? (this also if i have already logged in) Edited March 7, 2005 by lobotomia Quote Link to comment Share on other sites More sharing options...
jbretel Posted March 7, 2005 Share Posted March 7, 2005 why if i try to add a product in wish list i alway receive login box? (this also if i have already logged in) <{POST_SNAPBACK}> Hi Lobotomia - see my previous fix and explanation for including the tep_href prefix - some pages back - or download the amended Product_info.php page from the contributions page ! Regards JB Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 8, 2005 Share Posted March 8, 2005 Try this, I think I am doing this right, guess we will find out eh? ?if (!tep_session_is_registered('customer_id')) { ? $SESSION_WISHLIST = $HTTP_POST_VARS['products_id']; ? tep_session_register('SESSION_WISHLIST'); ? $navigation->set_snapshot(); ? tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } //ADDED FOR WHEN USERS ARE NOT LOGGED IN TO KEEP THE PRODUCT_ID if(tep_session_is_registered('SESSION_WISHLIST') { if ($customer_id > 0) { // Queries below replace old product instead of adding to quantity. tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )"); tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $att_option . "', '" . $att_value . "' )"); ?} ?} } tep_session_unregister('SESSION_WISHLIST'); } //END OF ADDITION <{POST_SNAPBACK}> Humm that doesn't work, it just times out... Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
dblake Posted March 8, 2005 Share Posted March 8, 2005 You should of gotten an error with that code. I have tested this and this worked for me. if (!tep_session_is_registered('customer_id')) { $SESSION_WISHLIST = $HTTP_POST_VARS['products_id']; tep_session_register('SESSION_WISHLIST'); $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } //ADDED FOR WHEN USERS ARE NOT LOGGED IN TO KEEP THE PRODUCT_ID if(tep_session_is_registered('SESSION_WISHLIST')) { // Queries below replace old product instead of adding to quantity. tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )"); tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $att_option . "', '" . $att_value . "' )"); } } tep_session_unregister('SESSION_WISHLIST'); } //END OF ADDITION Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 8, 2005 Share Posted March 8, 2005 You should of gotten an error with that code. I have tested this and this worked for me. ?if (!tep_session_is_registered('customer_id')) { ?$SESSION_WISHLIST = $HTTP_POST_VARS['products_id']; ?tep_session_register('SESSION_WISHLIST'); ?$navigation->set_snapshot(); ?tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } //ADDED FOR WHEN USERS ARE NOT LOGGED IN TO KEEP THE PRODUCT_ID if(tep_session_is_registered('SESSION_WISHLIST')) { ?// Queries below replace old product instead of adding to quantity. ?tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )"); ?tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $SESSION_WISHLIST . "' 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 . "', '" . $SESSION_WISHLIST . "', '" . $att_option . "', '" . $att_value . "' )"); ? } ?} tep_session_unregister('SESSION_WISHLIST'); } //END OF ADDITION <{POST_SNAPBACK}> Excellent you've done it! In all my tests it worked! Nice work dblake. I'll wait a couple of days and see if anyone has any problems and then post it to the contrib. Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
dblake Posted March 8, 2005 Share Posted March 8, 2005 your welcome ;) Quote Link to comment Share on other sites More sharing options...
DPB Posted March 8, 2005 Share Posted March 8, 2005 Hi Lobotomia - see my previous fix and explanation for including the tep_href prefix - some pages back - or download the amended Product_info.php page from the contributions page ! Regards JB <{POST_SNAPBACK}> Hi JB - I installed the latest release on a clean install and I have the same problem. Then transfered from Product_info.php to wishlist.php the logged on information gets lost and one is presentented wih a logon screen again. Any ideas - I have verified the code more than once and can't seem to find anything wrong. Quote Link to comment Share on other sites More sharing options...
dblake Posted March 8, 2005 Share Posted March 8, 2005 Thats because the install directions weren't updated when homewetbar uploaded his new version, or w/e... Change this: <!-- Wish List 2.3 Start --> <td align="center" class="main"><?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'); ?></td> <!-- Wish List 2.3 End --> to this: <!-- Wish List 2.3 Start --> <td align="center" class="main"><?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=\''. tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '\';document.cart_quantity.submit();"'); ?></td> <!-- Wish List 2.3 End --> on product_info.php ;) Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 8, 2005 Share Posted March 8, 2005 Thats because the install directions weren't updated when homewetbar uploaded his new version, or w/e... Change this: ? ? ? ? ? ? ? ?<!-- Wish List 2.3 Start --> ? ? ? ? ? ? ? ?<td align="center" class="main"><?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'); ?></td> ? ? ? ? ? ? ? ?<!-- Wish List 2.3 End ? --> to this: ? ? ? ? ? ? ? ?<!-- Wish List 2.3 Start --> ? ? ? ? ? ? ? ?<td align="center" class="main"><?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=\''. tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '\';document.cart_quantity.submit();"'); ?></td> ? ? ? ? ? ? ? ?<!-- Wish List 2.3 End ? --> on product_info.php ;) <{POST_SNAPBACK}> Humm I did not need to use this modified code, I have the prior and it works great. What does the modified code do differently and why does the old code work for me and not him do you think dblake? Are you using the newer code or the older one dblake? Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
dblake Posted March 8, 2005 Share Posted March 8, 2005 The older one works fine for me but it wont work for other people. Due to server configurations or whatever. Anyway the "tep_href_link" function keeps all links in tact with sessions. Basically because its a "raw" link without the session appended to it, it loses its session and therefore your login info. It thinks you have left the site and therefore your session is lost. Hard to explain, but does that make sense? Quote Link to comment Share on other sites More sharing options...
dblake Posted March 8, 2005 Share Posted March 8, 2005 Anyway, the new way is the "proper" way to do it and therefore that update should be added in with any new release that is put out. Quote Link to comment Share on other sites More sharing options...
homewetbar Posted March 9, 2005 Share Posted March 9, 2005 Makes sense, I'll include that fix and the other fix we were working on and post an update to the contribution tonight. Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
DPB Posted March 9, 2005 Share Posted March 9, 2005 Anyway, the new way is the "proper" way to do it and therefore that update should be added in with any new release that is put out. <{POST_SNAPBACK}> Hi dblake, thanks for the help. Something else to look at (before posting an update) - the SQL script wishlist.sql has an error. :) The error is in the insert part of the script - the current code is : INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List', 'MAX_DISPLAY_WISHLIST_PRODUCTS', '12', 'How many wish list items to show per page on the main wishlist.php file', '3', '', NULL , '0000-00-00 00:00:00', NULL , 'NULL' ); INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List Box', 'MAX_DISPLAY_WISHLIST_BOX', '4', 'How many wish list items to display in the infobox before it changes to a counter', '3', '', NULL , '0000-00-00 00:00:00', NULL , 'NULL' ); the last NULL value has quotes (for both records being inserted) and should not have them - should be : INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List', 'MAX_DISPLAY_WISHLIST_PRODUCTS', '12', 'How many wish list items to show per page on the main wishlist.php file', '3', '', NULL , '0000-00-00 00:00:00', NULL , NULL ); INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Max Wish List Box', 'MAX_DISPLAY_WISHLIST_BOX', '4', 'How many wish list items to display in the infobox before it changes to a counter', '3', '', NULL , '0000-00-00 00:00:00', NULL , NULL ); Regard Danie Quote Link to comment Share on other sites More sharing options...
squeakyfreak Posted March 13, 2005 Share Posted March 13, 2005 (edited) Hi, sorry if this has already been covered before but I'm having a few problems with the wishlist. I have installed the latest version available (2.4a?) on MS2, not a vanilla version, I have a few more contributions installed. The wishlist seems to work fine until you view it. I get the list telling me "Displaying 1 to 3 (of 3 items on your wishlist)" but above that there are no items! Has anyone else had these problems? test site online: http://allycatmetalware.com/osc_test/index.php you can log in with the following details: email= [email protected] password = password Edited March 13, 2005 by squeakyfreak Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.