Wie komme ich an eine Variable in sOrder?

Mit einem Hook für sOrder:

$this->subscribeEvent(‚sOrder::sSaveOrder::after‘,‚onAfterSaveOrder‘);

Möchte ich mit meiner function:

public function onAfterSaveOrder(Enlight_Event_EventArgs $args) {
   $getSubject = $args->getSubject();
   $variables = $getSubject->variables;
}

auf die in sOrder vorhandenen Variable  $variables zurückgreifen.
Aber irgendwie bleibt die Variable leer - hat jemand eine Idee?

Eventruell $args->getReturn(); ?

 

$getSubject ist ein Controller, es kommt darauf an, was gebraucht wird. Wenn es eine Variable ist, die im Template ausgegeben wird, dann solllte es am einfachsten sein mit

$variable = $getSubject->View()->getAssign('variableName')

ansonsten im Controller selbst nachsehen, was dort für Variablen gesetzt werden.

@R4M schrieb:

Eventruell $args->getReturn(); ?

Das gibt mir nur die orderNumber zurück. 

Die Variable in sOrder sieht so aus: 

  $variables = array(
            "sOrderDetails"=>$details,
            "billingaddress"=>$this->sUserData["billingaddress"],
            "shippingaddress"=>$this->sUserData["shippingaddress"],
            "additional"=>$this->sUserData["additional"],
            "sShippingCosts"=>$this->sSYSTEM->sMODULES['sArticles']->sFormatPrice($this->sShippingcosts)." ".$this->sSYSTEM->sCurrency["currency"],
            "sAmount"=>$this->sAmountWithTax ? $this->sSYSTEM->sMODULES['sArticles']->sFormatPrice($this->sAmountWithTax)." ".$this->sSYSTEM->sCurrency["currency"] : $this->sSYSTEM->sMODULES['sArticles']->sFormatPrice($this->sAmount)." ".$this->sSYSTEM->sCurrency["currency"],
            "sAmountNet"=>$this->sSYSTEM->sMODULES['sArticles']->sFormatPrice($this->sBasketData["AmountNetNumeric"])." ".$this->sSYSTEM->sCurrency["currency"],
            "sTaxRates" => $this->sBasketData["sTaxRates"],
            "ordernumber"=>$orderNumber,
            "sOrderDay" => date("d.m.Y"),
            "sOrderTime" => date("H:i"),
            "sComment"=>$this->sComment,
            'attributes' => $attributes,
            "sEsd"=>$esdOrder
        );

 Ich habe die Befürchtung, dass ich da gar nicht dran komme :-/ 

Hallo,

$variables ist ein local variable und du kannst nicht von  sOrder::sSaveOrder::after  nehmen.

sSaveOrder fuktion benutzt $variables als Param für sendMail funktion hier

also du kannst ein event von sendMail benutzen , um die $variables zu nehmen.

Beispiel Shopware_Modules_Order_SendMail_FilterVariables

VG,

Ahmad.

1 „Gefällt mir“