maraguta Posted March 14, 2016 Share Posted March 14, 2016 (edited) test1 Edited April 24, 2016 by maraguta (see edit history) Link to comment Share on other sites More sharing options...
maraguta Posted March 15, 2016 Author Share Posted March 15, 2016 (edited) test2 Edited April 24, 2016 by maraguta (see edit history) Link to comment Share on other sites More sharing options...
REGE Posted March 15, 2016 Share Posted March 15, 2016 Załóżmy, że nowe pole textarea nazwiesz "message1". Jak już zauważyłeś, kod odpowiedzialny za przesyłanie wartości znajdziesz w pliku OrderOpcController.php: switch (Tools::getValue('method')) { case 'updateMessage': if (Tools::isSubmit('message')) { $txtMessage = urldecode(Tools::getValue('message')); $this->_updateMessage($txtMessage); if (count($this->errors)) die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die(true); } break; zmodyfikuj go mniej więcej w ten sposób: switch (Tools::getValue('method')) { case 'updateMessage': if (Tools::isSubmit('message') || Tools::isSubmit('message1')) { $txtMessage = urldecode(Tools::getValue('message')); $txtMessage1 = urldecode(Tools::getValue('message1')); $this->_updateMessage($txtMessage.$txtMessage1); if (count($this->errors)) die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die(true); } break; Nie wiem tylko czy rozwiązanie, którego oczekujesz nie wymaga głębszej ingerencji w kod? Na pewno trzeba też się zająć zmienną $oldMessage, która występuje w paru miejscach klasy OrderOpcControllerCore. Link to comment Share on other sites More sharing options...
maraguta Posted March 19, 2016 Author Share Posted March 19, 2016 (edited) test3 Edited April 24, 2016 by maraguta (see edit history) Link to comment Share on other sites More sharing options...
maraguta Posted April 8, 2016 Author Share Posted April 8, 2016 Robię jak w instrukcji poiżej i wyskakuje mi błąd 500: 1. dodaj kolumnę "shipping_info" w ps_cart i ps_orders /classes/Cart.php Kod: [Zaznacz] /** @var string Object shipping message */ public $shipping_info; dodatkowo ten sam plik Kod: [Zaznacz] 'shipping_info' => array('type' => self::TYPE_STRING), /themes/default-bootstrap/order-carrier.tpl po </div> <!-- end delivery_options_address --> Kod: [Zaznacz] {if $opc} <div class="form-group"> <label for="shipping_info">{l s='Please specify additional shipping requirements.'}</label> <textarea class="form-control" cols="60" rows="6" name="shipping_info" id="shipping_info">{$cart->shipping_info}</textarea> </div> <script> $(document).ready(function(){ $('#shipping_info').blur(function() { $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: orderOpcUrl + '?rand=' + new Date().getTime(), async: false, cache: false, dataType : "json", data: 'ajax=true&method=updateShippingInfo&shipping_info=' + encodeURIComponent($('#shipping_info').val()) + '&token=' + static_token , success: function(jsonData) { if (jsonData.hasError) { var errors = ''; for(var error in jsonData.errors) //IE6 bug fix if(error !== 'indexOf') errors += $('<div />').html(jsonData.errors[error]).text() + "\n"; alert(errors); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { if (textStatus !== 'abort') alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); if (typeof bindUniform !=='undefined') bindUniform(); }); }); </script> {/if} /controllers/front/OrderOpcController.php Kod: [Zaznacz] if (Tools::isSubmit('ajax')) { if (Tools::isSubmit('method')) { switch (Tools::getValue('method')) { ++++ Kod: [Zaznacz] case 'updateShippingInfo': if (Tools::isSubmit('shipping_info')) { $this->context->cart->shipping_info = urldecode(Tools::getValue('shipping_info')); $this->context->cart->update(); $this->ajaxDie(true); } break; /classes/PaymentModule.php Kod: [Zaznacz] $order->shipping_info = $this->context->cart->shipping_info; Ktoś coś? Link to comment Share on other sites More sharing options...
maraguta Posted April 8, 2016 Author Share Posted April 8, 2016 (edited) t4 Edited April 24, 2016 by maraguta (see edit history) Link to comment Share on other sites More sharing options...
maraguta Posted April 24, 2016 Author Share Posted April 24, 2016 wystarczyło dopisać zmienne do innego kontrolera. cała zabawa to 2 linijki kodu Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now