//CAMBIAR REFERENCIA DE PEDIDOS
In PrestaShop 1.6 (tested and confirmed working in v1.6.0.14) you can accomplish this by the following method.
Copy the file /classes/PaymentModule.php to /override/classes/PaymentModule.php.
Edit the file /override/classes/PaymentModule.php as follows.
At lines 337-341 is a code block that should read like this:
if (!result)
{
PrestaShopLogger::addLog('PaymentModule::validateOrder - Order cannot be created',
3, null, 'Cart', (int)$id_cart, true);
throw new PrestaShopException('Can\'t save Order');
}
mmediately after that code block, insert the following two lines of code:
$order->reference = str_pad($order->id, 9, '0', STR_PAD_LEFT);
$order->update();
1. Delete the file /cache/class_index.php so that Prestashop automatically re-creates this file taking into account the new override file.
2. Any existing records in your PrestaShop database can be updated to use a numerical reference manually using a tool such as phpMyAdmin.
I would imagine the steps would be very similar if not identical to these for PrestaShop v1.5 but at this time I have not tested this solution with PrestaShop v1.5. If someone finds this solution works on v1.5 perhaps they could confirm this in the comments. Thank you.
//FACTURAS DEL TRIMESTRE
SELECT d.id_order AS NºPedido, os.name AS Estado, o.invoice_date AS Fecha, o.invoice_number AS NºFactura, o.total_paid_tax_excl AS SinIva, o.total_paid_real-o.total_paid_tax_excl AS Iva,o.total_paid_real AS Total,
a.firstname AS Nombre, a.lastname AS Apellido,a.company AS Empresa, a.dni AS "NIF-CIF", a.address1 AS Dirección, a.postcode AS "C.P.", a.city AS Ciudad, a.phone AS Teléfono, a.phone_mobile AS Móbil
FROM ps_orders d
LEFT JOIN ps_orders o ON ( d.id_order = o.id_order )
LEFT JOIN ps_address a ON ( o.id_address_invoice = a.id_address )
LEFT JOIN ps_customer g ON ( o.id_customer = g.id_customer )
LEFT JOIN ps_order_history h ON ( h.id_order = o.id_order )
LEFT JOIN ps_group_lang gl ON ( g.id_default_group = gl.id_group )
LEFT JOIN ps_order_state_lang os ON ( o.current_state = os.id_order_state )
WHERE o.date_upd
BETWEEN '2016-01-01'
AND '2016-04-01'
AND os.id_lang = 1
GROUP BY d.id_order
//Client List
SELECT id_customer, id_default_group, firstname, lastname, email, newsletter FROM ps_customer
//Client Addresses
SELECT `address1`,`address2`,`company`,`firstname`,`lastname`,`city`, `alias`,`id_address` FROM `ps_address`
//Client DNIs
SELECT `firstname`,`lastname`,`postcode`, dni FROM `ps_address`
//Clients for TrustedShops
SELECT c.email, o.reference, c.firstname, c.lastname from ps_orders o LEFT JOIN ps_customer c on o.id_customer=c.id_customer ORDER BY o.date_add DESC LIMIT 0, 5500
SELECT
p.id_product as id,
pl.name,
REGEXP_REPLACE(pl.description_short, '<[^>]*>+', '') as description,
GROUP_CONCAT(DISTINCT(al.name) SEPARATOR ", ") as combination,
IFNULL(p.price, 0) + IFNULL(pa.price, 0) as price
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product)
LEFT JOIN ps_product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute)
LEFT JOIN ps_attribute_lang al ON (al.id_attribute = pac.id_attribute)
LEFT JOIN ps_attribute a ON (a.id_attribute = pac.id_attribute)
LEFT JOIN ps_attribute_group ag ON (a.id_attribute_group = ag.id_attribute_group)
LEFT JOIN ps_attribute_group_lang agl ON (ag.id_attribute_group = agl.id_attribute_group)
WHERE
p.active=1 AND
p.id_manufacturer=1 AND
pl.id_shop=1 AND
pl.id_lang=1 AND
al.id_lang=1
GROUP BY
p.id_product,
pac.id_product_attribute