Problems with multiple products

I'm able to generate a product key for a single product using the php code below (replacing the X's and Y's with actual Version IDs) but when I attempt to move the SendPKeys function inside the while loop (before $ylCart->MoveNext();) in order to generate a key for more than one product (makes sense in my head), I encounter the following error: Fatal error: Cannot redeclare class LimeLM in /hermes/bosweb25c/b1408/ipg.youthlightcom/ssl/LimeLM.php on line 3. Can you specify what I will need to change in order to allow my customer to generate product keys for two or more separate products? I appreciate your help!

if ($WAGatewayResponse) { $ylCart->redirStr = "checkout_success.php"; if($downloads > 0){ require('PaymentSettings.php'); $custEmail = $_POST["email"]; $firstName = $_POST["firstname"]; $lastName = $_POST["lastname"]; while ( !$ylCart->EOF() ) { $itemID = "".$ylCart->DisplayInfo("ID") .""; if($itemID == 3075){ $LimeLM_VersionID = 'XXXX'; $quantity = "".$ylCart->DisplayInfo("Quantity") .""; $AppName = "".$ylCart->DisplayInfo("Name") .""; $AppPrice = "".$ylCart->DisplayInfo("Price") .""; } elseif($itemID == 3076){ $LimeLM_VersionID = 'YYYY'; $quantity = "".$ylCart->DisplayInfo("Quantity") .""; $AppName = "".$ylCart->DisplayInfo("Name") .""; $AppPrice = "".$ylCart->DisplayInfo("Price") .""; } $ylCart->MoveNext(); } SendPKeys($quantity, $custEmail, $firstName, $lastName, $AppName); $ylCart->MoveFirst(); } }

It's sounds like you're including LimeLM.php multiple times in your code. Include LimeLM.php once. You have to give me more information if you need more help.

My guess is that this is what's causing the problems:

if($downloads > 0){	require('PaymentSettings.php');

Yes, if I place the call to SendPKeys function inside the while loop then I get the error so I guess LimeLM.php would be included more than once if more than one product key needs to be generated; but if I place the call to SendPKeys function outside of the while loop... although it doesn't error, only one product key is generated. How can I call LimeLM.php only once but generate product keys for multiple products?

You have to modify the SendPKeys() function to actually work how you want it to. Or, just use the web API directly (which is what the SendPKeys() function is doing when it's calling LimeLM::GeneratePKeys()).