Jump to content

Data save to table PS1.6


Recommended Posts

Hello All,
1. I have a last problem saving data to table order_detail.
2. I have created new field in _product_line.tpl Combo box to change the data.
<td class="stat_del text-left">
<span class="stat_del_show">{$product['V_DEL_STAT']}</span>
{if $can_edit}
<span class="stat_del_edit" style="display:none;">
<input type="text" name="delstat" class="edit_dstat" value="{$product['V_DEL_STAT']|htmlentities}" list=liststat>
<datalist id=liststat >
<option> PREPARATION EN COURS CDICOUNT
<option> PREPARATION EN COURS ERIC
<option> LIVRAISON EN COURS GLS
<option> EN COURS DE RÉAPPROVISIONNEMENT
</datalist>
</span>
{/if}
</td>

3. I have added to orders.js following lines to check if i can get value from field/

$('button.submitProductChange').unbind('click').click(function(e) {
var VDELSTAT = $('.edit_dstat').val();
window.alert("Change to: " + VDELSTAT); - displays window witch chosen value - works ok
.....
.....

4. I'm trying to save the data to table with:
Adding to :
public function ajaxProcessEditProductOnOrder()
{
// Return value

$product_id_order_detail = Tools::getValue('product_id_order_detail');
$del_stat = Tools::getValue('VDELSTAT');
Db::getInstance()->Execute( 'UPDATE `'._DB_PREFIX_.'order_detail` SET `V_DEL_STAT` = '.$del_stat.' WHERE `id_order_detail` = '.(int)$product_id_order_detail );


but ZERO (0) value is saved to table.
I tried (for test):
public function ajaxProcessEditProductOnOrder()
{
// Return value

$product_id_order_detail = Tools::getValue('product_id_order_detail');
$del_stat = Tools::getValue('product_id_order_detail');
Db::getInstance()->Execute( 'UPDATE `'._DB_PREFIX_.'order_detail` SET `V_DEL_STAT` = '.$del_stat.' WHERE `id_order_detail` = '.(int)$product_id_order_detail );


In this case all works great id_order_detail is saved to my field in database.

I suppose I have to post somehow VDELSTAT value to be able to use it with Tools::getValue, but I have know idea how to do it.
I will be very greatful if someone could give me little advise.
Regards
Jakub
 

Edited by SQ5IZZ (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...