Hallo Zusammen,
wir sind auf ein Problem bei der Überschreibung des Templates mit AJAX-Aufruf gestoßen:
public function shippingPaymentAction()
{
// Load payment options, select option and details
$this->View()->sPayments = $this->getPayments();
$this->View()->sFormData = array('payment' => $this->View()->sUserData['additional']['user']['paymentID']);
$getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->sFormData['payment']);
$paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
if ($paymentClass instanceof \ShopwarePlugin\PaymentMethods\Components\BasePaymentMethod) {
$data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->sUserId);
if (!empty($data)) {
$this->View()->sFormData += $data;
}
}
if ($this->Request()->isPost()) {
$values = $this->Request()->getPost();
$values['payment'] = $this->Request()->getPost('payment');
$values['isPost'] = true;
$this->View()->sFormData = $values;
}
$this->View()->sBasket = $this->getBasket();
// Load current and all shipping methods
$this->View()->sDispatch = $this->getSelectedDispatch();
$this->View()->sDispatches = $this->getDispatches($this->View()->sFormData['payment']);
$this->View()->sLaststock = $this->basket->sCheckBasketQuantities();
$this->View()->sShippingcosts = $this->View()->sBasket['sShippingcosts'];
$this->View()->sShippingcostsDifference = $this->View()->sBasket['sShippingcostsDifference'];
$this->View()->sAmount = $this->View()->sBasket['sAmount'];
$this->View()->sAmountWithTax = $this->View()->sBasket['sAmountWithTax'];
$this->View()->sAmountTax = $this->View()->sBasket['sAmountTax'];
$this->View()->sAmountNet = $this->View()->sBasket['AmountNetNumeric'];
$this->View()->sRegisterFinished = !empty($this->session['sRegisterFinished']);
$this->View()->sTargetAction = 'shippingPayment';
if ($this->Request()->getParam('isXHR')) {
return $this->View()->loadTemplate('frontend/checkout/shipping_payment_core.tpl');
}
}
Wir möchten ein Plugin erstellen, das die Methode SHIPPINGPAYEMTNaCTION benutzen wird. Es sollte das über Ajax aufgerufene Template SHIPPIGN_PAYEMNT_CORE.TPL überschreiben.
Aktuell haben wir die folgende Methode angewendet:
public function onCheckoutShippingPayment(Enlight_Event_Eventarguments $arguments)
{
$controller = $arguments->getSubject();
$request = $controller->Request();
$response = $controller->Response();
$view = $controller->View();
if ($request->getParam('isXHR')) {
return $view->loadTemplate('checkout/shipping_payment_core_override.tpl');
}
}
Diese Lösung funktioniert, aber es wird immer wieder die Standard-Vorlage hervorgerufen..
Wie können wir das Template bei einem AJAX-Aufruf überschreiben?
Danke im Voraus:)
Mit freundlichen Grüßen
Jacek Jusiński