On searching the wrong address in the HubBox popup, there is no error message. When checked on the console, you are getting an error like “_messageErrorTemplate is not a function“.
Solution
The error: “_messageErrorTemplate is not a function” is coming because this function is not declared as function in the HubBox library.
To fix this issue you need to make some changes in the library of HubBox:
var _messageErrorTemplate = Mustache.render(_messageError || "");
var _messageWarning = $(selectors.messages.warning).html();
var _messageWarningTemplate = Mustache.render(_messageWarning || "");
and replace this with the below code:
var _messageErrorTemplate = function() { return Mustache.render(_messageError || ""); };
var _messageWarning = $(selectors.messages.warning).html();
var _messageWarningTemplate = function() { return Mustache.render(_messageWarning || ""); };
By declaring ‘_messageErrorTemplate‘ and ‘_messageWarningTemplate‘ as function, now you will get an error message on searching wrong address in the HubBox popup.
While using the library provided by HubBox, there is an error occurring-
require(C:\wamp64\www\HubBox\sample\src\public/../../vendor/autoload.php): failed to open stream: No such file or directory in C:\wamp64\www\HubBox\sample\src\public\index.php on line 14
Solution
This error occurred because of dependencies on files that are missed. You need to solve this issue by using below steps:
Step1: Delete the file sample/composer.lock from the library.
Step2: Make a folder with the name “vendor” under /sample/
Step3: Run the command “composer install” in command prompt at /sample/
It will download all the dependency files which are required.
After successfully downloading all the dependencies, you will able to use the HubBox library.
Problem Statement: Error coming in the response of Authentication API of HubBox ie. “HubBox Api Error: Bad Response Code”
Solution: If you are facing issue as shown below while you are checking Authentication API, it may be because of Authentication API is verifying SSL certificate for connection.
For this, you can turn off the SSL verification in the CURL request by adding below lines.
If this was the issue, you will need to add these lines in all APIs of HubBox Create Parcel, Cancel Parcel, Add Tracking and Collectpoint APIs as described below.
Create Parcel API: Make the change in the curl request of Create Parcel API in the function sendOrder() at HubBox/PHP/HubBox/Parcel.php as shown below:
Cancel Parcel API: Make the change in the curl request of Cancel Parcel API in the function cancelOrder() at HubBox/PHP/HubBox/Parcel.php as shown below:
Add Tracking API: Make the change in the curl request of Add Tracking API in the function addTracking() at HubBox/PHP/HubBox/Parcel.php as shown below:
Collectpoint API: Make the change in the curl request of Collectpoint API in the function getCollectPoint() at HubBox/PHP/HubBox/CollectPoints.php as shown below:
Problem Statement: Wrong product data coming in the response of Create Parcel API of HubBox Sandbox account.
Solution: If you are facing this issue in HubBox sandbox account as shown below, you can ignore this on the sandbox account as It will work fine in the Production account of HubBox.
Sent product data in the request of Create Parcel API: