close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Discounts based on users

Thread began 10/08/2014 2:35 pm by Daniel | Last modified 10/10/2014 12:20 pm by Daniel | 1670 views | 12 replies |

Daniel

Discounts based on users

Hello,

i'm trying to add some more dynamic aspects to the site. What I'm wanting to do is make a person create an account with us before they are able to make purchases. I was able to create all the pages needed (pretty sure) in the security assist wizard. In the table that was made in the database I added a custom row labeled userapproved which will just have a simple true or false value assigned to it.

Here's what I'm trying to figure out... If the user that is trying to check out has a false value assigned to it, then the person will need to pay full price for the product. If the user has a true value assigned to it under userapproved in the database then I want them to have a 15% (for example) discount on the product.

What I'm not sure how to do is during the checkout process, I'm needing the site to first check to make sure that the user is logged into the site. Then I'm needing the site to check for userapproved in the database to see if it has the true or false value, and make the appropriate adjustments to the price of the books if needed.

Thank you

Sign in to reply to this post

Jason ByrnesWebAssist

Use security assist to restrict access to the checkout pages.

in the security assist login behavior, go to the session tab and select to store userapproved column in a session variable.

you can use that session variable as a a discount trigger to apply the discount.

Sign in to reply to this post

Daniel

To restrict the pages, for example I have for cart.php
grant access if: Logged into ps4_users
if access denied, go to: login.php

Is this what all the pages involving the checkout process needs to be?

Where would I go to have it check that userapproved value for the static book products?

Sorry, i'm a noob at all this as you noticed from my previous post.

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, that access restriction should be applied to the checkout pages.

When creating the discount in the cart object, use the based on session variable value trigger to check that the saved session is true.

Sign in to reply to this post

Daniel

Jason,

I've added a discount named Academia
Separator and Condition
AND (which is grayed out) If Session variable exists: userapproved

Calculations
Based on the cart subtotal
cart subtotal minus .1

It isn't changing the price of the product though. the userapproved is in the table ps4_users that was created when running the security assist pages. I'm not sure if it's checking that table or not looking for a 0 or 1 value for userapproved to enable the discount for the products.

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

Daniel

This is a dev site that I set up while setting this up. For obvious reasons I didn't want to set this up on the live site.

I have it set up so that you need to be signed into the site with the variable userapproved in the database set to true, Which I'm assuming is a value of 1.

Sign in to reply to this post

Jason ByrnesWebAssist

on the login page, lines 74 - 75 and lines 94 - 95 do not have the code to set the user approved session. I edited those lines from:

"sessionColumns" => explode($WA_Auth_Separator,"UserID"),
"sessionNames" => explode($WA_Auth_Separator,"SecurityAssist_UserID"),



to:

"sessionColumns" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."userapproved"),
"sessionNames" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."userapproved"),



perhaps you made the change locally, but it dod not get uploaded to the server.

on the cart page, the display was set up to not show discounts, I added the discount display back in.

NOTE: the discount is set to trigger if the userapproved session is set. you should use the Based on session variable value trigger instead. it will still get set if the value is false in the DB, just set to 0, that's still set though.

Sign in to reply to this post

Daniel

Jason,

The site is not letting me log in now. I haven't done anything, just hit refresh to test it out. If I do forgot my password it sends me my email and password, but it will not let me log in.

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, should be working now, i had accidentally changed the userid session name. i changed it back to SecurityAssist_UserID

Sign in to reply to this post
loading

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