Changeset 2520568
- Timestamp:
- 04/23/2021 07:19:44 PM (5 years ago)
- Location:
- nudgify
- Files:
-
- 4 edited
- 1 copied
-
tags/1.1.1 (copied) (copied from nudgify/trunk)
-
tags/1.1.1/nudgify.php (modified) (3 diffs)
-
tags/1.1.1/readme.txt (modified) (1 diff)
-
trunk/nudgify.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
nudgify/tags/1.1.1/nudgify.php
r2515785 r2520568 4 4 Description: Install Nudgify on your WordPress website in less then 10 seconds. Integrate unique tracking code of Nudgify into every page of your website in one click. 5 5 Author: Nudgify 6 Version: 1.1. 06 Version: 1.1.1 7 7 Author URI: https://nudgify.com 8 8 License: GPLv2 … … 12 12 defined('ABSPATH') or die('Restricted access!'); 13 13 14 define('NUDGIFY_PLUGIN_VERSION', '1.1. 0');14 define('NUDGIFY_PLUGIN_VERSION', '1.1.1'); 15 15 define('NUDGIFY_PLUGIN_SLUG', 'nudgify'); 16 16 define('NUDGIFY_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 152 152 $this->product = wc_get_product($post->ID); 153 153 154 $productStock = $this->get_product_stock(); 155 156 if (is_null($productStock) && $this->product->is_type('variable')) { 157 $productStock = 0; 158 $variations = $this->product->get_available_variations(); 159 foreach ($variations as $variation) { 160 $productStock += $variation['max_qty']; 161 } 162 } 163 154 164 $pixelData['data']['product'] = [ 155 165 'id' => $this->product->get_id(), 156 'stock' => $ this->get_product_stock(),166 'stock' => $productStock, 157 167 'image' => $this->get_product_image($this->product) 158 168 ]; 159 169 } 160 170 } 161 162 171 $pixelDataString = $this->pixel_data_string($pixelData); 163 172 164 173 echo implode("\n", array( 165 174 '<script>', 166 " {$pixelDataString} ", 167 ' (function(w){', 168 ' var k="nudgify",n=w[k]||(w[k]={});', 169 " n.uuid={$uuid};", 170 ' var d=document,s=d.createElement("script");', 171 " s.src={$url};", 172 ' s.async=1;', 173 ' s.charset="utf-8";', 174 ' d.getElementsByTagName("head")[0].appendChild(s)', 175 ' })(window)', 175 " {$pixelDataString} ", 176 ' jQuery(document).on("show_variation", function (event, variant) {', 177 ' if (!variant.is_in_stock) return; ', 178 ' window.nudgify.product({', 179 ' id: variant.variation_id || null,', 180 ' stock: variant.max_qty || null,', 181 ' image: variant.image.thumb_src || null,', 182 ' })', 183 ' });', 184 ' (function(w){', 185 ' var k="nudgify",n=w[k]||(w[k]={});', 186 " n.uuid={$uuid};", 187 ' var d=document,s=d.createElement("script");', 188 " s.src={$url};", 189 ' s.async=1;', 190 ' s.charset="utf-8";', 191 ' d.getElementsByTagName("head")[0].appendChild(s)', 192 ' })(window)', 176 193 '</script>', 177 194 )); -
nudgify/tags/1.1.1/readme.txt
r2515785 r2520568 5 5 Requires at least: 4.6 6 6 Tested up to: 5.7.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
nudgify/trunk/nudgify.php
r2515785 r2520568 4 4 Description: Install Nudgify on your WordPress website in less then 10 seconds. Integrate unique tracking code of Nudgify into every page of your website in one click. 5 5 Author: Nudgify 6 Version: 1.1. 06 Version: 1.1.1 7 7 Author URI: https://nudgify.com 8 8 License: GPLv2 … … 12 12 defined('ABSPATH') or die('Restricted access!'); 13 13 14 define('NUDGIFY_PLUGIN_VERSION', '1.1. 0');14 define('NUDGIFY_PLUGIN_VERSION', '1.1.1'); 15 15 define('NUDGIFY_PLUGIN_SLUG', 'nudgify'); 16 16 define('NUDGIFY_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 152 152 $this->product = wc_get_product($post->ID); 153 153 154 $productStock = $this->get_product_stock(); 155 156 if (is_null($productStock) && $this->product->is_type('variable')) { 157 $productStock = 0; 158 $variations = $this->product->get_available_variations(); 159 foreach ($variations as $variation) { 160 $productStock += $variation['max_qty']; 161 } 162 } 163 154 164 $pixelData['data']['product'] = [ 155 165 'id' => $this->product->get_id(), 156 'stock' => $ this->get_product_stock(),166 'stock' => $productStock, 157 167 'image' => $this->get_product_image($this->product) 158 168 ]; 159 169 } 160 170 } 161 162 171 $pixelDataString = $this->pixel_data_string($pixelData); 163 172 164 173 echo implode("\n", array( 165 174 '<script>', 166 " {$pixelDataString} ", 167 ' (function(w){', 168 ' var k="nudgify",n=w[k]||(w[k]={});', 169 " n.uuid={$uuid};", 170 ' var d=document,s=d.createElement("script");', 171 " s.src={$url};", 172 ' s.async=1;', 173 ' s.charset="utf-8";', 174 ' d.getElementsByTagName("head")[0].appendChild(s)', 175 ' })(window)', 175 " {$pixelDataString} ", 176 ' jQuery(document).on("show_variation", function (event, variant) {', 177 ' if (!variant.is_in_stock) return; ', 178 ' window.nudgify.product({', 179 ' id: variant.variation_id || null,', 180 ' stock: variant.max_qty || null,', 181 ' image: variant.image.thumb_src || null,', 182 ' })', 183 ' });', 184 ' (function(w){', 185 ' var k="nudgify",n=w[k]||(w[k]={});', 186 " n.uuid={$uuid};", 187 ' var d=document,s=d.createElement("script");', 188 " s.src={$url};", 189 ' s.async=1;', 190 ' s.charset="utf-8";', 191 ' d.getElementsByTagName("head")[0].appendChild(s)', 192 ' })(window)', 176 193 '</script>', 177 194 )); -
nudgify/trunk/readme.txt
r2515785 r2520568 5 5 Requires at least: 4.6 6 6 Tested up to: 5.7.1 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.