Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Classes/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ protected function createDemandObjectFromSettings(array $settings): ProductDeman
}
if ($settings['orderBy']) {
if (
!isset($settings['orderDirection']) &&
$settings['orderDirection'] !== 'DESC'
!isset($settings['orderDirection'])
&& $settings['orderDirection'] !== 'DESC'
) {
$settings['orderDirection'] = 'ASC';
}
Expand Down
58 changes: 29 additions & 29 deletions Classes/Domain/Model/Product/BeVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function getPriceCalculated(): float
};

if (
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount']) &&
is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'] as $funcRef) {
if ($funcRef) {
Expand Down Expand Up @@ -144,8 +144,8 @@ public function getBestPriceCalculated($frontendUserGroupIds = []): float
};

if (
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount']) &&
is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'] as $funcRef) {
if ($funcRef) {
Expand Down Expand Up @@ -226,8 +226,8 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): ?SpecialP

foreach ($this->getSpecialPrices() as $specialPrice) {
if ($bestSpecialPrice === null) {
if (!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice;
}
Expand All @@ -236,16 +236,16 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): ?SpecialP

if (
(
($specialPrice->getPrice() < $bestSpecialPrice->getPrice()) &&
in_array($this->priceCalcMethod, [0, 1, 4, 5])
) ||
(
($specialPrice->getPrice() > $bestSpecialPrice->getPrice()) &&
in_array($this->priceCalcMethod, [2, 3])
($specialPrice->getPrice() < $bestSpecialPrice->getPrice())
&& in_array($this->priceCalcMethod, [0, 1, 4, 5])
)
|| (
($specialPrice->getPrice() > $bestSpecialPrice->getPrice())
&& in_array($this->priceCalcMethod, [2, 3])
)
) {
if (!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice;
}
Expand All @@ -263,12 +263,12 @@ public function getBestPrice(array $frontendUserGroupIds = []): float
if ($bestSpecialPrice) {
if (
(
($bestSpecialPrice->getPrice() < $bestPrice) &&
in_array($this->priceCalcMethod, [0, 1, 4, 5])
) ||
(
($bestSpecialPrice->getPrice() > $bestPrice) &&
in_array($this->priceCalcMethod, [2, 3])
($bestSpecialPrice->getPrice() < $bestPrice)
&& in_array($this->priceCalcMethod, [0, 1, 4, 5])
)
|| (
($bestSpecialPrice->getPrice() > $bestPrice)
&& in_array($this->priceCalcMethod, [2, 3])
)
) {
$bestPrice = $bestSpecialPrice->getPrice();
Expand Down Expand Up @@ -301,9 +301,9 @@ public function getBasePrice(): ?float
{
//TODO: respects different measuring units between variant and product
if (
!$this->product ||
!$this->product->getIsMeasureUnitCompatibility() ||
!$this->getPriceMeasure() > 0
!$this->product
|| !$this->product->getIsMeasureUnitCompatibility()
|| !$this->getPriceMeasure() > 0
) {
return null;
}
Expand Down Expand Up @@ -424,20 +424,20 @@ public function getTitle(): string
$titleArray = [];

if ($this->getProduct()->getBeVariantAttribute1()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute1()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute1()->getTitle()
. ' '
. $this->getBeVariantAttributeOption1()->getTitle();
}
if ($this->getProduct()->getBeVariantAttribute2()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute2()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute2()->getTitle()
. ' '
. $this->getBeVariantAttributeOption2()->getTitle();
}
if ($this->getProduct()->getBeVariantAttribute3()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute3()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute3()->getTitle()
. ' '
. $this->getBeVariantAttributeOption3()->getTitle();
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Model/Product/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): float
foreach ($this->specialPrices as $specialPrice) {
if ($specialPrice->getPrice() < $bestSpecialPrice) {
if (
!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice->getPrice();
}
Expand Down Expand Up @@ -238,8 +238,8 @@ public function getQuantityDiscountArray(array $frontendUserGroupIds = []): arra

if ($this->getQuantityDiscounts()) {
foreach ($this->getQuantityDiscounts() as $quantityDiscount) {
if (!$quantityDiscount->getFrontendUserGroup() ||
in_array($quantityDiscount->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$quantityDiscount->getFrontendUserGroup()
|| in_array($quantityDiscount->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$quantityDiscountArray[] = $quantityDiscount->toArray();
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Repository/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function findAllAsArray(?Category $selectedCategory = null): array
$newCategory = [
'uid' => $localCategory->getUid(),
'title' => $localCategory->getTitle(),
'parent' =>
($localCategory->getParent() ? $localCategory->getParent()->getUid() : null),
'parent'
=> ($localCategory->getParent() ? $localCategory->getParent()->getUid() : null),
'subcategories' => null,
'isSelected' => ($selectedCategory === $localCategory),
];
Expand All @@ -47,8 +47,8 @@ public function findSubcategoriesRecursiveAsArray(?Category $parentCategory = nu
$localCategories = $this->findAllAsArray();
foreach ($localCategories as $category) {
if (
!$parentCategory ||
$category['uid'] === $parentCategory->getUid()
!$parentCategory
|| $category['uid'] === $parentCategory->getUid()
) {
$this->getSubcategoriesIds(
$localCategories,
Expand Down Expand Up @@ -83,8 +83,8 @@ protected function buildSubcategories(array $categoriesArray, array $parentCateg
foreach ($categoriesArray as $category) {
if ($category['parent'] === $parentCategory['uid']) {
$newCategory = $category;
$newCategory['subcategories'] =
$this->buildSubcategories($categoriesArray, $category);
$newCategory['subcategories']
= $this->buildSubcategories($categoriesArray, $category);
$categories[] = $newCategory;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Repository/Product/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ protected function createOrderingsFromDemand(ProductDemand $demand): array
}

foreach ($orderList as $orderItem) {
[$orderField, $orderDirection] =
array_pad(
[$orderField, $orderDirection]
= array_pad(
GeneralUtility::trimExplode(' ', $orderItem, true),
2,
'asc'
);
if (
$orderDirection &&
strtolower((string)$orderDirection) === 'desc'
$orderDirection
&& strtolower((string)$orderDirection) === 'desc'
) {
$orderings[$orderField] = QueryInterface::ORDER_DESCENDING;
} else {
Expand Down
6 changes: 3 additions & 3 deletions Classes/EventListener/CheckProductAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public function checkStockForBeVariant(CartProductBeVariant $cartProductBeVarian
}

if (
$mode === 'add' &&
$cart->getProductById($cartProduct->getId()) &&
$cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())
$mode === 'add'
&& $cart->getProductById($cartProduct->getId())
&& $cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())
) {
$quantityInCart += $cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())->getQuantity();
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/EventListener/Create/CheckRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __invoke(RetrieveProductsFromRequestEvent $event): void
$request = $event->getRequest();

if (
!$request->hasArgument('product') ||
!(int)$request->getArgument('product')
!$request->hasArgument('product')
|| !(int)$request->getArgument('product')
) {
$event->addError(
new FlashMessage(
Expand All @@ -39,8 +39,8 @@ public function __invoke(RetrieveProductsFromRequestEvent $event): void
}

if (
!$request->hasArgument('quantity') ||
$request->getArgument('quantity') < 0
!$request->hasArgument('quantity')
|| $request->getArgument('quantity') < 0
) {
$event->addError(
new FlashMessage(
Expand Down
8 changes: 4 additions & 4 deletions Classes/Hooks/DatamapDataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ protected function isAllowedTargetPage($listType, $doktype)
($doktype === 183) && (
$listType === 'cartproducts_singleproduct'
)
) ||
(
)
|| (
($doktype !== 183) && (
$listType === 'cartproducts_products' ||
$listType === 'cartproducts_slots'
$listType === 'cartproducts_products'
|| $listType === 'cartproducts_slots'
)
)
) {
Expand Down
4 changes: 2 additions & 2 deletions Classes/Updates/SwitchableControllerActionsPluginUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ protected function getMigrationRecords(): array
protected function getTargetListType(string $sourceListType, string $switchableControllerActions): string
{
foreach (self::MIGRATION_SETTINGS as $setting) {
if ($setting['sourceListType'] === $sourceListType &&
$setting['switchableControllerActions'] === $switchableControllerActions
if ($setting['sourceListType'] === $sourceListType
&& $setting['switchableControllerActions'] === $switchableControllerActions
) {
return $setting['targetListType'];
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/CanonicalTagViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function render(): string
}

$arguments = [
['tx_cartproducts_product' =>
[
['tx_cartproducts_product'
=> [
'controller' => 'Product',
'product' => $product->getUid(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

// prepend category restriction at the beginning of foreign_table_where
if (!empty($categoryRestriction)) {
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'] = $categoryRestriction .
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'] = $categoryRestriction .
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'] = $categoryRestriction
. $GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'] = $categoryRestriction
. $GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@
['label' => '', 'value' => 0],
],
'foreign_table' => 'tx_cartproducts_domain_model_product_bevariantattributeoption',
'foreign_table_where' =>
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###' .
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute1 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) ' .
' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'foreign_table_where'
=> ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###'
. ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute1 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) '
. ' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'minitems' => 0,
'maxitems' => 1,
'eval' => 'int',
Expand All @@ -161,10 +161,10 @@
['label' => '', 'value' => 0],
],
'foreign_table' => 'tx_cartproducts_domain_model_product_bevariantattributeoption',
'foreign_table_where' =>
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###' .
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute2 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) ' .
' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'foreign_table_where'
=> ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###'
. ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute2 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) '
. ' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'minitems' => 0,
'maxitems' => 1,
'eval' => 'int',
Expand All @@ -182,10 +182,10 @@
['label' => '', 'value' => 0],
],
'foreign_table' => 'tx_cartproducts_domain_model_product_bevariantattributeoption',
'foreign_table_where' =>
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###' .
' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute3 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) ' .
' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'foreign_table_where'
=> ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.pid=###CURRENT_PID###'
. ' AND tx_cartproducts_domain_model_product_bevariantattributeoption.be_variant_attribute IN ((SELECT tx_cartproducts_domain_model_product_product.be_variant_attribute3 FROM tx_cartproducts_domain_model_product_product WHERE tx_cartproducts_domain_model_product_product.uid=###REC_FIELD_product###)) '
. ' ORDER BY tx_cartproducts_domain_model_product_bevariantattributeoption.title ',
'minitems' => 0,
'maxitems' => 1,
'eval' => 'int',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: ../../Includes.txt
.. include:: ../../Includes.rst.txt

========================================
Breaking: #145 - Display available stock
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/Model/CategoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getCartProductShowPidReturnsShowPid(): void
*/
protected function getAccessibleMock(
string $originalClassName,
array|null $methods = [],
?array $methods = [],
array $arguments = [],
string $mockClassName = '',
bool $callOriginalConstructor = true,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"typo3/cms-fluid": "^13.4"
},
"require-dev": {
"codappix/typo3-php-datasets": "^1.5",
"codappix/typo3-php-datasets": "^2.0",
"codeception/codeception": "^5.0",
"codeception/module-db": "^3.1",
"codeception/module-webdriver": "^4.0",
Expand Down