arkanimus Posted November 22, 2013 Share Posted November 22, 2013 (edited) Hi i want to senddata way Post from the View To the Controller, but i not have idea how to do that. i have the follow code in the shopping-cart.tpl File: <form action="{if $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" id="formcajas"> <fieldset> <h4><label for="lblCajas">{l s='Cajas'}</label></h4> <p> <input type="text" class="cajas" id="txtCajas" name="txtCajas"/> </p> <p class="submit"><input type="hidden" name="ingresaCajas" /><input type="submit" name="ingresaCajas" value="{l s='OK'}" class="button" /></p> </fieldset> </form> The Controller is OrderController, but the method $_POST does not works.. what can i do?? help please! thanks you! Edited November 22, 2013 by arkanimus (see edit history) Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted November 22, 2013 Share Posted November 22, 2013 hello prestashop use the Tools::getValue('somename') not a $_POST[''] i hope this is helpful http://doc.prestashop.com/display/PS15/Developer+Guide Link to comment Share on other sites More sharing options...
arkanimus Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) hello prestashop use the Tools::getValue('somename') not a $_POST[''] i hope this is helpful http://doc.prestashop.com/display/PS15/Developer+Guide Thank you for reply , i will try! Edited November 22, 2013 by arkanimus (see edit history) Link to comment Share on other sites More sharing options...
arkanimus Posted November 22, 2013 Author Share Posted November 22, 2013 i try but doest not work do youknow that I can be doing wrong?? OrderController it is ok?? Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted November 22, 2013 Share Posted November 22, 2013 (edited) please enabled the debug mode .. and track the what type is error ? you enabled debug mode is :define('_PS_MODE_DEV_', false) inssed of define('_PS_MODE_DEV_', true); config/defines.inc.php file define('_PS_MODE_DEV_', true); if (_PS_MODE_DEV_) { @ini_set('display_errors', 'on'); define('_PS_DEBUG_SQL_', true); /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true); } Edited November 22, 2013 by Nishith (see edit history) Link to comment Share on other sites More sharing options...
arkanimus Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) please enabled the debug mode .. and track the what type is error ? you enabled debug mode is :define('_PS_MODE_DEV_', false) inssed of define('_PS_MODE_DEV_', true); config/defines.inc.php file define('_PS_MODE_DEV_', true); if (_PS_MODE_DEV_) { @ini_set('display_errors', 'on'); define('_PS_DEBUG_SQL_', true); /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true); } Notice: Undefined index: cantidad in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 371 Notice: Trying to get property of non-object in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 371 $ 854 In the Shopping-car.tpl i have this code: <form action="{if $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" id="formcajas"> <fieldset> <h4><label for="lblCajas">{l s='Cajas'}</label></h4> <p> <input type="text" class="cajas" id="txtCajas" name="txtCajas"/> </p> <p class="submit"><input type="hidden" name="ingresaCajas" /><input type="submit" name="ingresaCajas" value="{l s='OK'}" class="button" /></p> </fieldset> </form> {/if} </td> {if $use_taxes} <td colspan="2" class="price total_price_container" id="total_price_container"> <p>{l s='Total:'}</p> <span id="total_price">{displayPrice price=($total_price-$cantidad)}</span> </td> {else} <td colspan="2" class="price total_price_container" id="total_price_container"> <p>{l s='Total:'}</p> <span id="total_price">{displayPrice price=$total_price_without_tax}</span> </td> {/if} </tr> in the Controller i have this: public function init() { global $orderTotal; parent::init(); $this->step = (int)(Tools::getValue('step')); if (!$this->nbProducts) $this->step = -1; $cantidad = Tools::getValue('txtCajas'); // If some products have disappear if (!$this->context->cart->checkQuantities()) { $this->step = 0; $this->errors[] = Tools::displayError('An item in your cart is no longer available in this quantity, you cannot proceed with your order.'); } // Check minimal amount . . .thanks you for reply! Edited November 22, 2013 by arkanimus (see edit history) Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted November 22, 2013 Share Posted November 22, 2013 (edited) hello try this your order controller public function init() { global $orderTotal; parent::init(); if(Tools::issubmit('ingresaCajas')) { $cantidad = Tools::getValue('txtCajas'); echo $cantidad; } ..................... ..................... Edited November 22, 2013 by Nishith (see edit history) Link to comment Share on other sites More sharing options...
arkanimus Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) hello try this your order controller public function init() { global $orderTotal; parent::init(); if(Tools::issubmit('ingresaCajas')) { $cantidad = Tools::getValue('txtCajas'); echo $cantidad; } ..................... ..................... Nothing Happened :'( Notice: Undefined index: cantidad in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 371 Notice: Trying to get property of non-object in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 371 $ 854 Edited November 22, 2013 by arkanimus (see edit history) Link to comment Share on other sites More sharing options...
arkanimus Posted November 22, 2013 Author Share Posted November 22, 2013 Thank you it Work's!!!!: Notice: Constant _PS_DEBUG_SQL_ already defined in /var/www/mayorista10/config/defines.inc.php on line 33 Notice: Constant _PS_DISPLAY_COMPATIBILITY_WARNING_ already defined in /var/www/mayorista10/config/defines.inc.php on line 35 try1 cantidad10 echo show : try1 cantidad10 but the view did not take the value <span id="total_price">{displayPrice price=($total_price-$cantidad)}</span> Notice: Undefined index: cantidad in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 356 Notice: Trying to get property of non-object in /var/www/mayorista10/cache/smarty/compile/2f5c149962cab8fc9bc0c9e32fc32772758fbf56.file.shopping-cart.tpl.php on line 356 $ 854 And now how can i send the var $cantidad from controller to the view???!! Thanks u! 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