Quantcast
Channel: Neueste Diskussionen - Shopware Community Forum
Viewing all articles
Browse latest Browse all 14594

ajaxAmountAction

$
0
0

Hallo,

leider schaffe ich es nicht $this->View()->sBasketAmount in der ajaxAmoutAction in Shopware/Controllers/Frontend/Checkout.php zu überschreiben.

public function ajaxAmountAction()
{
    Shopware()->Plugins()->Controller()->Json()->setPadding();

    $amount = $this->basket->sGetAmount();
    $quantity = $this->basket->sCountBasket();

    $this->View()->sBasketQuantity = $quantity;
    $this->View()->sBasketAmount = empty($amount) ? 0 : array_shift($amount);

    $this->Front()->Plugins()->ViewRenderer()->setNoRender();

    $this->Response()->setBody(
        json_encode(
            [
                'amount' => Shopware()->Template()->fetch('frontend/checkout/ajax_amount.tpl'),
                'quantity' => $quantity
            ]
        )
    );
}

Über das Event 

Enlight_Controller_Action_PostDispatchSecure_Frontend_Checkout

möchte ich der View einen anders berechneten Wert in $subject->View()->sBasketAmount geben. Leider wird dieser nicht gezogen.

Ich gehe ganz stark davon aus, dass PostDispatch zu spät ist, da in der Action bereits der Response gesetzt wird. 

Kann mir da jemand einen anderen Ansatz geben? Und nein, ich kann nicht die Funktion sBasket::sGetAmount hooken, weil ich nichts an der 

internen Berechnung von Shopware verändern möchte. Nur die Zahl bei der Ausgabe.

Danke!


Viewing all articles
Browse latest Browse all 14594


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>