SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const FREE_SHIPPING_TAG ="FreeShippingAU";
  2. const FREE_SHIPPING_LABEL = '<ul class="pr_sticker" style="margin: 0 17.5%;; "><li>free shipping *</li></ul>';
  3.  
  4. var __isp_options = {
  5.     isp_serp_with_product_attributes: '1',
  6.     isp_serp_callback: function () {
  7.         $jquery_isp('.isp_grid_product').each(function() {
  8.             let id =  $jquery_isp(this).attr("product_id");
  9.             if(ISP_PRODUCTS[id].att) {
  10.                 let tags = get_attr(ISP_PRODUCTS[id].att,"Tag");
  11.                 if(tags === 0){return;}
  12.                 if(tags.indexOf(FREE_SHIPPING_TAG) > -1 && $jquery_isp(this).find(".pr_sticker").length === 0){
  13.                     $jquery_isp(this).find(".isp_product_image_wrapper").append(FREE_SHIPPING_LABEL);
  14.                 }
  15.             }
  16.         });
  17.     }
  18. };
  19.  
  20. function get_attr(attributes, target) {
  21.     for (let i = 0; i < attributes.length ; i++) {
  22.         if(attributes[i][0] === target){
  23.             return attributes[i][1];
  24.         }
  25.     }
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top