Este es el codigo, se que tengo variables de sesion que no deberian de estar en el SP pero estoy tratando de ver como asignar los valors
Código MySQL:
Ver original-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
)
/*DECLARE customer_id INT;
SET customer_id = 0;
SELECT id_customer
FROM `ps_customer`
WHERE firstname = Nombre AND lastname= Apellido
INTO customer_id;
SELECT customer_id;*/
/*
SET @var = 0;
SELECT @var := id_customer
FROM `ps_customer`
WHERE firstname = 'Julio' AND lastname= 'Muro';
SELECT @var;*/
WHERE firstname
= Nombre
AND lastname
= Apellido
;
-- Declare customer_id INT;
-- set customer_id = (select id_customer from `ps_customer` where firstname = Nombre and lastname= Apellido);
-- Select customer_id
insert into `ps_cart`(id_shop_group
,id_shop
,id_carrier
,delivery_option
,id_lang
, id_address_delivery,id_address_invoice,id_currency,id_customer,
id_guest,secure_key,recyclable,gift,gift_message,allow_seperated_package,
)
id_shop_group,id_shop,id_carrier,delivery_option,id_lang,id_address_delivery,
id_address_invoice,id_currency,id_customer,id_guest,secure_key,recyclable,gift,
ps_cart
where id_cart
= @id_cart
;
update `ps_cart` set id_guest
=@id_guest
, id_address_delivery
= @id_address
, id_address_invoice = @id_address, id_customer = @customer_id,
set @invoice_number
= (select invoice_number
from `ps_orders` where id_order
= @id_order_max
); set @TotalMenosShippingIncl
= (TotalPaidNoTax
- 2.32); set @TotalProductMenosShipping
= (TotalConTax
- 2.32); set @shippingTax
= ShippingNoTax
+ ((ShippingNoTax
* Tax
)/100);
insert into `ps_orders`(reference
,id_carrier
,id_lang
,id_customer
,id_cart
,id_currency
, id_address_delivery,id_address_invoice,current_state,secure_key,
payment,conversion_rate,module,gift_message,shipping_number,
total_paid,total_paid_tax_incl,total_paid_tax_excl,total_paid_real,
total_products,total_products_wt,total_shipping,total_shipping_tax_incl,
total_shipping_tax_excl
,carrier_tax_rate
,date_add,date_upd
)
ReferenceCode,2,4,@customer_id,@id_cart,1,@id_address,@id_address,
CurrentState,'91b5b10c93a6f626f8e6154b32279510',Payment,
1.000000,Module,'','',TotalConTax,TotalConTax,TotalPaidNoTax,
0.00,@TotalMenosShippingIncl,@TotalProductMenosShipping,@shippingTax,
);