Changeset 2721057
- Timestamp:
- 05/10/2022 08:26:17 AM (4 years ago)
- Location:
- releva-nz/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
includes/class-relevatracking.php (modified) (1 diff)
-
public/class-relevatracking-public.php (modified) (8 diffs)
-
relevatracking.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releva-nz/trunk/README.txt
r2669900 r2721057 3 3 Tags: e-commerce, sales, advertising, marketing, retargeting, remarketing 4 4 Requires at least: 3.0.1 5 Tested up to: 5.9.05 Tested up to: 6.0.0 6 6 Requires PHP: 5.2 7 7 Stable tag: trunk … … 59 59 * update WooCommerce function calls which are deprecated and gonna be removed in the future 60 60 * adjust conversion tracking to exclude tax and shipping cost 61 62 = 2.1.1 = 63 * improved multisite support 64 * improve conversion tracking 65 * support for Wordpress 6 -
releva-nz/trunk/includes/class-relevatracking.php
r2369532 r2721057 70 70 71 71 $this->plugin_name = 'relevatracking'; 72 $this->version = ' 1.0.0';72 $this->version = '2.1.1'; 73 73 74 74 $this->load_dependencies(); -
releva-nz/trunk/public/class-relevatracking-public.php
r2628019 r2721057 55 55 //$this->load_client_id(); 56 56 $this->client_id = self::load_client_id(); 57 // http://localhost/patricianic.domain.wp/?releva_action=jsonexport (json export product) 58 add_action( 'releva_jsonexport', array( $this, 'jsonexport' ) ); 57 59 58 add_action( 'releva_csvexport', array( $this, 'csvexport' ) ); 60 59 add_action( 'releva_callback', array( $this, 'callback' ) ); … … 204 203 } 205 204 206 // http://localhost/patricianic.domain.wp/?releva_action=jsonexport (json export product)207 public function jsonexport() {208 $args = array(209 //'posts_per_page' => 10000,210 //'product_cat' => 'category-slug-here',211 //'post_type' => 'product',212 //'post_status' => array('publish'),213 'fields' => 'ids',214 'posts_per_page'=> -1,215 'post_type' => array('product'),216 'orderby' => 'title',217 );218 219 $the_query = new WP_Query( $args );220 // The Loop221 $full_data = array();222 global $wpdb;223 224 if( $the_query->have_posts() )225 {226 //while ( $the_query->have_posts() ) {227 //$the_query->the_post();228 foreach ($the_query->posts as $product_id) {229 230 //$the_query->post->ID = $product_id231 232 $single_product = array();233 $product = get_product($product_id);234 if(empty($product) ) {235 continue;236 }237 $single_product['product_id'] = $product_id;238 //$single_product['product_id'] = $product->get_id();239 240 $post_categories = wp_get_post_terms($product_id, $taxonomy = 'product_cat');241 $cat = ''; $ii = 0;242 foreach((array)$post_categories as $post_category):243 if($ii > 0){$cat .= ',';}244 //$cat .= $post_category->name;245 $cat .= $post_category->term_id;246 $ii++;247 endforeach;248 $single_product['category_ids'] = $cat;249 $single_product['product_name'] = $product->post->post_title;250 $single_product['short_description'] = $product->post->post_excerpt;251 $single_product['price'] = get_post_meta($product_id, '_price', true);252 253 254 $single_product['images'] = $this->get_images( $product );255 256 $stock_status = get_post_meta($product_id, '_stock_status', true);257 $single_product['stock_status'] = $stock_status=='instock'?'IN_STOCK':'OUT_OF_STOCK';258 259 260 $full_data[] = $single_product;261 }262 263 264 }265 266 //echo "<pre>"; var_export($full_data); echo "</pre>";267 echo json_encode($full_data);268 exit;269 }270 205 271 206 public function csvexport() { … … 336 271 $single_product['name'] = $product->get_name(); 337 272 $single_product['descriptionShort'] = $product->get_short_description(); 338 $single_product['descriptionLong'] = $product->get_description(); 273 //$single_product['descriptionLong'] = $product->get_description(); 274 $single_product['descriptionLong'] = ''; 275 339 276 340 277 $single_product['price'] = wc_get_price_including_tax( $product, array('price' => $product->get_regular_price() ) ); … … 521 458 // Add tracking for pages: 522 459 public function relevatracking() { 460 /** 461 * Don't initialize the plugin when WooCommerce is not active. 462 */ 463 if ( ! class_exists( 'WooCommerce', false ) ) { 464 return; 465 } 466 523 467 // is there any option client_id 524 468 if($this->client_id) { … … 529 473 // PRODUCT 530 474 $this->retargeting_product(); 475 // PRODUCT 476 $this->retargeting_cart(); 531 477 // ORDER SUCCESS PAGE 532 478 $this->retargeting_confirmation(); 479 // ANY OTHER PAGE 480 $this->retargeting_other(); 533 481 } 534 482 } … … 560 508 } 561 509 510 // CATEGORY PAGE 511 public function retargeting_cart() { 512 // URL: https://pix.hyj.mobi/rt?t=d&action=w&cid=CLIENT_ID 513 if (is_cart() ) { 514 $this->url_js='https://pix.hyj.mobi/rt?t=d&action=w&cid='.$this->client_id; 515 echo $this->render( 'front-page' ); 516 } 517 } 518 562 519 // PRODUCT PAGE 563 520 public function retargeting_product() { … … 597 554 } 598 555 556 public function retargeting_other() { 557 if(!is_front_page() && !(function_exists('is_product_category') && is_product_category()) && !is_product() && !is_order_received_page() && !is_cart()) { 558 $this->url_js='https://pix.hyj.mobi/rt?t=d&action=s&cid='.$this->client_id; 559 echo $this->render( 'front-page' ); 560 } 561 } 562 599 563 protected $order_id ; 600 564 protected $products_name = array(); … … 609 573 if($this->order_id) { 610 574 $order = new \WC_Order( $this->order_id ); 575 $this->order_id = $order->get_order_number(); 611 576 $this->order_total = number_format( (float) $order->get_total() - $order->get_total_tax() - $order->get_total_shipping(), wc_get_price_decimals(), '.', '' ); 612 577 foreach ( $order->get_items() as $item ) { -
releva-nz/trunk/relevatracking.php
r2628019 r2721057 17 17 * Plugin URI: https://releva.nz 18 18 * Description: Technology for personalized advertising 19 * Version: 2.1. 019 * Version: 2.1.1 20 20 * Author: releva.nz 21 21 * License: GPL-2.0+ … … 30 30 } 31 31 //check a plugin (WooCommerce) is active? 32 $all_plugins = apply_filters('active_plugins', get_option('active_plugins'));32 $all_plugins = (!is_multisite()) ? (array) get_option('active_plugins', array()) : (array) get_site_option('active_sitewide_plugins', array()); 33 33 34 if (!stripos(implode($all_plugins), 'woocommerce.php')) { 34 $result = implode($all_plugins) . implode(',',array_keys($all_plugins)); 35 36 if (!stripos($result, 'woocommerce.php')) { 35 37 add_action( 'admin_notices', 'relevatracking_render_wc_inactive_notice' ); 36 38 return; … … 46 48 $message = sprintf( 47 49 /* translators: %1$s and %2$s are <strong> tags. %3$s and %4$s are <a> tags */ 48 __( '%1$s Releva Trackingis inactive%2$s as it requires WooCommerce. Please %3$sactivate WooCommerce version 2.4.13 or newer%4$s', 'relevatracking' ),50 __( '%1$sreleva.nz is inactive%2$s as it requires WooCommerce. Please %3$sactivate WooCommerce version 2.4.13 or newer%4$s', 'relevatracking' ), 49 51 '<strong>', 50 52 '</strong>', … … 60 62 * This action is documented in includes/class-relevatracking-activator.php 61 63 */ 62 function activate_relevatracking( ) {64 function activate_relevatracking($networkwide) { 63 65 require_once plugin_dir_path( __FILE__ ) . 'includes/class-relevatracking-activator.php'; 66 64 67 Relevatracking_Activator::activate(); 65 68 }
Note: See TracChangeset
for help on using the changeset viewer.