Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Wishlist-update_MS1


Guest

Recommended Posts

Matti & Tony, Thanks for your time on this. I tried both and no go. So after some hair pulling and a few more hours, lol, I am no programmer otherwise I would have figured this out sooner, this is what I came up with and it works for my version 5/30/03 CVS MS2.

 

This is around line 377 in application_top

 

Original code: (where I was getting the 1064 error)

// 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=$pid");

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

                             }

                             break;

 

New Code to fix 1064 error:

// 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['products_id'] . "' and customers_id = '" . $customer_id . "'");

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 products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_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($goto, tep_get_all_get_params($parameters), 'NONSSL'));

                             }

                             break;

 

This line here:

 

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

 

just wouldn't work for me at all and changing the $pid to $products_id didn't work. It didn't like the $ in front of the products_id for some reason so I replaced this line in two places above with:

 

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

 

And it likes it, all works wonderfully and no more 1064 errors. I hope that helps someone else with this problem. I hope I explained it okay as I am a real novice at this. Thanks for the great contribution. Love it.

Mair

Link to comment
Share on other sites

  • Replies 93
  • Created
  • Last Reply

Top Posters In This Topic

Thanks Mary Anne - glad you got it sorted - both you and Lonny based your mods on the outdated application_top.php from the original contribution - I haven't pinpointed it yet, but when I was able to repeat the error using your files I could see that products_id was missing from the database query - ie. the variable was lost before that part of the script.

 

Oh... and you explained it beautifully - I just added some "code" tags to your post to make it clearer 8)

Link to comment
Share on other sites

I am also having trouble installing this Wish List contribution to my MS2. I have installed numerous contributions and made a lot of modifications and changes to my application_top.php, configure.php, english.php, column_right.php, etc..etc...

 

Isn't there a better written manual for this contribution. I want to know what changes and lines has been made to the files from the original oscommerce files.

 

This installation is painful and so far I've been without luck.

 

I viewed configure.php that comes with this contrib. line by line and tried to compare with my configure.php. It's painful! I think I'm getting cross-eyed here!!

Link to comment
Share on other sites

I think theres another problem.

 

When trying to add a product with (Available Options) product attributes it gets added just fine to the wishlist but it wont "Move to Cart" .

 

Anyone noticed this?

 

For me the same problem. How you have decided it?

Link to comment
Share on other sites

I think theres another problem.

 

When trying to add a product with (Available Options) product attributes it gets added just fine to the wishlist but it wont "Move to Cart" .

 

Anyone noticed this?

 

For me the same problem. How you have decided it?

 

This has already been discussed - if a product has attributes the user is directed to the product_info page where they can select the desired attributes and add it to their cart - this is one of the issues being addressed for the next release

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I have installed this mod and after a few problems.....

 

the product going to the cart issue....

 

and the missing sql for the table....

 

Both of which I fixed from the info here :lol:

 

It all works Great :wink:

 

Cheers

Link to comment
Share on other sites

Would anyone be able to help my self and my programmer to install this wishlist on my MS2 shop (which is still in development)? Or maybe just provide me with the needed changes to make it compatible with MS2?

 

Any help, instructions or any direction would be very helpful.

 

Thank you

Link to comment
Share on other sites

I have this module installed on a post MS2 store with a few modifications to the code for some custom features.

(The WWW button below is my store with the Wishlist installed.)

 

Can either yourself, or your programmer PM me with details of the problems. (Please try to be specific about them, so I can pinpoint it in my own install.)

Hopefully we'll be able to work it out and post some more details in this thread for the rest of the community.

 

Cheers,

Tony

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

Link to comment
Share on other sites

  • 3 weeks later...
just one little question:

what is the meaning of 'PM'?

:unsure:

To 'pm' is to 'private message' - you will notice the 'pm' button below each user's post - click this and you will see how it works - you can also pm a user from their profile page.

 

Matti

Link to comment
Share on other sites

  • 1 month later...

OK - I am a tad confused here. It says in the contrib page

These are all the altered and additional files those who have had difficulty installing Wishlist for MS1.

 

Which implies that nothing else is necessary, and that this version of the contrib is complete. But earlier in the thread someone said that the original download IS necessary. And, looking through, there is no SQL file to create the required tables, although I know that was posted earlier also and if that is the only thing that is missing, then I can add that easily enough. But IS there anything else missing and how much is duplicated in the original download?

 

Also is there any progress being made on this yet?

Looked around and didn't see an answer to this:? is there any way for my customers to give somebody a link to their wishlist?

 

Ex - my birthday is coming up, it would be nice to send my mother a link to my wishlist so she can see what I really want and not have to guess...

 

Seems pointless to have any kind of wishlist without this functionality, as that seems to be the whole point of a wish list. You choose what you want and then tell other people so they come and buy it for you. That's what I use Amazon's for anyway ;)

 

I would like to get this installed soonish in time for Christmas so any thoughts would be helpful.

 

I have MS1 2.2

Edited by JulieCSM
Link to comment
Share on other sites

  • 3 weeks later...

Looks like a nice contrib but to be honest...whats the point of it if others cant see it?

 

Can we add a function at least for the list to be emailed to someone? This would be great if a user can log in...add items to the wish list and then email to say...grandpa...in the email of course we add the persons info that actually wishes for the item. Then this contrib would be perfect in my eyes.

 

It seems like a great start though and hopefully someone can add my idea. I will install the ms1 latest version of the contrib tomorrow and take a look at what I can find.

Link to comment
Share on other sites

  • 3 weeks later...

Here is my application_top file. I have tried every single suggestion in this and any thread pertaining to this. Everything else works beautifully but I just cannot delete! Any help would be appreciated.

 

 

 

<?php

/*

$Id: application_top.php,v 1.264 2003/02/17 16:37:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// start the timer for the page parse time log

define('PAGE_PARSE_START_TIME', microtime());

 

// set the level of error reporting

error_reporting(E_ALL & ~E_NOTICE);

 

// check if register_globals is enabled.

// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.

if (function_exists('ini_get')) {

ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');

}

 

// disable use_trans_sid as tep_href_link() does this manually

if (function_exists('ini_set')) @ini_set('session.use_trans_sid', 0);

 

// Set the local configuration parameters - mainly for developers

if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

 

// include server parameters

require('includes/configure.php');

 

 

// define the project version

define('PROJECT_VERSION', 'osCommerce 2.2-MS1');

 

// set the type of request (secure or not)

$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

 

// define the filenames used in the project

define('FILENAME_ACCOUNT', 'account.php');

define('FILENAME_ACCOUNT_EDIT', 'account_edit.php');

define('FILENAME_ACCOUNT_EDIT_PROCESS', 'account_edit_process.php');

define('FILENAME_ACCOUNT_HISTORY', 'account_history.php');

define('FILENAME_ACCOUNT_HISTORY_INFO', 'account_history_info.php');

define('FILENAME_ADDRESS_BOOK', 'address_book.php');

define('FILENAME_ADDRESS_BOOK_PROCESS', 'address_book_process.php');

define('FILENAME_ADVANCED_SEARCH', 'advanced_search.php');

define('FILENAME_ADVANCED_SEARCH_RESULT', 'advanced_search_result.php');

define('FILENAME_ALSO_PURCHASED_PRODUCTS', 'also_purchased_products.php'); // This is the bottom of product_info.php (found in modules)

define('FILENAME_CHECKOUT_CONFIRMATION', 'checkout_confirmation.php');

define('FILENAME_CHECKOUT_PAYMENT', 'checkout_payment.php');

define('FILENAME_CHECKOUT_PAYMENT_ADDRESS', 'checkout_payment_address.php');

define('FILENAME_CHECKOUT_PROCESS', 'checkout_process.php');

define('FILENAME_CHECKOUT_SHIPPING', 'checkout_shipping.php');

define('FILENAME_CHECKOUT_SHIPPING_ADDRESS', 'checkout_shipping_address.php');

define('FILENAME_CHECKOUT_SUCCESS', 'checkout_success.php');

define('FILENAME_CONTACT_US', 'contact_us.php');

define('FILENAME_CONDITIONS', 'conditions.php');

define('FILENAME_CREATE_ACCOUNT', 'create_account.php');

define('FILENAME_CREATE_ACCOUNT_PROCESS', 'create_account_process.php');

define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');

define('FILENAME_DEFAULT', 'default.php');

define('FILENAME_DOWNLOAD', 'download.php');

define('FILENAME_INFO_SHOPPING_CART', 'info_shopping_cart.php');

define('FILENAME_LOGIN', 'login.php');

define('FILENAME_LOGOFF', 'logoff.php');

define('FILENAME_NEW_PRODUCTS', 'new_products.php'); // This is the middle of default.php (found in modules)

define('FILENAME_PASSWORD_FORGOTTEN', 'password_forgotten.php');

define('FILENAME_POPUP_IMAGE', 'popup_image.php');

define('FILENAME_POPUP_SEARCH_HELP', 'popup_search_help.php');

define('FILENAME_PRIVACY', 'privacy.php');

define('FILENAME_PRODUCT_INFO', 'product_info.php');

define('FILENAME_PRODUCT_LISTING', 'product_listing_.php');

define('FILENAME_PRODUCT_LISTING_COL', 'product_listing_col.php');

define('FILENAME_PRODUCT_NOTIFICATIONS', 'product_notifications.php');

define('FILENAME_PRODUCT_REVIEWS', 'product_reviews.php');

define('FILENAME_PRODUCT_REVIEWS_INFO', 'product_reviews_info.php');

define('FILENAME_PRODUCT_REVIEWS_WRITE', 'product_reviews_write.php');

define('FILENAME_PRODUCTS_NEW', 'products_new.php');

define('FILENAME_REDIRECT', 'redirect.php');

define('FILENAME_REVIEWS', 'reviews.php');

define('FILENAME_SHIPPING', 'shipping.php');

define('FILENAME_SHOPPING_CART', 'shopping_cart.php');

define('FILENAME_SPECIALS', 'specials.php');

define('FILENAME_TELL_A_FRIEND', 'tell_a_friend.php');

define('FILENAME_UPCOMING_PRODUCTS', 'upcoming_products.php'); // This is the bottom of default.php (found in modules)

//Wishlist

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

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

define('FILENAME_WISHLIST_SEND', 'wishlist_email.php');

//Wishlist

define('TABLE_WISHLIST', 'customers_wishlist');

// define the database table names used in the project

define('TABLE_ADDRESS_BOOK', 'address_book');

define('TABLE_ADDRESS_FORMAT', 'address_format');

define('TABLE_BANNERS', 'banners');

define('TABLE_BANNERS_HISTORY', 'banners_history');

define('TABLE_CATEGORIES', 'categories');

define('TABLE_CATEGORIES_DESCRIPTION', 'categories_description');

define('TABLE_CONFIGURATION', 'configuration');

define('TABLE_CONFIGURATION_GROUP', 'configuration_group');

define('TABLE_COUNTER', 'counter');

define('TABLE_COUNTER_HISTORY', 'counter_history');

define('TABLE_COUNTRIES', 'countries');

define('TABLE_CURRENCIES', 'currencies');

define('TABLE_CUSTOMERS', 'customers');

define('TABLE_CUSTOMERS_BASKET', 'customers_basket');

define('TABLE_CUSTOMERS_BASKET_ATTRIBUTES', 'customers_basket_attributes');

define('TABLE_CUSTOMERS_INFO', 'customers_info');

define('TABLE_LANGUAGES', 'languages');

define('TABLE_MANUFACTURERS', 'manufacturers');

define('TABLE_MANUFACTURERS_INFO', 'manufacturers_info');

define('TABLE_ORDERS', 'orders');

define('TABLE_ORDERS_PRODUCTS', 'orders_products');

define('TABLE_ORDERS_PRODUCTS_ATTRIBUTES', 'orders_products_attributes');

define('TABLE_ORDERS_PRODUCTS_DOWNLOAD', 'orders_products_download');

define('TABLE_ORDERS_STATUS', 'orders_status');

define('TABLE_ORDERS_STATUS_HISTORY', 'orders_status_history');

define('TABLE_ORDERS_TOTAL', 'orders_total');

define('TABLE_PRODUCTS', 'products');

define('TABLE_PRODUCTS_ATTRIBUTES', 'products_attributes');

define('TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD', 'products_attributes_download');

define('TABLE_PRODUCTS_DESCRIPTION', 'products_description');

define('TABLE_PRODUCTS_NOTIFICATIONS', 'products_notifications');

define('TABLE_PRODUCTS_OPTIONS', 'products_options');

define('TABLE_PRODUCTS_OPTIONS_VALUES', 'products_options_values');

define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS', 'products_options_values_to_products_options');

define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories');

define('TABLE_REVIEWS', 'reviews');

define('TABLE_REVIEWS_DESCRIPTION', 'reviews_description');

define('TABLE_SESSIONS', 'sessions');

define('TABLE_SPECIALS', 'specials');

define('TABLE_TAX_CLASS', 'tax_class');

define('TABLE_TAX_RATES', 'tax_rates');

define('TABLE_GEO_ZONES', 'geo_zones');

define('TABLE_ZONES_TO_GEO_ZONES', 'zones_to_geo_zones');

define('TABLE_WHOS_ONLINE', 'whos_online');

//Wishlist

define('TABLE_WISHLIST', 'customers_wishlist');

 

define('TABLE_ZONES', 'zones');

 

// customization for the design layout

define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

 

// check if sessions are supported, otherwise use the php3 compatible session class

if (!function_exists('session_start')) {

define('PHP_SESSION_NAME', 'sID');

define('PHP_SESSION_SAVE_PATH', '/tmp');

 

include(DIR_WS_CLASSES . 'sessions.php');

}

 

// define how the session functions will be used

require(DIR_WS_FUNCTIONS . 'sessions.php');

tep_session_name('osCsid');

 

// include the database functions

require(DIR_WS_FUNCTIONS . 'database.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// set the application parameters (can be modified through the administration tool)

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION . '');

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

 

// if gzip_compression is enabled, start to buffer the output

if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {

if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {

if (PHP_VERSION >= '4.0.4') {

ob_start('ob_gzhandler');

} else {

include(DIR_WS_FUNCTIONS . 'gzip_compression.php');

ob_start();

ob_implicit_flush();

}

} else {

ini_set('zlib.output_compression_level', GZIP_LEVEL);

}

}

 

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled

if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {

if (strlen(getenv('PATH_INFO')) > 1) {

$GET_arrays = array();

$PHP_SELF = str_replace(getenv('PATH_INFO'), '', $HTTP_SERVER_VARS['PHP_SELF']);

$vars = explode('/', substr(getenv('PATH_INFO'), 1));

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

if (strpos($vars[$i], '[]')) {

$GET_arrays[substr($vars[$i], 0, -2)][] = $vars[$i+1];

} else {

$HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];

}

$i++;

}

 

if (sizeof($GET_arrays) > 0) {

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

$HTTP_GET_VARS[$key] = $value;

}

}

}

} else {

$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

}

 

// include cache functions if enabled

if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

 

// include navigation history class

require(DIR_WS_CLASSES . 'navigation_history.php');

 

// some code to solve compatibility issues

require(DIR_WS_FUNCTIONS . 'compatibility.php');

 

// lets start our session

if (isset($HTTP_POST_VARS[tep_session_name()])) {

tep_session_id($HTTP_POST_VARS[tep_session_name()]);

} elseif ( (getenv('HTTPS') == 'on') && isset($HTTP_GET_VARS[tep_session_name()]) ) {

tep_session_id($HTTP_GET_VARS[tep_session_name()]);

}

 

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, substr(DIR_WS_CATALOG, 0, -1));

}

 

tep_session_start();

 

// Create the cart & Fix the cart if necesary

if (tep_session_is_registered('cart') && is_object($cart)) {

if (PHP_VERSION < 4) {

$broken_cart = $cart;

$cart = new shoppingCart;

$cart->unserialize($broken_cart);

}

} else {

tep_session_register('cart');

$cart = new shoppingCart;

}

 

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

// include the mail classes

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

 

// language

if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

if (!tep_session_is_registered('language')) {

tep_session_register('language');

tep_session_register('languages_id');

}

 

include(DIR_WS_CLASSES . 'language.php');

$lng = new language($HTTP_GET_VARS['language']);

 

if (!isset($HTTP_GET_VARS['language'])) $lng->get_browser_language();

 

$language = $lng->language['directory'];

$languages_id = $lng->language['id'];

}

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

 

// define our general functions used application-wide

require(DIR_WS_FUNCTIONS . 'general.php');

require(DIR_WS_FUNCTIONS . 'html_output.php');

 

// currency

if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {

if (!tep_session_is_registered('currency')) tep_session_register('currency');

 

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

if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

} else {

$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;

}

}

 

// navigation history

if (tep_session_is_registered('navigation')) {

if (PHP_VERSION < 4) {

$broken_navigation = $navigation;

$navigation = new navigationHistory;

$navigation->unserialize($broken_navigation);

}

} else {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

$navigation->add_current_page();

 

// Shopping cart actions

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

if (DISPLAY_CART == 'true') {

$goto = FILENAME_SHOPPING_CART;

$parameters = array('action', 'cPath', 'products_id', 'pid');

} else {

$goto = basename($PHP_SELF);

if ($HTTP_GET_VARS['action'] == 'buy_now') {

$parameters = array('action', 'pid', 'products_id');

} else {

$parameters = array('action', 'pid');

}

}

switch ($HTTP_GET_VARS['action']) {

// 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'])) {

$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

 

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 . "' )");

}

}

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['products_id'] . "' and customers_id = '" . $customer_id . "'");

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 products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_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($goto, tep_get_all_get_params($parameters), 'NONSSL'));

 

}

 

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'])) {

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

 

 

 

 

break;

}

}

 

// include the who's online functions

require(DIR_WS_FUNCTIONS . 'whos_online.php');

tep_update_whos_online();

 

// include the password crypto functions

require(DIR_WS_FUNCTIONS . 'password_funcs.php');

 

// include validation functions (right now only email address)

require(DIR_WS_FUNCTIONS . 'validations.php');

 

// split-page-results

require(DIR_WS_CLASSES . 'split_page_results.php');

 

// infobox

require(DIR_WS_CLASSES . 'boxes.php');

 

// auto activate and expire banners

require(DIR_WS_FUNCTIONS . 'banner.php');

tep_activate_banners();

tep_expire_banners();

 

// auto expire special products

require(DIR_WS_FUNCTIONS . 'specials.php');

tep_expire_specials();

 

// calculate category path

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

$cPath = $HTTP_GET_VARS['cPath'];

} elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {

$cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);

} else {

$cPath = '';

}

 

if (tep_not_null($cPath)) {

$cPath_array = tep_parse_category_path($cPath);

$cPath = implode('_', $cPath_array);

$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

} else {

$current_category_id = 0;

}

 

// include the breadcrumb class and start the breadcrumb trail

require(DIR_WS_CLASSES . 'breadcrumb.php');

$breadcrumb = new breadcrumb;

 

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

// add category names or the manufacturer name to the breadcrumb trail

if (isset($cPath_array)) {

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

$categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $cPath_array[$i] . "' and language_id='" . $languages_id . "'");

if (tep_db_num_rows($categories_query) > 0) {

$categories = tep_db_fetch_array($categories_query);

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

} else {

break;

}

}

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

$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $HTTP_GET_VARS['manufacturers_id'] . "'");

$manufacturers = tep_db_fetch_array($manufacturers_query);

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

}

 

// add the products model to the breadcrumb trail

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

$model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

$model = tep_db_fetch_array($model_query);

$breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));

}

 

// set which precautions should be checked

define('WARN_INSTALL_EXISTENCE', 'true');

define('WARN_CONFIG_WRITEABLE', 'true');

define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');

define('WARN_SESSION_AUTO_START', 'true');

define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');

?>

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