carlost Posted October 29, 2005 Share Posted October 29, 2005 Dennis, Hey hey... hope all is well in your day! 1) When I went to delete (remove completely via admin) a product, I got: 1146 - Table 'osc.table_wishlist' doesn't exist delete from TABLE_WISHLIST where products_id = '8' [TEP STOP] By adding: // Wish List define('TABLE_WISHLIST', 'customers_wishlist'); define('TABLE_WISHLIST_ATTRIBUTES', 'customers_wishlist_attributes'); which is already in includes/database_tables.php - to: admin/includes/database_tables.php, I no longer get the sql error when I delete a product... Any reason not to do this? 2) If there is a product with an attribute left in Wish List by a customer - and I then later delete (remove completely via admin) that product - there still remains a reference to it, (shows that there is still a product though not identified - similar to when I just make a product inactive) which can be seen by the customer whenever he/she logs in again. However if there is a product without an attribute left in the Wish List by a customer - and I then delete (remove completely via admin) that product - it is removed completely (as it should be). The same exact behavior is experienced with the Shopping Cart, which makes sense as you modeled the Wish List after the Shopping Cart. Would you know off-hand if this is specific to my modified OSC Application only? Either way, any thoughts on what can be done about it... Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted October 29, 2005 Author Share Posted October 29, 2005 Ok for 1, if you would have updated to 3.5d from my download you have have seen this as step 15. I know why you didn't since your heavily modified but what you did is correct. 2. The problem basically is the id number. For instance, a product has a a whole number 27 (ex.) for an id number. When you add attributes to the product you get a number like so 27{5}3. Now when you delete the product from the table and in turn delete it from the wishlist table, if the product had attributes added to it, it wouldnt delete because the id number wouldn't be the whole number. Make sense so far? Now probably the easiest way to do this is by adding another field to the wishlist tables. Field name would be: main_product_id. Then everytime a product is added to the wishlist with attributes, you can still record the main product id so when you delete that product in admin, you can then bump the wishlist delete to the main_product_id. That only solves half the problem though. What if you remove just an attribute from a product? Ya I dunno how to solve this without putting in tons of checks. I'll try to put together a fix for this when i have time as I will have to think this one out. Does that make sense? -Dennis Quote Link to comment Share on other sites More sharing options...
hubcat Posted October 29, 2005 Share Posted October 29, 2005 Dennis, OK, I've narrowed down the problem (though still no fix). If I do what you described above - log in to an account, add items to wishlist, put some in cart, checkout - it works perfectly, just as it did for you. But I put items in my wishlist and then log out - so they're in the DB now. Then I log back in (opened a new browser window so there wouldn't be any odd memory issues). Upon relog in, my wishlist is there and shows everything. Now I add things to the cart. The "Item in Cart" message does not show up (actually it did show up once on 1 out of 3 products), and when I check out, the items are still in my wishlist. I'm using the session fix you provided a few posts back. Can you try testing logging in and out and then adding stuff to the cart so I know if it's just me or if you are having the same issue? Thanks!! Adrienne Quote Link to comment Share on other sites More sharing options...
dblake Posted October 29, 2005 Author Share Posted October 29, 2005 I can't duplicate this. You shouldn't need to close the browser down, if you logoff, it will destroy the wishID session and your cartID session too. When you add things to your cart, are you adding from the wishlist? Are you adding the product from the product pages to the cart and maybe its the wrong attributes matched up in the wishlist? I dunno what it could be, but everything works fine for me. Carlos do you have this problem? -Dennis Quote Link to comment Share on other sites More sharing options...
hubcat Posted October 29, 2005 Share Posted October 29, 2005 I can't duplicate this. You shouldn't need to close the browser down, if you logoff, it will destroy the wishID session and your cartID session too. When you add things to your cart, are you adding from the wishlist? Are you adding the product from the product pages to the cart and maybe its the wrong attributes matched up in the wishlist? I dunno what it could be, but everything works fine for me. -Dennis I'm essentially doing the exact same steps as above, without adding new products to the wishlist. Here's the path: Go to product page -> Add item to Wishlist -> Repeat for several items -> Logout Login -> Go to Wishlist -> Add items to Cart (no Item in Cart msg appears) -> Go to Cart -> Checkout -> Go to Wishlist - all items (including purchased items) are still listed. Not sure why it works OK if I add them and then immediately checkout without logging out, but it seems like most users would save the items for later, so the path I'm having trouble with is the more likely path a customer would follow. I'll keep trying, but if you think of something, please let me know. Adrienne Quote Link to comment Share on other sites More sharing options...
dblake Posted October 29, 2005 Author Share Posted October 29, 2005 Right I did the same exact thing, but I dont get that problem. Everything is installed correctly and you have the most recent files? Seems weird to me why you can logout, log back in and your items appear back in the wishlist but they don't show in cart when you add it. I dunno I'm at a loss. It's hard to troubleshoot without seeing the code. I'm out of ideas. -Dennis Quote Link to comment Share on other sites More sharing options...
carlost Posted October 29, 2005 Share Posted October 29, 2005 Hey, I am trying to be a little more metodical & meticulous about my testing now because I have found I have been doing some things and not realizing it for awhile - such as same product slightly different attributes, and wondering why I'm not getting the "Item in Cart" message. I have gotten a reversal of the attributes order (how - I have no idea). Somehow in the cart it showed first size then color, and in the Wish List first color then size (could have been visa versa even). I hesitate to even mention it because I haven't been able to duplicate it again, and I don't know what sequence of events I did to bring it about the first time. I guess I am mentioning it because it took me awhile, again, before I realized there was a difference - I was looking it over to begin with because I was not getting the "Item in Cart". I'll have some better input a little later on this evening. Carlos Dennis, Yes, what you wrote about the attributes makes some sense to me. Being as how the shopping cart reacts this way too, it is a flaw in the OSC Application? Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted October 29, 2005 Author Share Posted October 29, 2005 Yes its a flaw. The osc guys prolly nvr thought of someone adding something to their cart and not buying it for a while and during that time, the product was discontinued and therefor was deleted. So that customers shopping cart and wishlist will be messed up. I know what needs to be done to fix this, i just dont have the time and I want to think it out more. ;) Damn attributes make everything hard. Worse thing in osc is the way they handle attributes... -Dennis Quote Link to comment Share on other sites More sharing options...
hubcat Posted October 29, 2005 Share Posted October 29, 2005 Carlos, THAT'S IT!! Thanks for the tip. All of my products have 3 attributes, always listed in the same order. For some reason, when I log out, and then log back in, the database lists all of the attributes, but not necessarily in the original order. If it comes up in the original order, the wishlist "Item in Cart" notice and deletion after purchase functions work properly. But if the order has been switched, they don't work. Jeff is now looking into how to force it so that the attributes are always shown in the same order. We'll post if he can figure it out. Please do the same if you do. Thanks, Adrienne Quote Link to comment Share on other sites More sharing options...
hubcat Posted October 30, 2005 Share Posted October 30, 2005 We tried a few things, but no luck. I'm going to post on the General Support forum about forcing a specific ordering of attributes and see if anyone else has run into this. Adrienne Quote Link to comment Share on other sites More sharing options...
carlost Posted October 31, 2005 Share Posted October 31, 2005 Dennis, I have tested it somewhat extensively - and am very pleased at how it works - especially the public aspect of it. It's really a great contribution! I have a suggestion for another release, should you one day decide to add to it, and that would be: To be able to Move (not just add) a product from the Shopping Cart to the Wish List. I have no idea really as to how involving this would be - I do know, from experimenting some, that it is beyond my limited experience. Regards, Carlos Quote Link to comment Share on other sites More sharing options...
carlost Posted October 31, 2005 Share Posted October 31, 2005 By the way... For whatever reason, I have not been able to duplicate the "Item In Cart" problem, again in the Wish List Page. I have had times when the attributes order in the cart and in the wish list are different, but the "Item In Cart" still appears as it should. The only time I could find when it doesn't is when adding a product from a public Wish List, then it seems if the attributes order is not exact "Item In Cart" does not appear as it should. For me this is not hardly even worth mentioning, I only do because of Adrienne's interest. And, actually, it seems this can be avoided altogether just by presenting the attributes options in the Product Info page alphabetically (example: color before size. Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted October 31, 2005 Author Share Posted October 31, 2005 (edited) Carlos try this fix out by Janz. Carlos, I think this should work as replacement for those two lines in tep_remove_product: tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); That will look for product id's that are exactly alike and those that start with the correct product id (REGEXP ^ looks for strings that "start with"). Have tried this with a MySQL client, but not in the osC code so use caution. Actually hold off on this for a minute, I don't think its a good fix. -Dennis Edited October 31, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
carlost Posted October 31, 2005 Share Posted October 31, 2005 Dennis, I never even got this reply from Jan... if nothing else - thanks for bringing it to my attention, so I can at least thank him for the effort! I'm trying to get some idea of how to update the Wish List Stats contribution. Right now for me it doesn't show Products Name nor Model Number at all - and, for the price it shows 0.00. I know this has to do with my Wish List being modified for SPPC... any thoughts are appreciated. I'm guessing it has to do with the query at the very least. I asked Jan for help with this too... I just have found that between the both of you... things get done perfectly with these two awesome contributions! Here's the admin/stats_wishlist.php file in case you are in a helping mood/ mode! <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td height="50" class="pageHeading">Wish List Report</td> <td class="pageHeading" align="right"> <?php # Get specific list data if (isset($HTTP_GET_VARS['cid'])) { $customers_query_raw = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '".$HTTP_GET_VARS['cid']."'"); $customers = tep_db_fetch_array($customers_query_raw); # name echo $customers['customers_firstname'] . ' ' . $customers['customers_lastname']; }else{ echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); } ?></td> </tr> </table></td> </tr> <?php if (isset($HTTP_GET_VARS['cid'])) { # Display wishlist data?> <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">Product</td> <td class="dataTableHeadingContent" align="center">Model</td> <td class="dataTableHeadingContent" align="center">Price</td> </tr> <?php # show the contents $products_query_raw = tep_db_query("select * from customers_wishlist where customers_id = '". $HTTP_GET_VARS['cid']."'"); while($products = tep_db_fetch_array($products_query_raw)) { ?> <tr class="dataTableRow"> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo $products['products_name']; ?> </td></tr> </table> </td> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo $products['products_model']; ?> </td></tr> </table> </td> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo $currencies->format($products['products_price']); ?> </td></tr> </table> </td> </tr> <?php } #eof while?> </table></td> </tr> <?php }else{ # show the list of wishlist owners ?> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent">?</td> <td class="dataTableHeadingContent" align="center">Customer</td> <td class="dataTableHeadingContent" align="center">Products In Wish List</td> </tr> <?php # Get list of owners 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 c.customers_firstname, c.customers_lastname, cw.customers_id, count(cw.products_id) as prodcount from " . TABLE_CUSTOMERS . " c, customers_wishlist cw WHERE cw.customers_id = c.customers_id group by c.customers_firstname, c.customers_lastname order by prodcount DESC"; $customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows); $customers_query_numrows = tep_db_query("select customers_id from " . TABLE_ORDERS . " 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('stats_wishlist.php', 'cid=' . $customers['customers_id'], 'NONSSL'); ?>'"> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo $rows; ?> </td></tr> </table> </td> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo '<a href="' . tep_href_link('stats_wishlist.php', 'cid=' . $customers['customers_id'], 'NONSSL') . '">' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . '</a>'; ?> </td></tr> </table> </td> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td class="dataTableContent"> <?php echo $customers['prodcount']; ?> </td></tr> </table> </td> </tr> <?php } # eof while } # eof if/else list or contents ?> </table></td> </tr> <tr> <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php if (!isset($HTTP_GET_VARS['cid'])) 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 if (!isset($HTTP_GET_VARS['cid'])) 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> And for reference, here's a copy of my modified for SPPC wishlist.php <?php echo tep_draw_form('wishlist_form', tep_href_link(FILENAME_WISHLIST)); ?> <table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB;?>"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <?php if ($messageStack->size('wishlist_error') > 0) { ?> <tr> <td align="center"> <table border="0" cellspacing="0" cellpadding="0" width="100%" class="messageStackErrorBorderBackground"> <tr> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td><br><?php echo $messageStack->output('wishlist_error'); ?><br></td></tr> </table> </td> </tr> </table> </td> </tr> <tr><td height="5"></td></tr> <?php } if ($messageStack->size('wishlist_success') > 0) { ?> <tr> <td align="center"> <table border="0" cellspacing="0" cellpadding="0" width="100%" class="messageStackSuccessBorderBackground"> <tr> <td align="center"> <table border="0" cellspacing="0" cellpadding="0"> <tr><td><br><?php echo $messageStack->output('wishlist_success'); ?><br></td></tr> </table> </td> </tr> </table> </td> </tr> <tr><td height="5"></td></tr> <?php } if (is_array($wishList->wishID) && !empty($wishList->wishID)) { reset($wishList->wishID); ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="3" class="productListing"> <tr> <td width="15%" class="productListing-heading" align="center"><?php echo BOX_TEXT_SELECT; ?></td> <td width="25%" class="productListing-heading" align="center"><?php echo BOX_TEXT_IMAGE; ?></td> <td width="35%" class="productListing-heading" align="center"><?php echo BOX_TEXT_PRODUCT; ?></td> <td width="25%" class="productListing-heading" align="center">Price Information</td> </tr> <?php $i = 0; // <!-- SPPC --> if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } while (list($wishlist_id, ) = each($wishList->wishID)) { $list_of_prdct_ids[] = tep_get_prid($wishlist_id); if (tep_not_null($list_of_prdct_ids)) { // implode will give an error when $list_of_prdct_ids is empty $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in ('" . implode("','",$list_of_prdct_ids) . "') and status = '1' and customers_group_id = '" . $customer_group_id . "'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $special_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']); } // end while ($specials_array = tep_db_fetch_array($specials_query)) } // end if (tep_not_null($list_of_prdct_ids)) } // end while (list($wishlist_id, ) = each($wishList->wishID)) reset($wishList->wishID); // <!-- /SPPC --> while (list($wishlist_id, ) = each($wishList->wishID)) { $product_id = tep_get_prid($wishlist_id); // <!-- SPPC --> if ($customer_group_id == '0') { $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, p.products_price as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'"); } else { $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, pg.customers_group_price as products_price, p.products_tax_class_id, NULL as specials_new_products_price, pg.customers_group_price as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and pg.customers_group_id = '" . $customer_group_id . "'"); } // end if/else ($customer_group_id == '0') $products = tep_db_fetch_array($products_query); // add special price if there is one, replace final price in that case too if (tep_not_null($special_prices)) { for ($i = 0; $i < count($special_prices); $i++) { if( $products['products_id'] == $special_prices[$i]['products_id'] ) { $products['specials_new_products_price'] = $special_prices[$i]['specials_new_products_price']; $products['final_price'] = $special_prices[$i]['final_price']; } } } // end if (tep_not_null($special_prices)) // <!-- /SPPC --> if (($i/2) == floor($i/2)) { $class = "productListing-even"; } else { $class = "productListing-odd"; } ?> <tr class="<?php echo $class; ?>"> <!-- Modification Check Box --> <?php if($products['products_status'] == 0) { ?> <td width="15%" align="center" class="productListing-data"><?php echo tep_draw_checkbox_field('add_deleteprod[]',$wishlist_id); ?></td> <?php } else { ?> <td width="15%" align="center" class="productListing-data"><?php echo tep_draw_checkbox_field('add_wishprod[]',$wishlist_id); ?></td> <?php } ?> <!-- /Modification Check Box --> <td width="25%" class="productListing-data" align="center"> <!-- Modification Image --> <?php if (!tep_not_null($products['products_id'])) { // <!-- Delete Product Notice (via products_id) Image --> ?> <br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green_left.gif'); ?><b><font color="#FF0000"> Please Delete </font></b><br><br> <?php } else { // <!-- Delete Product Notice (via products_id) Image --> if($products['products_status'] == 0) { // <!-- Modification Pic/No Pic --> if (tep_not_null($products['products_image'])) { echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); } else { echo tep_image(DIR_WS_IMAGES . 'no_image.gif'); } // <!-- /Modification Pic/No Pic --> } else { // <!-- Modification Pic/No Pic --> if (tep_not_null($products['products_image'])) { ?> <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $products['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $products['products_image'], addslashes($products['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $products['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> <?php } else { echo tep_image(DIR_WS_IMAGES . 'no_image.gif'); } // <!-- /Modification Pic/No Pic --> } } // <!-- Delete Product Notice (via products_id) Image --> ?> <!-- /Modification Image --> </td> <!-- Modification Name --> <?php if (!tep_not_null($products['products_id'])) { // <!-- Delete Product Notice (via products_id) Name --> ?> <td width="35%" align="center" class="productListing-data"> <?php } else { // <!-- Delete Product Notice (via products_id) Name --> if($products['products_status'] == 0) { ?> <td width="35%" align="center"><table border="0" cellpadding="3" cellspacing="0" width="96%"><tr><td align="center" class="productListing-data"><b><?php echo $products['products_name']; ?></b> <?php } else { ?> <td width="35%" align="center"><table border="0" cellpadding="3" cellspacing="0" width="96%"><tr><td align="center" class="productListing-data"><b><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist_id, 'NONSSL'); ?>"><?php echo $products['products_name']; ?></a></b> <?php } } // <!-- Delete Product Notice (via products_id) Name --> ?> <!-- /Modification Name --> <input type="hidden" name="prod_link[]" value="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist_id, 'NONSSL'); ?>" /> <input type="hidden" name="prod_name[]" value="<?php echo $products['products_name']; ?>" /> <?php /******************************************************************* ******** THIS IS THE WISHLIST CODE FOR PRODUCT ATTRIBUTES ********* *******************************************************************/ $attributes_addon_price = 0; // Now get and populate product attributes $att_name = ""; if (isset($wishList->wishID[$wishlist_id]['attributes'])) { while (list($option, $value) = each($wishList->wishID[$wishlist_id]['attributes'])) { echo tep_draw_hidden_field('id[' . $wishlist_id . '][' . $option . ']', $value); $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 = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' 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']; } $att_name .= " (" . $attributes_values['products_options_name'] . ": " . $attributes_values['products_options_values_name'] . ") "; // <!-- Modification Attributes --> if (tep_not_null($products['products_id'])) { // <!-- Delete Product Notice (via products_id) Attributes --> if ($attributes_values['options_values_price'] > 0) { echo '<br /><small><i>' . $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] . '</i></small><br><span style="font-family: Arial; font-size: 7pt">+?' . $currencies->display_price($attributes_values['options_values_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '?<font color="#FF0000">(</font>included in price<font color="#FF0000">)</font></span>'; } else { echo '<br /><small><i> ' . $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] . '</i></small>'; } // end while attributes for product } // end if ($attributes_values['options_values_price'] > 0) } } // <!-- Delete Product Notice (via products_id) Attributes --> // <!-- /Modification Attributes --> echo '<input type="hidden" name="prod_att[]" value="' . $att_name . '" />'; $products['specials_new_products_price'] = tep_get_products_special_price($products['products_id']); if (tep_not_null($products['specials_new_products_price'])) { // $products_price = '<b><span class="productSpecialPrice">SPECIAL</span> <br>' . $currencies->display_price($products['specials_new_products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</b>'; $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 = '<b>' . $currencies->display_price($products['products_price']+$attributes_addon_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</b>'; } /******************************************************************* ******* CHECK TO SEE IF PRODUCT HAS BEEN ADDED TO THEIR CART ******* *******************************************************************/ if($cart->in_cart($wishlist_id) && ($products['products_status'] != 0)) { echo '<br /><font color="#FF0000"><b>Item in Cart</b></font>'; } $i++; ?> <!-- Modification Name - Short Description --> <?php if (!tep_not_null($products['products_id'])) { // <!-- Delete Product Notice (via products_id) Name - Short Description --> ?> <br><b><font color="#FF0000"> Product Is No Longer Available </font></b><br><br> <?php } else { // <!-- Delete Product Notice (via products_id) Name - Short Description --> if($products['products_status'] == 0) { ?> </td></tr><tr><td class="productListing-data" style="text-align: Justify; line-height: 125%"><?php echo $products['short_desc']; ?></td></tr></table> <?php } else { ?> </td></tr><tr><td class="productListing-data" style="text-align: Justify; line-height: 125%"><?php echo $products['short_desc']; ?></td></tr><tr><td align="right"><a class="popUpNavigation" href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']); ?>">More Information >>></a></td></tr></table> <?php } } // <!-- Delete Product Notice (via products_id) Name - Short Description --> ?> <!-- /Modification Name - Short Description --> </td> <!-- Modification Price --> <?php if (!tep_not_null($products['products_id'])) { // <!-- Delete Product Notice (via products_id) Price --> ?> <td width="25%" class="productListing-data" align="center" nowrap><b><font color="#FF0000"> Check & Update </font></b></td> <?php } else { // <!-- Delete Product Notice (via products_id) Price --> if($products['products_status'] == 0) { ?> <td width="25%" class="productListing-data" align="center"><b>Item Is Currently<br><font color="#FF0000">NOT ?AVAILABLE</font></b></td> <?php } else { ?> <td width="25%" align="center" class="productListing-data"><?php echo $products_price; ?></td> <?php } } // <!-- Delete Product Notice (via products_id) Price --> ?> <!-- /Modification Price --> </tr> <?php } ?> </table> </td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="wishList">Update The Wish List By Placing A Check In The Check Box To The Right Of The Item(s)<br>Then Click On Either The "ADD TO CART" Or The "DELETE" Button Below</td> </tr> <!-- <tr> <td height="5"></td> </tr> <tr> <td align="center" class="main"><?php // echo BOX_TEXT_WISHLIST_HELP_WHOLESALE;?></td> </tr> --> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="0" class="infoBox"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr class="infoBoxContents"> <td align="center"><?php echo tep_image_submit('button_delete.gif', ' Delete From Wish List ', 'name="delete_prod" value="delete_prod"'); ?></td> <td align="center"><?php echo tep_image_submit('button_in_cart.gif', ' Add to Cart ', 'name="add_prod" value="add_prod"'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table> <?php /******************************************************************* *********** CODE TO SPECIFY HOW MANY EMAILS TO DISPLAY ************* *******************************************************************/ if(!tep_session_is_registered('customer_id')) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td align="center"><table border="0" cellspacing="0" cellpadding="0" width="96%"> <tr> <td class="main" style="text-align: Justify; line-height: 125%"><?php echo WISHLIST_EMAIL_TEXT_GUEST; ?></td> </tr> </table></td> </tr> <tr> <td align="center"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td align="center" class="main"><table cellpadding="2" cellspacing="0"> <tr> <td class="main"><?php echo TEXT_YOUR_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('your_name', $your_name); ?><b><font color="#FF0000"> ?*</font></b></td> </tr> <tr> <td class="main"><?php echo TEXT_YOUR_EMAIL; ?></td> <td class="main"><?php echo tep_draw_input_field('your_email', $your_email); ?><b><font color="#FF0000"> ?*</font></b></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td align="center"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } else { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td align="center"><table border="0" cellspacing="0" cellpadding="0" width="96%"> <tr> <td class="main" style="text-align: Justify; line-height: 125%"><?php echo WISHLIST_EMAIL_TEXT; ?></td> </tr> </table></td> </tr> <tr> <td align="center"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php } $email_counter = 0; while($email_counter < DISPLAY_WISHLIST_EMAILS) { ?> <tr> <td align="center"> <table border="0" width="98%" cellspacing="0" cellpadding="2"> <tr> <td align="center" class="main"><table cellpadding="2" cellspacing="0"> <tr> <td class="main"><?php echo TEXT_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('friend[]', $friend[$email_counter]); ?><b><font color="#FF0000"> ?*</font></b></td> </tr> <tr> <td class="main"><?php echo TEXT_EMAIL; ?></td> <td class="main"><?php echo tep_draw_input_field('email[]', $email[$email_counter]); ?><b><font color="#FF0000"> ?*</font></b></td> </tr> </table></td> </tr> <?php $email_counter++; } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td align="center"><table border="0" width="70%" cellspacing="0" cellpadding="0"> <tr> <td class="main"><?php echo TEXT_MESSAGE . tep_draw_textarea_field('message', 'soft', 25, 3); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="0" class="infoBox"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr class="infoBoxContents"> <td align="center"><?php echo tep_image_submit('button_send.gif', IMAGE_BUTTON_SEND_WISHLIST, 'name="email_prod" value="email_prod"'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '15'); ?></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </form> <?php } else { // Nothing in the customers wishlist ?> <table border="0" width="100%" cellspacing="0" cellpadding="5"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <?php if ($customer_group_id == '0') { ?> <td align="center" class="main"><?php echo BOX_TEXT_NO_ITEMS_RETAIL;?></td> <?php } else { ?> <td align="center" class="main"><?php echo BOX_TEXT_NO_ITEMS_WHOLESALE;?></td> <?php } ?> </tr> </table> </td> </tr> </table> <?php } ?> Carlos P.S. If it interests you to have any of my modified files (I have Wish List & SPPC with Price Break working with some 4 dozen other modified contributions) Just let me know! Actually, if you want to take a look at my template/ test site, I'll send you the url - Let me know! And again, thanks for all your help! Quote Link to comment Share on other sites More sharing options...
dblake Posted October 31, 2005 Author Share Posted October 31, 2005 The previous wishlist_stats, I think housed the product name, model number, and price in that table. I did not do that because prices and names can change. What you need to do is join the products and products description tables into the query to query your name, price, and model number. -Dennis Quote Link to comment Share on other sites More sharing options...
carlost Posted October 31, 2005 Share Posted October 31, 2005 Carlos try this fix out by Janz.Actually hold off on this for a minute, I don't think its a good fix. -Dennis Dennis, Jan's fix works for me. Is there something you're thinking of that's not obvious to me? I updated the Wish List TABLES as well, and it works as far as I can tell: tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); /* <!-- Wish List --> */ tep_db_query("delete from " . TABLE_WISHLIST . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where (products_id = '" . (int)$product_id . "' or products_id REGEXP '^" . (int)$product_id . "{');"); /* <!-- /Wish List --> */ Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted October 31, 2005 Author Share Posted October 31, 2005 No I think that will work fine. I didn't know exactly how to use REGEXP so I assumed that it would just search the beginning of the string and get confused such as product id 1 or 11. But the way he has it setup it searches all the way to the bracked ({) if it has attributes. Is a very good fix, hats off to Janz ;) -Dennis Quote Link to comment Share on other sites More sharing options...
carlost Posted November 1, 2005 Share Posted November 1, 2005 The previous wishlist_stats, I think housed the product name, model number, and price in that table. I did not do that because prices and names can change. What you need to do is join the products and products description tables into the query to query your name, price, and model number. -Dennis Dennis, I'm totally lost here. Spent the entire evening trying to figure out how to do this without making any headway at all. Can you see your way to showing me how this is done? Thanks, Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted November 1, 2005 Author Share Posted November 1, 2005 Find this query # show the contents $products_query_raw = tep_db_query("select * from customers_wishlist where customers_id = '". You this query as an example to change your above query. To get the price and the name. See how the tables are "LEFT JOIN" in? You need to do the same. $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"); -Dennis Quote Link to comment Share on other sites More sharing options...
tammy507 Posted November 1, 2005 Share Posted November 1, 2005 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 Quote Link to comment Share on other sites More sharing options...
carlost Posted November 1, 2005 Share Posted November 1, 2005 Find this query # show the contents $products_query_raw = tep_db_query("select * from customers_wishlist where customers_id = '". You this query as an example to change your above query. To get the price and the name. See how the tables are "LEFT JOIN" in? You need to do the same. $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"); -Dennis Dennis, I'm still not getting it... I've always had trouble with understanding mYsql queries. With the php I can sometimes see the logic, and therefore alter or modify some. With the mYsql I just haven't a clue. If you're not up to helpng me further with this I understand, after all it's not a part of your contribution. I did write to the author, and he says he hasn't enough time to upgrade it. I didn't think there was much time involved, not that any amount of time isn't valuable - cause it is of course - I just thought it was something somewhat simple for someone who understands. For me it's just icing on the cake, and I'm guessing I can eventually find someone to help me with it - it just would save me some anx if you could elaborate more. I'd really like to understand it. I've tried things like: $products_query_raw = 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_WISHLIST . " where customers_id = '" . 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"); and other variations of this, but as you must know - I'm not getting it this way, in fact it feels like I'm not even close. If you do see your way to finishing this with me, I'd be glad to wrap it up as an update to the "Simple Wish List Reports" contribution, for your contribution - in you name of course. Thanks for the time already spent. Carlos Quote Link to comment Share on other sites More sharing options...
dblake Posted November 1, 2005 Author Share Posted November 1, 2005 I will do it tonight, and yes its fairly easy but when I have bosses breathing down my neck for stuff its hard to take time and write it out for you. Give me a few hours to get back to ya. -Dennis Quote Link to comment Share on other sites More sharing options...
carlost Posted November 1, 2005 Share Posted November 1, 2005 I will do it tonight, and yes its fairly easy but when I have bosses breathing down my neck for stuff its hard to take time and write it out for you. Give me a few hours to get back to ya. -Dennis Dennis, Thanks! And, please don't misunderstand what I was saying... I did not at all mean to convey to you that I thought it was easy to do so... I was kind of thinking out loud, so to speak, that the guy who wrote it might have been a little more generous by quickly updating it... and even that thought is tempered with I understand that time is valuable... As for you, you have been way more than generous with your time... not only with me... but it's easy to see throughout this forum that you have with everyone here. And, that's not even mentioning the generosity involved in writing the contribution to begin with! Carlos Quote Link to comment Share on other sites More sharing options...
Guest Posted November 1, 2005 Share Posted November 1, 2005 Hey.. Very Nice contribution :-" Just have a little problem: I get following error: Fatal error: Call to a member function on a non-object in /includes/column_right.php on line 14 Line 24 in column_right.php looks like this: if($wishList->count_wishlist() != '0') { require(DIR_WS_BOXES . 'wishlist.php'); } Got the capital L in wishList!!! what can cause this problem?? Best regards, Jesper Thygesen Denmark Quote Link to comment Share on other sites More sharing options...
dblake Posted November 1, 2005 Author Share Posted November 1, 2005 Make sure you have the most recent catalog/includes/classes/wishlist.php file. It has that function "count_wishlist" added into the bottom. -Dennis 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.