Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 2.0 Support Thread


defender39

Recommended Posts

PHP newb here.  I bet you love hearing those words :P

 

I'm not totally new, I am getting better with PHP so I might not be a lost cause.

 

Anyway, I would like to have the add to wishlist button displayed even when you're not logged in.  Of course when they click on it I would want them redirected to the log in page.

 

Can someone give me a hand with that?

 

PS-Great contrib by the way, even if I can't get the above done it's still great as is.

Anyone :(

Go New England Patriots!!!!

Link to comment
Share on other sites

Anyone  :(

 

In catalog/product_info.php

 

Change:

                <!-- begin mod for Wishlist v2.2 -->
               <td align="left" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>
               <!-- end mod for Wishlist v2.2 -->

 

to:

 

                <!-- begin mod for Wishlist v2.2 -->
               <td align="left" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>
               <!-- end mod for Wishlist v2.2 -->

Link to comment
Share on other sites

In catalog/product_info.php

 

Change:

 ? ? ? ? ? ? ? ?<!-- begin mod for Wishlist v2.2 -->
? ? ? ? ? ? ? ?<td align="left" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>
? ? ? ? ? ? ? ?<!-- end mod for Wishlist v2.2 -->

 

to:

 

 ? ? ? ? ? ? ? ?<!-- begin mod for Wishlist v2.2 -->
? ? ? ? ? ? ? ?<td align="left" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>
? ? ? ? ? ? ? ?<!-- end mod for Wishlist v2.2 -->

Thank you so much :D Great mod :thumbsup:

Go New England Patriots!!!!

Link to comment
Share on other sites

Ok, the Product Attributes Add-On to the Wish List v2.2 is ready!

http://www.oscommerce.com/community/contributions,1682

 

Notice that this is only an Add-on to the current Wish List contribution. The snapshot I had was Wish List 2.2 (Talon177) - 01 April 2004, so the instructions might vary a little bit depending on your installation.

Link to comment
Share on other sites

Ok, the Product Attributes Add-On to the Wish List v2.2 is ready!

http://www.oscommerce.com/community/contributions,1682

 

Notice that this is only an Add-on to the current Wish List contribution. The snapshot I had was Wish List 2.2 (Talon177) - 01 April 2004, so the instructions might vary a little bit depending on your installation.

 

 

OH BOY!!! I am all over this one!!! I'll install it tonight and give ya'll a heads up on how it goes.

 

Jorgeo, THANK YOU!!!!!!!!!!

 

Doug

Link to comment
Share on other sites

Just installed the Wishlist 2.2 Contribution that supports product attributes. The previous Wishlist mod worked perfectly, but I am having a coding problem with the infobox on this one. I had fairly heavily modified the original infobox design, so this code is not standard. Could someone take a look and tell me why I am getting the following error message? Thanks!

 

ERROR MESSAGE:

Parse error: parse error, unexpected T_STRING in /home/username/public_html/store/includes/boxes/wishlist.php on line 46

 

 

<?php
/*
 $Id: wishlist.php,v 1.1 2002/07/01 13:52:20 mattice Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce
*/

// retreive the wishlist
 // $wishlist_query = tep_db_query("select * from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id");
 $wishlist_query_raw = "select * from " . TABLE_WISHLIST . " WHERE customers_id = $customer_id order by products_name";
 $wishlist_query = tep_db_query($wishlist_query_raw);


?>
<!-- wishlist //-->
         <tr>
           <td>

<?php
   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'left',
                                'text'  => BOX_HEADING_CUSTOMER_WISHLIST
                               );
   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_WISHLIST, '','NONSSL'));

   $info_box_contents = array();

 if (tep_db_num_rows($wishlist_query)) {
if (tep_db_num_rows($wishlist_query) < MAX_DISPLAY_WISHLIST_BOX) {
   $product_ids = '';
   while ($wishlist = tep_db_fetch_array($wishlist_query)) {
     $product_ids .= $wishlist['products_id'] . ',';
   }
   $product_ids = substr($product_ids, 0, -1);

   $customer_wishlist_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . "\n";
   $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . $languages_id . "' order by products_name");
   while ($products = tep_db_fetch_array($products_query)) {


     $customer_wishlist_string .= '  <tr>' . "\n" .
                                  '    <td class="smallText" valign="middle"><span class="menulinkleft"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL') . '">' . $products['products_name'] . '</a></span></td>' . "\n" .

// BoF Modification by: R. Siebert (VINI & VITA)
                               '    <td class="infoBoxContents" align="right" valign="middle" width="24"><a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id'] . '&rfw=1', 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'cart.gif', ICON_CART) . '</a>' . "\n" .
          '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=remove_wishlist&pid=' . $products['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'nocart.gif', ICON_NO_CART) . '</a></td>' . "\n" .

// Begin Wish List Code w/Attributes
'<tr><td>'
tep_draw_form('product_' . $products['products_id'], tep_href_link(FILENAME_WISHLIST)) . tep_draw_hidden_field('products_id', $products['products_id']) . tep_draw_hidden_field('wishlist_action', 'wishlist_add_cart');

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[] with products
$customer_wishlist_string .= tep_draw_hidden_field('id[' . $wishlist_products_attributes['po'] . ']', $wishlist_products_attributes['pov']);
                                       }
                                   }
'</a></form>' . tep_draw_separator('pixel_black.gif', '100%', '1') . '</td>' . "\n";
// EoF Modification by: R. Siebert (VINI & VITA)

   }
    } else {

   $customer_wishlist_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . "\n";
$customer_wishlist_string .= '<tr><td class="infoBoxContents">' . sprintf(TEXT_WISHLIST_COUNT, tep_db_num_rows($wishlist_query)) . '</td></tr>' . "\n";
  }
} else {
   $customer_wishlist_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . "\n";
$customer_wishlist_string .= '<tr><td class="infoBoxContents">' . BOX_WISHLIST_EMPTY . '</td></tr>' . "\n";
 }
   $customer_wishlist_string .= '<tr><td colspan="3" align="left" class="smallText"><br><a href="' . tep_href_link(FILENAME_WISHLIST, '','NONSSL') . '">' . BOX_LINK_WISHLIST . '</a></td></tr>' . "\n";
//    $customer_wishlist_string .= '<tr><td colspan="3" align="right" class="smallText"><a href="javascript:popupWindowWishlist(\'' . tep_href_link('popup_' . FILENAME_WISHLIST_HELP, '','NONSSL') . '\')"><u>'. BOX_HEADING_CUSTOMER_WISHLIST . ' Help</u> [?]</a></td></tr>' . "\n"; // Popup link
   $customer_wishlist_string .= '<tr><td colspan="3" align="left" class="smallText"><a href="' . tep_href_link(FILENAME_WISHLIST_HELP, '','NONSSL') . '">' . BOX_HEADING_CUSTOMER_WISHLIST_HELP . '</a></td></tr>' . "\n"; // Normal link
   $customer_wishlist_string .= '</table>';

   $info_box_contents[] = array('align' => 'left',
                                'text'  => $customer_wishlist_string);

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- wishlist_eof //-->

Link to comment
Share on other sites

ERROR MESSAGE:

Parse error: parse error, unexpected T_STRING in /home/username/public_html/store/includes/boxes/wishlist.php on line 46

// Begin Wish List Code w/Attributes
'<tr><td>'
tep_draw_form('product_' . $products['products_id'], tep_href_link(FILENAME_WISHLIST)) . tep_draw_hidden_field('products_id', $products['products_id']) . tep_draw_hidden_field('wishlist_action', 'wishlist_add_cart');

 

My guess is that you forgot the add '.' to concatenate the string after '<tr><td>', so change the above code to:

 

// Begin Wish List Code w/Attributes
'<tr><td>'.
tep_draw_form('product_' . $products['products_id'], tep_href_link(FILENAME_WISHLIST)) . tep_draw_hidden_field('products_id', $products['products_id']) . tep_draw_hidden_field('wishlist_action', 'wishlist_add_cart');

Link to comment
Share on other sites

Jorgeo

 

Thanks for adding the wishlist.php addon. I've added it in and so far I've come up with one issue:

 

I added a product without any attributes to be chosen. When I added it, it took me to my wishlist page and successfully added it in. HOWEVER there was an error message at the top of the page:

 

Warning: Invalid argument supplied for foreach() in /home/audiocav/public_html/store/includes/application_top.php on line 550

 

Lines 449-450 in application_top.php are:

 

// Now we have an array of options and values for attributes in id[]

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

 

Cheers

Link to comment
Share on other sites

Issue # 2 (revised)

 

DId some more testing and found out it's not a problem with items that don't have attributes. Rather, if you don't add in a message in the message field (when emailing to a friend), no products will be displayed.

 

Jorgeo

 

Issue # 2

 

When a product without attributes is added onto the wishlist, I've tried to use the 'email to a friend'.  However the email has no products in it at all...

Link to comment
Share on other sites

Lines 449-450 in application_top.php are:

 // Now we have an array of options and values for attributes in id[]
                                   foreach($id as $att_option=>$att_value) {

 

Ah, I must have overlooked that case in which the product has no attributes. I have warnings turned off through STS, so no wonder I missed it. My gut feeling tells me that you should put an if statement around it like this

 // Now we have an array of options and values for attributes in id[]
                                  if (isset ($id)) {
                                    foreach($id as $att_option=>$att_value) {
                                         // stuff here
                                    } 
                                  }

 

Also, I'll leave the wishlist email unmodified for now. If someone would like to print what the product attributes where in the email, it'll probably look really similar to the code found in catalog/wishlist.php

Link to comment
Share on other sites

Hi, great contrib, but with the last addon I've 1 problem, if I try to add the product to the wishlist with this code in product info

        <td align="center" class="main"><?php if (tep_session_is_registered('customer_id')) 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>

I've an error on the document.cart_quantity

 

I've also installed master product and in the same file I've this

	<?php  echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?>

instead of

	<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

If I restore the original function, when I add any product to a wish list I'm redirect to login page (but I've already make a logon) and the product was't add to the wish list...

 

Any idea?

 

If you want I can report some file, like as application top or product info...

 

Tnx, jo.

Link to comment
Share on other sites

Hi, great contrib, but with the last addon I've 1 problem, if I try to add the product to the wishlist with this code in product info

 

I've an error on the document.cart_quantity

 

Tnx, jo.

 

The document.cart_quantity line is a javascript trick to make *one* form submit to either one of *two* different pages (one sends info to the shopping cart, the other one sends info to the wish list)., according to the submit button pressed.

 

By default, the name of the form with all the product info is "cart_quantity". change document.cart_quantity to document.[your_form_name_here]. I believe this might be "buy_now_"

 

Note to developers:

It'll probably be better to have a whole different form for the 'Add to Wishlist button'. I used the already existing form and added a button that redirected to FILENAME_WISHLIST

Link to comment
Share on other sites

The document.cart_quantity line is a javascript trick to make *one* form submit to either one of *two* different pages (one sends info to the shopping cart, the other one sends info to the wish list)., according to the submit button pressed.

 

By default, the name of the form with all the product info is "cart_quantity". change document.cart_quantity to document.[your_form_name_here]. I believe this might be "buy_now_"

 

Note to developers:

It'll probably be better to have a whole different form for the 'Add to Wishlist button'. I used the already existing form and added a button that redirected to FILENAME_WISHLIST

 

 

Ok, now the button works, tnx jorgeo, but the laste error persist, when I add any item to the wishlist, I return to the login page. Note: I'm already logged to the shop....

Link to comment
Share on other sites

Ok, now the button works, tnx jorgeo, but the laste error persist, when I add any item to the wishlist, I return to the login page. Note: I'm already logged to the shop....

 

 

Hey guys,

 

Just got everything install with the wishlist/ w attributes.

before attributes install all was well and working, but now I am having the same error. If I am not logged in then I go to login page on trying to add to wishlist (good), but if I am already logged in and try to add to wishlist, then I also go to the login page, and nothing getts to the wishlist. I just keep going in a loop.

 

Wondering if this has to do with:

 

4- catalog/product_info.php

// Below code will submit a form with associated product attributes to the wishlist file

// through POST variables instead of just appending the product_id to URL query

 

~LOOK FOR previous Wish List contribution:

<!-- begin mod for Wishlist v2.2 -->

<td align="left" class="main"><?php if (tep_session_is_registered('customer_id')) echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>

<!-- end mod for Wishlist v2.2 -->

 

OR if you don't require login to show wishlist button, it should look like this:

 

<!-- begin mod for Wishlist v2.2 -->

<td align="left" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td>

<!-- end mod for Wishlist v2.2 -->

 

~CHANGE TO:

<!-- Begin Wish List Code w/Attributes-->

<td align="center" class="main"><?php if (tep_session_is_registered('customer_id')) 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>

<!-- End Wish List Code w/Attributes-->

 

OR if you don't require login:

 

<!-- Begin Wish List Code w/Attributes-->

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

<!-- End Wish List Code w/Attributes-->

 

 

I am no PHP wizard or anything even close, but since this part "seems" to deal with logged in status, and that "seems" to be the trouble it is where I am looking (haven't a clue what I am looking for, but looking LOL)

 

Could someone give it a look over and see what could be causing this?

 

THANKS!

and AWSOME addon to a Great contribution----> THANK YOU!

 

Doug

Link to comment
Share on other sites

Hmmm, I'm not sure what the issue with the login is. My guesses:

 

1- The wishlist button is not located inside the product form: With the previous version, you could put the button anywhere. With this version, is has to be located inside the form

 

2- It might be that your sessions are being stored in cookies, I use a database to store them. This option is located in catalog/includes.configure.php:

  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

osCommerce should still be able to handle them transparently, but maybe not

 

3- Also, I'm using the secure autologin contribution:

http://www.oscommerce.com/community/contributions,2087

This might be another issue.

Link to comment
Share on other sites

Jorge,

 

Here's something I've found, you can't add two products that are the same but with different attributes. Such as, one candle with a strawberry scent and another with a cinnamon scent. The latter overrides the first in the wishlist, even though they are two seperate products. Any ideas?

Link to comment
Share on other sites

Hmmm, I'm not sure what the issue with the login is. My guesses:

 

1- The wishlist button is not located inside the product form: With the previous version, you could put the button anywhere. With this version, is has to be located inside the form

 

2- It might be that your sessions are being stored in cookies, I use a database to store them. This option is located in catalog/includes.configure.php:

 ?define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

osCommerce should still be able to handle them transparently, but maybe not

 

3- Also, I'm using the secure autologin contribution:

http://www.oscommerce.com/community/contributions,2087

This might be another issue.

 

 

Howdy,

 

here is an update to my situation:

 

I went ahead and uploaded everything to my web store (I have a local machine that I test run everything on 1st), anyway on the web store all is well, no log in problem loop at all..go figure, the local machine still does the loop for some reason. Anyway when I did the upload I noticed I was now having this same problem

QUOTE(Predd0 @ Oct 7 2004, 01:05 AM)

Lines 449-450 in application_top.php are:

CODE// Now we have an array of options and values for attributes in id[]

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

 

 

 

 

 

 

Ah, I must have overlooked that case in which the product has no attributes. I have warnings turned off through STS, so no wonder I missed it. My gut feeling tells me that you should put an if statement around it like this

CODE

// Now we have an array of options and values for attributes in id[]

if (isset ($id)) {

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

// stuff here

}

}

 

 

So I followed your directions and...IT WORKS! I did have to drop the 2nd "}" in your code though (the one on the very last line), now I don't seem to be getting that error anymore. I'll keep my figures crossed and let you know of anything else that happens.

 

THANKS!!!

doug

Link to comment
Share on other sites

Ok very strange now,

 

I just noticed that on the web store, the option is not going over to the wishlist. I see the product picture, and price (not adjusted with option).

 

any ideas?

Link to comment
Share on other sites

Jorge,

 

  Here's something I've found, you can't add two products that are the same but with different attributes. Such as, one candle with a strawberry scent and another with a cinnamon scent. The latter overrides the first in the wishlist, even though they are two seperate products. Any ideas?

 

Yeah, I was aware of that. Supporting this feature might be pretty difficult, hopefully someone else will be able to help to the contribution by fixing this

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