Managing the Prestashop order ID
The PrestaShop order ID is generated once the payment has been finalized. This is why when PrestaShop calls the payment gateway, the order ID does not yet exist. Only the shopping cart number is generated and sent to the payment gateway.
In the Expert Back Office, the registered order ID corresponds to the shopping cart number of PrestaShop.
Therefore, it is normal that you cannot see the order ID in the payment confirmation e-mails sent by Lyra Collect. Only the shopping cart number is displayed.
Modification of the PrestaShop code:
You have the possibility to modify the PrestaShop code in order to display the shopping cart ID in the PrestaShop order table.
For versions prior to Prestashop 1.7.7.0
Open the following file: AdminOrdersController.php (controllers/admin directory)
After the following code (around line 82):
$this->fields_list = array ( 'id_order' => array( 'title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'text-center', 'class' => 'fixed-width-xs' ),
Add the following code:
'id_cart' => array( 'title' => $this->l('Cart'), 'align' => 'center', 'width' => 25),
The addition of this code will allow to display a column entitled Shopping cart between the ID and Reference columns.
For versions greater than or equal to Prestashop 1.7.7.0
Open the following file: OrderGridDefinitionFactory.php (répertoire src / Core / Grid / Definition / Factory)
After the following code (around line 188):
->add((new IdentifierColumn('id_order')) ->setName($this->trans('ID', [], 'Admin.Global')) ->setOptions([ 'identifier_field' => 'id_order', 'preview' => $previewColumn, 'clickable' => false, ]) )
Add the following code:
->add((new IdentifierColumn('id_cart')) ->setName($this->trans('Cart ID', [], 'Admin.Global')) ->setOptions([ 'identifier_field' => 'id_cart', 'preview' => $previewColumn, 'clickable' => false, ]) )
After the following code (around line 321):
->add((new Filter('id_order', TextType::class)) ->setTypeOptions([ 'required' => false, 'attr' => [ 'placeholder' => $this->trans('Search ID', [], 'Admin.Actions'), ], ]) ->setAssociatedColumn('id_order') )
Add the following code:
->add((new Filter('id_cart', TextType::class)) ->setTypeOptions([ 'required' => false, 'attr' => [ 'placeholder' => $this->trans('Search cart ID', [], 'Admin.Actions'), ], ]) ->setAssociatedColumn('id_cart') )
Open the following file: OrderQueryBuilder.php ( src / Core / Grid / Query directory)
Replace the following code (around line 92):
->addSelect('o.id_order, o.reference, o.total_paid_tax_incl, os.paid, osl.name AS osname')
with:
->addSelect('o.id_order, o.id_cart, o.reference, o.total_paid_tax_incl, os.paid, osl.name AS osname')
After the following code (around line 165):
'id_order' => 'o.id_order',
Add the following code:
'id_cart' => 'o.id_cart',
After the following code (around line 300):
'id_order' => 'o.id_order',
Add the following code:
'id_cart' => 'o.id_cart',
The addition of this code will allow to display a column entitled Shopping cart between the ID and Reference columns. A search and sorting by cart number field will also be available.