Scripts for using the platform

Scripts for the Hotlist.biz CMS SaaS platform
Instructions for using scripts
You can copy the script file embed code or script code and paste it into the Block/Menu on your site. It is recommended to insert all scripts into one block/menu. You can place the block/menu in «Service tags before the Body tag (Header Meta)», «Site header (Header)» or «Site bottom (Footer)».


Popup window
Instructions, an example, and automatic popup generation are available here: Popup window generator

[Example of button - popup with video]

Popup window with Forms
Instructions, an example, and automatic popup with forms generation are available here: Popup window with Forms generator

Replacing Variety Selection Text
The message about the need to select a product type is implemented in the dialog box using a CSS element. You can replace labels in CSS styles:
 Code: СSS
html:lang(ru) .hotengine-shop_cart_add_error_wrong_variety:after{ content:"Вы не выбрали разновидность товара."; }
html:lang(en) .hotengine-shop_cart_add_error_wrong_variety:after{ content:"You did not select a complete set of goods."; }
html:lang(uk) .hotengine-shop_cart_add_error_wrong_variety:after{ content:"Вы не обрали різновид товару."; }
html:lang(pl) .hotengine-shop_cart_add_error_wrong_variety:after{ content:"Nie wybrałeś typu produktu."; }


In order to replace the message about an unselected variety, in the product card, you need to add the callback_hotengine_variety_require function code (if the variety is not selected, before calling the message dialog box). The function starts when the variety is not selected.

In the product card, specify the text "Variety title". Depending on the text, the value for the «.hotengine-shop-product-variety-title» class changes. For example, if the text «Select weight:» is specified, then the title class will be «.hotengine-shop-product-variety-title_24». You can check the class when values ​​change by viewing the source code of the page, after specifying the variation header.

Text replacement code:
 Code: html
<script type="text/javascript"> 
  <!-- 
  function callback_hotengine_variety_require(){

if($(".hotengine-shop-product-variety-title_24").length > 0){
  $text = "You haven`t chosen the weight!";
  } else if($(".hotengine-shop-product-variety-title_38").length > 0){
  $text = "You have not selected a quantity!";
  } else if($(".hotengine-shop-product-variety-title_26").length > 0){
  $text = "You have not chosen a color!";
  } else {
  $text = "You have not selected a variety!";
  }

 $("body").append('<div id="hotengine-shop_cart_add_error_wrong_variety"><b align="center" style="display:block;">'+$text+'</b><a class="hotengine-shop_cart_add_error_wrong_variety-btn-close" onclick=\\'return $("#hotengine-shop_cart_add_error_wrong_variety").dialog("close").remove();\\'></a></div>');

  
  $("#hotengine-shop_cart_add_error_wrong_variety").dialog({
  width: $(window).width() > 420 ? 410 : "90%",
  minWidth: "300px",
  modal: true,
  stack: true,
 sticky: true,
  title: "",
  close: function(){ $(this).remove(); },
  open: function(){
  $(document).on("click",".ui-widget-overlay",function(){
  $("#hotengine-shop_cart_add_error_wrong_variety").dialog("close").remove();
  })
  return false; 
  }
  });
  
  return false; 
  }
  -->
  </script>

The popup will contain the specified text in the $text variable.

A similar function when viewing the list of products, callback_hotengine_variety_require_list ($href), is supplemented with a link to the product card, and therefore can be used in the displayed dialog.

Messages after authorization or account activation
In order to create a pop-up window with a message about the authorization or activation status, you need to create the callback_hotengine_authorize_result function


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

An example of a standard function that will be called in the absence of your own function:
/templates/scripts/hotengine-script-callback_hotengine_authorize_result.js
Text messages loaded with CSS styles:
/templates/styles/hotengine-script-callback_hotengine_authorize_result.css

Related products in the cart / with the product are bought

Ajax loading product list:
Block generator with products can be loaded using a GET/POST/AJAX запроса. request. To do this, you need to make a request from your site (your domain) to the page «/ajax_get_list_shop.php». In the request, you can specify additional properties for displaying products. You can find a list of all possible values ​​on the page «List/slider generator with store products». For the correct display of the style of the list of products, you need to add an HTML wrapper and parent elements, as well as buttons for rewinding/continuing the list of products (scrolling forward/backward). An example of such a wrapper is shown in the script below.


When viewing the shopping cart, a micro-markup element is created that contains the "Buy with item" list. The list of such products can be displayed in a pop-up window or as a block with products.
Turn on the markup "Buy with goods" when viewing the cart, in the site settings, in the "Store" tab.
Place one of the options for displaying the list with products on the page "cart_send" - [Cart/Order form from the cart], in the text of the page.

Code for adding a list under the "Continue shopping" button:
 Code: html
<script type="text/javascript"><!--
  $(function(){ 
  if(!$("#hotengine-shop-cart-form").length){
  //check bought with values 
  $product_in_cart = $(".hotengine-marking[data-hotengine-marking-type='shop_catalog_page_cart_products_list']");
  $bought_with_all = '';
$product_in_cart.each(function(){
  if(typeof $product_in_cart !== typeof undefined && $product_in_cart !== false && $product_in_cart !='undefined' && $product_in_cart !=''){
  var $boughtwith = $(this).attr("data-hotengine-marking-boughtwith");
  
  if(typeof $boughtwith !== typeof undefined && $boughtwith !== false && $boughtwith !='undefined' && $boughtwith !='' && $boughtwith.length > 0){
  if($bought_with_all!=''){ $bought_with_all += ','; }
  $bought_with_all += $boughtwith;
  }
  
  
  
  }
});
  //check bought with values 

if($bought_with_all!=''){   //we have a sku or id list

 $product_in_cart_id = $(".hotengine-marking[data-hotengine-marking-type='shop_catalog_page_cart_products_list']");
var $shop_catalog_page_remove = [];
$product_in_cart.each(function(){
  if(typeof $product_in_cart !== typeof undefined && $product_in_cart !== false && $product_in_cart !='undefined' && $product_in_cart !=''){
  
  $shop_catalog_page_remove.push($(this).attr("data-hotengine-marking-shop_catalog_page_id"));
  $shop_catalog_page_remove.push($(this).attr("data-hotengine-marking-shop_catalog_page_sku"));
  $site_id = $(this).attr("data-hotengine-marking-site_id");
  }
  });

var $bought_with_all = $bought_with_all.split(',');
$bought_with_all = $.grep($bought_with_all, function(value){
  return $.inArray(value, $shop_catalog_page_remove) < 0;
  });

$bought_with_all.filter(Boolean);
if($bought_with_all.length>0){
var $bought_with_all = $bought_with_all.join(',')
//USING LIST OF BOUGHT WITH AS PRODUCT LIST 

 var $onpage = "20";
  var $param = ':shop_products_slider:htmlonly:products_id-'+$bought_with_all+':site-'+$site_id+':start-0:on_page-'+$onpage+':description:button-cart:id-hotengine-shop-products-list-boughtwith';
  $('.hotengine-shop-cart_continue_link').after('<div id="hotengine-shop-products-list-boughtwith" style="display:none;"><div class="hotengine-shop-products-list-div" data-hotengine-shop-products-list-param="'+$param+'" data-product_limits="'+$onpage+'"><span class="hotengine-shop-products-list-div-button-left hotengine-shop-products-list-div-button hotengine-shop-products-list-right" data-site-id="'+$site_id+'" data-product_limits_start_n="0"></span><span class="hotengine-shop-products-list-content"></span><span class="hotengine-shop-products-list-div-button-right hotengine-shop-products-list-div-button, hotengine-shop-products-list-right" data-site-id="'+$site_id+'" data-product_limits_start_n="0"></span></div></div>');
 
 
  $("#hotengine-shop-products-list-boughtwith .hotengine-shop-products-list-content").load("/ajax_get_list_shop.php?get&c="+$site_id+"&n=0&onpage="+$onpage+"&param="+$param , function(){

$(".hotengine-shop-products-list-content-loading").hide("fast", function(){ 
  $(".hotengine-shop-products-list-content-loading").remove(); 
  }); 

  
  if($("#hotengine-shop-products-list-boughtwith .hotengine-shop-products-list-content").is(':not(:empty)') && $("#hotengine-shop-products-list-boughtwith .hotengine-shop-products-list-content .hotengine-shop-product-list-block-empty").length < 0){
  $("#hotengine-shop-products-list-boughtwith").show(); 
    if(typeof(callback_hotengine_shop_products_list_div_button) === "function"){ 
    callback_hotengine_shop_products_list_div_button(); 
    }
  }
  
  }); 


//USING LIST OF BOUGHT WITH AS PRODUCT LIST 
} //if($bought_with_all.length>0){
} //if($bought_with_all!=''){
}
});
  //--></script>




The list will only be displayed when related products are found.
#hotengine-shop-products-list-boughtwith - specify the style for the block with a list of products.
:append - show "show more" button at the bottom (add :append before :button-cart)
To display a button at the bottom, append the "hotengine-shop-products-list-right" class "hotengine-shop-products-list-append", as well as hotengine-shop-products-list-div-append to the hotengine-shop-products-list-div class


CSS Style Example:
 Code: CSS

#hotengine-shop-products-list-boughtwith:before{ content:"Buy with the selected goods:"; display:block; text-align:center; line-height:30px;}
#hotengine-shop-products-list-boughtwith {margin-top:50px;}





Code pop-up window with a list of:
 Code: html
<script type="text/javascript"><!--
  $(function(){ 
if(!$("#hotengine-shop-cart-form").length){
  //check bought with values 
  $product_in_cart = $(".hotengine-marking[data-hotengine-marking-type='shop_catalog_page_cart_products_list']");
var $bought_with_all = '';
$product_in_cart.each(function(){
  if(typeof $product_in_cart !== typeof undefined && $product_in_cart !== false && $product_in_cart !='undefined' && $product_in_cart !=''){
  var $boughtwith = $(this).attr("data-hotengine-marking-boughtwith");
  
  if(typeof $boughtwith !== typeof undefined && $boughtwith !== false && $boughtwith !='undefined' && $boughtwith !='' && $boughtwith.length > 0){
  if($bought_with_all!=''){ $bought_with_all += ','; }
  $bought_with_all += $boughtwith;
  }
  
  
  
  }
});
  //check bought with values 

if($bought_with_all!=''){   //we have a sku or id list

 $product_in_cart_id = $(".hotengine-marking[data-hotengine-marking-type='shop_catalog_page_cart_products_list']");
var $shop_catalog_page_remove = [];
$product_in_cart.each(function(){
  if(typeof $product_in_cart !== typeof undefined && $product_in_cart !== false && $product_in_cart !='undefined' && $product_in_cart !=''){
  
  $shop_catalog_page_remove.push($(this).attr("data-hotengine-marking-shop_catalog_page_id"));
  $shop_catalog_page_remove.push($(this).attr("data-hotengine-marking-shop_catalog_page_sku"));
  $site_id = $(this).attr("data-hotengine-marking-site_id");
  }
  });

var $bought_with_all = $bought_with_all.split(',');
$bought_with_all = $.grep($bought_with_all, function(value){
  return $.inArray(value, $shop_catalog_page_remove) < 0;
  });

$bought_with_all.filter(Boolean);
if($bought_with_all.length>0){
var $bought_with_all = $bought_with_all.join(',')
//USING LIST OF BOUGHT WITH AS PRODUCT LIST 
 var $width='800'; //winodw width at start
  var $product_width = '350'; //product width
  if($width>$(window).width()){ 
  $width = $(window).width()-30; //resize to window widrth 
  };
  var $onpage = Math.round($width/$product_width);  //count product on one window
  var $param = ':shop_products_slider:htmlonly:products_id-'+$bought_with_all+':site-'+$site_id+':start-0:on_page-'+$onpage+':description:button-cart:auto_width:id-hotengine-shop-products-list-boughtwith';
if (typeof $bought_with_all !== typeof undefined && $bought_with_all !== false && $bought_with_all !== "undefined" && $bought_with_all.length > 0 && $bought_with_all!=""){
  var $title = "Buy with the selected goods:";
  $("body").append('<div id="hotengine-bought_with-window"><div id="hotengine-shop-products-list-boughtwith"><div class="hotengine-shop-products-list-div" data-hotengine-shop-products-list-param="'+$param+'" data-product_limits="'+$onpage+'"><span class="hotengine-shop-products-list-div-button-left hotengine-shop-products-list-div-button" data-site-id="'+$site_id+'" data-product_limits_start_n="0"></span><span class="hotengine-shop-products-list-content"></span><span class="hotengine-shop-products-list-div-button-right hotengine-shop-products-list-div-button" data-site-id="'+$site_id+'" data-product_limits_start_n="0"></span></div></div><br/><a class="hotengine-bought_with-window-btn-close" onclick=\'return $("#hotengine-bought_with-window").dialog("close").remove();\'></a></div>');
$("#hotengine-shop-products-list-boughtwith .hotengine-shop-products-list-content").load("/ajax_get_list_shop.php?get&c="+$site_id+"&n=0&onpage="+$onpage+"&param="+$param , function(){
$(".hotengine-shop-products-list-content-loading").hide("fast", function(){ 
  $(".hotengine-shop-products-list-content-loading").remove(); 
  }); 

if ($("#hotengine-bought_with-window .hotengine-shop-products-list-content .hotengine-shop-product-list-block span").length > 2){
  $("#hotengine-bought_with-window").dialog({
  width: $width+"px",
  minWidth: $width+"px",
  modal: true,
  stack: true,
  sticky: true,
  title: $title,
  close: function(){ $(this).remove(); },
  open: function(){
  $(document).on("click",".ui-widget-overlay",function(){
  $("#hotengine-bought_with-window").dialog("close").remove();
    if(typeof(callback_hotengine_shop_products_list_div_button) === "function"){ 
     callback_hotengine_shop_products_list_div_button(); 
    }
  })
  }
  });
  
  } else { $("#hotengine-bought_with-window").hide(0);}
  
  }); 
  }


//USING LIST OF BOUGHT WITH AS PRODUCT LIST 
} //if($bought_with_all.length>0){
} //if($bought_with_all!=''){
}
});
  //--></script>



The window will pop up only when related products are found.

.hotengine-bought_with-window-btn-close - specify the style for the window close button (displayed below the list of products in the window).

CSS Style Example:
 Code: CSS

.hotengine-bought_with-window-btn-close:before{ content:"Закрыть";}
.hotengine-bought_with-window-btn-close {
  display:block;
  background:none;
  width:110px;
  line-height:38px;
  height: auto;
  padding: 0px 0px;
  white-space:nowrap;
  background: #4f86b1;
  cursor: pointer;
  transition-delay: 0;
  transition-duration: 0.2s;
  transition-property: all;
  transition-timing-function: cubic-bezier(0, 0, 1, 1);
  border:none; box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
  text-shadow:1px 1px 1px rgba(1, 39, 106, 1);
  color: #fff!important;
  text-decoration: none;
  margin:-10px auto 0px auto;
  text-align: center;
}
.hotengine-bought_with-window-btn-close:hover { background:#24689E; opacity: 1; -moz-opacity: 1; -khtml-opacity: 1; filter: alpha(opacity=100);  }




The list «Buy with the item» is additionally displayed when viewing the item card. If you need to make a pop-up window or a list of products displayed only in the basket, then use the «List of products for mailing». If so, replace «data-hotengine-marking-boughtwith» with «data-hotengine-marking-boughtwith-email»

Code for popup with a list after adding an item to the cart (callback_hotengine_cart_plus_after_boughtwith):

The callback_hotengine_cart_plus_after_boughtwith function is called after adding an item to the cart and contains the value of the list "with item being purchased".

 Code: html
<script type="text/javascript"><!--
function callback_hotengine_cart_plus_after_boughtwith($bought_with_all){
if($bought_with_all!=''){   //we have a sku or id list
  //USING LIST OF BOUGHT WITH AS PRODUCT LIST 
  var $width='800'; //winodw width at start
  var $product_width = '350'; //product width
  if($width>$(window).width()){ 
  $width = $(window).width()-30; //resize to window widrth 
  };
  var $onpage = Math.round($width/$product_width);  //count product on one window
  var $param = ':shop_products_slider:htmlonly:products_id-'+$bought_with_all+':start-0:on_page-'+$onpage+':description:button-cart:auto_width:id-hotengine-shop-products-list-boughtwith';
 var $title = "Buy with the selected goods:";
  $("body").append('<div id="hotengine-bought_with-window"><div id="hotengine-shop-products-list-boughtwith"><div class="hotengine-shop-products-list-div" data-hotengine-shop-products-list-param="'+$param+'" data-product_limits="'+$onpage+'"><span class="hotengine-shop-products-list-div-button-left hotengine-shop-products-list-div-button"  data-product_limits_start_n="0"></span><span class="hotengine-shop-products-list-content"></span><span class="hotengine-shop-products-list-div-button-right hotengine-shop-products-list-div-button" data-product_limits_start_n="0"></span></div></div><br/><a class="hotengine-bought_with-window-btn-close" onclick=\'return $("#hotengine-bought_with-window").dialog("close").remove();\'></a></div>');
  $("#hotengine-shop-products-list-boughtwith .hotengine-shop-products-list-content").load("/ajax_get_list_shop.php?n=0&onpage="+$onpage+"&param="+$param , function(){
  $(".hotengine-shop-products-list-content-loading").hide("fast", function(){ 
  $(".hotengine-shop-products-list-content-loading").remove(); 
  }); 

  if ($("#hotengine-bought_with-window .hotengine-shop-products-list-content .hotengine-shop-product-list-block span").length > 2){
  $("#hotengine-bought_with-window").dialog({
  width: $width+"px",
  minWidth: $width+"px",
  modal: true,
  stack: true,
  sticky: true,
  title: $title,
  close: function(){ $(this).remove(); },
  open: function(){
  $(document).on("click",".ui-widget-overlay",function(){
  $("#hotengine-bought_with-window").dialog("close").remove();
     if(typeof(callback_hotengine_shop_products_list_div_button) === "function"){ 
      callback_hotengine_shop_products_list_div_button(); 
     }
  })
  }
  });
  
  }
  
  }); 
  

//USING LIST OF BOUGHT WITH AS PRODUCT LIST 
} //if($bought_with_all!=''){
  }
//--></script>

The callback_hotengine_cart_plus_after_boughtwith function can be replaced with callback_hotengine_cart_plus_after_boughtwith_email, to display the same list but for email distribution (email distribution of other products).

The window will only pop up when related products are found.

.hotengine-bought_with-window-btn-close - specify the style for the window close button (displayed below the list of products in the window).

CSS Style Example:
 Code: CSS

.hotengine-bought_with-window-btn-close:before{ content:"Close";}
.hotengine-bought_with-window-btn-close {
  display:block;
  background:none;
  width:110px;
  line-height:38px;
  height: auto;
  padding: 0px 0px;
  white-space:nowrap;
  background: #4f86b1;
  cursor: pointer;
  transition-delay: 0;
  transition-duration: 0.2s;
  transition-property: all;
  transition-timing-function: cubic-bezier(0, 0, 1, 1);
  border:none; box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
  text-shadow:1px 1px 1px rgba(1, 39, 106, 1);
  color: #fff!important;
  text-decoration: none;
  margin:-10px auto 0px auto;
  text-align: center;
}
.hotengine-bought_with-window-btn-close:hover { background:#24689E; opacity: 1; -moz-opacity: 1; -khtml-opacity: 1; filter: alpha(opacity=100);  }





Function after adding a product to the cart. Buyer Discount Alert

The callback_hotengine_cart_plus_after function is called after adding an item to the cart. In this example, the notification about the amount of the customer's discount, if any, is implemented. The data is taken from the data-hotengine-cart-discount microdata in the cart.

 Code: html
<script type="text/javascript">
  <!--
  function callback_hotengine_cart_plus_after($items_in_cart){
  var $stick_cart = $(".hotengine-shop-cart-sticker-cart-cart");
  if (typeof $stick_cart !== typeof undefined && $stick_cart !== false && $stick_cart !== "undefined" && $stick_cart.length > 0){
  var $your_discount = $stick_cart.attr("data-hotengine-cart-discount");
  if($your_discount!='' && $your_discount!= undefined){ $("#cart").after('<span class="hotengine-your_discount">'+$your_discount+'</span>'); }
  }
  }
$(function(){
  callback_hotengine_cart_plus_after();
  });
  -->
  </script>

In order for the notification to be triggered not only after adding an item to the cart, it is necessary to duplicate the script for checking the availability of the discount microdata. For example, this is implemented using an additional call to the callback_hotengine_cart_plus_after(); function without adding an item to the cart.

CSS Style Example:
 Code: CSS
.hotengine-your_discount  { 
    white-space: nowrap;
    position: absolute;
    margin-top: -32px;
    right: 47px;
    background: #f00;
    color: #fff;
    border-radius: 50px 50px 0px 50px;
    line-height: 30px;
    width: 50px;
    opacity: 0.9;
    text-align: center;
  }






Load article list using Javascript

Ajax loading article list:
Block generator with articles can be downloaded using a GET/POST/AJAX request. To do this, you need to make a request from your site (your domain) to the «/ajax_get_list_blog.php» page. You can specify additional properties for displaying articles in the request. You can find a list of all possible values ​​on the page «Articles widget». For correct display of articles, you need to add HTML wrapper and parent elements, as well as buttons for rewinding/continuing the list of articles (scrolling forward/backward). An example of such a wrapper is shown in the script below.




 Code: html
<div class="blog-page-list-AJAXLOAD">
</div>
<script type="text/javascript"><!--
  $(function(){ 
  $blog_marking = $(".hotengine-marking[data-hotengine-marking-type='blog_catalog_page']");
  if(typeof $blog_marking !== typeof undefined && $blog_marking !== false && $blog_marking !='undefined' && $blog_marking !=''){
  
  $site_id = 'XXXX';
  $blog_cat_id = $blog_marking.attr("data-hotengine-marking-blog_cat_page_catid");

 var $onpage = "4"; 
  var $param = ':blog_page_slider:htmlonly:cat_id-'+$blog_cat_id+':site-'+$site_id+':start-0:on_page-'+$onpage+':description:append:id-hotengine-blog-page-list-AJAXLOAD';
  $('.blog-page-list-AJAXLOAD').html('<div id="hotengine-blog-page-list-AJAXLOAD" style="display:none;"><div class="hotengine-blog-page-list-div hotengine-blog-page-list-div-append" data-hotengine-blog-page-list-param="'+$param+'" data-blog_limits="'+$onpage+'"><span class="hotengine-blog-page-list-div-button-left hotengine-blog-page-list-div-button hotengine-blog-page-list-append" data-site-id="'+$site_id+'" data-blog_limits_start_n="0"></span><span class="hotengine-blog-page-list-content"></span><span class="hotengine-blog-page-list-div-button-right hotengine-blog-page-list-div-button hotengine-blog-page-list-append" data-site-id="'+$site_id+'" data-blog_limits_start_n="0"></span></div></div>');
  
  
  $("#hotengine-blog-page-list-AJAXLOAD .hotengine-blog-page-list-content").load("/ajax_get_list_blog.php?c="+$site_id+"&n=0&onpage="+$onpage+"&param="+$param , function(){
$(".hotengine-blog-page-list-content-loading").hide("fast", function(){ 
  $(".hotengine-blog-page-list-content-loading").remove(); 
  }); 
  
  
  if($("#hotengine-blog-page-list-AJAXLOAD .hotengine-blog-page-list-content").is(':not(:empty)') && $("#hotengine-blog-page-list-AJAXLOAD .hotengine-blog-page-list-content .hotengine-blog-product-list-block-empty").length < 0){
  $("#hotengine-blog-page-list-AJAXLOAD").show(); 
  }
  
  }); 

 
  }
});
  //--></script>


This code loads articles as with the "Block/Menu Generator, Articles Slider". In this script, loading occurs with the replacement of the parent category of the list of articles, which is defined using micro-markup.
XXXX - Site ID.
$onpage - the number of articles on one page (slide)
$blog_cat_id - directory categories, which in the example is indicated using micro-markup from this open article.
.blog-page-list-AJAXLOAD - Block into which articles are loaded.


Loading an article using Javascript in JSON format

Script for loading an article in JSON format

These articles are available upon request /ajax.php?json&blog_cat_p=XX

  • XX - Article ID

The request only works if you specify your domain, for example http://example.com/ajax.php?json&blog_cat_p=0


 Code:
<script type="text/javascript">
function decodeHtml(str)
  {
  var map =
  {
  '&amp;': '&',
  '&lt;': '<',
  '&gt;': '>',
  '&quot;': '"',
  '&amp;#039;': "'"
  };
  return str.replace(/&amp;|&lt;|&gt;|&quot;|&#039;/g, function(m) {return map[m];});
  }
$(function(){
  $.getJSON("/ajax.php?json&blog_cat_p=14674", function(blog){
   if(Object.keys(blog).length > 0){ 
    // full parameters console.log(blog);
    console.log(decodeHtml(blog.blog_cat_page_title_inpage));
    console.log(decodeHtml(blog.blog_cat_page_description));
    console.log(decodeHtml(blog.blog_cat_page_text));
    console.log(decodeHtml(blog.blog_cat_page_datestamp));
   } 
  });
});
</script>


Styling the search filter (hiding the list of values ​​when clicked)

If you need to hide/reveal the values ​​of the search filter, then you can use the script from the example below. The script writes the ID of the block with a list of values ​​in Cookies and displays/hides it according to the option selected by the user.
Attention! To use a search filter, first create a «Product Type» and provide values ​​for the characteristic type. This script is recommended to be used for «Multiple value».



 Code: html
<script><!--
  /*FILTER STYLE*/
  $(function(){
$("#shop_catalog_product_types_id_ajax .shop_catalog_product_types_block").each(function(){
 if ($.cookie("scptbt"+$(this).attr("data-id"))){ 
  $(this).find(".shop_catalog_product_types_block_title").addClass("scptbt_ishidden");
  $(this).find(".shop_catalog_product_types_block_value").css({"max-height":"0px"});
  }
  })

$(document).on('click','#shop_catalog_product_types_id_ajax .shop_catalog_product_types_block_title',function(){
  var thise = $(this);
  var sptelem = $(this).next(".shop_catalog_product_types_block_value");
  if(sptelem.outerHeight() < 1){
  sptelem.css({"max-height":"unset"});
  thise.removeClass("scptbt_ishidden");
  if ($.cookie("scptbt"+thise.parent().attr("data-id"))){ $.cookie('scptbt' + thise.parent().attr("data-id"), null, {expires: null, path: '/'});	}
  } else {
  sptelem.css({"max-height":"0px"}); 
  thise.addClass("scptbt_ishidden");
  $.cookie('scptbt' + thise.parent().attr("data-id"), true, {expires: null, path: '/'}); 
  }
  
  
  })

})
  /*FILTER STYLE*/
  --></script>


Css style for header (icon):

 Code: css
#search_smart_hotengine-search_form_block .shop_catalog_product_types_block_title:after{

position: relative;
    content: "";
    display: inline-block;
    top: -2px;
    left: 10px;
    width: 8px;
    height: 5px;

background: url(/templates/styles/menu_arrow/arrow-down.svg) no-repeat center center; background-size: 15px; opacity: 0.3;
}
.scptbt_ishidden:after{
 transform: rotate(270deg);
}



Creating your own sorting of the product list

If you need to create your own product sorting form, you can do this by passing GET variables. Below you will find instructions on how to save the selected sorting in COOKIES, as well as an example on how to implement sorting. To quickly create sorting you can use a «Functional Menu» - «Sorting goods». A search form will be inserted into the menu, as well as basic sorting fields.


The following GET parameters are available for custom sorting:
«order_by»:
  • 0 - by product id
  • 1 - by the date the product was added
  • 2 - by product price
  • 4 - by product name
  • 5 - by product priority

«sort_by»:
  • 0 - Descending (DESC)
  • 1 - Ascending (ASC)

«sort_instock_priority»: (sorted by priority, goods in stock are higher than goods out of stock)

  • 0 - ignore parameter
  • 1 - first, goods are in stock and on order, then those that are not in stock. Further, the sorting parameters specified above are taken into account.
  • 2 - initially out of stock.

«Price_from» - price from
«Price_to» - price up to
«Producer» - manufacturer (id or name of the manufacturer)
«Collection» - collection (id or collection name)
«Search» - search query
«Smart_search» - search query data from the search filter

In addition, the values ​​that are taken into account if a non-empty value is specified (for example, «1»):
«Shop_sale» - promotional,
«Shop_new_goods» - new items,
«Shop_bestsellers» - bestsellers,
«Shop_discount» - discount,
«Shop_reduced_price» - Reduced price,
«Order_by_param» - an additional parameter with an arbitrary value, for creating your own list, sorting by name or value.

When a GET variable «sort_by»is found in the address of the open page, the sorting data will be set accordingly to these values. If a page with a list of products is opened, the values ​​will be filled from the link of the «.hotengine-pagination-current» element. In addition, upon opening a sorted page, COOKIEs will be generated to remember the user-selected options. The script that performs this function, which is also installed when creating the functional sorting menu, is located at /templates/scripts/hotengine-script-sort-shop-products.js.

Consider an example of creating a sort with your own values.

This can be done using the additional parameter «order_by_param», when selected, the values ​​of the fields «order_by», «sort_by» and others will be changed.
Set one field (#order_by_param) with a choice of options , and also leave the number of products displayed.


Create "Block/Menu", location "at the top".
Block Name/Menu: hotengine_sort_products
Block Header/Menu: hotengine_sort_products
Block Position/Menu: Top
Show Block/Menu on pages: everywhere
Enter characters to display Block/Menu when found: (No spaces)
/pers_shop/ /producer/ /collection/ /shop/

Enter characters to not display Block / Menu when found: (No spaces)
.htm
Menu text:
 Code:
<form id="hotengine-sort-products-generated" name="hotengine-sort-products-generated" method="get" action="">
 <span>

<label>
<select name="order_by_param" id="order_by_param">
<option value="none">Sort</option>
<option value="lowtohight">Cheap to expensive</option>
<option value="highttolow">From expensive to cheap</option>
<option value="new">New</option>
<option value="sales">Promotional</option>
<option value="date">By date</option>
</select>
</label>

<div class="hidden">
<select name="shop_new_goods" id="shop_new_goods"><option value=""><option value="1"></select>
<select name="shop_sale" id="shop_sale"><option value=""><option value="1"></select>

 <label>
 <select name="sort_by" id="sort_by"> 
 <option value="ASC">Sort:</option>
 <option value="ASC">Ascending</option>
 <option value="DESC">Descending</option>
 </select>
 </label>
<label>
 <select name="order_by" id="order_by"> 
 <option value="5">Sort:</option>
 <option value="0">By item ID</option>
 <option value="4">By Name</option>
 <option value="1">By date</option>
 <option value="2">By price</option>
 </select>
 </label>
</div>
<label>
 <select name="NUM_ONPAGE" id="NUM_ONPAGE" onchange="this.form.submit()"> 
 <option value="10">10</option>
 <option value="20">20</option>
 <option value="30">30</option>
 <option value="50">50</option> 
 </select>
 </label>
 <input class="smart_search" name="smart_search" type="hidden" value="">
 <input class="search" name="search" type="hidden" value="">
 </span>
 </form> 
 
 
<script>
$(function(){
$(document).on("change","#order_by_param",function(){
if($(this).val()=="lowtohight"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("2").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("ASC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("").prop('selected',true); 
} else if($(this).val()=="highttolow"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("2").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("DESC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("").prop('selected',true); 
} else if($(this).val()=="date"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("1").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("DESC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("").prop('selected',true); 
} else if($(this).val()=="sales"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("1").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("DESC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("1").prop('selected',true); 
} else if($(this).val()=="new"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("1").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("DESC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("1").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("").prop('selected',true); 
} else if($(this).val()=="none"){
$('#hotengine-sort-products-generated select[name="order_by"]').val("5").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="sort_by"]').val("ASC").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_new_goods"]').val("").prop('selected',true); 
$('#hotengine-sort-products-generated select[name="shop_sale"]').val("").prop('selected',true); 
}
$(this).closest("form").submit();
});
});
</script>

 <script type="text/javascript" src="/templates/scripts/hotengine-script-sort-shop-products.js"></script>


 


CSS style for sorting (add CSS styles in the design editor):
 Code:
.menu_position_top_000000 #menu_c .headm{ display:none; }
.menu_position_top_000000 #menu_c { border: none; background: none; text-align: right;}
.menu_position_top_000000 #menu_c select { 
 background: transparent; 
 padding: 5px 8px 5px 5px; 
 font-size: 12px;
 line-height: 1;
 border-radius: 2px;
 height: 24px;
 -webkit-appearance: none;
 overflow: hidden;
 background: url(/templates/styles/menu_arrow/arrow-down.svg) no-repeat 95%; background-size: 16px;

 }
 .menu_position_top_000000 #menu_c select[name="NUM_ONPAGE"] { background:none;}
 .menu_position_top_000000 #menu_c span:before{ content:"Sort:"; display:inline-block; padding: 5px; font-size: 12px; }
 
 @-moz-document url-prefix(){ 
 .menu_position_top_000000 #menu_c select {
  padding:0px!important;
  background:none!important;

 }

}
 

Where 000000 needs to be replaced with the ID of the created menu with the sorting code.



Changing the «order_by_param» field will change the sort values and submit the form. Sorting fields have been added to the Form, including «New items» и «Promotion». The fields are hidden, since only a separate list «order_by_param» and the number of displayed products will be used visually. After submitting the form, the Values will be saved in a COOKIE.

Loading the basket on hover

If you need to display the contents of the cart on hover over the trash icon, you can enable the « Content on hover» option in the «Settings», in the tab «Store» - «Making the basket». Or perform a GET call to the address «/ajax.php?cart&load_cart_ajax»
JavaScript displaying the contents of the cart:

 Code:
<script type="text/javascript" src="/templates/scripts/hotengine-script-cart-hover-block.js"></script>


CSS style:
 Code:
/*CART HOVER BLOCK*/
#hotengine-cart_menu-hover-block{position:absolute; z-index:99; background:#fff; color:#444; border:1px solid #C7C7C7; padding:20px; display:block; width:50%; display:none; text-align:left;}
#hotengine-cart_menu-hover-block:before{ content:""; height:15px; width:100%; display:block; position:absolute; top:-10px; left:0px; z-index:99999;  }
#hotengine-cart_menu:hover + #hotengine-cart_menu-hover-block{ display:block; }
#hotengine-cart_menu-hover-block:hover{display:block; }
#hotengine-cart_menu-hover-block .hotengine-cart_menu-hover-block-close:after {
    content: "x";
    background: rgb(255,255,255);
    background: radial-gradient(circle,rgba(255,255,255,0) 0%,rgba(182,182,182,1) 100%);
    oveflow: hidden;
    border-radius: 50%;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    width: 15px;
    height: 15px;
    position: absolute;
    right: 5px;
    top: 5px;
    line-height: 14px;
    text-align: center;
    color: #656565;
    cursor: pointer;
    opacity: 0.8;
    font-size: 9px;
}
/*CART HOVER BLOCK*/

The script displays an additional block in case of detection of goods in the basket and hovering the mouse cursor over «#hotengine-cart_menu» (cart in the block/menu).




Product card child images

Loading a list of product images

For each product card, you can get a list of embedded images in JSON format. To do this, you need to make a request to the page «/ajax.php?get_shop_images=PATH», where PATH is the path to any product image or product ID.

Upload product image list in Colorbox popup gallery:

To add an icon that, when clicked, will pop up the colorbox gallery, scrolling through all the images available in the product, Add the following script to the Block/Menu:
 Code:
<script type="text/javascript" defer src="/templates/scripts/hotengine-script-shop-load-images-product.js"></script>


Icon CSS style:
 Code:
/*CHILD IMAGES SHOW POPUP IN SHOP LIST*/
.hotengine-shop-product-img-load-list {
    background: url(/templates/styles/mobile/search.png) no-repeat center center;
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 5;
    background-size: contain;
}
/*CHILD IMAGES SHOW POPUP IN SHOP LIST END*/

Display child images in product list with image list scroll buttons:

If you need to display child images in the product list, then enable the option «Installed images in the product list»; in the store settings, in the «Product View / Tabs / Variety» tab. Add the following script to the Block/Menu:
 Code:
<script type="text/javascript" defer src="/templates/scripts/hotengine-script-shop-images-child-in-list.js"></script>


CSS style:
 Code:
/*CHILD IMAGES SHOW IN SHOP LIST*/
.hotengine-imgchenge { position:absolute; z-index:2; padding:4px; font-size:20px; display:inline-block;  background: #858585;
    color: #fff;
    border-radius: 50%;
    height: 20px;
    width: 20px; line-height:20px; top: 50%; cursor:pointer; margin:-10px 5px 5px 5px; opacity:0;}
.hotengine-imgchenge-left {left:0px;} 
.hotengine-imgchenge-left:after{content:"<";}
.hotengine-imgchenge-right {right:0px;} 
.hotengine-imgchenge-right:after{content:">";}
.hotengine-shop-product-list-block:hover .hotengine-imgchenge{ opacity:1; -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -ms-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;}
/*CHILD IMAGES SHOW IN SHOP LIST END*/

If the product contains child images, then the script displays buttons for scrolling them, forward and backward.

Show child images in product list: Image replacement on hover:

If you need to display a child image on hover in the product list, then enable the option "Installed images in the product list"; in the store settings, in the product list»; in the store settings, in the «Product View / Tabs / Variety» tab. Add the following script to the Block/Menu:

 Code:
<script type="text/javascript" defer src="/templates/scripts/hotengine-script-shop-images-child-in-list-hover.js"></script>


Dropdown menu script

Dropdown menu script (default)

By default, you can customize how the child items of the Main Menu are displayed. This can be done in the "Design Editor", in the «Main Menu» tab, or when changing the main menu items in the «My Blocks/Menu» section.

When changing parameters, to the element «id="hotengine-mainmenu"» appropriate classes will be added.

  • «.hotengine-mainmenu-dropdown-default» - dropdowns by default
  • «.hotengine-mainmenu-categories-popup» - popup window with menu items full width of the page
  • «.hotengine-mainmenu-categories-column» – drop-down window with menu items on the entire width of the page
For the correct use of scripts, the list elements containing subitems are assigned the class «.hotengine-mainmenu-dropdown».
By disabling these scripts in the Main Menu Options or removing the above classes, you can set your own event code or CSS styles on hover.

The following are examples of scripts that activate these dropdown sub-items for the main menu, and are built in by default.
Default drop down menu
 Code:
<script type="text/javascript">
$(function(){
if(!$(".hotengine-mainmenu-categories-popup").length && !$(".hotengine-mainmenu-categories-column").length && $(".hotengine-mainmenu-dropdown-default").length && $("#hotengine-mainmenu .hotengine-mainmenu-dropdown").length){ 
if(typeof $hotengine_mainmenu_categories_dropdown == "undefined"){
$.getScript("/templates/scripts/hotengine-script-mainmenu-categories-dropdown.js"); 
}
}
});
</script>

Pop-up window
 Code:
<script type="text/javascript">
$(function(){
if($(".hotengine-mainmenu-categories-popup").length && $("#hotengine-mainmenu .hotengine-mainmenu-dropdown").length){
if(typeof $hotengine_mainmenu_categories_popup == "undefined"){
$.getScript("/templates/scripts/hotengine-script-mainmenu-categories-popup.js");
}
}
});
</script>

Dropping window
 Code:
<script type="text/javascript">
$(function(){
if($(".hotengine-mainmenu-categories-column").length && $("#hotengine-mainmenu .hotengine-mainmenu-dropdown").length){ 
if(typeof $hotengine_mainmenu_categories_popup_column == "undefined"){
$.getScript("/templates/scripts/hotengine-script-mainmenu-categories-popup-column.js"); 
}
}
});
</script>
Script after loading Automatic descriptions

Script for adding the "Buy" button after loading Automatic descriptions in the product card

If you are using auto descriptions in short form, after clicking "Read More" you can add a "Buy" button, as well as a price.
After loading the text, the callback function "callback_hotengine_shop_autodescription_readmore" will be executed.

 Code:
<script type="text/javascript">
function callback_hotengine_shop_autodescription_readmore($id,$job){ 
  if($job=="load"){
 var clone = $(".hotengine-shop-product-offerdetails .hotengine-shop-product-cart_icon").clone();
  var priceblock = $(".hotengine-shop-product-offerdetails .hotengine-shop-product-price_box").clone();
  $(".hotengine-store-autodescription-block .hotengine-store-autodescription-list-block[data-hotengine-marking-id=\""+$id+"\"] .hotengine-store-autodescription-fulltext").append([priceblock,clone]);
  
  }
}
</script>
Json loading goods

Script for loading a product card in JSON format

Product card data available upon request /ajax.php?json&shop_products

When unloading goods, you can specify sorting and filtering options by the following parameters:
  • id - product card ID (one or more values, separated by commas).
  • pers_shop_cat_page_catid - store category ID (one or more values, separated by commas)
  • producer - producer (one or more values, separated by commas)
  • collection - collection (one or more values, separated by commas)
  • sort_by - sorting
  • order_by - sorting
  • sort_instock_priority - sorting priority
  • price_from - price from
  • price_to - price to
  • stock - availability

The request only works with your domain, for example http://example.com/ajax.php?json&shop_products&id=0


 Code:
<script type="text/javascript">
function decodeHtml(str)
  {
  var map =
  {
  '&amp;': '&',
  '&lt;': '<',
  '&gt;': '>',
  '&quot;': '"',
  '&amp;#039;': "'"
  };
  return str.replace(/&amp;|&lt;|&gt;|&quot;|&#039;/g, function(m) {return map[m];});
  }
$(function(){
  $.getJSON("/ajax.php?json&shop_products&id=12345,12346", function(offers){
   if(Object.keys(offers).length > 0){ 
    // full parameters console.log(offers);
    $.each( offers.offers, function(z, items){ 
      $.each(items, function(i, item){ 
        console.log(decodeHtml(item.description)); //show description with htmldecode
        console.log(decodeHtml(item.text)); //show text with htmldecode
      });
    });
   } 
  });
});
</script>
Hiding/Showing characteristics in the product description

Hiding/Showing characteristics in the product description

In the product card, the display of Characteristics is available. The block can contain a long list, so you can use a script to hide some of the characteristics. To do this, create a Block/Menu and paste the following script:
 Code:
<script type="text/javascript" defer src="/templates/scripts/hotengine-script-hide-properties.js"></script>

Script can be changed by specifying the number of fields to display by default. To do this, copy the Script from the file and paste it into the Block/Menu.

Button css style:
 Code:
/*SHOW/HIDE PROPERTIES*/
.shop_catalog_product_properties_block_showblock{text-align:left; margin-bottom:40px;}
.shop_catalog_product_properties_block_showblock:before{
    content: "Show all characteristics"!important;
    white-space: nowrap;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    height: auto;
    border-radius:0px;
    margin: 5px auto 5px auto;
    font-size: 15px;
    padding: 4px 4px;
    border-bottom: 1px dashed #666666;
    margin-left:19px;
    display: inline-block;
}
html:lang(en) .shop_catalog_product_properties_block_showblock:before{
    content: "Show all characteristics"!important;
}
html:lang(ru) .shop_catalog_product_properties_block_showblock:before{
    content: "Показать все характеристики"!important;
}
html:lang(uk) .shop_catalog_product_properties_block_showblock:before{
    content: "Показати всі характеристики"!important;
}
html:lang(pl) .shop_catalog_product_properties_block_showblock:before{
    content: "Pokaż wszystkie cechy"!important;
}

html:lang(en) .shop_catalog_product_properties_block_showblock.visible:before{
    content: "Hide"!important;
}
html:lang(ru) .shop_catalog_product_properties_block_showblock.visible:before{
    content: "Скрыть"!important;
}
html:lang(uk) .shop_catalog_product_properties_block_showblock.visible:before{
    content: "Приховати"!important;
}
html:lang(pl) .shop_catalog_product_properties_block_showblock.visible:before{
    content: "Ukrywać"!important;
}

.shop_catalog_product_properties_block_showblock:hover:before{
    color:#008fc3;
    border-color: #008fc3;
}
/*SHOW/HIDE PROPERTIES END*/