QloApps icon indicating copy to clipboard operation
QloApps copied to clipboard

Error creating an order via API in QloApps: "Undefined index: avg_paid_unit_price_tax_excl" and "Undefined index: amount_tax_excl"

Open DiegoNMedina opened this issue 1 year ago • 1 comments

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:

  1. Set up a cart with a room using the QloApps API.
  2. Attempt to convert the cart into an order via the API.
  3. The system generates errors related to undefined indices (avg_paid_unit_price_tax_excl and amount_tax_excl).

Diagnosis:

  • The error occurs in the compiled Smarty file, which suggests that the template hotel-booking-cart-data.tpl.php is trying to access indices that are not present.
  • The table qlo_htl_cart_booking_data, used to store booking information, does not contain the fields avg_paid_unit_price_tax_excl and amount_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_data table 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:

  1. Update the hotel-booking-cart-data.tpl.php template to check if the indices exist before accessing them.
  2. Ensure that the price and tax-related data are properly loaded into the cart before converting it to an order.
  3. Review if the information needs to be populated in a different table (like qlo_cart or qlo_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.

DiegoNMedina avatar Nov 15 '24 19:11 DiegoNMedina

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?

aman-webkul avatar Nov 19 '24 14:11 aman-webkul