close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

select wholesale price in ecart and on detail page when session variable exists.

Thread began 9/07/2009 8:35 pm by dave315749 | Last modified 9/14/2009 9:00 am by Jason Byrnes | 1877 views | 4 replies |

dave315749

select wholesale price in ecart and on detail page when session variable exists.

HI, i am building a website and i need to know how to make ecart see when a session variable when a wholesaler is logged in then choose the wholesale_price column from the database and add that price to the cart instead of the retailprice column.

I had a support ticket on this from a previous version of ecart, and tried but it didnt work.

Does anyone have a step by step instructions?

Sign in to reply to this post

Eric Mittman

I do not have a step by step guide for you on this but here is the general idea:

You set the session variable when the user logs in. You will check this session variable to determine the price to charge.

How you do that is to make sure you have a whole sale price in your table for your items. There should be a public price and the wholesale price.

Once you have that worked out you should just set it up to use the public price. Then you will need to manually edit the code on the page to have it use the wholesale price if the session variable is set to a particular value.

So if your session variable is called 'wholesaler' and has a value of 1 and the recordset on your product detail page was call rsProducts and the columns were 'price' and 'wholesale' you would update the code for the price in the add to cart server behavior like this:

$ATC_itemPrice = ($_SESSION['wholesaler'] == 1)?$row_rsProducts['wholesale']:$row_rsProducts['price'];

This type of selection statement to choose one value over another based on a condition is called a ternary expression. If the condition is true then the value after the question mark is used, if the condition is false then the value after the colon is used instead. So in this case if the session variable wholesaler holds a value of 1 then the wholesale price from the db will be used, otherwise use the regular price column.

This is only meant to be a high level overview, not a step by step guide. If you have any questions about any part of this please post back with your questions and I will do what I can to help clarify, or make other suggestions that may help.

Sign in to reply to this post

mike292921

This may be easier

I just think its easier since your site is dynamic to create a wholesale subdomain and use the column wholesale price as the value when they log in to avoid some more time consuming steps. At least that is what I would and make it just restricted to those who are wholesalers. Easy enough because I try not to get too techy, I not advanced but I get the job done.

Sign in to reply to this post

dave315749

It worked for ATC

Thanks it worked perfectly!

What would it involve to automaticly set the shopping cart to show the values of wholesale_price when they are logged in as a wholesaler... but then if they are not logged in to show the retail_price ?

Sign in to reply to this post

Jason ByrnesWebAssist

Create an if statement where you are displaying the price:

php:
Price: $<?php 

if($_SESSION['wholesaler'] == 1) {
  echo 
$row_rsProducts['wholesale']
} else { 
  echo
$row_rsProducts['price'];
}
?>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...