Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 2.0 Support Thread


defender39

Recommended Posts

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 by dblake
Link to comment
Share on other sites

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

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

-> 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:

 

 

 

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).

 

 

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 by dblake
Link to comment
Share on other sites

That fix worked like a charm dblake. I'm posting an update to the contrib now as its definately worth including!

 

Thanks!

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

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?

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

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 by dblake
Link to comment
Share on other sites

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 by lobotomia
Link to comment
Share on other sites

why if i try to add a product in wish list i alway receive login box? (this also if i have already logged in)

 

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

Link to comment
Share on other sites

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

 

 

Humm that doesn't work, it just times out...

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

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

Link to comment
Share on other sites

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

 

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.

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

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

 

 

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.

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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 ;)

 

 

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?

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

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?

Link to comment
Share on other sites

Makes sense, I'll include that fix and the other fix we were working on and post an update to the contribution tonight.

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

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.

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

Link to comment
Share on other sites

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 by squeakyfreak
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...