Version Notes
Product feed improvements:
- Fixes issue with certain store names
- Fixes issue with Blank Descriptions
- Uses TSV url in feed setup
Download this release
Release Info
| Developer | Jordan Rogers-Smith |
| Extension | Facebook_Ads_Toolbox |
| Version | 2.1.15 |
| Comparing to | |
| See all releases | |
Code changes from version 2.1.14 to 2.1.15
- app/code/community/Facebook/AdsToolbox/Block/Adminhtml/Diaindex.php +2 -7
- app/code/community/Facebook/AdsToolbox/Block/Adminhtml/Pixelindex.php +1 -1
- app/code/community/Facebook/AdsToolbox/Block/Head.php +0 -4
- app/code/community/Facebook/AdsToolbox/Block/common.php +4 -0
- app/code/community/Facebook/AdsToolbox/Model/FacebookProductFeed.php +45 -21
- app/code/community/Facebook/AdsToolbox/Model/FacebookProductFeed.php.rej +0 -37
- app/code/community/Facebook/AdsToolbox/Model/Observer.php +1 -1
- app/code/community/Facebook/AdsToolbox/etc/config.xml +1 -1
- app/code/community/Facebook/AdsToolbox/lib/fb.php +1 -1
- app/design/frontend/base/default/template/facebookadstoolbox/addtocart.phtml +2 -2
- app/design/frontend/base/default/template/facebookadstoolbox/head.phtml +2 -2
- app/design/frontend/base/default/template/facebookadstoolbox/initiate_checkout.phtml +6 -4
- app/design/frontend/base/default/template/facebookadstoolbox/purchase.phtml +5 -3
- app/design/frontend/base/default/template/facebookadstoolbox/search.phtml +4 -2
- app/design/frontend/base/default/template/facebookadstoolbox/viewcategory.phtml +4 -2
- app/design/frontend/base/default/template/facebookadstoolbox/viewcontent.phtml +5 -3
- package.xml +9 -7
app/code/community/Facebook/AdsToolbox/Block/Adminhtml/Diaindex.php
CHANGED
|
@@ -55,7 +55,7 @@ class Facebook_AdsToolbox_Block_Adminhtml_Diaindex
|
|
| 55 |
}
|
| 56 |
|
| 57 |
public function fetchStoreName() {
|
| 58 |
-
return FacebookAdsToolbox::getStoreName();
|
| 59 |
}
|
| 60 |
|
| 61 |
public function fetchStoreTimezone() {
|
|
@@ -94,15 +94,10 @@ class Facebook_AdsToolbox_Block_Adminhtml_Diaindex
|
|
| 94 |
}
|
| 95 |
|
| 96 |
public function getFeedUrl() {
|
| 97 |
-
|
| 98 |
$this->getFeedIndex()->getBaseUrl(),
|
| 99 |
strtolower($this->fetchFeedSetupFormat())
|
| 100 |
);
|
| 101 |
-
if (extension_loaded('zlib')) {
|
| 102 |
-
return $feed_url.'.gz';
|
| 103 |
-
} else {
|
| 104 |
-
return $feed_url;
|
| 105 |
-
}
|
| 106 |
}
|
| 107 |
|
| 108 |
public function fetchFeedSamples() {
|
| 55 |
}
|
| 56 |
|
| 57 |
public function fetchStoreName() {
|
| 58 |
+
return htmlspecialchars(FacebookAdsToolbox::getStoreName(), ENT_QUOTES, 'UTF-8');
|
| 59 |
}
|
| 60 |
|
| 61 |
public function fetchStoreTimezone() {
|
| 94 |
}
|
| 95 |
|
| 96 |
public function getFeedUrl() {
|
| 97 |
+
return sprintf('%sfacebook_adstoolbox_product_feed.%s',
|
| 98 |
$this->getFeedIndex()->getBaseUrl(),
|
| 99 |
strtolower($this->fetchFeedSetupFormat())
|
| 100 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
public function fetchFeedSamples() {
|
app/code/community/Facebook/AdsToolbox/Block/Adminhtml/Pixelindex.php
CHANGED
|
@@ -26,7 +26,7 @@ class Facebook_AdsToolbox_Block_Adminhtml_Pixelindex
|
|
| 26 |
}
|
| 27 |
|
| 28 |
public function fetchStoreName() {
|
| 29 |
-
FacebookAdsToolbox::getStoreName();
|
| 30 |
}
|
| 31 |
|
| 32 |
public function fetchTimezone() {
|
| 26 |
}
|
| 27 |
|
| 28 |
public function fetchStoreName() {
|
| 29 |
+
return htmlspecialchars(FacebookAdsToolbox::getStoreName(), ENT_QUOTES, 'UTF-8');
|
| 30 |
}
|
| 31 |
|
| 32 |
public function fetchTimezone() {
|
app/code/community/Facebook/AdsToolbox/Block/Head.php
CHANGED
|
@@ -15,8 +15,4 @@ if (file_exists(__DIR__.'/common.php')) {
|
|
| 15 |
}
|
| 16 |
|
| 17 |
class Facebook_AdsToolbox_Block_Head extends Facebook_AdsToolbox_Block_Common {
|
| 18 |
-
|
| 19 |
-
public function getFacebookPixelID() {
|
| 20 |
-
return Mage::getStoreConfig('facebook_ads_toolbox/fbpixel/id');
|
| 21 |
-
}
|
| 22 |
}
|
| 15 |
}
|
| 16 |
|
| 17 |
class Facebook_AdsToolbox_Block_Head extends Facebook_AdsToolbox_Block_Common {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
}
|
app/code/community/Facebook/AdsToolbox/Block/common.php
CHANGED
|
@@ -44,4 +44,8 @@ class Facebook_AdsToolbox_Block_Common extends Mage_Core_Block_Template {
|
|
| 44 |
return 'exmagento-'
|
| 45 |
. $this->getMagentoVersion() . '-' . $this->getPluginVersion();
|
| 46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
}
|
| 44 |
return 'exmagento-'
|
| 45 |
. $this->getMagentoVersion() . '-' . $this->getPluginVersion();
|
| 46 |
}
|
| 47 |
+
|
| 48 |
+
public function getFacebookPixelID() {
|
| 49 |
+
return Mage::getStoreConfig('facebook_ads_toolbox/fbpixel/id');
|
| 50 |
+
}
|
| 51 |
}
|
app/code/community/Facebook/AdsToolbox/Model/FacebookProductFeed.php
CHANGED
|
@@ -108,22 +108,22 @@ class FacebookProductFeed {
|
|
| 108 |
break;
|
| 109 |
case self::ATTR_TITLE:
|
| 110 |
if ((bool)$attr_value) {
|
| 111 |
-
$attr_value =
|
| 112 |
// title max size: 100
|
| 113 |
if (strlen($attr_value) > 100) {
|
| 114 |
$attr_value = substr($attr_value, 0, 100);
|
| 115 |
}
|
| 116 |
-
return $
|
| 117 |
}
|
| 118 |
break;
|
| 119 |
case self::ATTR_DESCRIPTION:
|
| 120 |
if ((bool)$attr_value) {
|
| 121 |
-
$attr_value =
|
| 122 |
// description max size: 5000
|
| 123 |
if (strlen($attr_value) > 5000) {
|
| 124 |
$attr_value = substr($attr_value, 0, 5000);
|
| 125 |
}
|
| 126 |
-
return $
|
| 127 |
}
|
| 128 |
break;
|
| 129 |
case self::ATTR_GOOGLE_PRODUCT_CATEGORY:
|
|
@@ -137,23 +137,23 @@ class FacebookProductFeed {
|
|
| 137 |
break;
|
| 138 |
case self::ATTR_SHORT_DESCRIPTION:
|
| 139 |
if ((bool)$attr_value) {
|
| 140 |
-
$attr_value =
|
| 141 |
// max size: 1000
|
| 142 |
// and replacing the last 3 characters with '...' if it's too long
|
| 143 |
$attr_value = strlen($attr_value) >= 1000 ?
|
| 144 |
substr($attr_value, 0, 995).'...' :
|
| 145 |
$attr_value;
|
| 146 |
-
return $
|
| 147 |
}
|
| 148 |
break;
|
| 149 |
case self::ATTR_PRODUCT_TYPE:
|
| 150 |
// product_type max size: 750
|
| 151 |
if ((bool)$attr_value) {
|
| 152 |
-
$attr_value =
|
| 153 |
if (strlen($attr_value) > 750) {
|
| 154 |
$attr_value = substr($attr_value, strlen($attr_value) - 750, 750);
|
| 155 |
}
|
| 156 |
-
return $
|
| 157 |
}
|
| 158 |
break;
|
| 159 |
}
|
|
@@ -264,6 +264,7 @@ class FacebookProductFeed {
|
|
| 264 |
$io->open(array('path' => $feed_file_path));
|
| 265 |
if ($io->fileExists($feed_file_path) &&
|
| 266 |
!$io->isWriteable($feed_file_path)) {
|
|
|
|
| 267 |
Mage::throwException(Mage::helper('Facebook_AdsToolbox')->__(
|
| 268 |
'File "%s" cannot be saved. Please make sure the path "%s" is '.
|
| 269 |
'writable by web server.',
|
|
@@ -301,7 +302,21 @@ class FacebookProductFeed {
|
|
| 301 |
$exception_count = 0;
|
| 302 |
$store_id = FacebookAdsToolbox::getDefaultStoreId();
|
| 303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
while ($count < $total_number_of_products) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
if ($should_log) {
|
| 306 |
self::log(
|
| 307 |
sprintf(
|
|
@@ -320,25 +335,25 @@ class FacebookProductFeed {
|
|
| 320 |
->addUrlRewrite();
|
| 321 |
|
| 322 |
foreach ($products as $product) {
|
| 323 |
-
|
| 324 |
-
|
|
|
|
| 325 |
Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE &&
|
| 326 |
$product->getStatus() !=
|
| 327 |
Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
|
| 328 |
|
| 329 |
-
try {
|
| 330 |
$e = $this->buildProductEntry($product);
|
| 331 |
$io->streamWrite($e."\n");
|
| 332 |
-
}
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
}
|
| 343 |
}
|
| 344 |
}
|
|
@@ -386,6 +401,8 @@ class FacebookProductFeed {
|
|
| 386 |
$time_estimate =
|
| 387 |
$time_spent * $total_number_of_products / $num_samples * 1.5 + 30;
|
| 388 |
|
|
|
|
|
|
|
| 389 |
Mage::getModel('core/config')->saveConfig(
|
| 390 |
'facebook_ads_toolbox/dia/feed/time_estimate',
|
| 391 |
$time_estimate
|
|
@@ -457,6 +474,13 @@ class FacebookProductFeed {
|
|
| 457 |
return self::fileIsStale($file_path);
|
| 458 |
}
|
| 459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
private function lowercaseIfAllCaps($string) {
|
| 461 |
// if contains lowercase or non-western characters, don't update string
|
| 462 |
if (!preg_match('/[a-z]/', $string) && !preg_match('/[^\\p{Common}\\p{Latin}]/u', $string)) {
|
| 108 |
break;
|
| 109 |
case self::ATTR_TITLE:
|
| 110 |
if ((bool)$attr_value) {
|
| 111 |
+
$attr_value = $this->processAttrValue($attr_value, $escapefn);
|
| 112 |
// title max size: 100
|
| 113 |
if (strlen($attr_value) > 100) {
|
| 114 |
$attr_value = substr($attr_value, 0, 100);
|
| 115 |
}
|
| 116 |
+
return $attr_value;
|
| 117 |
}
|
| 118 |
break;
|
| 119 |
case self::ATTR_DESCRIPTION:
|
| 120 |
if ((bool)$attr_value) {
|
| 121 |
+
$attr_value = $this->processAttrValue($attr_value, $escapefn);
|
| 122 |
// description max size: 5000
|
| 123 |
if (strlen($attr_value) > 5000) {
|
| 124 |
$attr_value = substr($attr_value, 0, 5000);
|
| 125 |
}
|
| 126 |
+
return $attr_value;
|
| 127 |
}
|
| 128 |
break;
|
| 129 |
case self::ATTR_GOOGLE_PRODUCT_CATEGORY:
|
| 137 |
break;
|
| 138 |
case self::ATTR_SHORT_DESCRIPTION:
|
| 139 |
if ((bool)$attr_value) {
|
| 140 |
+
$attr_value = $this->processAttrValue($attr_value, $escapefn);
|
| 141 |
// max size: 1000
|
| 142 |
// and replacing the last 3 characters with '...' if it's too long
|
| 143 |
$attr_value = strlen($attr_value) >= 1000 ?
|
| 144 |
substr($attr_value, 0, 995).'...' :
|
| 145 |
$attr_value;
|
| 146 |
+
return $attr_value;
|
| 147 |
}
|
| 148 |
break;
|
| 149 |
case self::ATTR_PRODUCT_TYPE:
|
| 150 |
// product_type max size: 750
|
| 151 |
if ((bool)$attr_value) {
|
| 152 |
+
$attr_value = $this->processAttrValue($attr_value, $escapefn);
|
| 153 |
if (strlen($attr_value) > 750) {
|
| 154 |
$attr_value = substr($attr_value, strlen($attr_value) - 750, 750);
|
| 155 |
}
|
| 156 |
+
return $attr_value;
|
| 157 |
}
|
| 158 |
break;
|
| 159 |
}
|
| 264 |
$io->open(array('path' => $feed_file_path));
|
| 265 |
if ($io->fileExists($feed_file_path) &&
|
| 266 |
!$io->isWriteable($feed_file_path)) {
|
| 267 |
+
self::log('Feed file is not writable');
|
| 268 |
Mage::throwException(Mage::helper('Facebook_AdsToolbox')->__(
|
| 269 |
'File "%s" cannot be saved. Please make sure the path "%s" is '.
|
| 270 |
'writable by web server.',
|
| 302 |
$exception_count = 0;
|
| 303 |
$store_id = FacebookAdsToolbox::getDefaultStoreId();
|
| 304 |
|
| 305 |
+
if ($should_log) {
|
| 306 |
+
self::log(
|
| 307 |
+
sprintf(
|
| 308 |
+
'About to begin writing %d products',
|
| 309 |
+
$total_number_of_products));
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
while ($count < $total_number_of_products) {
|
| 313 |
+
// Compute and log memory usage
|
| 314 |
+
self::log(
|
| 315 |
+
sprintf(
|
| 316 |
+
"Current Memory usage: %f M / %s",
|
| 317 |
+
memory_get_usage() / (1024.0 * 1024.0), // Value returned is in bytes
|
| 318 |
+
ini_get('memory_limit')));
|
| 319 |
+
|
| 320 |
if ($should_log) {
|
| 321 |
self::log(
|
| 322 |
sprintf(
|
| 335 |
->addUrlRewrite();
|
| 336 |
|
| 337 |
foreach ($products as $product) {
|
| 338 |
+
try {
|
| 339 |
+
$product->setStoreId($store_id);
|
| 340 |
+
if ($product->getVisibility() !=
|
| 341 |
Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE &&
|
| 342 |
$product->getStatus() !=
|
| 343 |
Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
|
| 344 |
|
|
|
|
| 345 |
$e = $this->buildProductEntry($product);
|
| 346 |
$io->streamWrite($e."\n");
|
| 347 |
+
}
|
| 348 |
+
} catch (\Exception $e) {
|
| 349 |
+
$exception_count++;
|
| 350 |
+
// Don't overload the logs, log the first 3 exceptions.
|
| 351 |
+
if ($exception_count <= 3) {
|
| 352 |
+
self::logException($e);
|
| 353 |
+
}
|
| 354 |
+
// If it looks like a systemic failure : stop feed generation.
|
| 355 |
+
if ($exception_count > 100) {
|
| 356 |
+
throw $e;
|
| 357 |
}
|
| 358 |
}
|
| 359 |
}
|
| 401 |
$time_estimate =
|
| 402 |
$time_spent * $total_number_of_products / $num_samples * 1.5 + 30;
|
| 403 |
|
| 404 |
+
self::log('Feed Generation Time Estimate: '.$time_estimate);
|
| 405 |
+
|
| 406 |
Mage::getModel('core/config')->saveConfig(
|
| 407 |
'facebook_ads_toolbox/dia/feed/time_estimate',
|
| 408 |
$time_estimate
|
| 474 |
return self::fileIsStale($file_path);
|
| 475 |
}
|
| 476 |
|
| 477 |
+
private function processAttrValue($attr_value, $escapefn) {
|
| 478 |
+
$attr_value = $escapefn ? $this->$escapefn($attr_value) : $attr_value;
|
| 479 |
+
$attr_value = $this->htmlDecode($attr_value);
|
| 480 |
+
$attr_value = $escapefn ? $this->$escapefn($attr_value) : $attr_value;
|
| 481 |
+
return trim($attr_value);
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
private function lowercaseIfAllCaps($string) {
|
| 485 |
// if contains lowercase or non-western characters, don't update string
|
| 486 |
if (!preg_match('/[a-z]/', $string) && !preg_match('/[^\\p{Common}\\p{Latin}]/u', $string)) {
|
app/code/community/Facebook/AdsToolbox/Model/FacebookProductFeed.php.rej
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
diff a/facebook_ads_toolbox/magento_v1.x/code/Model/FacebookProductFeed.php b/facebook_ads_toolbox/magento_v1.x/code/Model/FacebookProductFeed.php (rejected hunks)
|
| 2 |
-
@@ -180,9 +180,32 @@
|
| 3 |
-
$items[self::ATTR_LINK] = $this->buildProductAttr(self::ATTR_LINK,
|
| 4 |
-
FacebookAdsToolbox::getBaseUrl().
|
| 5 |
-
$product->getUrlPath());
|
| 6 |
-
- $items[self::ATTR_IMAGE_LINK] = $this->buildProductAttr(self::ATTR_IMAGE_LINK,
|
| 7 |
-
- FacebookAdsToolbox::getBaseUrlMedia().
|
| 8 |
-
- 'catalog/product'.$product->getImage());
|
| 9 |
-
+
|
| 10 |
-
+ $image_url = null;
|
| 11 |
-
+ $image = $product->getImage();
|
| 12 |
-
+ if (!$image || $image === '' || $image === 'no_selection') {
|
| 13 |
-
+ $image = $product->getSmallImage();
|
| 14 |
-
+ }
|
| 15 |
-
+ if (!$image || $image === '' || $image === 'no_selection') {
|
| 16 |
-
+ $image = $product->getThumbnail();
|
| 17 |
-
+ }
|
| 18 |
-
+ if (!$image || $image === '' || $image === 'no_selection') {
|
| 19 |
-
+ $product->load('media_gallery');
|
| 20 |
-
+ $gal = $product->getMediaGalleryImages();
|
| 21 |
-
+ if ($gal) {
|
| 22 |
-
+ foreach ($gal as $gal_image) {
|
| 23 |
-
+ if ($gal_image['url'] && $gal_image['url'] !== '') {
|
| 24 |
-
+ $image_url = $gal_image['url'];
|
| 25 |
-
+ break;
|
| 26 |
-
+ }
|
| 27 |
-
+ }
|
| 28 |
-
+ }
|
| 29 |
-
+ }
|
| 30 |
-
+ if (!$image_url) {
|
| 31 |
-
+ $image_url = FacebookAdsToolbox::getBaseUrlMedia().'catalog/product'.$image;
|
| 32 |
-
+ }
|
| 33 |
-
+
|
| 34 |
-
+ $items[self::ATTR_IMAGE_LINK] = $this->buildProductAttr(self::ATTR_IMAGE_LINK, $image_url);
|
| 35 |
-
|
| 36 |
-
$brand = null;
|
| 37 |
-
$brand = $this->getCorrectText($product, self::ATTR_BRAND, 'brand');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Facebook/AdsToolbox/Model/Observer.php
CHANGED
|
@@ -129,7 +129,7 @@ class Facebook_AdsToolbox_Model_Observer {
|
|
| 129 |
if ($supportzip) {
|
| 130 |
$feed->saveGZip();
|
| 131 |
}
|
| 132 |
-
} catch (Exception $e) {
|
| 133 |
FacebookProductFeed::log(sprintf(
|
| 134 |
'Caught exception: %s. %s', $e->getMessage(), $e->getTraceAsString()
|
| 135 |
));
|
| 129 |
if ($supportzip) {
|
| 130 |
$feed->saveGZip();
|
| 131 |
}
|
| 132 |
+
} catch (\Exception $e) {
|
| 133 |
FacebookProductFeed::log(sprintf(
|
| 134 |
'Caught exception: %s. %s', $e->getMessage(), $e->getTraceAsString()
|
| 135 |
));
|
app/code/community/Facebook/AdsToolbox/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facebook_AdsToolbox>
|
| 5 |
-
<version>2.1.
|
| 6 |
</Facebook_AdsToolbox>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facebook_AdsToolbox>
|
| 5 |
+
<version>2.1.15</version>
|
| 6 |
</Facebook_AdsToolbox>
|
| 7 |
</modules>
|
| 8 |
<global>
|
app/code/community/Facebook/AdsToolbox/lib/fb.php
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
* of patent rights can be found in the PATENTS file in the code directory.
|
| 9 |
*/
|
| 10 |
|
| 11 |
-
if (!class_exists('FacebookAdsToolbox')) {
|
| 12 |
class FacebookAdsToolbox {
|
| 13 |
|
| 14 |
const LOGFILE = 'facebook_ads_extension.log';
|
| 8 |
* of patent rights can be found in the PATENTS file in the code directory.
|
| 9 |
*/
|
| 10 |
|
| 11 |
+
if (!class_exists('FacebookAdsToolbox', false)) {
|
| 12 |
class FacebookAdsToolbox {
|
| 13 |
|
| 14 |
const LOGFILE = 'facebook_ads_extension.log';
|
app/design/frontend/base/default/template/facebookadstoolbox/addtocart.phtml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
<?php if ($this->shouldFireAddToCart()) { ?>
|
| 2 |
<script>
|
| 3 |
fbq('track', 'AddToCart', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
-
content_type: "<?php echo $this->getContentType() ?>",
|
| 8 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 9 |
<?php if ($this->getContentName()) { ?>
|
| 10 |
, content_name: "<?php echo $this->getContentName() ?>"
|
| 1 |
+
<?php if ($this->getFacebookPixelID() && $this->shouldFireAddToCart()) { ?>
|
| 2 |
<script>
|
| 3 |
fbq('track', 'AddToCart', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
+
content_type: "<?php echo $this->getContentType() ?>",
|
| 8 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 9 |
<?php if ($this->getContentName()) { ?>
|
| 10 |
, content_name: "<?php echo $this->getContentName() ?>"
|
app/design/frontend/base/default/template/facebookadstoolbox/head.phtml
CHANGED
|
@@ -19,8 +19,8 @@ src="https://www.facebook.com/tr?id=<?php echo $this->getFacebookPixelID() ?>&ev
|
|
| 19 |
/></noscript>
|
| 20 |
<!-- End Facebook Pixel Code -->
|
| 21 |
<?php } else { ?>
|
| 22 |
-
<!-- NO Pixel ID is
|
| 23 |
<script>
|
| 24 |
-
console.log('No facebook pixel is configured, please log in as a admin and then visit Facebook
|
| 25 |
</script>
|
| 26 |
<?php } ?>
|
| 19 |
/></noscript>
|
| 20 |
<!-- End Facebook Pixel Code -->
|
| 21 |
<?php } else { ?>
|
| 22 |
+
<!-- NO Pixel ID is configured, please goto Admin -->
|
| 23 |
<script>
|
| 24 |
+
console.log('No facebook pixel is configured, please log in as a admin and then visit Facebook Ads Extension -> Get Started');
|
| 25 |
</script>
|
| 26 |
<?php } ?>
|
app/design/frontend/base/default/template/facebookadstoolbox/initiate_checkout.phtml
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
fbq('track', 'InitiateCheckout', {
|
| 3 |
source: 'magento',
|
| 4 |
-
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 5 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 6 |
-
content_type: "<?php echo $this->getContentType() ?>",
|
| 7 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 8 |
<?php if ($this->getValue() && $this->getCurrency()) { ?>
|
| 9 |
, value: <?php echo $this->getValue() ?>
|
|
@@ -12,4 +13,5 @@
|
|
| 12 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 13 |
<?php } ?>
|
| 14 |
});
|
| 15 |
-
</script>
|
|
|
| 1 |
+
<?php if ($this->getFacebookPixelID()) { ?>
|
| 2 |
+
<script>
|
| 3 |
fbq('track', 'InitiateCheckout', {
|
| 4 |
source: 'magento',
|
| 5 |
+
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
+
content_type: "<?php echo $this->getContentType() ?>",
|
| 8 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 9 |
<?php if ($this->getValue() && $this->getCurrency()) { ?>
|
| 10 |
, value: <?php echo $this->getValue() ?>
|
| 13 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 14 |
<?php } ?>
|
| 15 |
});
|
| 16 |
+
</script>
|
| 17 |
+
<?php } ?>
|
app/design/frontend/base/default/template/facebookadstoolbox/purchase.phtml
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
fbq('track', 'Purchase', {
|
| 3 |
source: 'magento',
|
| 4 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 5 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 6 |
-
content_type: "<?php echo $this->getContentType() ?>",
|
| 7 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 8 |
<?php if ($this->getValue() && $this->getCurrency()) { ?>
|
| 9 |
, value: <?php echo $this->getValue() ?>
|
|
@@ -12,4 +13,5 @@
|
|
| 12 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 13 |
<?php } ?>
|
| 14 |
});
|
| 15 |
-
</script>
|
|
|
| 1 |
+
<?php if ($this->getFacebookPixelID()) { ?>
|
| 2 |
+
<script>
|
| 3 |
fbq('track', 'Purchase', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
+
content_type: "<?php echo $this->getContentType() ?>",
|
| 8 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 9 |
<?php if ($this->getValue() && $this->getCurrency()) { ?>
|
| 10 |
, value: <?php echo $this->getValue() ?>
|
| 13 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 14 |
<?php } ?>
|
| 15 |
});
|
| 16 |
+
</script>
|
| 17 |
+
<?php } ?>
|
app/design/frontend/base/default/template/facebookadstoolbox/search.phtml
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
fbq('track', 'Search', {
|
| 3 |
source: 'magento',
|
| 4 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 5 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 6 |
query: "<?php echo $this->getSearchQuery() ?>"
|
| 7 |
});
|
| 8 |
-
</script>
|
|
|
| 1 |
+
<?php if ($this->getFacebookPixelID()) { ?>
|
| 2 |
+
<script>
|
| 3 |
fbq('track', 'Search', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
query: "<?php echo $this->getSearchQuery() ?>"
|
| 8 |
});
|
| 9 |
+
</script>
|
| 10 |
+
<?php } ?>
|
app/design/frontend/base/default/template/facebookadstoolbox/viewcategory.phtml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
fbq('track', 'ViewCategory', {
|
| 3 |
source: 'magento',
|
| 4 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
|
@@ -7,4 +8,5 @@
|
|
| 7 |
, content_category: "<?php echo $this->getCategory() ?>"
|
| 8 |
<?php } ?>
|
| 9 |
});
|
| 10 |
-
</script>
|
|
|
| 1 |
+
<?php if ($this->getFacebookPixelID()) { ?>
|
| 2 |
+
<script>
|
| 3 |
fbq('track', 'ViewCategory', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 8 |
, content_category: "<?php echo $this->getCategory() ?>"
|
| 9 |
<?php } ?>
|
| 10 |
});
|
| 11 |
+
</script>
|
| 12 |
+
<?php } ?>
|
app/design/frontend/base/default/template/facebookadstoolbox/viewcontent.phtml
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
fbq('track', 'ViewContent', {
|
| 3 |
source: 'magento',
|
| 4 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 5 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 6 |
-
content_type: "<?php echo $this->getContentType() ?>",
|
| 7 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 8 |
<?php if ($this->getContentName()) { ?>
|
| 9 |
, content_name: "<?php echo $this->getContentName() ?>"
|
|
@@ -18,4 +19,5 @@
|
|
| 18 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 19 |
<?php } ?>
|
| 20 |
});
|
| 21 |
-
</script>
|
|
|
| 1 |
+
<?php if ($this->getFacebookPixelID()) { ?>
|
| 2 |
+
<script>
|
| 3 |
fbq('track', 'ViewContent', {
|
| 4 |
source: 'magento',
|
| 5 |
version: "<?php echo $this->getMagentoVersion() ?>",
|
| 6 |
pluginVersion: "<?php echo $this->getPluginVersion() ?>",
|
| 7 |
+
content_type: "<?php echo $this->getContentType() ?>",
|
| 8 |
content_ids: [<?php echo $this->getContentIDs() ?>]
|
| 9 |
<?php if ($this->getContentName()) { ?>
|
| 10 |
, content_name: "<?php echo $this->getContentName() ?>"
|
| 19 |
, currency: "<?php echo $this->getCurrency() ?>"
|
| 20 |
<?php } ?>
|
| 21 |
});
|
| 22 |
+
</script>
|
| 23 |
+
<?php } ?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Facebook_Ads_Toolbox</name>
|
| 4 |
-
<version>2.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://raw.githubusercontent.com/fbsamples/audience-network-support/master/LICENSE">Facebook License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -60,12 +60,14 @@ _Installation Instructions_
|
|
| 60 |
Additional FAQ
|
| 61 |
https://www.facebook.com/help/532749253576163</description>
|
| 62 |
<notes>Product feed improvements:
|
| 63 |
-
-
|
| 64 |
-
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
<
|
| 68 |
-
<
|
|
|
|
|
|
|
| 69 |
<compatible/>
|
| 70 |
<dependencies><required><php><min>5.3.0</min><max>8.0.0</max></php></required></dependencies>
|
| 71 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Facebook_Ads_Toolbox</name>
|
| 4 |
+
<version>2.1.15</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://raw.githubusercontent.com/fbsamples/audience-network-support/master/LICENSE">Facebook License</license>
|
| 7 |
<channel>community</channel>
|
| 60 |
Additional FAQ
|
| 61 |
https://www.facebook.com/help/532749253576163</description>
|
| 62 |
<notes>Product feed improvements:
|
| 63 |
+
- Fixes issue with certain store names
|
| 64 |
+
- Fixes issue with Blank Descriptions
|
| 65 |
+
- Uses TSV url in feed setup
|
| 66 |
+
</notes>
|
| 67 |
+
<authors><author><name>Jordan Rogers-Smith</name><user>jordanrs</user><email>jordanrs@fb.com</email></author><author><name>Yu Li</name><user>liyuhk</user><email>liyuhk@fb.com</email></author><author><name>Dmitri Dranishnikov</name><user>dmitrid</user><email>dmitrid@fb.com</email></author><author><name>Adam Hoff</name><user>ahoff</user><email>ahoff@fb.com</email></author></authors>
|
| 68 |
+
<date>2016-11-18</date>
|
| 69 |
+
<time>01:53:13</time>
|
| 70 |
+
<contents><target name="magecommunity"><dir name="Facebook"><dir name="AdsToolbox"><dir><dir name="Block"><file name="AddToCart.php" hash="2e31117ad8e7b4e3ecf1e235277142ed"/><dir name="Adminhtml"><file name="Diaindex.php" hash="5a9df961999a28ce2d6399e096df318f"/><file name="Feedindex.php" hash="86450e134bcfd4e30b94de3c29d6c101"/><file name="Pixelindex.php" hash="055c1d64fa60ec3909dd9d317392424d"/></dir><file name="Head.php" hash="8e392b70af8647013a9c15c0528ade73"/><file name="InitiateCheckout.php" hash="2ea5eeba2a53336d67081063b570082f"/><file name="Purchase.php" hash="10bd19d5d1687b8967fc1c4b91410e39"/><file name="Search.php" hash="a06d6ba96455beaed85c617ec758258a"/><file name="ViewCategory.php" hash="ecb02aa4085ba56baedf6fde729b4b79"/><file name="ViewContent.php" hash="a079a5a593a7faf389067177057db2a8"/><file name="common.php" hash="651e50d3f2a3d9f681a026fe10790109"/></dir><dir name="Helper"><file name="Data.php" hash="09da04dbb30d6de8b7a873f0447456ba"/></dir><dir name="Model"><file name="FacebookProductFeed.php" hash="8ecbf7bde69e9f09283ed18157937d59"/><file name="FacebookProductFeedSamples.php" hash="56d006dc2cca6ca2e88e9ccae60d274a"/><file name="FacebookProductFeedTSV.php" hash="4391132b3f69b32e534a7a5aa21b779f"/><file name="FacebookProductFeedXML.php" hash="c8ba195a0e85182b8541bd1a655e02d5"/><file name="Observer.php" hash="299a0d315d9ee0e8cb26c0eef3f8e23e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FbfeedController.php" hash="0d7960608bcde90dd3d65a89e0c21692"/><file name="FbfeedlogController.php" hash="3b94fd3429ecf877cb54af173340a326"/><file name="FbmainController.php" hash="60eca5932835fca49fd0ca39b9ec7880"/><file name="FbpixelController.php" hash="f00c250878671e6e4957239ddd952476"/><file name="FbregenController.php" hash="1837e42c7e6d4d9c77bb386732d08e28"/></dir><file name="DebugController.php" hash="4d1219b72175e8b19d6fd6b3b59c7e8f"/><file name="ProductfeedController.php" hash="08e388ead90067721fb6718cac0779dd"/></dir><dir name="etc"><file name="adminhtml.xml" hash="be7e9a1dfc20ca73654c8e4ac557e4c9"/><file name="config.xml" hash="1e1a2cb4cdfd15bd916d981b39be058e"/></dir><dir name="lib"><file name="fb.php" hash="3cec6abe3ad61fba09ca9f510434ba56"/></dir></dir><file name="LICENSE" hash="4e3837b373e2371aeb3317bc8d245ad6"/><file name="PATENTS" hash="7eb20d51ce76c08c2e6c939674e75c93"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="facebookadstoolbox.xml" hash="cd8d60f293f5d1b5925efe01c7e48af7"/></dir><dir name="template"><dir name="facebookadstoolbox"><file name="addtocart.phtml" hash="c1a930b7c09e75f0d9746cba611e3c76"/><file name="head.phtml" hash="f70e26f4f4ee523a17a84ec577fdfde3"/><file name="initiate_checkout.phtml" hash="676e97512a1653bb3965c7171594db98"/><file name="purchase.phtml" hash="1a0383a64698a9d4c2131afc69762fc6"/><file name="search.phtml" hash="35d58ba1a53f73f715c81d2011a9a2d7"/><file name="viewcategory.phtml" hash="857d720f35a902f6ec86e34d5c88f203"/><file name="viewcontent.phtml" hash="55f054f759b06537376774ccbe6dddbe"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="facebookadstoolbox.xml" hash="5974bb612e16c7b7eff07ef06eddebda"/></dir><dir name="template"><dir name="facebookadstoolbox"><file name="dia_index.phtml" hash="839af71b1454571a41243e24cecc84ec"/><file name="feed_index.phtml" hash="157e56ef40e56378bcd07284162fb439"/><file name="pixel_index.phtml" hash="0b8e1171703bfb27ce5c768c6e79dc81"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="Facebook"><dir name="AdsToolbox"><dir><dir name="Adminhtml"><file name="dia.js" hash="9ac2e2030268bcdc33c430f21a6b357b"/><file name="feed.js" hash="134fbbb334e0d2422b77435dc105ebf5"/><dir name="lib"><file name="react-dom.min.js" hash="80dd76fff4872e658666dec43913360c"/><file name="react.min.js" hash="c3207f7bf39699d4279ba404ea55f163"/></dir><file name="pixel.js" hash="916afd85272d48e3b34c8f2a9f4db38a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Facebook_AdsToolbox.xml" hash="164bc795b6911c5b0a6ca357a56f38cc"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="Facebook"><dir name="AdsToolbox"><dir><dir name="css"><dir name="Adminhtml"><file name="dia.css" hash="201b2a78305d44d6eeebbf67231e7767"/><file name="feed.css" hash="2763caa9c8f3b9b21f85a59915d39157"/><file name="pixel.css" hash="8b143487fcc4a902c0e44de8e2af6eef"/></dir></dir><dir name="images"><dir name="Adminhtml"><file name="buttonbg.png" hash="09adbacda0d592a215277230c48df285"/><file name="fbicons.png" hash="8f1b559a279a3785f1b2492a79f518d8"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
| 71 |
<compatible/>
|
| 72 |
<dependencies><required><php><min>5.3.0</min><max>8.0.0</max></php></required></dependencies>
|
| 73 |
</package>
|
