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

Easy way to split up payments for cart items based on a Member ID?

Thread began 7/02/2010 6:04 pm by angelleye | Last modified 7/06/2010 3:47 pm by angelleye | 871 views | 4 replies


Just in case anybody else ever comes across something like this, it is very doable, it's just not something built into eCart that you can do without going into code view.

First, I looped through eCart to gather up an array of all the different member ID's...

$MemberID = '';
$MembersCounter = 0;
$MembersArray = array();

while (!$eCart->EOF())
$CurrentMemberID = $eCart->DisplayInfo("MemberID");

// If ID is not in membersArray , then add it to array.
if (!in_array("$CurrentMemberID", $MembersArray))
array_push($MembersArray, $CurrentMemberID);

if($CurrentMemberID != $MemberID)

$MemberID = $CurrentMemberID;


Then, I loop through that array to process each member ID. Within that loop I loop through eCart again to pick out the items where the member ID matches and tally up a subtotal for that seller. I load that amount into my own object and handle that stuff accordingly...

foreach($MembersArray as $ma){

$subtotal = 0;

while (!$eCart->EOF())
if($eCart->DisplayInfo("MemberID") == $ma){
$subtotal += $eCart->DisplayInfo("Quantity")* $eCart->DisplayInfo("Price");


echo $total = number_format($subtotal, 2)."<br>";
$a->add_field('x_amount', $total);

// Process this total, then move to next.

// Process the payment and output the results
switch ($a->process()) {

case 1: // Successs
echo "<b>Success:</b><br>";
echo $a->get_response_reason_text();
echo "<br><br>Details of the transaction are shown below...<br><br>";

case 2: // Declined
echo "<b>Payment Declined:</b><br>";
echo $a->get_response_reason_text();
echo "<br><br>Details of the transaction are shown below...<br><br>";

case 3: // Error
echo "<b>Error with Transaction:</b><br>";
echo $a->get_response_reason_text();
echo "<br><br>Details of the transaction are shown below...<br><br>";

I was hoping to avoid so many loops but this is working.

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





Ease of use


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