Skip to content

Commit a1af1e2

Browse files
committed
Fix tests
1 parent 93e69ca commit a1af1e2

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

classes/Hook/HookActionCarrierProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function run()
4848

4949
// Load carrier name
5050
$carrierName = (string) $carrierRepository->findByCarrierId((int) $this->params['cart']->id_carrier);
51-
51+
5252
// Check if we actually have some name
5353
if (empty($carrierName)) {
5454
return;

classes/Hook/HookActionCartUpdateQuantityBefore.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ public function run()
5151
/*
5252
* The hook passes a legacy Product object to add, but no attribute information.
5353
* But thankfully, we can use id_product_attribute for this.
54-
*
54+
*
5555
* Other info is fairly standard:
56-
*
56+
*
5757
* Add to cart from product page + up from cart page
5858
* $this->params['operator'] == up
5959
* $this->params['quantity'] to determine quantity
60-
*
60+
*
6161
* Down from cart page
6262
* $this->params['operator'] == down
6363
* $this->params['quantity'] to determine quantity
6464
*/
6565

6666
// Format product and standardize ID
67-
$product = (array) $this->params['product'];
67+
$product = (array) $this->params['product'];
6868
$product['id_product'] = $product['id'];
6969

7070
// Get some basic information

classes/Hook/HookDisplayBackOfficeHeader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function processOrder($idOrder)
167167
[
168168
'currency' => $orderData['currency'],
169169
'payment_type' => $orderData['payment_type'],
170-
'items' => $orderProducts
170+
'items' => $orderProducts,
171171
]
172172
);
173173

classes/Hook/HookDisplayOrderConfirmation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function run()
8888
[
8989
'currency' => $orderData['currency'],
9090
'payment_type' => $orderData['payment_type'],
91-
'items' => $orderProducts
91+
'items' => $orderProducts,
9292
]
9393
);
9494

classes/Wrapper/ProductWrapper.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
namespace PrestaShop\Module\Ps_Googleanalytics\Wrapper;
2222

2323
use Configuration;
24-
use Db;
2524
use Context;
25+
use Db;
26+
use Manufacturer;
2627
use PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray;
2728
use PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray;
2829
use Product;
@@ -80,7 +81,7 @@ public function prepareItemListFromProductList($productList, $useProvidedQuantit
8081
* @return array Item data standardized for GA
8182
*/
8283
public function prepareItemFromProduct($product, $useProvidedQuantity = false)
83-
{
84+
{
8485
// Standardize product ID
8586
$product_id = 0;
8687
if (!empty($product['id_product'])) {
@@ -89,7 +90,7 @@ public function prepareItemFromProduct($product, $useProvidedQuantity = false)
8990
$product_id = $product['id'];
9091
}
9192

92-
// Standardize product price
93+
// Standardize product price, make sure this price went through calculation before you pass it here
9394
if (empty($product['price_amount'])) {
9495
$product['price_amount'] = $product['price'];
9596
}
@@ -107,7 +108,7 @@ public function prepareItemFromProduct($product, $useProvidedQuantity = false)
107108
if (!empty($product['manufacturer_name'])) {
108109
$item['item_brand'] = $product['manufacturer_name'];
109110
// If we don't, which can happen due to some bugs in getProductProperties, we will fetch it manually
110-
} else if (!empty($product['id_manufacturer'])) {
111+
} elseif (!empty($product['id_manufacturer'])) {
111112
$manufacturerName = Manufacturer::getNameById((int) $product['id_manufacturer']);
112113
if (!empty($manufacturerName)) {
113114
$item['item_brand'] = $manufacturerName;
@@ -124,7 +125,7 @@ public function prepareItemFromProduct($product, $useProvidedQuantity = false)
124125
$item['item_variant'] = $product['attributes_small'];
125126

126127
// If we don't, we will construct it in the same format
127-
} else if (!empty($product['id_product_attribute'])) {
128+
} elseif (!empty($product['id_product_attribute'])) {
128129
$variant = $this->getProductVariant((int) $product['id_product_attribute']);
129130
if (!empty($variant)) {
130131
$item['item_variant'] = $variant;

0 commit comments

Comments
 (0)