I had a problem creating and adding sales / quote_address objects to the multi-thread validation process. Currently, when I create a new address object, it just reuses the same object over and over; Thus, when I add items to a single address, it adds them to all addresses. As a check, I set the for loop after my main loop to display the entire identifier of the created addresses - it always highlights number 3. When I try to dynamically change the ID of the newly created addresses (commented out section), they will not appear at all in the final cycle. My code is as follows:
$idCounter = 1;
foreach($dropshippersCombineWProducts as $dropshippersWCProducts) {
$newAddress = null;
$newAddress = Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress);
foreach ($newAddress->getItemsCollection() as $item) {
$item->isDeleted(true);
}
foreach ($dropshippersWCProducts[1] as $_item) {
$newAddress->addItem($_item);
}
$quote->setShippingAddress($newAddress);
$newAddress->collectShippingRates();
}
$addresses = $quote->getAllShippingAddresses();
foreach ($addresses as $address) {
echo $address->getId();
}
Any help would be greatly appreciated.