svepe Posted July 26, 2003 Posted July 26, 2003 Hi all, I?m (trying..) making a "shop" for resellers. I have disabled so that nobody (but me :) ) can register users and so on.. This far I really like the way osCommerce is build. Even for me who aint good with code it?s quite easy to modificate it the way you want it! Though I have run into an issue that I would appreciate some help with, and yes, I can?t do it without some help from a codeing guru.. :( I would like the prices in my shop to be "disabled" until you login, is this possible and how hard would it be to make this more than fiction? ( this because I would like resellers to see what we are offering but they have to apply for reseller before they can see the prices we offer. ) Thanx in advance for any points of views and (perhaps) some help with the codeing!
Guest Posted July 26, 2003 Posted July 26, 2003 http://www.oscommerce.com/community/contri...ons,601/page,10
svepe Posted July 26, 2003 Author Posted July 26, 2003 WOW!!! :) THANX A LOT MELTUS!!! Going to try it out right a way! Thank you really much again!!
svepe Posted July 26, 2003 Author Posted July 26, 2003 Lots of usefull stuff on those pages! Recomend them to all of you! Does anyone have:loginviewprice2?.zip who could send it to me? The download page was down so I couldn?t download the file... :(
Guest Posted July 26, 2003 Posted July 26, 2003 In catalog/includes/classes/currencies.php... right down the bottom change: function display_price($products_price, $products_tax, $quantity = 1) { return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); } } ?> to: function display_price($products_price, $products_tax, $quantity = 1) { if (tep_session_is_registered('customer_id')){ return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); } else { return ''; } } } ?> You may wish to hide the cart also... column_right.php if (tep_session_is_registered('customer_id'))include(DIR_WS_BOXES . 'shopping_cart.php'); and in catalog/shopping_cart.php, change: require("includes/application_top.php"); to: require("includes/application_top.php"); if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); }
svepe Posted July 26, 2003 Author Posted July 26, 2003 Johnson, thank You so much for Your time!! I really appreciate it! Thank You very much! I ?would never had this thing working on my own!
Guest Posted July 27, 2003 Posted July 27, 2003 That's what I am here for... B) BTW, where the code has: } else { ? ? ? ? ? ?return ''; ? ? ?} You *can* put something like: } else { ? ? ? ? ? ?return 'Login for price'; ? ? ?}
blokke Posted January 15, 2004 Posted January 15, 2004 ........... You may wish to hide the cart also... column_right.php ?if (tep_session_is_registered('customer_id'))include(DIR_WS_BOXES . 'shopping_cart.php'); and in catalog/shopping_cart.php, change: ?require("includes/application_top.php"); to: ?require("includes/application_top.php"); ? ? ?if (!tep_session_is_registered('customer_id')) { ? ?$navigation->set_snapshot(); ? ?tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); ?} Hide Prices suggested code by Matti Ressler My install: modified MS2 The code for catalog/shopping_cart.php returns an error message: "Parse error: parse error in \catalog\shopping_cart.php on line 16" (the "if"-line). I tried to run without the code for shopping_cart.php, but found that it is possible to add a product / buy and then view the price in the shopping cart. Please help... ....play it again, Sam....
Guest Posted January 15, 2004 Posted January 15, 2004 Post some of your own file - the above code is correct - I suspect you may have an error in a line above the mod. Matti
blokke Posted January 15, 2004 Posted January 15, 2004 Thanks for your reply. I'm very close to a B2B functionality of osC.... The start of catalog/shopping_cart.php is <?php /* $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require("includes/application_top.php"); ?// Start "hide prices" ? ?if (!tep_session_is_registered('customer_id')){ ? ?$navigation->set_snapshot(); ? ?tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); ?} // Stop "hide prices" require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> The error message refer to line 17 which is the "if"-line. Tell me if you need more code. Thanks again. :) ....play it again, Sam....
Guest Posted January 15, 2004 Posted January 15, 2004 It looks fine - I would say you are pulling the error page from cache - clear your cache. Matti
blokke Posted January 15, 2004 Posted January 15, 2004 Sorry,I don't think so. I cleared and got the same error. I've tried both an online test and on my PC, both with Opera and IE. The same thing happens. Here is what I do: 1. From the front page (where prices are hided) click on a product. 2. From product info page click on "add to Chart" button. 3. Error message..... How can I work to find find the source of the error? Any clues? Is it a lot of comlicated work to remove the "buy now" and "add to chart" buttons, when not logged in? (I can give you the link, if you want to see...) ....play it again, Sam....
rerbe Posted January 16, 2004 Posted January 16, 2004 I have been looging for a solution for hiding the prices for non-logged in users, I could not get the contribution to work, but this works great!!!!! You the Man!!!!! :) :) :) :) The solution is never too far away ...
blokke Posted January 16, 2004 Posted January 16, 2004 Hi, Richard! Good thing that you are successful with the code for hiding prices. I still have some problems. I even tried on a clean install and got the same error: "Parse error: parse error in \catalog\shopping_cart.php on line 16" (the "if"-line). What happens when not logged in and you try to add a product to the cart, or just try to look at the cart? That's when I get the error. I simply don't understand what's happening here....... :blink: Would appreciate your comments on this. Thanks! ....play it again, Sam....
devosc Posted January 16, 2004 Posted January 16, 2004 Hi All, I started to implement this feature on my, and recently noticed this thread, both of which applies the same logic. However, one thing I have noticed in my own version, is when a guest customer is redirected to login page, once they login the cart is not automatically updated with the item that they had price-blindly selected. This I am now thinking might be irrating to customers who are registered but just doing a preliminary browse, so I am now considering removing the buy now buttons altogether. But on an extended slightly similiar note, which might help to overcome the above, is there a way for to get osC to return the customer to the page that they were currently viewing when they clicked the buy now button and then logged in, which by default seems to be redirecting the customer to the main index page? "Any fool can know. The point is to understand." -- Albert Einstein
blokke Posted January 17, 2004 Posted January 17, 2004 For information :D I solved my problem in another way, by removing all the "buy now" and "add to cart" buttons when not logged in. As soon as a customers log in and are approved, he may see the prices. Seems to work well. I never found out about my parse error problem.... Thanks for help anyway. ....play it again, Sam....
billyjack Posted February 7, 2004 Posted February 7, 2004 Could you shed a little light on how you accomplished hiding the add to cart and checkout if user isnt logged in, and show the buttons when they are logged in. I really could use this code. thank you billyjack :o
blokke Posted February 21, 2004 Posted February 21, 2004 Hi! Sorry for my late answer, have been busy lately. Here is my solution to hide prices and hide buy buttons: Appendix A //start blokke "hide prices" Hide Prices (simple code from forum) - ok 291203 ( http://www.oscommerce.com/forums/index.php?sho...F%BDentry202205 ) In catalog/includes/classes/currencies.php... right down the bottom change: ? ?function display_price($products_price, $products_tax, $quantity = 1) { ? ? ?return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); ? ?} ?} ?> to: ? ?function display_price($products_price, $products_tax, $quantity = 1) { ? ? if (tep_session_is_registered('customer_id')){ ? ? ?return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); ? ? ? ?} else { ? ? ? ? ?return ''; ?} } } ?> ------------------------ hide the cart also... column_right.php ?if (tep_session_is_registered('customer_id'))include(DIR_WS_BOXES . 'shopping_cart.php'); ------------------------ hide the spesials also... column_right.php if (tep_session_is_registered('customer_id'))include(DIR_WS_BOXES . 'specials.php'); ------------------------ Suggested change in shoppingcart not done (forum). ------------------------ remove "add to cart" buttons: \catalog\product_info.php Replace: <td class="main" align="right"> echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> With: <td class="main" align="right"><?php if (tep_session_is_registered('customer_id')){ echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); }else{ RETURN'Login for price'; }?></td> ------------------------- /catalog/product_reviews_info.php Replace: echo '<p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></p>'; With: if (tep_session_is_registered('customer_id')){ echo '<p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></p>'; } ------------------------- blokke - remove "Buy now" buttons Catalog/index.php Line 128-147 is now like: if (tep_session_is_registered('customer_id')){ $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); }else{ $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE); } // end blokke "hide prices" Hope this will help. Regards Brynjar lokke as "blokke" :) ....play it again, Sam....
Recommended Posts
Archived
This topic is now archived and is closed to further replies.