Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist MS1 SQL error


DicE

Recommended Posts

Hi,

 

I'm running Wishlist mod with the MS1 modification (so it's supposed to work), but I can't get it to work properly.

 

Adding products is no problem, but when you delete them from the wishlist I get this SQL error:

MYSQL QUERY ERROR REPORT

---------------------------------------

1064 - You have an error in your SQL syntax near '' at line 1

 

delete from customers_wishlist WHERE customers_id=3 AND products_id=

---------------------------------------

Remote Address: 192.128.252.68

Referer : http://www.thinq.be/catalog/wishlist.php

Requested : /catalog/wishlist.php/page/1/action/remove_wishlist/pid/2973

 

It seems he doesn't know what products_id to take (as it's always <nothing>). I've had multiple users of my shop try it out and all SQL errors look alike, except for the customer_id ofcourse.

 

When you try to move a product from the wishlist to the cart, it copies the product to the cart, and leave the wishlist entry there also, instead of removing it...

 

Does anybody know why I'm having these errors? Could it be because of the "Search Engine Friendly url" I have enabled? I've tried it with the setting disabled also but no Joy...

 

PLEASE HELP! Just tell me what you want to see.

 

DicE

_____.:::.________###__________|/______

:(o o): . (o o) (o o)

ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-

Link to comment
Share on other sites

I haven't used wishlist but from the sources I see that only the delete actions use $pid to refer to the product_id all other actions refer to $product_id.

So my guess would be ot change all occurences of $pid with $product_id in includes/application_top.php and try again.

 

Hope this helps,

Rob

Link to comment
Share on other sites

thanx for the effort Rob, but I already tried that without any luck... :(

 

anybody else any ideas?

 

DicE

_____.:::.________###__________|/______

:(o o): . (o o) (o o)

ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-

Link to comment
Share on other sites

Than it's probably my second guess:

 

Change

      case 'remove_wishlist' :



                            tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$pid");

 

to

      case 'remove_wishlist' :



                            tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$HTTP_GET_VARS['products_id']");

 

CAVEAT:

You'll have to be careful with this code though as there is no sanity checking on the variable that gets passed to the sql server this way. It's fine for testing but will leave you vulnerable to SQL injection attacks.

Link to comment
Share on other sites

I have uploaded all the modified and additional files from a *working copy* of osC 2.2-MS1 with the Wishlist installed - Wishlist_Files_MS1.

 

You may find them here:

 

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

 

If you are installing for the first time you will need the other download as well: Wishlist-update_MS1... you will only need the wishlist.sql file for your database.

 

In future, please do not begin new threads on Wishlist-MS1... I cannot keep track of threads I am not subscribed to :shock:

Link to comment
Share on other sites

Woo Hoo!

The problem with the queries seems to be apparent on the newer versions of MySQL only. I'm not sure if these fixes will work on the older versions, though they should... can someone using an older MySQL test the code below and return their results.

 

I've found where the errors were in the queries, though I have one other problem now. The products aren't being split across the pages.

(The fixes to the queries can be found in my file attached below).

<?php

/*

 $Id: wishlist_help.php,v 1  2002/11/09 wib



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');



 if (!tep_session_is_registered('customer_id')) {

   $navigation->set_snapshot();

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }

 

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WISHLIST);



 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_WISHLIST, '', 'NONSSL'));

?>

<!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; ?>">

<?php if (CTBN_BREADCRUMB_SHOW_BROWSER_TITLE == 'true') {echo '<title>'. $breadcrumb->trail_title(' » ') .'</title>'; } else { echo '<title>'. 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 //-->

   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

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

   $wishlist_query_raw = "select * from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id order by products_name";



   $wishlist_split = new splitPageResults($wishlist_query_raw, MAX_DISPLAY_WISHLIST_PRODUCTS);

   $wishlist_query = tep_db_query($wishlist_query_raw);



 if (($wishlist_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

     <tr>

       <td>

       <table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

           <td class="smallText"><?php echo $wishlist_split->display_count(TEXT_DISPLAY_NUMBER_OF_WISHLIST); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $wishlist_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

         </tr>

       </table></td>

     </tr>



<?php

 }

?>

     <tr>

       <td>

       <table border="0" width="100%" cellspacing="0" cellpadding="2">

           <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td>

     </tr>

           <tr>

<!-- customer_wishlist //-->

<?php

   $info_box_contents = array();

   $product_ids = '';

   while ($wishlist = tep_db_fetch_array($wishlist_query)) {

         $product_ids .= $wishlist['products_id'] . ',';

 }

   $product_ids = substr($product_ids, 0, -1);



?>

<?php

 if ($wishlist_split->number_of_rows > 0) {

   $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id in (" . $product_ids . ") and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");



   $row = 0;

   while ($products = tep_db_fetch_array($products_query)) {

     if ($new_price = tep_get_products_special_price($products['products_id'])) {

     $products_price = '<s>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</span>';

     } else {

     $products_price = $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id']));

     }

     $row++;



?>

             <td width="50%" valign="top" align="center" class="main"><div align="center"><a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?>"><?php echo $products['products_name']; ?></a></div>

               <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($products['products_id']) . '&products_id=' . $products['products_id'], 'NONSSL'); ?>"><?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?></a><br>

               <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5'); ?><br>Price: <?php echo $products_price; ?><br>

               <a href="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id'] . '&rfw=1', 'NONSSL'); ?>">Move to Cart</a> | <a href="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=remove_wishlist&pid=' . $products['products_id'], 'NONSSL'); ?>">Delete</a><br>

               <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5'); ?></td>

<?php

     if ((($row / 2) == floor($row / 2))) {

}?>

 </tr>

         <tr>

   <td colspan="2"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td>

         </tr>

<?php

   }

 } else {

?>

         <tr>

           <td class="main"><?php echo BOX_WISHLIST_EMPTY; ?></td>

         </tr>

         <tr>

           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

         </tr>

<?php

 }

?>

       </table></td>

     </tr>

<?php

 if (($wishlist_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

     <tr>

       <td>

       <table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

           <td class="smallText"><?php echo $wishlist_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $wishlist_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

         </tr>

       </table></td>

     </tr>

<?php

 }

?>

   </table></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'); ?>

I have the 'Displaying 1 to 2 (of 3 items on your wishlist)' displaying the correct information, though the actual products aren't split, they're all on one page.

 

I'd like to have them listed in three columns (unsure of how many rows at this stage), as per my normal product listing here: http://www.turningbase.com/index.php?cPath=31_34

 

Does anyone know how to get the products displaying like this in the wishlist?

 

Thanks,

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

Link to comment
Share on other sites

Could you just post the diff?.... your file has other modifications that will leave peoples installations broken :shock:

 

Warning: Missing argument 3 for splitpageresults() in c:program fileseasyphpwwwcatalogincludesclassessplit_page_results.php on line 24



Warning: Missing argument 4 for splitpageresults() in c:program fileseasyphpwwwcatalogincludesclassessplit_page_results.php on line 24

Link to comment
Share on other sites

Yes, I do have one modification of my own, the 'CTBN_BREADCRUMB_SHOW_BROWSER_TITLE' though it won't make a difference on anyone elses setup since it will equal 'false' and revert to the original method of showing the browser title.

 

I think the errors are due to the difference between the number of arguements required for the 'splitpageresults' function in MS1 and MS2CVS. On this note, can someone test this under a stock standard MS2CVS and return your results.

 

Thanks,

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

Link to comment
Share on other sites

I think the errors are due to the difference between the number of arguements required for the 'splitpageresults' function in MS1 and MS2CVS.  On this note, can someone test this under a stock standard MS2CVS and return your results.

 

Thanks,

Tony

 

Could you please post the diff for the benefit of those running MS1 who may have the *query problem* you had with your version of MySQL - this contribution (and thread) is for MS1

Link to comment
Share on other sites

The * query problem * didn't end up being a query problem at all.

With MS2CVS, I had to change the splitPageResults function.

 

Change this:

$wishlist_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_WISHLIST_PRODUCTS, $wishlist_query_raw, $wishlist_numrows);

To this:

$wishlist_split = new splitPageResults($wishlist_query_raw, MAX_DISPLAY_WISHLIST_PRODUCTS);

 

Change this:

  if ($wishlist_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3')) {

To this:

  if (($wishlist_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

 

Change this:

<td class="smallText"><?php echo $wishlist_split->display_count($wishlist_numrows, MAX_DISPLAY_WISHLIST_PRODUCTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_WISHLIST); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $wishlist_split->display_links($wishlist_numrows, MAX_DISPLAY_WISHLIST_PRODUCTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

To this:

<td class="smallText"><?php echo $wishlist_split->display_count(TEXT_DISPLAY_NUMBER_OF_WISHLIST); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $wishlist_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

 

Change this:

if (tep_db_num_rows($wishlist_query)) {

To this:

if ($wishlist_split->number_of_rows > 0) {

 

Change this:

if ($wishlist_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) {

To this:

  if (($wishlist_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

 

Change this:

<td class="smallText"><?php echo $wishlist_split->display_count($wishlist_numrows, MAX_DISPLAY_WISHLIST_PRODUCTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_WISHLIST); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $wishlist_split->display_links($wishlist_numrows, MAX_DISPLAY_WISHLIST_PRODUCTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

To this:

<td class="smallText"><?php echo $wishlist_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>

           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $wishlist_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

Try that out... I don't know if it'll work on MS1.

I've got the module 75% working (problem is incorrect number of product on page)... if the changes work for you, all the better. If not, than sorry... it may be MS2 or my site only.

"The price of success is perseverance. The price of failure comes much cheaper."

Link to comment
Share on other sites

Try that out... I don't know if it'll work on MS1.

 

The above mods are *not* necessary, and have not been tested on MS1 - there is a new download in the contributions area with *all* the changed/additional php files necessary to run the Wishlist on MS1 - it does not include the wishlist.sql file contained in the first MS1 package - this will also be needed on a new installation.

 

Wishlist MS1 will *not* run on the current CVS snapshot - there will be a new release for MS2

Link to comment
Share on other sites

  • 2 months later...

Hi Tony,

 

I've tried the mods you listed in this thread but I'm still getting the error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from customers_wishlist WHERE customers_id=2 order by

 

select count(select * from customers_wishlist WHERE customers_id=2 order by products_name) as total

 

[TEP STOP]

 

Any idea what else it could be?

 

I'm on 2.2 MS2.

 

Thanks!

Link to comment
Share on other sites

seems to me i just changed

Change this:

CODE

$wishlist_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_WISHLIST_PRODUCTS, $wishlist_query_raw, $wishlist_numrows);

 

To this:

CODE

$wishlist_split = new splitPageResults($wishlist_query_raw, MAX_DISPLAY_WISHLIST_PRODUCTS);

 

like mentioned above in this threat and the sql-error was gone.

but now i had 'division by zero'

because i did not define MAX_DISPLAY_WISHLIST_PRODUCTS

 

but after i added the define the wishlist shows! :lol:

 

am trying to make wishlist work on a fresh ms2-installation!

Link to comment
Share on other sites

  • 1 month later...

I am having the same problem and when I disable the Search Engine Friendly URLs then it works great!! I dont know how to proceed. So far I have put about 4 hours into this and no luck. I have read a lot of posts and tried dozens of changes.

 

If anyone has this working please attempt to turn on SEF and then delete items from the wishlist...does it work?

Link to comment
Share on other sites

Ok...I fixed the error.

 

 

look in application top for the delete function...

 

 

tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

 

 

and replace it with

 

 

tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");

 

this was a fix someone proposed but I had to change the products_id to pid

 

seems to me that the contrib has some real problems handling the queries..when I add an item the wishlist my wishlist box has this link for delete

 

http://www.videogamedeals.com/add_wishlist...ishlist/pid/724

 

As you can see...it's incorrect...It looks like it adds add_wishlist for some reason..I am home sick today so it is hard to think clear.

 

I will say that with SEF set to off the contrib works great.

Link to comment
Share on other sites

I found another error when you attempt to move to cart..it doesnt remove from wishlist.

 

      case 'cust_order' :    if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

                                if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

                                } else {

                                  tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");

  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

                                }

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

 

Change your 'cust_order' function in application_top.php to the above. Also note: there are 2 cust_order functions. Feel free to delete one. This contrib is a mess but it still is pretty descent. You can mess with the wishlist at my site.

 

http://www.videogamedeals.com and you can login as [email protected] with test1 as a pass. This is a LIVE SITE! So do not mess around too much please.

 

Also note: I run my site with SEF on and this produces some errors with the wishlist..right after I add items to the cart the urls for the move to cart and delete us are created with bad links. And I just fixed it!

 

USE THIS LINE //

tep_redirect(tep_href_link(FILENAME_WISHLIST));

 

to replace

 

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));

 

so here is my completed addons for application_top.php that seem to fix my many errors. Now it works 100% with SEF on or off on MS1

 

//Wishlist

  define('FILENAME_WISHLIST', 'wishlist.php');

  define('FILENAME_WISHLIST_HELP', 'wishlist_help.php');

//Wishlist 

  define('TABLE_WISHLIST', 'customers_wishlist');

 

// Add product to the wishlist

 

      case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {

                              if  ($HTTP_POST_VARS['products_id']) {

                            tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");

                              }

                            }

 

tep_redirect(tep_href_link(FILENAME_WISHLIST));

        break;

   

    // Add wishlist item to the cart

case 'wishlist_add_cart': reset ($lvnr);

                          reset ($lvanz);

                                while (list($key,$elem) =each ($lvnr))

                                      {

                                        (list($key1,$elem1) =each ($lvanz));

                                        tep_db_query("update " . TABLE_WISHLIST . " SET products_quantity=$elem1 WHERE customers_id=$customer_id AND products_id=$elem");

                                        tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_quantity='999'");

                                        $produkte_mit_anzahl=tep_db_query("select * from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$elem AND products_quantity<>'0'");

 

                                        while ($HTTP_POST_VARS=mysql_fetch_array($produkte_mit_anzahl))

                                              {

                                              $cart->add_cart($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['products_quantity']);

                                              }

                                        }

                                  reset ($lvanz);

                              tep_redirect(tep_href_link(FILENAME_WISHLIST));

                              break;

 

 

// remove item from the wishlist

///// CHANGES TO case 'remove_wishlist' BY DREAMSCAPE /////

      case 'remove_wishlist' :

                            tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");

                            tep_redirect(tep_href_link(FILENAME_WISHLIST));

                            break;                           

      // performed by the 'buy now' button in product listings and review page

      case 'buy_now' :        if (tep_session_is_registered('customer_id')) { tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$products_id"); }

        if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

                                tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL'));

                              } else {

                                $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);

 

                                tep_redirect(tep_href_link(FILENAME_WISHLIST));

                              }

                              break;

                   

                         

 

    }

  }

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