Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Prices for logged in users only


drakonan

Recommended Posts

I need to be able to set up customer ids for OEM customers only. This means that i need to have the price hidden for non-logged in users.

 

Once a user logs in the prices show. This also should disable all shopping cart functionality etc of course.

 

I tried the similar contribution in the contributions section, but the code must have been too old even for the version of osCommerce I'm using (Just after the "new" checkout... an early december snapshot)

 

Does anyone know of another contribution or could help me?

 

Thanks for your time,

 

Brandon

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Thanks Wayne for your reply, but as I said earlier, I've already tried that one. I even liked how it'd allow quantity to be entered without having to "update" in the cart after "Add to Cart"

 

There's only two months difference between the versions, but it must be enough to mess things up. The strings in the latter part of its modifications needed to be edited tell me to replace code that doesn't exist. I don't understand PHP well enough to interpret what the programmer intended...

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Oh yeah,

Linda asked me in this topic:

http://www.oscommerce.com/forums/viewtopic.php?t=42946

 

if i didn't want prices to show or if i wanted different prices for non logged in customers. I don't want the prices to show at all for those without logins.

 

I'll use a submit form or they'll call to get an ID before they can use any of the shopping cart features or see pricing.

 

I created a new thread prematurely, I somehow was sure that i wasn't responded to... but I was...

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Okay this is quick and dirty but I believe it will give you a solution quickly.

 

In product_info look for the following line:

 

<td align="right" class="pageHeading"><?php echo $products_price; ?></td>

 

In my copy of MS1 it is about line 70. Replace that line with:

 

<td align="right" class="pageHeading"><?php tep_session_is_registered('customer_id') ? echo $products_price : echo "Login to View Price"; ?></td>

 

In includes/modules/new_products.php find the line that starts with:

 

'text' => '<a href="' .

 

and then delete the following section from it:

. $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))

 

In includes/modules/products_new.php find the line that starts with"

 

<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(

 

At the end of that line remove:

 

. TEXT_PRICE . ' ' . $products_price

 

Finally, go into your Admin Control Panel and set the price column to 0 for the product listing.

 

While, this isn't a complete solution, it should get the job done in a quick minute until a more robust solution can be developed.

Link to comment
Share on other sites

Well, I tried what you said but the first part must be syntactically off

 

"Parse error: parse error, unexpected T_ECHO in f:program fileseasyphpwwwdishopproduct_info.php on line 76"

 

You did however find for me the place, and even though I don't know what tep_ anything is (esp tep_session_is_registered) I "echo"ed customer_id and found out it said two when logged in, and I guess its "Null" when not...

 

so I did

 

<td align="right" class="pageHeading"><?php if ($customer_id > 0) {echo $products_price;}else {echo "Login for Price";} ?></td>

 

and its working.

 

Maybe one day I'll be a PHP coder. Then again, maybe not :) What does tep mean and what purpose does that variable you used serve? This is a good opportunity for me to learn some PHP :)

 

Even though the prices don't display now though, they can still purchase the products, they just don't know how much the products would cost until checkout.

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

I think I know what the problem is. Should have had the echo outside the conditional. Well you got it working for now.

 

The tep_ designates functions within Oscommerce. They allow you to access data and variables without hurting the integrity of that information.

Link to comment
Share on other sites

Thanks for your help. Now I need to hide the buttons and checkout unless user is logged in. I guess i'll try and see if I can figure out what "Zip" was coding when he made the price only for logged in customers...

 

Unless you happen to know a good way to go about disabling the checkout and shopping cart.

 

So I guess you're saying that I coded syntactically, but not "grammatically" correct.

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Well it was my first contribution what seems like a long time ago.

 

It was done well before the new check out was done,

Also some of the TEP functions/classes/modules have changed

which makes some of the code not work or work incorrectly

 

The check out has change a lot since then.

 

What I was trying to do is block all prices from showing unless you were logged in and had been approved by the admin.

 

I assumed that if you could not see prices, buy it now button

or in cart button you could not purchase. For those few that could possibly

jump to the cart and add some thing there. It was up to the store owner

to ignore them.

 

At the time I did it to learn php and get familur with OSC.

 

Do I plan on updating the contribution? Good question

I have about 1 to 3 weeks left on my current project, I did have some

other projects besides that one that I wanted to work on.

 

A person could say that since I was the last one to work on it I should upgade it.. But I don't know how soon that would be

 

Tom O'Neill

Link to comment
Share on other sites

Hey "Zip," thanks for replying. "Ajeh" talked about modifying currency.php to better remove prices. That'd work for less coding, and php file "traversal" for all those newbies like me :). I really like her... something about women coders.... :oops: that thought wasn't supposed to become words, but anyway... :wink:

 

I think she implemented that idea with her quantity controller and the new MS1 "shoppe enhancement" mods...

 

With pricing removed what about shopping functionality? Is there something that could be "broken" or whatever unless user is logged in, so even an osc intermediate couldn't manually add and checkout? I wouldn't think it'd be a real problem, but better safe than sorry...

 

I may learn PHP well enough pretty soon to attempt to contribute something... than again I may not :(.

 

At any rate, I've also got to read up on the right way of coding (like for contributions as well) first so...

 

"Ajeh" haven't you made a "gallery" out of osC before? IF so, what did you do to break the shopping cart component? Maybe, the customer_id could be an on off switch for that idea...

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

About the time I published the contribution Linda had published

Quantity Controller a month or two after that. I stopped working on my updated

contribution because some of what I was doing was duplicated in her's.

 

Linda had mentioned at that time about using currency.php to hide the price.

But there was something about that was not working the way I wanted it to I think I could not

get to all the prices that way but I don't remember for sure. Plus

It was between the announcement for the new cart code and the code was release. So I

stopped working on it untill things settled down.I was also going to add several

wholesale price levels.

 

As far as being complicated yes it was, I was in the process of moving a lot of the code to

a price class/function that could be called. It would have reduced code a lot that had to be added to

the core code. by creating a price class function it would not pass a price to the cart unless

a person was logged in. That would prevent the cart side from having anything added

because it would have $0.00 cart total and even if they used a Credit Card $0.00 would have been

charged to it. So no charge backs. And not messing with cart code. It would cause the cart owner

to add the inventory back in.

 

The advantage to this contribution was that the admin had to approve membership. You could also have several membership

levels . Unitll membership was approved no prices were visible. The next logical step would have been

to add once a person created an account they would be able to purchase a membership only,

then the admin would approve them for purchase and see prices.

 

To kind of explain where I was going is that we do ad specialty printing and imprinting.

 

we needed a regular shopping cart, but we also needed a wholesale cart with several

levels of pricing. Regular customer also needed several levels of discounts.

In the ad specialty you have wholesale and quantity discount and they are not always

calculated on a percentage.

 

Any way I got a lot closer today on getting cat_menu_tabs finished today. Working

on that contribution has taught me a lot about moving my code out of the core code

to make it much easier to install. Its also taught me a lot about working with the admin.

In about a week (x2) I should be able to back to it. Then I plan on working on stock control

for attributes.

 

goto go check out that "shoppe enhancement"

 

Tom

Link to comment
Share on other sites

Are you saying you're going to attempt to start working on this or when you refered to getting "back to it" you meant your cat_menu_tabs contrib?

 

I hadn't even thought about stock issues with attributes... looks we'll have that turned off in the admin until you're finished :)

 

Linda has done a really nice job with her Shoppe enhancement, but I don't know if she's going to code a "price only available to customers" component or not... If not, maybe it'd be best to use her code base as a starter for a new login contrib. (Or maybe she'll read this and want to add this part herself :) )

 

One can only hope...

 

Anyway, I'm still having trouble redirecting 404 pages right now...

 

I can't "see" my requested_url.. it's like its missing... I don't know if it's only me or what... Hey, if you get a chance, goto

 

http://www.cookssaw.com/thispageisnthere.html

 

and see if my 404 tells you that it couldn't find "thispageisnthere.html"

 

That's what it should do, but it just says "none" to me...

 

Anyway, I had a nice elaborate page and everything, but it wasn't working, so I just stuck a basic variable echo page there for troubleshooting...

 

(I'm wanting to redirect the old html pages to new php pages)

 

Mine says this: (minus the IP :wink:)

 

Well, (none) doesn't exist, but don't fret, maybe I can help you figure out what you need. Other nice info:

HTTP REFERER: http://www.oscommerce.com/forums/posting.php 

REMOTE ADDRESS: 255.255.255.255 



HTTP HOST: cookssaw.com 



HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705) 



REDIRECT STATUS: (none)

 

Thanks for your time,

Brandon

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

I have made so many add-ons, tweaks and customizations it isn't funny.

 

Some things are quick to do ... others take a but more time.

 

There are settings you can do for quick and painless changes like the currencies.php returns '' when not logged in. But to make it cleaner, the New Products should be cleaned up to not show Price:

 

Or, make currencies.php return ... 'Please Login for Prices' ... things like that.

 

Then the buttons need to switch to login buttons or just their functionality disabled in application_top.php on the Shopping cart actions for not logged in users ... like take them to a login page or something or just do nothing ... etc.

 

I will have to put together a quickie gallery setting to manage a shop where prices show/don't show, login can shop/not shop, etc. etc.

 

I will add something like that to the next version of SEC ... and also see about making a stand alone for it.

Link to comment
Share on other sites

Ok, that's another good idea... :idea: I like that; login buttons instead of just nothing...

 

I've gotta go eat. I know you've done alot for the osCommerce community, and I appreciate it. osCommerce and its community wouldn't be the same without your efforts.

 

Thanks for all your time, and thought

 

Love,:wink:

Brandon

 

PS: I'm going to try to use your logic and see if I can ruin my shop.

 

Thanks again

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

here's the basic stuff I use

 

<!--#echo var="REDIRECT_STATUS" -->

 

 

Opps the page you were trying to go to does not exsits anymore

on <!--#echo var="HTTP_HOST" --> ,

<p>

 

<!--#echo var="REQUEST_URI" -->

 

this line should say what page was requested

 

You can use meta tags here is a sample page from netmechanics for redirect.

 

<HTML>

<HEAD>

<!-- Send users to the new location. -->

<TITLE>redirect</TITLE>

<META HTTP-EQUIV="refresh"

CONTENT="10;URL=http://www.netmechanic.com">

</HEAD>

<BODY>

This page has moved. You will be

automatically redirected

to its new location in 10 seconds.

If you aren't forwarded

to the new page,

<a href="http://www.netmechanic.com">

click here</a>.

</BODY>

</HTML>

 

the part that sends a person to a new page,

 

<META HTTP-EQUIV="refresh"

CONTENT="10;URL=http://www.netmechanic.com">

 

as far as the questions

-------

Are you saying you're going to attempt to start working on this or when you refered to getting "back to it" you meant your cat_menu_tabs contrib?

No I ment, although I may have said it differntly.

When I finish cat_menu_tabs contrib I need to decide on what to start on next. all are seperate contributions

 

1. login for approved customers.

2. quanity control for product attibutes.

3. Dynamicly generated button for thema

4. get a good text attributes working.

5. Wait for Quantity Control update for ms1. (I know Linda, donate and you'll get it done, but I am still trying to recover for all ot the MS dev stuff I purchased and is now sitting on the shelve. Boy, was the boss upset on that one)

 

------

I hadn't even thought about stock issues with attributes... looks we'll have that turned off in the admin until you're finished

 

This part applies if you need to keep invetory on options you add on to a product.

 

Like haveing a basic model then having an option of a 30 hp or a 40 hp engine. You only have x number of engines on hand of both sizes

so you don't want to sale more of one size then you actually have on hand.

 

--------

where I entended to go with customer log on for prices

I intended it so you could show a suggested retail price, your web price, then if you had dealer they could log on and you could have price list for them to use.

It could also be used to prevent a customer or competitors from purchasing or seeing prices untill they were approved by the admin.

 

Tom

Link to comment
Share on other sites

hmm... That's what's so crazy, the variable "request_uri" should have that "bad" page but it doesn't! I've tried this on my local "EasyPHP" apache webserver, and on an online site... I at first was thinking that since the online site used Front Page extensions (which modify alot of the apache config files, the .htaccess etc) but after I tried on my local site, which doesn't I changed my mind...

 

Neither show the variable, it's blank...

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

MMM. I runApache 2.x on my local dev server. but my host

uses 1.3.27 for my online site which works.

 

My live site works, lets me check my local server.

 

Tom

Link to comment
Share on other sites

Could you tell me from step one what you had to do to set up your 404 page?

 

I edited my .htaccess directory, placing

ErrorDocument 404 http://mysite.com/404.shtml (I've also tried in php)

 

Then, I tried to make a simple shtml or php page that echoed the requested (bad) url into the browser for me to see that the variable was there and right. I haven't been able to get it to show though...

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

I am Lazy!

My web host has something called Cpanel.

I enabled error messages that I wanted, clicked on what i wanted for the

script response like reguest url. it then generated it.

I then download to my machine and edit it adding HTML that I used on my web site to generate my static pages..

 

See i told you I was lazy.

 

To tell the truth it has been so long since I set up a redirect. I am using

win98/apache 2.x for dev I try not to mess with it to much since it

tries to go to LALA land when I do.

 

My Linux server , sadly was a parts doner for my son's computer so

I am not messing with real web servers much right now.

 

But in the apache httpd.conf file I think I remember setting it up there.

 

If you have a host you may have to check there faq's or contact tec support to see it the server allows error page redirect.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...