azer Posted February 16, 2006 Share Posted February 16, 2006 hi mates , i released a new version of : Prices for Logged-In Users Only http://www.oscommerce.com/community/contributions,601 Provide a new configuration variable: "Allow Guests to See Prices". When 'false', all prices and methods of ordering a disabled unless the user is logged in. i need help fixing a bug i got : when someone chose to add for instance 4 times the same article, if it s not logged , he is redirect ro the login page, and as to login BUT after being logged in , the cart is empty , the information regarding the product he added are lost any advice : // customer adds a product from the products page case 'add_product' : // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { 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; Quote MS2 Link to comment Share on other sites More sharing options...
EricK Posted February 19, 2006 Share Posted February 19, 2006 Hi, I'm trying to add the Logged-In Users Only with QT Pro contribution installed, and I get a Parse error: unexpected T_CASE in .../catalog/includes/application_top.php on line 427 ... this is line 427 in application_top.php // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) { Where should I add this redirect code .. // customer adds a product from the products page case 'add_product' : // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { into this? // customer adds a product from the products page // BOF: MOD - QT Pro // 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']); case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id']) && ($HTTP_POST_VARS['products_id']==(int)$HTTP_POST_VARS['products_id'])) { $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']; } } $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes); // EOF: MOD - QT Pro } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Much thanks, EricK Quote Link to comment Share on other sites More sharing options...
Guest Posted April 3, 2006 Share Posted April 3, 2006 Hi there! Great contribution, i love it :blush: Just a question from a PHP dummie... When i go to the link that says ' login for price' it redirects to the wrong place. It redirects to http://www.warez4less.com/login.php but is has to be http://www.warez4less.com/oscommerce/login.php . Any ideas? Thank you, Walter Berude, Holland Quote Link to comment Share on other sites More sharing options...
TabulaRasa Posted April 13, 2006 Share Posted April 13, 2006 In the instructions it says to replace this code in the application_top.php file // 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; // performed by the 'buy now' button in product listings and review page case 'buy_now' : 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; The problem is that code doesn't appear anywhere in the application_top.php file I'm looking at. Any thoughts? Quote Link to comment Share on other sites More sharing options...
jackrabbit Posted April 20, 2006 Share Posted April 20, 2006 Yea, hi! Thank you for your work on this contribution! When I went to use the lastest contribution I found that the code to be replaced in the currencies.php was not in my currencies.php. So, I dl'd the v4.3 and installed that without a problem and it works great. I was just wondering what I am missing out on and if there is anything I can do to get this latest version working. Thanks for your work and your help. Quote Link to comment Share on other sites More sharing options...
Jari646 Posted April 24, 2006 Share Posted April 24, 2006 Hi, Can somebody help me modify this contribution, so that price and quantities show only logged users? :thumbsup: Quote Link to comment Share on other sites More sharing options...
vtella Posted May 13, 2006 Share Posted May 13, 2006 Can anyone tell me whats wrong with this code? I am installing the mod on CRELOADED 6.2 Pro. I keep getting a parse error , unexpected $ But for the life of me I can't find where the braces need to be closed. The code in question is catalog/product_info.php. Here is the code from that page with the contrib added. It didn't have the code that initially needed to be changed so I added it to the top as you can see. ------------------------------------------------------------------------ if ($products_options['options_values_price'] != '0' && tep_session_is_registered('customer_id')) { require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); $content = CONTENT_PRODUCT_INFO; $javascript = 'popup_window.js'; require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> ---------------------------------------------------------------------- If I leave out the code change I can get to the product info page and everything looks good, but after the description I get this error in the same box. ----------------------------------------------------------------- 1054 - Unknown column 'popt.language_id' in 'where clause' select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='142' and patrib.options_id = popt.products_options_id and popt.language_id = '1' [TEP STOP] ----------------------------------------------------------------- Any and all help would be welcome. Here is the link to the contrib so you can check it out. www.oscommerce.com/com...load,11453 If you want to see whats going on you can go to my catalog @ www.victortella.com/catalog Just go through the procces of selecting a product and you will see what I mean. All the best Victor Quote Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2006 Share Posted May 21, 2006 After a week of going through the contributions and forums and googling the forum I finally give up. This contribution seems ideal except for one aspect that I can find no solution for. I am building a store that is strictly wholesale with a list of stockists for visitors. I therefore do not want visitors redirected to the login page but want to hide the buy now and add to cart buttons on product_listing.php and product_info.php. My dealers however want to see the recommended retail price, so I cannot use a "hide prices if 0" contribution. I've installed the seperate pricing contribution so I am able to select the visitors as a group in order to hide the prices and buttons just from them ..... but how to actually write the code I have no idea. I've managed to hide the prices via currencies.php, but the buttons are driving me nuts. I've even studied the code of this and similar conributions to see if I could come up with my own hack, but no luck. Can someone please, please help me! Quote Link to comment Share on other sites More sharing options...
yatahaze Posted June 6, 2006 Share Posted June 6, 2006 I've been able to hide lots of information using a bit of code from this mod. Is there a way for me to hide EVERYTHING when the person is logged off? I have a piece of code that I can surround anything to get it to hide if the user isnt logged in. Is there a part of the oscommerce that when deleted, the site just appears to be blank? I can wrap that in the code, then it will be turned into the login box or whatever I choose. Anyone know if such code exists? Quote Link to comment Share on other sites More sharing options...
azer Posted June 26, 2006 Author Share Posted June 26, 2006 Is there a way for me to hide EVERYTHING when the person is logged off? there is a contribution that do that , you should search in the contribs ! another problem , is taht if any body add something to the cart, it redirect to the login page and lose the added element and the page wehre the customer was coming from :angry: i know there is a contribtuion that solve this kind of trouble , but didnt find it yet ! Quote MS2 Link to comment Share on other sites More sharing options...
Alexian Posted July 13, 2006 Share Posted July 13, 2006 Can someone please help me I keep getting this error: Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/12706/catalog/includes/classes/currencies.php:102) in /var/www/html/12706/catalog/includes/functions/general.php on line 80 I have even put the origenal header file back This is on line 80: header('Location: ' . $url); Quote Link to comment Share on other sites More sharing options...
scheinarts Posted July 19, 2006 Share Posted July 19, 2006 Can anyone tell me whats wrong with this code?I am installing the mod on CRELOADED 6.2 Pro. I keep getting a parse error , unexpected $ But for the life of me I can't find where the braces need to be closed. The code in question is catalog/product_info.php. Here is the code from that page with the contrib added. It didn't have the code that initially needed to be changed so I added it to the top as you can see. ------------------------------------------------------------------------ if ($products_options['options_values_price'] != '0' && tep_session_is_registered('customer_id')) { require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); $content = CONTENT_PRODUCT_INFO; $javascript = 'popup_window.js'; require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> ---------------------------------------------------------------------- If I leave out the code change I can get to the product info page and everything looks good, but after the description I get this error in the same box. ----------------------------------------------------------------- 1054 - Unknown column 'popt.language_id' in 'where clause' select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='142' and patrib.options_id = popt.products_options_id and popt.language_id = '1' [TEP STOP] ----------------------------------------------------------------- Any and all help would be welcome. Here is the link to the contrib so you can check it out. www.oscommerce.com/com...load,11453 If you want to see whats going on you can go to my catalog @ www.victortella.com/catalog Just go through the procces of selecting a product and you will see what I mean. All the best Victor this contribution claims it will do it Show Price list for SPPC 4.1 v1.0 http://www.oscommerce.com/community/contri...eparate+pricing Quote Link to comment Share on other sites More sharing options...
asmt3 Posted July 25, 2006 Share Posted July 25, 2006 Can someone please help me I keep getting this error: Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/12706/catalog/includes/classes/currencies.php:102) in /var/www/html/12706/catalog/includes/functions/general.php on line 80 I have even put the origenal header file back This is on line 80: header('Location: ' . $url); Know this post is old, but maybe this will useful for someone else: Try deleting any blank space at the beginning and/or end of currencies.php. Worked for me :-" Quote Link to comment Share on other sites More sharing options...
avidiom Posted August 17, 2006 Share Posted August 17, 2006 after adding the "Prices for Logged-In Users Only" and "restricted_website" contribs, the add to cart button now does not work in the products listing page when a customer is logged in. The customer would need to go into the product information page in order to add the item into the cart. Does have a SSL cert cause this problem? Any suggestions? Which codes do you need to see in order to help me? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 21, 2006 Share Posted August 21, 2006 Ok, well I don't get something: This contribution works fine and all, but if someone adds something to the cart, it gives a cart subtotal! So what good does it do to hide the prices, only to have them just show up anyways without being logged in? Did I miss something? :'( Quote Link to comment Share on other sites More sharing options...
scaphis Posted September 7, 2006 Share Posted September 7, 2006 I love this contrib. very much, as I am adding a normal categories box for engine parts, turbo kits etc. but also a box for "customer cars". I managed to show the images in the header using box1.gif,box2.gif names in the images folder, however, I cannot figure out how to add this contribution on top: Great Categories *CSS* v2.1 Standard - 2005/07/09 Would be nice if anyone could show me how to alter the php so that I can use these CSS styles with multiple Category boxes. here is a screenshot of my site before multiple categories with the Great Categories Contribution: here is after: P.S.- I am not using the category box enhancement contrib.-so I commented it out HERE: // CategoryBox Enhancement // if (tep_has_category_subcategories($counter)) { // $categories_string .= tep_image(DIR_WS_IMAGES . 'arrw1_L.gif', ''); // } // else { // $categories_string .= tep_image(DIR_WS_IMAGES . 'arrw2_L.gif', ''); // } :LIKE THAT Quote Link to comment Share on other sites More sharing options...
sellis21970 Posted September 28, 2006 Share Posted September 28, 2006 Ok, well I don't get something: This contribution works fine and all, but if someone adds something to the cart, it gives a cart subtotal! So what good does it do to hide the prices, only to have them just show up anyways without being logged in? Did I miss something? :'( Have you found a fix for this. I am having the same problem. Quote Link to comment Share on other sites More sharing options...
azer Posted November 8, 2006 Author Share Posted November 8, 2006 there is a bad aspect with this contrib , it s taht when you add in cart or you are in page and you login to see price , then you lose the informations of the products you wantd to put in cart or the page where you where located , i know i saw one time a fix for that but impossible to find again Quote MS2 Link to comment Share on other sites More sharing options...
designxxl Posted March 24, 2007 Share Posted March 24, 2007 (edited) this was a wrong reply, sorry:( Edited March 24, 2007 by designxxl Quote Link to comment Share on other sites More sharing options...
designxxl Posted March 24, 2007 Share Posted March 24, 2007 after adding the "Prices for Logged-In Users Only" and "restricted_website" contribs, the add to cart button now does not work in the products listing page when a customer is logged in. The customer would need to go into the product information page in order to add the item into the cart. Does have a SSL cert cause this problem? Any suggestions? Which codes do you need to see in order to help me? Thanks in advance. Know this post is old, but maybe this will useful for someone else: Try deleting any blank space at the beginning and/or end of currencies.php. Worked for me :-" The problem is that the modifcation made in file APPLICATION_TOP.PHP is incorrect. FIND THIS CODE: // 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; // performed by the 'buy now' button in product listings and review page case 'buy_now' : 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; and REPLACE WITH // customer adds a product from the products page case 'add_product' : if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { 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; // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { 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; It should work now Quote Link to comment Share on other sites More sharing options...
Guest Posted March 29, 2007 Share Posted March 29, 2007 My logged in show prices on the "Buy Now" button will add the item to the cart, BUT logs the person OFF and returns them the the same product page they are on. If the person logs back on again the item is there. It does NOT happen on the "Add to Cart" button. Does anyone have or had the same problem or any ideas on how to fix it? Any help would be greatly appreciated Bob Quote Link to comment Share on other sites More sharing options...
xavierchan Posted April 17, 2007 Share Posted April 17, 2007 if let say I want to make it to be viewed without logging in, how can I do it? Actually I have forget which codes I used for the function. Quote Link to comment Share on other sites More sharing options...
hgrzesiek Posted July 2, 2007 Share Posted July 2, 2007 The problem is that the modifcation made in file APPLICATION_TOP.PHP is incorrect. FIND THIS CODE: // 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; // performed by the 'buy now' button in product listings and review page case 'buy_now' : 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; and REPLACE WITH // customer adds a product from the products page case 'add_product' : if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { 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; // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } else { 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; It should work now Hi to all I made this changes in application_top.php but i still getting the same error. Any ideas. I would be really greatful for any help Quote Link to comment Share on other sites More sharing options...
inferno272 Posted August 29, 2007 Share Posted August 29, 2007 im curious, im using the contrib, and it works just fine, however the issue i have is only a few products are to have this restriction on it, not them all. is there a way to selectively turn this on and off for different categories/manufacturers/individual products? Quote Link to comment Share on other sites More sharing options...
inferno272 Posted August 29, 2007 Share Posted August 29, 2007 anyone? 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.