close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 | 804 views | 4 replies |

angelleye

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

I've got eCart setup and I included a custom column called MemberID. I need to create a checkout system that splits up the payments so each seller receives their money directly.

For example, say there are 5 items on the cart. 2 belong to seller 1 and totals $20.00, 2 belong to seller 2 and totals $10.00, and 1 belongs to seller 3 and totals $25.00. I need to somehow make this available to my application so I can generate my own calls to authorize.net...one for each payment on the split order.

So a single order that the buyer sees a grand total of $55.00 needs to split into 3 differnet payments to 3 different sellers: 20.00, 25.00, and 10.00.

The MemberID in the shopping cart should make this easy on me but I'm just not seeing the best way to do this. I can handle the calls to Authorize.net once I have my 3 seprate totals pulled out, I just need those 3 seprate totals (or however many different sellers are on any given order.)

Any information on how I can handle this would be greatly appreciated. thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

This is not supported in eCart.

eCart cannot split the payments between different sellers.

The payments can be made to only one seller account.

Sign in to reply to this post

angelleye

I know it's not a direct feature of eCart, but I was hoping maybe it was something you guys had run into before and came up with some creative way of handling it.

My plan of action right now is to simply loop through eCart and create separate arrays that consist of each separate seller's items. Then I can easily handle the rest myself. I'm just struggling a little bit with the PHP logic to accomplish that.

If you happen to know of something that would work out for me I'd be much appreciative. Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

No, we do not have a way of accomplishing this using eCart.

Sign in to reply to this post

angelleye

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)
$MembersCounter++;

$MemberID = $CurrentMemberID;
$eCart->MoveNext();

}
$eCart->MoveFirst();



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 Authorize.net object and handle that stuff accordingly...

foreach($MembersArray as $ma){

$ma;
$subtotal = 0;

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

$eCart->MoveNext();
}

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>";
break;

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>";
break;

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>";
break;
}



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

Sign in to reply to this post

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