close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Tweaking... need some help on few issues

Thread began 5/30/2012 1:47 am by Christopher West | Last modified 6/01/2012 2:19 pm by Jason Byrnes | 4848 views | 12 replies |

Christopher WestCommunity Expert

Tweaking... need some help on few issues

Hello

I need to tweak my website and figured to put all issues I need help with in one post.

1. Rather then using timestamp in my database table. What code can I put in the date field of my insert server behaviour (as want to make sure that the current data doesn't get entered when I update a record in the website.

2. in the website I built whe a customer adds a product to the cart then click on checkout it needs to login, however if they haven't set an account up yet they need to register..however on registration it automatically logs them in but it goes to their customer area rather then going back to the point before registering. (in this case the checkout page) the system already works when a customer has already registered so when they login it goes to checkout etc. but it doesn't if they need to register first. So I need it to redirect if they are registering while they added a product to the cart.

3. I have. Page where a customer adds different shipping addresses for future use. So on the page where they select a shipping address as a default one (which gets displayed in the checkout page) I'm using a checkbox however for this to work the customer would need to deselect any they don't want and check the one they want as a default ..this is rubbish coding on my part..but I just can't figure out how to use radio buttons so that the list of different address are shown the.customer selects an address to be default using radio buttons then clicks saves which in turn updates all the address records on that page..I tried and each attempt never works for me. Any advice on how to solve this?

4. I used session variables to insert my order tables with the details from the checkout page..but realised that if a customer changes their email address then only their account table is updated and the orders table still holds their old email address...what would be the best way to make sure the order tables also. Get updated with new email address.

5. On my header next to the cart link what code could I use to display a link like "cart [4] items in cart"

6. On my categories menu list what code could I use to put the number of products in brackets on the right side of the categories name. Eg. Charm Bracelets (11)

Sign in to reply to this post

Jason ByrnesWebAssist

1) Set the data type for the date field to use date rather than timestamp. the use the following code to insert the correct date:

php:
<?php echo(date("Y-m-d")); ?>




2) does the registration page have an authenticate user behavior on it that automatically logs them in?

create the link to the registration page as:
<a href="regitration.php?accesscheck=<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">register</a>

and on the registration form, make sure the action passes any query string variables that are passed in:

php:
 action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != ""?"?".htmlentities($_SERVER["QUERY_STRING"], ENT_QUOTES):""); ?>"




3) Each shipping address should be a unique record. I'm assuming that in your users table, you have a column that links to the default shipping address by storing the ID for that record?

the radio buttons value should use the ID for the shipping address records, and on submit it should update the relation column in the users table.

4) you should be storing the ID of the logged in user in the orders table, and use a join query to return the billing address rather than storing it in the orders table.

5) use the following code to display total quantity:

php:
<?php echo $cartName->TotalColumn("Quantity"); ?>



6) You would need to use an SQL COUNT statement to return the numbers of records that belonged to the category:
sql_func_count.asp

Sign in to reply to this post

Christopher WestCommunity Expert

for point (3) I I just have a shippingaddress table with each address stored in individual records and each one has a field called "default" which is an int(1) so value 0 means not default and value 1 means default address to use. so on my checkout page i have a recordset query that selects the address where that field is set to 1.

point (2) yes the registration page i added an authenicate user ages ago as originally when a customer registers i wanted them to be logged in automatically. but i never account for them registering while creating an order.

Sign in to reply to this post

Jason ByrnesWebAssist

Originally Said By: designerwest
  for point (3) I I just have a shippingaddress table with each address stored in individual records and each one has a field called "default" which is an int(1) so value 0 means not default and value 1 means default address to use. so on my checkout page i have a recordset query that selects the address where that field is set to 1.  



not the correct way to do it.

in the users table, you should have a column that stores the ID of the default shipping address instead.

Sign in to reply to this post

Christopher WestCommunity Expert

ok **** :) thanks. will need to recode quite a bit from the adivce you given me today on various bits :)

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, I just tested the Issue Number 2 in my post (concerning customer registration page not redirecting to the checkout page)

The issue is when I go through the process when clicking on the button to register it would go back to the login page (but I know im logged).

I added your code - which im attaching for you to view.

I would like to point out the below querystrings in the URL if this helps troubleshoot...the order they are are follows:

checkout page
login page (here would be the link to register as well)
registration page

login.php?accesscheck=%2Fcheckout.php%3F

login.php

login.php

Chris

Attached Files
functions.zip
Sign in to reply to this post

Jason ByrnesWebAssist

The redirect page after registering is based on the accesscheck query string variable


the accesscheck querystring variable will be used as the redirect page. The code i gave to link to the registration page should be placed on the checkout page.

this link to the registration page:
login.php


will redirect to the login page because that is the value of the accesscheck variable:
accesscheck=/login.php

Sign in to reply to this post

Christopher WestCommunity Expert

Jason you totally lost me now :(

how can i put a "link" on the checkout page if the user cant access the checkout page since they would need to login/register

the register link needs to be on the login page (so user has the choice to login or click register link if they are not a member).

I just a little lost now when you suggested the link should go on the checkout page :( sorry if i got you totally wrong (lack of sleep) Chris

Sign in to reply to this post

Jason ByrnesWebAssist

to make the link on the login page redirect to the checkout page, use this code:
<a href="../../register.php?accesscheck=/checkout.php">click here</a>

Sign in to reply to this post

Christopher WestCommunity Expert

so am i right in saying that you code you just gave me just now replaces the original code you gave me early one which was:

<a href="regitration.php?accesscheck=<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">register</a>

as this is what confused me slightly :)

I just need to make sure that :
1. (all registration links is done via the link on the login and forget password page)
2. if customer registers by going to login page first, it will log them in and go to their account.
3. if customer adds stuff to cart then when they go to checkout it requires them to login, but they click on register after register they go to checkout page (without going to their account as stated in point 2).
4. if customer adds stuff to cart then when they go to checkout they just login, then this goes to checkout (this currently happens on my original code thats live on website)

I just want to confirm that your code help does the above conditions.

currently your code suggestion is:

on the register form i use: action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != ""?"?".htmlentities($_SERVER["QUERY_STRING"], ENT_QUOTES):""); ?>"

and on the register link (on my login and forget password pages, i use the code:

<a href="../../register.php?accesscheck=/checkout.php">Register</a>


Obviously on the register page i do have "secruity assist authenticate user"

and have ticked "pass original query string on redirect" and "go to previous url (if exists)"

if log in succeeds, go to: accoutn.php
if log in fails go to: login.php

on the login.php for he authenticate user i also have ticked the passquery string and go to previous url, i left if log in succeeds blank.

obviously i attahced the files previously as well to show what i mean.

Chris


Chris

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