close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart session variables

Thread begun 11/28/2011 4:17 pm by david331670 | Last modified 2/23/2012 4:41 pm by Jason Byrnes | 4847 views | 10 replies |

david331670

eCart session variables

Help again please.
I have a <?php echo $_GET['pgx']; ?> from URL
The "pgx" refers to number of pages of a book.
I have a default number of pages with a fixed price, additional pages are charged for at a price per page. When I use <?php echo $_GET['pgx']; ?> to get total pages in the book my cart sees this as additional pages on top of the default pages, and calculates i.e. a 50 page book as 40pages default +(40 page default +10 additional pages) the calculations are for 90 pages not 50 pages.
How can I subtract the default number of pages (40) from the total book pages given
by supplied by the URL information <?php echo $_GET['pgx']; ?> so that the Cart Summary calculates the total number of pages correctly. I have tried a number of ways i.e. <?php echo $_GET['pgx']; ?>-40 but I do not know what I am doing. I have also tried in the eCart Object in the price calculations with no luck.
Is it easy, can you help
Thanks
David

Sign in to reply to this post

Ian S

Hi David,

Off the top of my head you could try something like

$pagecount = <?php echo ($_GET['pgx']-40); ?>

and then use $pagecount as your chargeable page count variable.

Or if you wanted to put it into a session value

$_SESSION['pagecount'] = <?php echo ($_GET['pgx']-40); ?>

Let me know if that works out.

Cheers
Ian

Sign in to reply to this post

david331670

ecart Voucher

Ian
Thanks I will give its try, I've been very busy and this just got pushed to the back
Thanks
David

Sign in to reply to this post

david331670

page count

Ian
I finally got around to the page count problem.
Your solution for the session variable <?php echo ($_GET['pgx']-40); ?> worked a treat
Thank you very much and Happy New Year
David

Sign in to reply to this post

Ian S

Hi David,

Happy New Year.

Glad it worked out for you :-)

Cheers
Ian

Sign in to reply to this post

david331670

eCart checkout

I have discovered 1 small glitch for <?php echo ($_GET['pgx']-40); ?>
My default setting is for 40 pages, however the customer can select as little as 20 pages which, when they do. puts a -20 pages in the column and multiplies this by the page price and subtracts (20 x .95) from the initial minimum price which I don't want.
Is there a way to eliminate a negative value in the above script, i.e. &#8805; (greater and equal to) 0.
my other alternative is to make the minimum number of pages to 40.
Can you help?
Thanks
David

Sign in to reply to this post

Jason ByrnesWebAssist

after setting the session:
$_SESSION['pagecount'] = <?php echo ($_GET['pgx']-40); ?>


you could check the value, and reset it to 0 if it is a negative value:
if($_SESSION['pagecount'] <= 0) $_SESSION['pagecount'] = 0;

Sign in to reply to this post

david331670

eCart page count

Thanks for your reply
Page count
I have used <?php echo ($_GET['pgx']-40); ?> as part of the cart, not as a session.
Cart code:
<input type="text" name="Spectrum_online_7_Pages_Add" value="<?php echo ($_GET['pgx']-40); ?>" /> where "pgx" is the page count.

Where would I place
if($_SESSION['pagecount'] <= 0) $_SESSION['pagecount'] = 0;
or would this be different.

after setting the session:
$_SESSION['pagecount'] = <?php echo ($_GET['pgx']-40); ?>

Thanks
David

Sign in to reply to this post

Jason ByrnesWebAssist

i dont honestly know enough about how your page is configured to be able to tell you where to put the code.

I guess you could do it directly in the form element using:

php:
<input type="text" name="Spectrum_online_7_Pages_Add" value="<?php echo (($_GET['pgx']-40<0)?0:$_GET['pgx']-40); ?>" />
Sign in to reply to this post

david331670

Ecart page count

Thank you for your reply.
The code: <input*type="text"*name="Spectrum_online_7_Pages_Add"*value="<?php*echo*(($_GET['pgx']-40<0)?0:$_GET['pgx']-40);*?>"*/>
has an error somewhere as the page will not load with this code. (the DW highlighted code when correct is just plain txt ) I'm afraid I don't know how to correct it
Sorry
Can you please check it?
Thanks
dsavid

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