Versuchen Sie, Zwischensumme, Grandtotal und mehr Beobachter Magento 1.7

Ich versuche, um die Zwischensumme und Grandtotal aus einem Auftrag, aber das Ergebnis ist immer NULL.

Ich habe versucht, eine Menge von Lösungen, die ich online gefunden, aber nichts funktioniert..
Der Fall, dass ich warten: sales_order_place_after

Dies ist der code:

class MyCompany_MyObserver_Model_Observer {

public function send_email($observer) {

    $customer = Mage::getSingleton('customer/session')->getCustomer();
    //Get name and email of customer
    $email = $customer->getEmail();
    $fullname = $customer->getName();
    //Get the customer group and check that if Trade customer group a email gets sent
    $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();

Den code so weit funktioniert, wie es soll.Ich kann den Namen und die E-Mail und groupID

Den code unten hält, brechen, egal was!
Ich habe versucht, alle Lösungen die ich finden konnte.Ich versuche mit var_dump um den Wert zu sehen..

        $session= Mage::getSingleton('checkout/session');
        //Get totals
        $number =  Mage::getModel('checkout/cart')->getQuote()->getTotals();
        $subtotal = number_format($number,2);
        $discount = $totals['discount']->getValue();
        $shippingtotal = $totals['shipping']->getValue();
        var_dump($grandtotal);
        //die();

        $grand_total = Mage::getModel('checkout/cart')->getQuote()->getGrandTotal();

        $shippingMethod = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();

        $paymentMethod = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getTitle();

        //Get billing and shipping address

        $billingaddress = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();

        $billingStreet = $billingaddress->getData('street');
        $billingPostcode = $billingaddress->getData("postcode");
        $billingCity = $billingaddress->getData("city");
        $billingRegion = $billingaddress->getRegionCode();
        $billingCountry = $billingaddress->getCountryModel()->getName();

        $shippingAddress = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();

        $shippingName = $shippingAddress->getName();
        $shippingCompany = $shippingAddress->getData("company");
        $shippingStreet = $shippingAddress->getData("street");
        $shippingPostcode = $shippingAddress->getData("postcode");
        $shippingCity = $shippingAddress->getData("city");
        $shippingRegion = $shippingAddress->getRegion();
        $shippingCountry = $shippingAddress->getCountryModel()->getName();

}
}

Meine config-Datei sieht ungefähr so aus: ich Fang die richtige Veranstaltung? Die einzigen Dinge, die ich bekommen kann sind: Auftrags-Id Kunde Name und E-Mail.

<events>
  <checkout_onepage_controller_success_action>
    <observers>
      <sales_order_place_after>
        <type>singleton</type>
        <class>MyCompany_MyObserver_Model_Observer</class>
        <method>send_email</method>
      </sales_order_place_after>
    </observers>
  </checkout_onepage_controller_success_action>     
</events>
InformationsquelleAutor vbak | 2013-10-17
Schreibe einen Kommentar