Make the order ref the same as the order ID
To make the order reference in PrestaShop 8.2 the same as the order ID, you'll need to modify the
Order.php file. This involves changing the generateReference() function to return the order ID instead of a random alphanumeric string.
Here's a step-by-step guide:
- Locate the
Order.phpfile: Navigate to the PrestaShop installation directory, then go toclasses/order/Order.php. - Open the
Order.phpfile: Open the file using a text editor. - Find the
generateReference()function: Locate thegenerateReference()function within theOrderclass. - Modify the function: Replace the existing code within the
generateReference()function with the following:
public static function generateReference($order_id) {
return $order_id;
}
This code directly returns the order ID as the reference.
- Save the file: Save the changes to
Order.php. - Clear the cache: To ensure the changes are reflected, clear the PrestaShop cache. You can do this by navigating to your PrestaShop backend, going to "Performance," and then clicking "Clear Cache".
- Verify the changes: Place a test order to verify that the order reference now matches the order ID.
- Hits: 6