Error creating an order via API in QloApps: "Undefined index: avg_paid_unit_price_tax_excl" and "Undefined index: amount_tax_excl"
Undefined Index Error: avg_paid_unit_price_tax_excl and amount_tax_excl in hotel-booking-cart-data.tpl.php
Description
Problem description:
While attempting to create an order via the QloApps API using a pre-configured cart, I encountered an error related to undefined indices in the file hotel-booking-cart-data.tpl.php. The error message is as follows:
Undefined index: avg_paid_unit_price_tax_excl (/var/www/html/cache/smarty/compile/36/88/7d/36887d61046a4b417fe6341a95db65c2dc9dde90_0.file.hotel-booking-cart-data.tpl.php, line 106) Undefined index: amount_tax_excl (/var/www/html/cache/smarty/compile/36/88/7d/36887d61046a4b417fe6341a95db65c2dc9dde90_0.file.hotel-booking-cart-data.tpl.php, line 162)
Steps to reproduce the issue:
- Set up a cart with a room using the QloApps API.
- Attempt to convert the cart into an order via the API.
- The system generates errors related to undefined indices (
avg_paid_unit_price_tax_exclandamount_tax_excl).
Diagnosis:
- The error occurs in the compiled Smarty file, which suggests that the template
hotel-booking-cart-data.tpl.phpis trying to access indices that are not present. - The table
qlo_htl_cart_booking_data, used to store booking information, does not contain the fieldsavg_paid_unit_price_tax_exclandamount_tax_excl. - Upon reviewing the structure of the table
qlo_htl_cart_booking_data, these indices do not exist, indicating that the system is either looking for data in the wrong place or missing a step to populate this data.
Possible Cause:
- It appears that QloApps expects these indices to exist in the
qlo_htl_cart_booking_datatable or in another related structure before completing the cart-to-order conversion process. - Alternatively, it could be an issue in the template
hotel-booking-cart-data.tpl.php, where it does not check if these indices exist before attempting to access them.
Proposed Solution:
- Update the
hotel-booking-cart-data.tpl.phptemplate to check if the indices exist before accessing them. - Ensure that the price and tax-related data are properly loaded into the cart before converting it to an order.
- Review if the information needs to be populated in a different table (like
qlo_cartorqlo_order_detail) to avoid missing indices.
Relevant Logs:
Including the error logs for reference:
Undefined index: avg_paid_unit_price_tax_excl (/var/www/html/cache/smarty/compile/36/88/7d/36887d61046a4b417fe6341a95db65c2dc9dde90_0.file.hotel-booking-cart-data.tpl.php, line 106) Undefined index: amount_tax_excl (/var/www/html/cache/smarty/compile/36/88/7d/36887d61046a4b417fe6341a95db65c2dc9dde90_0.file.hotel-booking-cart-data.tpl.php, line 162)
Thank you for your attention, and I look forward to your assistance in resolving this issue.
We have reviewed the issue you raised but were unable to reproduce at our end. To assist you further with the debugging, could you please confirm which version of QloApps you are using?