Callback functions and ready-made scripts



Example of callback functions after JavaScript execution

The site uses many functions, after which you may need to execute your own scripts. For this purpose, we have added a set of callback functions that are called after script execution, with a preliminary check of their existence.
For example, after adding a product to the cart, the function callback_hotengine_cart_plus_after is called, if it exists

Code: JavaScript
if(typeof(callback_hotengine_cart_plus_after) === "function"){ 
callback_hotengine_cart_plus_after(); 
}


To run your own script of the function callback_hotengine_cart_plus_after, you need to create it.

Code: JavaScript
window.callback_hotengine_cart_plus_after = function(){
  // your script
};



List of some provided Callback functions:

Shop
callback_hotengine_ajax_load_products_list - after loading the product list (universal function in all cases of loading the product list via script)
callback_hotengine_ajax_load_products - after loading the product list, via the "Show more" button.
callback_hotengine_shop_products_list_div_button - after scrolling through the product list in a slider
callback_hotengine_shop_page_boughtwith_loaded($id) - after loading the "bought together" list ($id - ID of loaded products)
callback_hotengine_shop_page_products_synonyms_loading($id) - before loading the "synonym products" list ($id - ID of loaded products)

Shop / Automatic description
callback_hotengine_shop_autodescription($type) - after displaying automatic description ($type - html,ajax)
callback_hotengine_shop_autodescription_readmore($id,$job) - after loading the expanded text of the automatic description ($job - show,hide,load)

Shop / Cart
callback_hotengine_cart_plus - after sending a request to add a product to the cart
callback_hotengine_cart_addresult($result,$item_id) - after adding a product to the cart, various result variants ($result - result value. Values: "added" - added, "removed" - removed, "instock_smaller" - stock less than being added, "instock_smaller_exists" - stock less than already in cart)
callback_hotengine_cart_plus_after($items_in_cart) - after adding a product to the cart ($items_in_cart - number of items in cart after execution)
callback_hotengine_cart_plus_after_boughtwith($ids) - after adding a product to the cart, the "Bought together" list is passed in the $ids variable
callback_hotengine_cart_plus_after_boughtwith_email($ids) - after adding a product to the cart, the "Mailing list" is passed in the $ids variable (E-mail mailing of other products)
callback_hotengine_cart_count_product_num - after selecting a product to change its quantity in the cart
callback_hotengine_cart_error_wrong_num - incorrect product quantity specified when adding to cart
callback_hotengine_shop_update_cart_menu - update the number of items in the cart (for menus with a cart, for example in mobile menu)
callback_hotengine_cart_menu_hover_block - Function executed when hovering over the cart icon after displaying its contents

Shop / Variant
callback_hotengine_shop_product_variaty_select - after selecting a variant
callback_hotengine_variety_change_price($price) - after selecting a variant and changing the price ($price - new price)
callback_hotengine_variety_change_sku($sku) - after selecting a variant and changing the product code ($sku - new sku)
callback_hotengine_variety_change_skuimage($img) - after selecting a variant if a new image is specified ($img - new image path)
callback_hotengine_variety_change_stock_count($stock) - after selecting a variant and changing the stock count ($stock - new stock count). This function is not initialized if not created, since it is not always necessary to change the stock count.
callback_hotengine_variety_require() - if a variant is not selected, before showing the dialog message
callback_hotengine_variety_require_list($href) - if a variant is not selected, before showing the dialog message, when viewing the product list ($href - link to view the product card)

Shop / Favorite / Compare
callback_hotengine_favorite_addresult($result,$count_favorite) - after adding a product to favorites, various result variants ($result - result value. Values: "added" - added, "removed" - removed; $count_favorite - number of items in favorites)
callback_hotengine_compare_plus() - after adding a product to the comparison list

Shop / Search
callback_hotengine_shop_catalog_product_types - after selecting a product type in the search filter

Shop / Stock
callback_hotengine_shop_product_stock_inform- after calling the "Notify when in stock" window
callback_hotengine_shop_product_stock_inform_send - after sending the "Notify when in stock" request

Shop / Delivery
callback_hotengine_loading_delivery_type - after selecting a delivery method
callback_hotengine_loading_delivery_type_finalvalues - after selecting the final delivery method value

Shop / Storehouse
callback_hotengine_shop_cart_change_storehouse - after selecting a pickup point

User
callback_hotengine_authorize_result($result) - function after user authorization ($result - execution result: 2-login or password error, 3-account blocked, 4-activation required, 5-activation successful, 6-Incorrect Captcha code)

Shop / Sell Statistic
callback_hotengine_statisticsell_printorder($a) - after calling the order print window. $a=1 - before displaying the window. $a=2 - after displaying the window.

Blog
callback_hotengine_blog_page_list_div_button - after scrolling through the article list in a slider

Dialog
callback_hotengine_dialog_email - after calling the feedback window (built-in feedback form)
callback_hotengine_form_loaded - after loading the form (Form builder / Popup form)
callback_hotengine_form_submit_result($a) - after submitting the form via dialog window. $a=0 - error. $a=1 - ok.

Mobile
callback_hotengine_mobilemenu_click($a,$href) - clicking links in the mobile menu. $a=0 - item links and top icons. $a=1 - subcategory links. $a=2 - after displaying the ajax window with content.
callback_hotengine_mobilemenu_show - function for displaying mobile menu content (for creating an appearance effect). By default document.getElementById("hotengine-mobile-outer")?.style.setProperty("display", "block");

Example
Example of appearing from right to left.
Code: html
let $element = $("#hotengine-mobile-outer");
let elementWidth = $element.outerWidth();
$element.css({ right: -elementWidth, display: "block" }).animate({ right: 0 }, 500);




Other
callback_hotengine_loadGoogleReviews_after - function when loading the Google Place reviews block
callback_hotengine_booking_form($a) - function for working with booking. $a values: 2 - before getting available slots. 3 - after creating the available slots list. 4 - after clicking the back button. 5 - show available slots starting from the specified date, 6 - start of the booking confirmation process. 7 - before sending the booking confirmation. 8 - before sending the booking confirmation, after forming the data list. 9 - before sending the confirmation of the selected slot for booking. 10 - form submission - booking confirmation. 1 - booking submission, result.

Ready-made scripts


Most solutions can be implemented using scripts (JavaScript). Some of them are described on the instructions page, some on the settings page. Additionally, you can find ready-made solutions on the Scripts for use on websites page.