Programlı bir satış / quote_address nesnesi oluştururken Magento

0 Cevap php

Ben oluşturma ve multishipping ödeme işlemi için satış / quote_address nesneleri ekleme ile bir sorun yaşıyorum. Ben yeni bir adres nesnesi oluşturmak zaman Şu anda, sadece tekrar aynı nesneyi yeniden edilir; Ben bir adrese öğe eklerken Böylece, bu tüm adresleri ekleyebilirsiniz. Çek olarak, ben oluşturulan adreslerin kimlikleri, tüm echo benim ana döngü sonra döngü için bir koyun -. Her zaman 3 numarayı dışarı echos i dinamik yeni oluşturulan adresleri (out yorumladı bölüm, kimliğini değiştirmeye çalıştığınızda ) onlar bile döngü için tüm finalde görünmeyecektir. Aşağıdaki gibi benim kod:

//dynamically create the addresses and add them to the shipping information screen
$idCounter = 1;
foreach($dropshippersCombineWProducts as $dropshippersWCProducts) {
    $newAddress = null;
    $newAddress = Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress);

    //$idCounter++;
    //$newAddress->setId($idCounter);

    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();
}

Herhangi bir yardım çok takdir.

0 Cevap