Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Wishlist v1.2 - Extended


dreamscape

Recommended Posts

Here's what it took to get it working for me in Version 2.2-MS1.... the first is an entire change of the mod to product_info.php, the second only a slight change to the 'add' in application_top.php.... all other changes remain the same other than the missing curly bracket in column_right.php...

 

Enjoy!

 

//changes to Wishlist by JOHNSON - version 2.2-MS1

//product_info.php



<?php

   }

?>

     <tr>

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

         <tr>

           <td align="left" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a></td>

           <td align="center" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td>

           <td align="right" class="main"><?php echo tep_draw_form('wishlist_quantity', tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist')); ?>

          <?php if (tep_session_is_registered('customer_id')) echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST); ?>

          </form></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><br>  

       

// application_top.php

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

Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Was anyone able to solve this problem??

 

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



delete from customers_wishlist WHERE customers_id=17 AND products_id= 



[TEP STOP]

 

 

This is the error I get when logged in and trying to use the "Buy Now" or when I try to delete from the wishlist. The "Buy Now" works fine when not logged in.

 

Thanks

Link to comment
Share on other sites

Thank you......Thank you......Thank you......Thank you......The thing FINALLY works now.

 

Here's what it took to get it working for me in Version 2.2-MS1.... the first is an entire change of the mod to product_info.php, the second only a slight change to the 'add' in application_top.php.... all other changes remain the same other than the missing curly bracket in column_right.php...

 

Enjoy!

 

//changes to Wishlist by JOHNSON - version 2.2-MS1

//product_info.php



<?php

   }

?>

     <tr>

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

         <tr>

           <td align="left" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a></td>

           <td align="center" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td>

           <td align="right" class="main"><?php echo tep_draw_form('wishlist_quantity', tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist')); ?>

          <?php if (tep_session_is_registered('customer_id')) echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST); ?>

          </form></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><br>  

       

// application_top.php

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

"Aliiiiive, it's alive, it's ALIIIIIIIIIIIIIVE!!!"

Link to comment
Share on other sites

  • 1 month later...

Does anyone know away that the Wishlist box will only appear if you add a product to the wish list rather then always be present?

 

something along these line that I got from Linda McGrath for my shopping cart -- in includeds/column_right.php so my cart only shows on screen once a product has been added........

 

  if ($cart->count_contents() >= 1) {

 require(DIR_WS_BOXES . 'shopping_cart.php');

 }

 

Im guessing something along these lines:

 

 if (tep_session_is_registered('customer_id')){

if ($wishlist->count_contents() >= 1)

include(DIR_WS_BOXES . 'wishlist.php');

}

 

but that dont work because $wishlist in not a function, and im clueless.

 

can this be done?

Link to comment
Share on other sites

  • 10 months later...
Was anyone able to solve this problem??

 

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



delete from customers_wishlist WHERE customers_id=17 AND products_id= 



[TEP STOP]

I have the exact same problem. But it only happens when I try to delete a product from the wishlist. Any ideas on how to solve this problem?

 

Otherwise a great and useful contrib.

TIA,

 

Scotty

Link to comment
Share on other sites

  • 11 months later...

I've found this contribution most useful but there is one small feature I'd like to see.

 

At the moment the wishlist shows the price of an item without tax, is there any way to make it show the tax inclusive price?

 

Thanks

 

Neil

Link to comment
Share on other sites

  • 2 weeks later...

I am getting this error because of wish list. Can someone tell me what file it is coming from and what they think will fix it?

 

 

 

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

 

delete from customers_wishlist WHERE customers_id=3 AND products_id=

 

[TEP STOP]

 

 

Thanks

George

Link to comment
Share on other sites

I am getting this error when i click on "view my wihslist". I searced everywhere but cant solve this. Please help

 

1064 - You have an error in your SQL syntax near 'select * from customers_wishlist WHERE customers_id=2 order by products_name) as' at line 1

 

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

 

[TEP STOP]

Link to comment
Share on other sites

  • 3 months later...

Since I added QT Pro 4.1, product attributes don't get added into the wishlist created using Wishlists. This leads to all kinds of havoc.

 

Thanks to osCommerce, I'm learning a lot about PHP and getting pretty good at customizing the store. But QT Pro's under-the hood stuff is bewildering to me -- I'm only good enough to realize that my array and regular expression chops aren't nearly good enough to figure out how it works.

 

Has anyone figured out how to update the customers_wishlist_attributes table using the QT Pro engine?

 

--Mike

Link to comment
Share on other sites

Since I added QT Pro 4.1, product attributes don't get added into the wishlist created using Wishlists.  This leads to all kinds of havoc.

 

Aha! In the QT Pro forum I found this:

 

In catalog/includes/application_top.php, replace this:

    $goto = basename($PHP_SELF);
  switch ($HTTP_POST_VARS['wishlist_action']) {
    // Customer wants to update the product quantity in their shopping cart
    case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                              if ($HTTP_POST_VARS['products_id']) {
                                if ($customer_id > 0) {
          // Queries below replace old product instead of adding to queatity.
                                  tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_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_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                  // Read array of options and values for attributes in id[]
                                  if (isset ($id)) {
                                    foreach($id as $att_option=>$att_value) {
                                      // Add to customers_wishlist_attributes table
                                      tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                    }
                                  }
                                }
                              }
                            }
                            break;

with this:

 $goto = basename($PHP_SELF);
  switch ($HTTP_POST_VARS['wishlist_action']) {
    // Customer wants to update the product quantity in their shopping cart
    case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                              if ($HTTP_POST_VARS['products_id']) {
                                if ($customer_id > 0) {
          // Queries below replace old product instead of adding to queatity.
                                  tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_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_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
//++++ QT Pro: Begin Changed code
                              $attributes=array();
                              if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {
                                $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);
                                foreach ($attrlist as $attr) {
                                  list($oid, $oval)=explode('-',$attr);
                                  if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)
                                    $attributes[$oid]=$oval;
                                }
                              }
                              if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
                                foreach ($HTTP_POST_VARS['id'] as $key=>$val) {
                                  if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)
                                    $attributes=$attributes + $HTTP_POST_VARS['id'];
                                }
                              }

                                  // Read array of options and values for attributes in id[]
                                    foreach($attributes as $att_option=>$att_value) {
                                      // Add to customers_wishlist_attributes table
                                      tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                  }
                                }
                              }
                            }
                            break;

 

The one over there had an extra closing brace before the break that I had to remove, but once that was done the problem was fixed. Thank God for ralphday because I can't make head or tail of how QT Pro works.

 

--Mike Jennings

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