Skip to content

Commit

Permalink
remove jquery UI (#53)
Browse files Browse the repository at this point in the history
Removing jquery UI as it is not used on our functions
  • Loading branch information
kkong87 authored Jan 8, 2021
1 parent a30ad2d commit 4643451
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
23 changes: 12 additions & 11 deletions view/frontend/templates/pixel/code.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if (($action == 'catalogsearch_result_index' || $action == 'catalogsearch_advanc

$queryString = $this->getQueryString();
if($queryString) {

$pixelCode['method'] = 'trackProductsSearched';
$pixelCode['parameter'][0] = $queryString;
}
Expand All @@ -56,7 +56,7 @@ if (($action == 'catalog_category_view' || $action == 'catalogsearch_result_inde
if($productListData) {
$categoryId = isset($productListData['categoryId']) ? $productListData['categoryId'] : '';
$categoryName = isset($productListData['categoryName']) ? $productListData['categoryName'] : '';

$pixelCode['method'] = 'trackProductListViewed';
$pixelCode['parameter'][0] = array();
$pixelCode['parameter'][0]['listId'] = $categoryId;
Expand All @@ -69,7 +69,7 @@ if (($action == 'catalog_category_view' || $action == 'catalogsearch_result_inde
if ($action == 'catalog_product_view' && $block->isProductViewTrackPixelEnabled() ) {

$productData = $this->getProductData();

if($productData) {
$name = isset($productData['name']) ? $productData['name'] : '';
$productId = isset($productData['productId']) ? $productData['productId'] : '';
Expand All @@ -87,10 +87,11 @@ if ($action == 'catalog_product_view' && $block->isProductViewTrackPixelEnabled(
if($block->isAddCartTrackPixelEnabled()){
?>
<script>
require(['jquery', 'jquery-ui-modules/widget'],function($){

require([
'jquery'
],function($){
$('#product-addtocart-button').click(function () {

affirm.analytics.trackProductAdded({
name: '<?php echo $name ?>',
productId: '<?php echo $productId ?>',
Expand Down Expand Up @@ -121,16 +122,16 @@ if ($action == 'checkout_cart_index' && ($block->isAddCartTrackPixelEnabled()))
$currency = isset($cartProduct['currency']) ? $cartProduct['currency'] : '';
$price = isset($cartProduct['price']) ? $cartProduct['price'] : '';
$quantity = isset($cartProduct['quantity']) ? $cartProduct['quantity'] : '';

$product = array();
$product['name'] = $name;
$product['name'] = $name;
$product['productId'] = $productId;
$product['currency'] = $currency;
$product['price'] = $price;
$product['quantity'] = $quantity;

$products[] = $product;
}
}
$pixelCode['parameter'][0] = $products;
}
}
Expand All @@ -155,10 +156,10 @@ if (($action == 'checkout_index_index' || $action == 'onepagecheckout_index_inde
$pixelCode['parameter'][0]['total'] = $total;

$quoteProductsData = $this->getQuoteProductsData();

if($quoteProductsData) {
$products = array();

foreach ($quoteProductsData as $cartProduct) {

$name = isset($cartProduct['name']) ? $cartProduct['name'] : '';
Expand Down
9 changes: 4 additions & 5 deletions view/frontend/web/js/affirmPixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
/*jshint jquery:true*/
define([
"jquery",
"Astound_Affirm/js/model/aslowas",
"jquery-ui-modules/widget"
"Astound_Affirm/js/model/aslowas"
], function ($, aslowas) {
"use strict"

Expand All @@ -63,14 +62,14 @@ define([
affirm.analytics[options.method](options.parameter[0], options.parameter[1]);
});
}

if (typeof affirm == "undefined") {
$.when(aslowas.loadScript(self.options.pixelConfig)).done(function() {

sendTracker(self.options);
});
} else {

sendTracker(self.options);
}
}
Expand Down
3 changes: 1 addition & 2 deletions view/frontend/web/js/affirmWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
/*jshint jquery:true*/
define([
"jquery",
"Astound_Affirm/js/model/aslowas",
"jquery-ui-modules/widget"
"Astound_Affirm/js/model/aslowas"
], function ($, aslowas) {

"use strict"
Expand Down
3 changes: 1 addition & 2 deletions view/frontend/web/js/aslowasPDP.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/*jshint jquery:true*/
define(["jquery",
"mage/translate",
"Astound_Affirm/js/model/aslowas",
"jquery-ui-modules/widget"
"Astound_Affirm/js/model/aslowas"
], function ($, $t, aslowas) {

"use strict"
Expand Down
3 changes: 1 addition & 2 deletions view/frontend/web/js/aslowasPLP.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/*jshint jquery:true*/
define(["jquery",
"mage/translate",
"Astound_Affirm/js/model/aslowas",
"jquery-ui-modules/widget"
"Astound_Affirm/js/model/aslowas"
], function ($, $t, aslowas) {

"use strict"
Expand Down
3 changes: 1 addition & 2 deletions view/frontend/web/js/model/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
/*global alert*/
define([
"jquery",
"mage/translate",
"jquery-ui-modules/widget"
"mage/translate"
],
function ($, $t) {
'use strict';
Expand Down

0 comments on commit 4643451

Please sign in to comment.