close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

filter record set by cart product name on cart page

Thread began 4/07/2010 4:49 am by dave315749 | Last modified 4/19/2010 11:41 am by Eric Mittman | 3068 views | 11 replies |

dave315749

filter record set by cart product name on cart page

Looking for a way to filter a record set by either a ecart product name or ID.

I am showing a record set for each product in the cart.

How would i go about doing this?

Thanks!

Sign in to reply to this post

Eric Mittman

It would probably be best to sort by the item id. You can get the id for the first item in the cart with this value:

php:
<?php echo $eCart1->DisplayInfo("ID"); ?>



You would use the name of your cart in place of eCart1. You can also get the value directly from the bindings tab under the eCart object. You could loop over the items in the cart to get the id for each one using an eCart loop like this:

php:
<?php

while (!$eCart1->EOF())      { //start the loop
?>
code to loop over here
<?php
  $eCart1
->MoveNext(); // go to the next item in the cart
}
$eCart1->MoveFirst(); //after looping over all of the items go back to the first one
?>
Sign in to reply to this post

dave315749

recordset

So how do i do that for a recordset? i highlighted the record set and tryed the repeat cart region but it says "before inserting this item , make a selection on the page. "

Maybe i dont fully understand it

Sign in to reply to this post

Eric Mittman

The code example that I posted it how you would loop over the recordset once for each item. You will need to create your recordset first. In here you can filter it by the item id by going into the filter section at the bottom. In here you will specify to filter on items id column, then for the value you would enter:

php:
$eCart1->DisplayInfo("ID")



You would need to replace the eCart1 with the name of your cart. Once you have the recordset setup like this you can then manually add in the code to loop over each item in the cart. This will give you a series of recordsets with each one for a specific item in the cart. The looping will need to be done manually as this is not a supported feature of the cart.

Sign in to reply to this post

dave315749

ok

Where do i put this code?

PHP Code:
<?php
while (!$eCart1->EOF()) { //start the loop
?>
code to loop over here
<?php
$eCart1->MoveNext(); // go to the next item in the cart
}
$eCart1->MoveFirst(); //after looping over all of the items go back to the first one
?>



??? Does that go on the actual cart where im pulling the record sets values or does that go on the actual php for pulling the recordset?

Sign in to reply to this post

Eric Mittman

If you would like to have a recordset for each item in the cart then you would have this loop occur for the recordset. This will let you have recordsets for each item in the cart. This is not a simple setup, it is custom and will require some additional custom coding to implement.

If you have a recordset that you are filtering for a particular item you can store that records values in a session variable and reference it on any other page in the site. If you want to have the recordset run for all of the items in the cart you will need to loop over your recordset code so that the recordset occurs once for each item. You will need to have unique session variables that hold the values, then you can reference them on your cart page or any other page in the site.

Sign in to reply to this post

dave315749

Got the looping -- new question

I am almost there editing the shopping cart to have multiple items per item in the shopping cart. What i need to know is how to i modify the [total price] of each item in the shopping cart so that i can tell it to multiply by how many show below each item in the cart.

So need to know how to multiply the price by how many record sets are found for each item in the shopping cart.

example of the cart in the picture below.

Sign in to reply to this post

Eric Mittman

The total price that you see for a line item in the cart is calculated with the TotalPrice cart calculation. You can take a look at it in the cart object under the calculations tab. One really cool feature of eCart is that you can customize the calculations or make your own. When altering or crafting one you can make use of php code directly in the calculation.

I think that this will be the key for you to get the total to represent the additional line items in the cart. If you do it like this you will get the accurate price for the items in the cart itself and can rely on the built in cart functionality for discounts, charges, shipping, tax and all of the regular checkout stuff.

Sign in to reply to this post

dave315749

OK, dont know that much php but something like this?

[price] * [quantity] * $_SESSION['students'] ??

Sign in to reply to this post

Eric Mittman

The exact code that you will need to put in will depend on how you are accumulating the value of the additional items that are in the cart. It will be up to you to get this calculation formed correctly.

The calculation that you have listed here should work if the quantity specified is for all of the items the the $_SESSION['students'] variable holds the accumulated values of the other items. Remember that the calculation is like a column in the cart and is performed for each line item in the cart, so if your session variable does not exist before the first item is in the cart it might cause problems. Doing an update to the cart display after setting this session variable should make it work though.

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