Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist 3.0 Support Thread


dblake

Recommended Posts

I just DL the contribution today, so i should be the newest.

 

Got this at the bottom in catalog/includes/classes/wishlist.php

 

function count_wishlist() { // get total number of items in wishlist

$total_items = 0;

if (is_array($this->wishID)) {

reset($this->wishID);

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

$total_items++;

}

}

Link to comment
Share on other sites

Sorry Figured it out!!!

 

Just copyed the test into my .php kodes.

 

Then the text did not come out right. Everything was on one line.

 

My mistake... A little tired!

Link to comment
Share on other sites

Howdy all,

 

I have one of the early versions of wishlist installed on my live store and love it. So when I decided to redo the store I just had to come back and get the new and improved version! (Thanks for this wonderful contribution!)

 

I have a 2 layered testing layout with a local system (which I do everything on first) and a testing website (which I upload all changes to and again test before making changes to the live store). I have installed wishlist 3.5d and have a couple of questions.

 

On both the local and live stores I do not see a wishlist box (as a guest). If I go to a product page I see the add to wishlist button, but when I click on it. It puts the item in the shopping cart not the wishlist, and I still do not see the wishlist box.

 

 

If i log in then I see the wishlist box, but again if I go to a product page and select add to wishlist. It takes me to the shopping cart.

 

I am using the cssbuttons mod (don't know if that has any affect)

 

Does anyone know what could be causing this???

 

Thanks!

RW

 

PS

Live site

Testing Website

Link to comment
Share on other sites

Yes the css is prolly causing the problem. I looked at your source code and the input for the wishlist is a "submit" button. It needs to stay as a "image" submit button. It has properties that HAVE to stay the same for it to work right. Cuz right now its just acting as a submit button and will submit the form. I have it setup that it sets a certain parameter and in your application top, it sees that parameter and does the wishlist functions instead of the shopping cart functions. That's why on the application top file I put a comment that says "Must be before Shopping Cart actions".

 

-Dennis

Link to comment
Share on other sites

Yes the css is prolly causing the problem. I looked at your source code and the input for the wishlist is a "submit" button. It needs to stay as a "image" submit button. It has properties that HAVE to stay the same for it to work right. Cuz right now its just acting as a submit button and will submit the form. I have it setup that it sets a certain parameter and in your application top, it sees that parameter and does the wishlist functions instead of the shopping cart functions. That's why on the application top file I put a comment that says "Must be before Shopping Cart actions".

 

-Dennis

 

 

Dennis,

 

Thanks for looking so quickly on this. I am going to try to ask the css button mod creator for advice on how to fix this, but do you have any ideas?

 

the css button mod is a global thing centered on tep_image_submit buttons (lol..just my luck).

 

Thanks again!

Doug

Link to comment
Share on other sites

Okay... here it is for when you have some moments.

 

I just mimicked the the buy_now.

 

In - shopping_cart.php

 

On the line AFTER:

$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

 

GOES:

'<br><br><br><a href="' . tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=move_to_wishlist&products_id=' . $products[$i]['id']) . '">Move To Wish List</a>' .

 

In - includes/application_top.php

 

On the line AFTER:

	  // 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, '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;

 

GOES:

	  case 'move_to_wishlist' :   if (isset($HTTP_GET_VARS['products_id'])) {
							  $wishList->add_wishList($HTTP_GET_VARS['products_id']);
							  $cart->remove($HTTP_GET_VARS['products_id']);
							  }
							  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
							  break;

 

Now for the attributes!

 

Carlos

Link to comment
Share on other sites

Ok Carlos, this should get you started and you see where I took this code from and what I did. I took from wishlist.php file so you can add in the attributes by following that code.

 

First thing open up stats_wishlist.php and add this at the top like so:

 

  require('includes/application_top.php');
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 

Then here is your query info. I replaced all of his as we needed to get the product_id from the wishlist table and strip off the attributes from it with the function tep_get_prid();

 

				<td valign="top" class="dataTableContent">
			<?php

			$wishlist_query = tep_db_query("select products_id from " . TABLE_WISHLIST . " where customers_id = '" . $customers[customers_id] . "'");
			while($wishlist = tep_db_fetch_array($wishlist_query)) {
				$product_id = tep_get_prid($wishlist[products_id]);
				$products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_status, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");
				$products = tep_db_fetch_array($products_query);

				echo $products['products_name'] . ' ' . $currencies->format($products['final_price'])  . '<br>';

			}
			?>
			</td>

 

You can add on to that and format it however cuz as it stands right now I hate the format of the admin stats. Make it nice and release it ;)

 

-Dennis

Link to comment
Share on other sites

Dennis,

 

I appreciate the effort...

 

The first part of code was already there.

 

The second part of code I haven't a clue what to do with. When I replace queries, it does nothing. When I try to blend them, still nothing.

 

Maybe you think that I have more experiece than I do...

 

Carlos

Link to comment
Share on other sites

just dont use the tep_image_submit function, just use strait html.

 

-Dennis

 

 

Dennis,

 

I hate to be a complete pain here, but I am new to all of this. How would I change

<td align="center"><?php echo tep_image_submit('button_wishlist.gif', 'Add to Wishlist', 'name="wishlist" value="wishlist"'); ?></td>

 

Into html? (I am looking at the right line correct?)

 

again I am sorry to pester you with this.

 

Doug

Link to comment
Share on other sites

Dennis,

 

I appreciate the effort...

 

The first part of code was already there.

 

The second part of code I haven't a clue what to do with. When I replace queries, it does nothing. When I try to blend them, still nothing.

 

Maybe you think that I have more experiece than I do...

 

Carlos

 

Here is my test stats_wishlist.php file.

 

<?php
/*
 $Id: stats_wishlists.php,v 1.00 2005/06/15

 Aaron Hiatt [email protected]
 http://www.scaredrabbit.com

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

?>
<!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>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- 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="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_NUMBER; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS_COMPANY; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS_WISHLIST; ?></td>
			<!--Uncomment if you use the Separate Pricing Contribution
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS_GROUP_NAME; ?></td>
			-->
		  </tr>
<?php
 if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
 $customers_query_raw = "select a.entry_company, pd.products_name, w.products_id, c.customers_id, c.customers_firstname, c.customers_lastname from " . TABLE_WISHLIST . " w, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id where c.customers_id = w.customers_id and w.products_id = pd.products_id group by c.customers_firstname, c.customers_lastname order by c.customers_lastname desc";
 $customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);

// fix counted customers
 $customers_query_numrows = tep_db_query("select customers_id from " . TABLE_WISHLIST . " group by customers_id");
 $customers_query_numrows = tep_db_num_rows($customers_query_numrows);

 $rows = 0;
 $customers_query = tep_db_query($customers_query_raw);

 while ($customers = tep_db_fetch_array($customers_query)) {  

$rows++;

if (strlen($rows) < 2) {
$rows = '0' . $rows;
}

?>
		  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers&page=1&cID=' . $customers['customers_id'], 'NONSSL'); ?>'">
			<td class="dataTableContent" valign="top" align="center"><?php echo $rows; ?>.</td>
			<td class="dataTableContent" valign="top"><?php echo $customers['customers_firstname'] . ' ' . $customers['customers_lastname']; ?></td>
			<td class="dataTableContent" valign="top"><?php echo $customers['entry_company']; ?></td>
			<td valign="top" class="dataTableContent">
			<?php

			$wishlist_query = tep_db_query("select products_id from " . TABLE_WISHLIST . " where customers_id = '" . $customers[customers_id] . "'");
			while($wishlist = tep_db_fetch_array($wishlist_query)) {
				$product_id = tep_get_prid($wishlist[products_id]);
				$products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_status, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");
				$products = tep_db_fetch_array($products_query);

				echo $products['products_name'] . ' ' . $currencies->format($products['final_price'])  . '<br>';

			}
			?>
			</td>
			<!--Uncomment if you use the Separate Pricing Contribution
			<td class="dataTableContent" valign="top"><?php echo $customers['customers_group_name']; ?></td>
			-->
		  </tr>
<?php
 }
?>
		</table></td>
	  </tr>
	  <tr>
		<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
			<td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?> </td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

 

 

Dennis,

 

I hate to be a complete pain here, but I am new to all of this. How would I change

<td align="center"><?php echo tep_image_submit('button_wishlist.gif', 'Add to Wishlist', 'name="wishlist" value="wishlist"'); ?></td>

 

Into html? (I am looking at the right line correct?)

 

again I am sorry to pester you with this.

 

Doug

 

<input type="image" src="includes/languages/english/images/buttons/button_wishlist.gif" border="0" alt="Add to Wishlist" title=" Add to Wishlist " name="wishlist" value="wishlist" />

 

-Dennis

Edited by dblake
Link to comment
Share on other sites

Dennis

 

I can't thank you enough for the above code! It works like a charm and still enables me to do the css buttons (as I only have to do 1 graphic change for your button)

 

Thank you very much for your time and efforts on this!

 

Doug

Link to comment
Share on other sites

I dont know anything about php, but I am slowly learning. If someone could just point me in the right direction, I would be forever grateful. I'm just completely lost as to where to start.

 

Tammy

 

 

t_pic1.jpg

 

I'm hoping someone here can help me figure this out.

 

I installed this great contribution, without any problems. Kudos!

 

On each individual product page the "add to wishllist" button shows up fine, however Id like to know how to add it to the Product list.

 

Such as, if you go to http://www.refundworld.com/haves_and_wants/

 

and click on the category "coupon inserts", it will bring up a list as shown in thie above pic. How do I add an "add to wishlist" at this point?

 

Any ideas?

 

Thanks in advance

Tammy

Link to comment
Share on other sites

Its more than just a quick fix, if you know nothing of php you won't be able to add it, as you will need to add a new case in application_top.php. But if you want to dive in, just follow the example of the case "buy_now".

 

-Dennis

Link to comment
Share on other sites

Its more than just a quick fix, if you know nothing of php you won't be able to add it, as you will need to add a new case in application_top.php. But if you want to dive in, just follow the example of the case "buy_now".

 

-Dennis

 

 

Thank you Dennis,

 

I will "nose" around in applicationtop and see what I can find. I know a "little" VERY little LOL, Ive learned to edit the files from contribution intructions, Ive learned to add, block out stuff, etc.

 

Again, THANK YOU!

Tammy

Link to comment
Share on other sites

Hi, I have just installed Wishlist. Everything seems to work fine when the customer adds product to the wishlist. But when the friend receives the mail, visit the public wishlist and click the products he wants to buy and then "add to cart" the product is not added to cart. There is an redirect to index.php but nothing is added to the cart.. The same thing happens when just clicking add to cart (and not choosing products in the public wishlist).

Link to comment
Share on other sites

It's amazing none else is having this problem cause everyone should.

 

On wishlist_public.php find this

<?php echo tep_draw_form('wishlist_form', tep_href_link(FILENAME_WISHLIST_PUBLIC)); ?>

 

Replace that with this:

 

<?php echo tep_draw_form('wishlist_form', tep_href_link(FILENAME_WISHLIST_PUBLIC, 'public_id=' .$public_id)); ?>

 

That should fix you and everyone else. I will include this in my next update when I get around to it.

 

-Dennis

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