2222
2323use Configuration ;
2424use Context ;
25- use Product ;
26- use Tools ;
27- use Shop ;
2825use PrestaShop \PrestaShop \Adapter \Presenter \Product \ProductLazyArray ;
2926use PrestaShop \PrestaShop \Adapter \Presenter \Product \ProductListingLazyArray ;
27+ use Product ;
28+ use Shop ;
29+ use Tools ;
3030
3131class ProductWrapper
3232{
@@ -83,9 +83,9 @@ public function wrapProduct($product, $extras = [], $index = 0)
8383
8484 /**
8585 * Takes provided list of product (lazy) arrays and converts it to a format that GA4 requires.
86- *
86+ *
8787 * @param array $productList
88- *
88+ *
8989 * @return array Item data standardized for GA
9090 */
9191 public function prepareItemListFromProductList ($ productList , $ isCartList = false )
@@ -103,7 +103,7 @@ public function prepareItemListFromProductList($productList, $isCartList = false
103103 $ product = $ this ->prepareItemFromProduct ($ product , $ isCartList );
104104 $ product ['index ' ] = $ counter ;
105105 $ items [] = $ product ;
106- $ counter ++ ;
106+ ++ $ counter ;
107107 }
108108
109109 return $ items ;
@@ -115,9 +115,9 @@ public function prepareItemListFromProductList($productList, $isCartList = false
115115 * - ProductListingLazyArray from presented listings
116116 * - ProductListingLazyArray from presented cart
117117 * - Raw $cart->getProducts()
118- *
118+ *
119119 * @param ProductLazyArray|ProductListingLazyArray|array $product
120- *
120+ *
121121 * @return array Item data standardized for GA
122122 */
123123 public function prepareItemFromProduct ($ product , $ isCartList = false )
@@ -139,7 +139,7 @@ public function prepareItemFromProduct($product, $isCartList = false)
139139 'affiliation ' => Shop::isFeatureActive () ? $ this ->context ->shop ->name : Configuration::get ('PS_SHOP_NAME ' ),
140140 'index ' => 0 ,
141141 'price ' => $ product ['price_amount ' ],
142- 'quantity ' => 1
142+ 'quantity ' => 1 ,
143143 ];
144144
145145 // Add manufacturer info if we have it
@@ -183,7 +183,7 @@ public function prepareItemFromProduct($product, $isCartList = false)
183183 $ counter = 1 ;
184184 foreach ($ productCategories as $ productCategory ) {
185185 $ item [$ counter == 1 ? 'item_category ' : 'item_category ' . $ counter ] = $ productCategory ['name ' ];
186- $ counter ++ ;
186+ ++ $ counter ;
187187 }
188188
189189 return $ item ;
0 commit comments