Jump to content

How can i maintain data consistency?


arkanimus

Recommended Posts

Hello friends:

 

This is my problem.. i could to edit the code to add a textbox and edit the Total Value, but...

this value not have consistency...

 

look i have the following code in Cart.php

 

public function getOrderTotal($with_taxes = true, $type = Cart::BOTH, $products = null, $id_carrier = null, $use_cache = true)
{


$cantidad = 1;
if(Tools::issubmit('ingresaCajas'))
        {
            $cantidad = Tools::getValue('txtCajas');
                
        }
$total_price = $price * (int)$product['cart_quantity']*$cantidad;
......
.......
$virtual_context
);


$total_price = Tools::ps_round($price * (int)$product['cart_quantity'], 2);
$total_price = $total_price*$cantidad;
[spam-filter]


$order_total += $total_price;
}

Then In the Controller (OrderController.php):


parent::init();
$cantidad = 1;
if(Tools::issubmit('ingresaCajas'))
        {
            $cantidad = Tools::getValue('txtCajas');
            echo 'Try cantidad'.$cantidad;     
        }
$cantidad2 = 1;
   $this->context->smarty->assign('cantidad2', $cantidad);

Then in the TPL (shopping.tpl):

 

<form action="{if $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" id="voucher">
<fieldset>


                            <h4><label for="lblCajas">{l s='Cajas'}</label></h4>
<p>
<input type="text" class="cajas" id="txtCajas" name="txtCajas" value="{$cantidad2}"/>
</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}</span>
The Result is the Following:
 
Step 1:
1prs.png
 
Step: 5
 
pw7y.png
 
 
How Can i Solve it?? Thanks youu Guys!
Edited by arkanimus (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...