Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wishlist MS1 Troubles : Can't delete


DicE

Recommended Posts

Hi,

 

I've installed this contribution with all it's updates like mentioned in multiple pages here in the forum, but I keep having the same prob. I can add products to my wishlist, but I can't remove them.

I can copy them to my cart. And I say "copy" because ,again, the original does not get deleted from the wishlist table when "moving" a product from the wishlist to the cart.

:cry:

anybody has any ideas? I'd really like to get this one resolved before going live next week!

 

I'll post my application_top.php with the wishlist code...

// customer wants to update the product quantity in their shopping cart

     case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

                               if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {

                                 $cart->remove($HTTP_POST_VARS['products_id'][$i]);

                               } else {

                                 if (PHP_VERSION < 4) {

                                   // if PHP3, make correction for lack of multidimensional array.

                                   reset($HTTP_POST_VARS);

                                   while (list($key, $value) = each($HTTP_POST_VARS)) {

                                     if (is_array($value)) {

                                       while (list($key2, $value2) = each($value)) {

                                         if (ereg ("(.*)][(.*)", $key2, $var)) {

                                           $id2[$var[1]][$var[2]] = $value2;

                                         }

                                       }

                                     }

                                   }

                                   $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';

                                 } else {

                                   $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

                                 }

                                 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

                               }

                             }

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

                             break;

     // customer adds a product from the products page

     case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

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

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

                             }

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

                             break;

                             

     // Add product to the wishlist

///// CHANGES TO case 'add_wishlist' BY DREAMSCAPE /////

     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 customers_id=$customer_id AND products_id=$products_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 . "' )"); 

                              } 

                            } 

                            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($goto, tep_get_all_get_params($parameters), 'NONSSL'));

                             break;





// remove item from the wishlist

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

     case 'remove_wishlist' :

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

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

                            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 (isset($HTTP_GET_VARS['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']));

                                 } else {

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

                                }

                               }

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

                             break;

                             

     case 'notify' :         if (tep_session_is_registered('customer_id')) {

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

                                 $notify = $HTTP_GET_VARS['products_id'];

                               } elseif (isset($HTTP_GET_VARS['notify'])) {

                                 $notify = $HTTP_GET_VARS['notify'];

                               } elseif (isset($HTTP_POST_VARS['notify'])) {

                                 $notify = $HTTP_POST_VARS['notify'];

                               } else {

                                 tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

                               }

                               if (!is_array($notify)) $notify = array($notify);

                               for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

                                 $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");

                                 $check = tep_db_fetch_array($check_query);

                                 if ($check['count'] < 1) {

                                   tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");

                                 }

                               }

                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

                             } else {

                               $navigation->set_snapshot();

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

                             }

                             break;

     case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {

                               $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                               $check = tep_db_fetch_array($check_query);

                               if ($check['count'] > 0) {

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

                               }

                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));

                             } else {

                               $navigation->set_snapshot();

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

                             }

                             break;

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

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

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

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

                               } else {

                                 // First delete from wishlist:

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

                                 $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)));

                             break;

   }

 }

 

Thanks a lot in advance!!! this one is really urgent. Please help!

 

DicE

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

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

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

Link to comment
Share on other sites

Hello,

 

doesn't anyone have any idea? I'm pulling out the little hair I have :shock:

A clue as to where to start looking? I don't get it, the module for deleting is an exact copy past of what is in the install instructions. :?:

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

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

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

Link to comment
Share on other sites

Did you do all the inlcudes for the application top? I did this a while ago with a lot of input from Mattice (he did the hardest part) so I will have to go and lookit over again - which might not be for a few days.

Link to comment
Share on other sites

yes, at least I think I did. :oops:

I've checked it more then ones anyway. but like I said in my original posting, the code that is "done" for removing a product from the wishlist table, is an exact copy-paste of the installation file.

 

if it would be something else, like adding a product to the wishlist, I could understand that there would be probs since I had to modify that code to make it work together with another modification I have installed. But I didn't change the part for deleting a product so...

 

strange...

 

Please Help!!! Just tell me what you need.

DicE

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

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

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

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