Skip to content

Commit

Permalink
Version v1.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitridr committed Oct 24, 2017
1 parent 15b9ffb commit a8f66db
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** Facebook for WooCommerce Changelog ***

2017-10-19 version 1.6.5
* Fix unterminated div tag. Thanks @pwag42
* After 7 days, show a link to a new ads interface on the settings page.

2017-10-04 version 1.6.4
* Default to variant specific image as primary image for FB.
* Add a Checkbox to allow override to use the parent product image.
Expand Down
33 changes: 33 additions & 0 deletions facebook-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class WC_Facebookcommerce_Integration extends WC_Integration {

const FB_MESSAGE_DISPLAY_TIME = 180;

// Number of days to wait before showing a link to our ads products.
const FB_SHOW_REDIRECT = 7;

const FB_VARIANT_IMAGE = 'fb_image';
const FB_VARIANT_SIZE = 'size';
const FB_VARIANT_COLOR = 'color';
Expand Down Expand Up @@ -86,6 +89,10 @@ public function __construct() {
? $this->settings['fb_pixel_id']
: '';

$this->pixel_install_time = isset($this->settings['pixel_install_time'])
? $this->settings['pixel_install_time']
: '';

$this->use_pii = isset($this->settings['fb_pixel_use_pii'])
&& $this->settings['fb_pixel_use_pii'] === 'yes'
? true
Expand Down Expand Up @@ -1206,6 +1213,9 @@ function ajax_save_fb_settings() {
// only save a pixel if we already have an API key.
if ($this->settings['fb_api_key']) {
$this->settings['fb_pixel_id'] = $_REQUEST['pixel_id'];
if ($this->pixel_id != $_REQUEST['pixel_id']) {
$this->settings['pixel_install_time'] = current_time('mysql');
}
} else {
self::log("Got pixel-only settings, doing nothing");
echo "Not saving pixel-only settings";
Expand Down Expand Up @@ -1280,6 +1290,7 @@ function ajax_delete_fb_settings() {

$this->settings['fb_page_id'] = '';
$this->settings['fb_external_merchant_settings_id'] = '';
$this->settings['pixel_install_time'] = '';

update_option(
$this->get_option_key(),
Expand Down Expand Up @@ -1958,6 +1969,7 @@ public function maybe_display_facebook_api_messages() {
function admin_options() {
$configure_button_text = __('Get Started', 'facebook-for-woocommerce');
$page_name = '';
$redirect_uri = '';
if (!empty($this->settings['fb_page_id']) &&
!empty($this->settings['fb_api_key']) ) {

Expand All @@ -1966,6 +1978,9 @@ function admin_options() {

$configure_button_text = __('Re-configure Facebook Settings',
'facebook-for-woocommerce');

$redirect_uri = 'https://www.facebook.com/ads/dia/redirect/?settings_id='
. $this->external_merchant_settings_id;
}
?>
<h2><?php _e('Facebook', 'facebook-for-woocommerce'); ?></h2>
Expand Down Expand Up @@ -2054,6 +2069,24 @@ class="btn" onclick="facebookConfig()" id="set_dia" ';
</div>
</div>
<br/><hr/><br/>
<div>
<p><?php
$now = new DateTime(current_time('mysql'));
// check if pixel_install_date has been set or cleared before
// DateInterveral::diff: difference in days
$diff = !$this->pixel_install_time
? null
: $now->diff(new DateTime($this->pixel_install_time))->format('%a');
if ($redirect_uri !== '' &&
is_numeric($diff) && (int)$diff > self::FB_SHOW_REDIRECT) {
echo sprintf(__('<strong><font size="3"> Good News! You\'re now
eligible to use an advanced feature on Facebook to create ads.
<a href='. $redirect_uri. ' target="_blank">'. ' Try it out.
</a></font></strong>', 'facebook-for-woocommerce'));
}
?>
</p>
</div>
<?php

$GLOBALS['hide_save_button'] = true;
Expand Down
2 changes: 1 addition & 1 deletion facebook-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Grow your business on Facebook! Use this official plugin to help sell more of your products using Facebook. After completing the setup, you'll be ready to create ads that promote your products and you can also create a shop section on your Page where customers can browse your products on Facebook.
* Author: Facebook
* Author URI: https://www.facebook.com/
* Version: 1.6.4
* Version: 1.6.5
* Woo: 2127297:0ea4fe4c2d7ca6338f8a322fb3e4e187
* Text Domain: facebook-for-woocommerce
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/fbutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class WC_Facebookcommerce_Utils {

const FB_RETAILER_ID_PREFIX = 'wc_post_id_';
const PLUGIN_VERSION = '1.6.4'; // Change it in `facebook-for-*.php` also
const PLUGIN_VERSION = '1.6.5'; // Change it in `facebook-for-*.php` also
public static $ems = null;
public static $fbgraph = null;
/**
Expand Down

0 comments on commit a8f66db

Please sign in to comment.