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!
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!
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 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
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
?>
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
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:
$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.
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?
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.
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.
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.
OK, dont know that much php but something like this?
[price] * [quantity] * $_SESSION['students'] ??
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.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.