Skip to content

Commit

Permalink
Fixed various PHP8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jan 3, 2023
1 parent 211f9e9 commit 7f81e8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions system/modules/isotope/library/Isotope/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public static function findDefaultVariantOfProduct(IsotopeProduct $objProduct, a
}
}

$defaultId = $cache[$objProduct->getProductId()];
$defaultId = $cache[$objProduct->getProductId()] ?? null;

if ($defaultId < 1 || !\in_array($defaultId, $objProduct->getVariantIds())) {
return null;
Expand Down Expand Up @@ -622,7 +622,7 @@ protected static function buildFindQuery(array $arrOptions)
str_replace('-', '_', $GLOBALS['TL_LANGUAGE'])
);

$arrOptions['group'] = (null === $arrOptions['group'] ? '' : $arrOptions['group'].', ') . 'translation.id';
$arrOptions['group'] = (empty($arrOptions['group']) ? '' : $arrOptions['group'].', ') . 'translation.id';
}

if ($hasVariants) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,16 +724,16 @@ protected function generateProductOptionWidget($strField, &$arrVariantOptions, &

if ($objAttribute->isVariantOption()
|| ($objAttribute instanceof IsotopeAttributeWithOptions && $objAttribute->canHavePrices())
|| $arrData['attributes']['ajax_option']
|| $arrField['attributes']['ajax_option'] // see https://github.com/isotope/core/issues/2096
|| ($arrData['attributes']['ajax_option'] ?? null)
|| ($arrField['attributes']['ajax_option'] ?? null) // see https://github.com/isotope/core/issues/2096
) {
$arrAjaxOptions[] = $strField;
}

// Convert optgroups so they work with FormSelectMenu
// @deprecated Remove in Isotope 3.0, the options should match for frontend if attribute is customer defined
if (
\is_array($arrField['options'])
\is_array($arrField['options'] ?? null)
&& array_is_assoc($arrField['options'])
&& \count(
array_filter(
Expand Down Expand Up @@ -906,7 +906,7 @@ public function validateVariant($loadDefaultVariant = true)

if (Input::post('FORM_SUBMIT') == $this->getFormId() && \in_array(Input::post($attribute), $arrValues)) {
$arrOptions[$attribute] = Input::post($attribute);
} elseif (Input::post('FORM_SUBMIT') == '' && \in_array($arrDefaults[$attribute], $arrValues)) {
} elseif (Input::post('FORM_SUBMIT') == '' && isset($arrDefaults[$attribute]) && \in_array($arrDefaults[$attribute], $arrValues)) {
$arrOptions[$attribute] = $arrDefaults[$attribute];
} elseif (\count($arrValues) == 1) {
$arrOptions[$attribute] = $arrValues[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function getEnabledAttributesByPosition($varValue)

$arrAttributes = array_filter($arrAttributes, function ($a) use ($arrFields) {
return ($a['enabled']
&& \is_array($arrFields[$a['name']])
&& \is_array($arrFields[$a['name']] ?? null)
&& $arrFields[$a['name']]['attributes']['legend'] != ''
);
});
Expand Down

0 comments on commit 7f81e8b

Please sign in to comment.