Jump to content

Paymentmodule


Yolanda-vigo

Recommended Posts

Hola!

 

Me gustaría pedir ayuda para conseguir que  en el mensaje que se recibe del pedido, el cálculo del código descuento y el IVA en el pedido sea aplicado según el total sin IVA y no con IVA. Hasta el momento he conseguido que el total de los descuentos aparezca sin IVA, pero el  vale descuento aparece con IVA, Lo mismo pasa con el total del IVA, calcula sobre el total sin tener en cuenta el descuento. Aunque el total es correcto las cantidades referentes al vale descuento y al IVA no son las correctas. Es posible que se trate de modificar algo en estas líneas, en el caso del vale descuento?:

 

482

if (count($order_list) == 1 && $values['tax_excl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0)
                        {
                            // Create a new voucher from the original
                            $voucher = new CartRule($cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
                            unset($voucher->id);

                            // Set a new voucher code
                            $voucher->code = empty($voucher->code) ? substr(md5($order->id.'-'.$order->id_customer.'-'.$cart_rule['obj']->id), 0, 16) : $voucher->code.'-2';
                            if (preg_match('/\-([0-9]{1,2})\-([0-9]{1,2})$/', $voucher->code, $matches) && $matches[1] == $matches[2])
                                $voucher->code = preg_replace('/'.$matches[0].'$/', '-'.(intval($matches[1]) + 1), $voucher->code);

                            // Set the new voucher value
                            if ($voucher->reduction_tax)
                            {
                                $voucher->reduction_amount = $values['tax_excl'] - ($order->total_products_wt - $total_reduction_value_ti);

                                // Add total shipping amout only if reduction amount > total shipping
                                if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_incl)
                                    $voucher->reduction_amount -= $order->total_shipping_tax_incl;
                            }
                            else
                            {
                                $voucher->reduction_amount = $values['tax_excl'] - ($order->total_products - $total_reduction_value_tex);

                                // Add total shipping amout only if reduction amount > total shipping
                                if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_excl)
                                    $voucher->reduction_amount -= $order->total_shipping_tax_excl;
                            }

                            $voucher->id_customer = $order->id_customer;
                            $voucher->quantity = 1;
                            $voucher->quantity_per_user = 1;
                            $voucher->free_shipping = 0;
                            if ($voucher->add())
                            {
                                // If the voucher has conditions, they are now copied to the new voucher
                                CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);

                                $params = array(
                                    '{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
                                    '{voucher_num}' => $voucher->code,
                                    '{firstname}' => $this->context->customer->firstname,
                                    '{lastname}' => $this->context->customer->lastname,
                                    '{id_order}' => $order->reference,
                                    '{order_name}' => $order->getUniqReference()
                                );

558

$cart_rules_list[] = array(
                            'voucher_name' => $cart_rule['obj']->name,
                            'voucher_reduction' => ($values['tax_excl'] != 0.00 ? '-' : '').Tools::displayPrice($values['tax_excl'], $this->context->currency, false)
                        );

 

 

en el caso del cálculo del IVA esty aúnmás perdida... agradecería mucho alguna ayuda o sugerencia!!

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...