close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Finding an eCart value

Thread began 8/31/2011 1:11 pm by Mike Perry | Last modified 9/01/2011 5:01 pm by Mike Perry | 3560 views | 16 replies |

Mike Perry

Finding an eCart value

I need to filter an update query with an eCart column value.

I'm using a while statement to poll a table of books; one of the eCart columns is the recID for any book in the cart. I need to update the purchaseDate field for any book whose recID is in the cart.

Is there a clean way to just try and match the recID values in the cart in an UPDATE statement??

Thanks,

Mike

Sign in to reply to this post

Jason ByrnesWebAssist

you can usse the cart conditional total to return the quantity of an item with a specific recID.

for example, to look up the cart quantity where recID is "22" you could use this code:

$yourCartName->ConditionalTotal("Quantity", "recID", "22")

where yourCartName is the name of your cart object.

Sign in to reply to this post

Mike Perry

Originally Said By: Jason Byrnes
  you can usse the cart conditional total to return the quantity of an item with a specific recID.

for example, to look up the cart quantity where recID is "22" you could use this code:

$yourCartName->ConditionalTotal("Quantity", "recID", "22")

where yourCartName is the name of your cart object.  


I think I understand this one; what I need is something like this:

  $query = mysql_query('UPDATE books SET purchaseDate = '.$now.' WHERE recID = '<a value in any of the recID fields in the cart object>);  



Does that make sense??

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to hand code the recordset loop to use the value from the recordset and use this in a n if statement to trigger the update

something like this:
do {
if ($yourCartName->ConditionalTotal("Quantity", "recID", $row_RecordsetName['recID']) > 0) {
$query = mysql_query('UPDATE books SET purchaseDate = '.$now.' WHERE recID = $row_RecordsetName['recID']);
}
} while ($row_RecordsetName = mysql_fetch_assoc($RecordsetName))

Sign in to reply to this post

Mike Perry

Originally Said By: Jason Byrnes
  you would need to hand code the recordset loop to use the value from the recordset and use this in a n if statement to trigger the update

something like this:
do {
if ($yourCartName->ConditionalTotal("Quantity", "recID", $row_RecordsetName['recID']) > 0) {
$query = mysql_query('UPDATE books SET purchaseDate = '.$now.' WHERE recID = $row_RecordsetName['recID']);
}
} while ($row_RecordsetName = mysql_fetch_assoc($RecordsetName))  


Thanks, Jason -- I'll play a little and see what happens!!

ETA: Which recordset loop??

Sign in to reply to this post

Jason ByrnesWebAssist

  I'm using a while statement to poll a table of books;  




that recordset loop

Sign in to reply to this post

Mike Perry

Jason -- the code creates the following errors when called in the success.php page:

  Notice: Undefined variable: bookfair in D:\WebDev\htdocs\ccds2011\success.php on line 85

Fatal error: Call to a member function ConditionalTotal() on a non-object in D:\WebDev\htdocs\ccds2011\success.php on line 85  



php:
<?php

    
function updateBookspD()    {
        
$now=mktime();
        do    {
            if (
$bookfair->ConditionalTotal("Quantity""recID"$row_books['recID']) > 0) {
            
$query mysql_query('UPDATE books SET purchaseDate = '.$now.' WHERE recID = '.$row_books['recID']);
            }
        } 
        while (
$row_books mysql_fetch_assoc('books'));
        }
            
?>



Line 85 is the if statement. . .

Thoughts??

Sign in to reply to this post

Jason ByrnesWebAssist

either this code is before the require once line that attaches the cart include file, or the require once line that attaches the cart include file is missing all together.

Sign in to reply to this post

Mike Perry

Originally Said By: Jason Byrnes
  either this code is before the require once line that attaches the cart include file, or the require once line that attaches the cart include file is missing all together.  


This is at the top of the file:

php:
<?php

//WA eCart Include
require_once("WA_eCart/bookfair_PHP.php");
?>
<?php 
require_once('Connections/ccds.php'); ?>
<?php
$bookfair
->GetContent();
?>



The function declaration is the last code prior to the <DOCTYPE> declaration. There is a Clear Cart button on the page that does function properly. . .

Out to a meeting -- back this afternoon. . . thanks

Sign in to reply to this post

Jason ByrnesWebAssist

it would be much easier if you would send the full php file in a zip archive so I can see the full page code in context, without the php file all i can do is guess at things that could be wrong.

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