dblake Posted August 30, 2005 Author Share Posted August 30, 2005 Hi Guys :-" , I am wondering if you know what would keep the add wishlist in the products_info.php from adding the product_id to the customer_wishlist table. I am actually using the wishlist included in CRE6.15. It adds the customer_id but puts a "0" in the product_id for every entry. It is adding the entrys. <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td> <!-- Begin Wishlist Code --> <td align="right" 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_add_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td> <!-- End Wishlist Code --> Help would be much appreciated. <{POST_SNAPBACK}> Im sorry I dont support CRE. You should get with the developers of that. -Dennis Quote Link to comment Share on other sites More sharing options...
pnkranger Posted August 30, 2005 Share Posted August 30, 2005 You beautiful man...or woman. :) Thanks for the help. Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 Your welcome, and I dont like my name and I would feel bad if a woman was named Dennis :P Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 Hi Guys :-" , I am wondering if you know what would keep the add wishlist in the products_info.php from adding the product_id to the customer_wishlist table. I am actually using the wishlist included in CRE6.15. It adds the customer_id but puts a "0" in the product_id for every entry. It is adding the entrys. <tr class="infoBoxContents"> ? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2"> ? ? ? ? ? ? ?<tr> ? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> ? ? ? ? ? ? ? ?<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_template_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> ? ? ? ? ? ? ? ?<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td> ? ? ? ? ? ? ? <!-- Begin Wishlist Code --> ? ? ? ? ? ? ? ?<td align="right" 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_add_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; ?></td> ? ? ? ? ? ? ? <!-- End Wishlist Code --> Help would be much appreciated. <{POST_SNAPBACK}> Judging by the "action=add_wishlist" I would say that you CRE6.15 came preinstalled with version 2.x of the wishlist module. You might try this forum Wishlist 2.0 or you can always upgrade to version 3.1. I was using version 2.x for the longest time but always found the user interface cumbersome and difficult to understand. This version is much more user friendly and follows the same visual guide lines as the shopping cart. Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 (edited) You beautiful man...or woman. :) Thanks for the help. <{POST_SNAPBACK}> I think he was "wishing" for woman... ;) Edited August 30, 2005 by BearHappy Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 I think he was "wishing" for woman... ;) <{POST_SNAPBACK}> I couldn't be with a woman who coded. My wife hates it and I like that. Because she drags me away from this damn computer and gives me an exucse to take a break ;) Guys I still need closing ideas to make this final. Is it good how it is? Maybe I'll look into building this into admin more, for stats and what not. Also I need someone to tell me what happens if you have a product thats on a wishlist, and then if you remove the product from admin or make it inactive. Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 On the note of when a product has been disabled from admin. The product will still show on the wishlist but when added to the cart shows "out of stock". Works for me, the only other thing I could recommend might be below... catalog/wishlist.php $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"); added "p.products_status," to query if($cart->in_cart($wishlist_id)) { echo '<br /><font color="#FF0000"><b>Item in Cart</b></font>'; } if($products['products_status'] == 0) { echo '<br /><font color="#FF0000"><b>Item No Longer Available </b></font>'; } added $products['products_status'] line catalog/admin/includes/functions/general.php tep_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . (int)$product_id . "'"); tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'"); added TABLE_WISHLIST and TABLE_WISHLIST_ATTRIBUTES delete catalog/admin/includes/database_tables.php define('TABLE_WISHLIST', 'customers_wishlist'); define('TABLE_WISHLIST_ATTRIBUTES', 'customers_wishlist_attributes'); added to end of file before ?> These modifications will: A. Mark a product "No long Available" in the wishlist if the item has been disabled. B. Remove a product from all wishlists if the product has been removed from admin. Dennis, Check my code, I could have missed something... Travis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 As far as stats, I do use something I pulled from contribs that reports what customers have on thier wishlists. But its lacking the attributes data... Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 Nope looks perfect. You did point out something I missed though (small). "Item in Cart" is not in the language file, so I need to fix that ;) and add your new "Item No Longer Available". BearHappy you know you messed up right? I now no you can code :D. Lets work on admin stats for this. -Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 I'm a hack at best, the only other thing I could think of (I'm not sure if this needed), what if someone wants a quantity of an item? Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 I thought about that too, but that would be a big edition and I didn't really see a need for it. Map out how you think the admin should be and need and I will put together a list and start on that when I have time. -Dennis Quote Link to comment Share on other sites More sharing options...
G4 Productions Posted August 30, 2005 Share Posted August 30, 2005 I'm a hack at best, the only other thing I could think of (I'm not sure if this needed), what if someone wants a quantity of an item? <{POST_SNAPBACK}> Hi Guys. Been watching this thread and trying to help out when ever I can. Great contrib and willing to help out as much as possible when I can. With BearHappy's edit and contrib and with the ablity for the admin stats, I think this mod done. What else could one do? This is by far one of the best mods out there. Is there a donation link one can dblake? Thanks, Rolly Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 I will add a donation link on the Final release. I'll put in all the little extra stuff and finishing touches. Just trying to get all bugs out and get a hold on what needs to be focused on for the admin side. Possibilites are endless when it comes to mods but your right all the main points have been hit ;) -Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted August 30, 2005 Share Posted August 30, 2005 Darn it, below is the file I was attempting to hack to get some admin stats. But now after I have uploded it I'm getting the dreaded Parse error: parse error, unexpected T_REQUIRE in /public_html/admin/stats_wishlists.php on line 1 error which won't flipp'n go away. I think that adding some attribute reporting and a proper link to the customer record will work fine. I need to cut some useless items such as "Company" out but the real work has already been done. <?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'); ?> <!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> </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 $products_query = tep_db_query("select w.products_id, pd.products_id, pd.products_name, c.customers_id from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CUSTOMERS . " c, " . TABLE_WISHLIST . " w where w.customers_id = " . $customers['customers_id'] . " and w.products_id = pd.products_id and c.customers_id = w.customers_id order by pd.products_name"); while ($products = tep_db_fetch_array($products_query)) { echo $products['products_name'] . '<br>'; } ?> </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'); ?> Quote Link to comment Share on other sites More sharing options...
dblake Posted August 30, 2005 Author Share Posted August 30, 2005 Line 1 eh? I know Aaron, I do work for him sometimes. I should tell him to make his little addon better! Didn't even notice that update. -Dennis Quote Link to comment Share on other sites More sharing options...
pnkranger Posted August 31, 2005 Share Posted August 31, 2005 Line 1 eh? I know Aaron, I do work for him sometimes. I should tell him to make his little addon better! Didn't even notice that update. -Dennis <{POST_SNAPBACK}> I get 1 dumb question a day, right? If I wanted to show the wishlist box as soon as products were added (instead of when a customer logged in)...how would I change that? Quote Link to comment Share on other sites More sharing options...
dblake Posted August 31, 2005 Author Share Posted August 31, 2005 It should be present all the time. It should be just like your shopping cart. If no products are in your wishlist it should show 0 items. I dont think I added in a function to check if any items are in the wishlist so you can put a check in for that. Hmm add this in catalog/includes/classes/wishlst.php, on the bottom before the last }?> is fine. function count_wishlist() { $total_items = 0; if (is_array($this->wishID)) { reset($this->wishID); while (list($wishlist_id, ) = each($this->wishID) { $total_items++; } } return $total_items; } Then open up catalog/includes/column_right.php and find then line: require(DIR_WS_BOXES . 'wishlist.php'); Which should of been step 7 in the install instructions. Then change it to this. if($wishlist->count_wishlist() != '0') { require(DIR_WS_BOXES . 'wishlist.php'); } I have not tested this so dont get mad if it dont work. Should work fine though unless I missed something. I will add this in the next update so you can either show the wishlist when products are added, or just show it all the time. -Dennis Quote Link to comment Share on other sites More sharing options...
pnkranger Posted August 31, 2005 Share Posted August 31, 2005 (edited) Currently it only shows for registered users. Guests cannot view the Wishlist Box. Is this something I messed up? nevermind...forgot to add it to STS user code correctly. Thanks for the help. Edited August 31, 2005 by pnkranger Quote Link to comment Share on other sites More sharing options...
pnkranger Posted August 31, 2005 Share Posted August 31, 2005 dblake, Getting a couple of problems with the code you posted above: First, the code for the classes > wishlist was missing a ")" on the "while" line. Should look like this: function count_wishlist() { $total_items = 0; if (is_array($this->wishID)) { reset($this->wishID); while (list($wishlist_id) = each($this->wishID)) { $total_items++; } } return $total_items; } Problem now is that I'm getting this error: Fatal error: Call to a member function on a non-object in /home/angarden/public_html/shop/includes/sts_user_code.php on line 33 line 33 looks like this: if($wishlist->count_wishlist() != '0') { require(DIR_WS_BOXES . 'wishlist.php'); } Quote Link to comment Share on other sites More sharing options...
dblake Posted August 31, 2005 Author Share Posted August 31, 2005 $wishList Notice the capital L. My bad. -Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted September 1, 2005 Share Posted September 1, 2005 Just a reminder; Dennis, be sure to update the public wishlist file like the account based file. As in getting rid of the page count and next page and adding the "Item No Longer Availlable" line. Quote Link to comment Share on other sites More sharing options...
dblake Posted September 1, 2005 Author Share Posted September 1, 2005 Trav you do it! :P I will when I get the time. I'm swamped with SugarCRM right now. They just did big update and messed up a lot of my mods. So I'm in the process or recoding those :( -Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted September 2, 2005 Share Posted September 2, 2005 Sure I'll take care of the public file. LOL Sugar CRM huh, I'm actually a CRM admin for the company I work for. We use Saratoga Systems iAvenue however on an Oracle back end. So, is Sugar worth it? Quote Link to comment Share on other sites More sharing options...
dblake Posted September 2, 2005 Author Share Posted September 2, 2005 www.sugarcrm.com And yes. OpenSource and just as powerful. Bigger things like "teams" needs to be coded in yourself or you can pay for the pro version at like $200 a user or something. But if your a decent hack and know classes, you should do fine with incorporating new stuff. Or you can hire me :P -Dennis Quote Link to comment Share on other sites More sharing options...
BearHappy Posted September 2, 2005 Share Posted September 2, 2005 Below is the code for the wishlist_public.php, I have also added the two messages to the wishlist language file. <?php /* $Id: wishlist.php,v 3.0 2005/04/20 Dennis Blake osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST); if(!isset($_GET['public_id'])) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } $public_id = $_GET['public_id']; /******************************************************************* ****************** QUERY CUSTOMER INFO FROM ID ********************* *******************************************************************/ $customer_query = tep_db_query("select customers_firstname from " . TABLE_CUSTOMERS . " where customers_id = '" . $public_id . "'"); $customer = tep_db_fetch_array($customer_query); /******************************************************************* ****************** ADD PRODUCT TO SHOPPING CART ******************** *******************************************************************/ if (isset($HTTP_POST_VARS['add_wishprod'])) { if(isset($HTTP_POST_VARS['add_prod_x'])) { foreach ($HTTP_POST_VARS['add_wishprod'] as $value) { $product_id = tep_get_prid($value); $cart->add_cart($product_id, $cart->get_quantity(tep_get_uprid($product_id, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]); } tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } $breadcrumb->add(NAVBAR_TITLE_WISHLIST, tep_href_link(FILENAME_WISHLIST, '', 'SSL')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <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 (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <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 //--> <!-- 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 //--> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php echo tep_draw_form('wishlist_form', tep_href_link(FILENAME_WISHLIST)); ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" colspan="3"><?php echo $customer['customers_firstname'] . HEADING_TITLE2; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_wishlist.gif', HEADING_TITLE, 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 if ($messageStack->size('wishlist') > 0) { ?> <tr> <td><?php echo $messageStack->output('wishlist'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } /******************************************************************* ****** QUERY THE DATABASE FOR THE CUSTOMERS WISHLIST PRODUCTS ****** *******************************************************************/ $wishlist_query_raw = "select products_id from " . TABLE_WISHLIST . " where customers_id = '" . $public_id . "'"; $wishlist_query = tep_db_query($wishlist_query_raw); ?> <!-- customer_wishlist //--> <?php if (tep_db_num_rows($wishlist_query)) { ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="3" class="productListing"> <tr> <td class="productListing-heading"><?php echo BOX_TEXT_IMAGE; ?></td> <td class="productListing-heading"><?php echo BOX_TEXT_PRODUCT; ?></td> <td class="productListing-heading"><?php echo BOX_TEXT_PRICE; ?></td> <td class="productListing-heading" align="center"><?php echo BOX_TEXT_SELECT; ?></td> </tr> <?php /******************************************************************* ***** LOOP THROUGH EACH PRODUCT ID TO DISPLAY IN THE WISHLIST ****** *******************************************************************/ $i = 0; while ($wishlist = tep_db_fetch_array($wishlist_query)) { $wishlist_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 = '" . $wishlist_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); if (($i/2) == floor($i/2)) { $class = "productListing-even"; } else { $class = "productListing-odd"; } ?> <tr class="<?php echo $class; ?>"> <td valign="top" class="productListing-data" align="left"><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist['products_id'], 'NONSSL'); ?>"><?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?></a></td> <td valign="top" class="productListing-data" align="left" class="main"><b><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist['products_id'], 'NONSSL'); ?>"><?php echo $products['products_name']; ?></a></b> <?php /******************************************************************* ******** THIS IS THE WISHLIST CODE FOR PRODUCT ATTRIBUTES ********* *******************************************************************/ $attributes_addon_price = 0; // Now get and populate product attributes $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='" . $public_id . "' and products_id = '" . $wishlist['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['.$wishlist['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 = '" . $wishlist_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']; } echo '<br /><small><i> ' . $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] . '</i></small>'; } // end while attributes for product if (tep_not_null($products['specials_new_products_price'])) { $products_price = '<s>' . $currencies->display_price($products['products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($products['products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])); } /******************************************************************* ******* CHECK TO SEE IF PRODUCT HAS BEEN ADDED TO THEIR CART ******* *******************************************************************/ if($cart->in_cart($wishlist[products_id])) { echo '<br /><font color="#FF0000"><b>' . MESSAGE_IN_CART . '</b></font>'; } if($products['products_status'] == 0) { echo '<br /><font color="#FF0000"><b>' . MESSAGE_AVAILABILITY . '</b></font>'; } $i++; ?> </td> <td valign="top" class="productListing-data"><?php echo $products_price; ?></td> <td valign="top" class="productListing-data" align="center"><?php echo tep_draw_checkbox_field('add_wishprod[]',$wishlist['products_id']); ?></td> </tr> <?php } ?> </table> </td> </tr> <tr> <td align="right"><br /><?php echo tep_image_submit('button_in_cart.gif', 'Add to Cart', 'name="add_prod" value="add_prod"'); ?></td> </tr> </table></form> <?php } else { // Nothing in the customers wishlist ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main"><?php echo BOX_TEXT_NO_ITEMS;?></td> </tr> </table> </td> </tr> </table> <?php } ?> <!-- customer_wishlist_eof //--> </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'); ?> add to /catalog/includes/languages/english/wishlist.php define('MESSAGE_IN_CART', 'Item in Cart'); define('MESSAGE_AVAILABILITY', 'Item No Longer Available'); 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.
Note: Your post will require moderator approval before it will be visible.