Skip to content

Commit

Permalink
* bugfix: An error in a basket view did not get shown in the front end.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzholz committed Feb 14, 2020
1 parent a36d25f commit c745680
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 71 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2020-02-14 Franz Holzinger <[email protected]>
* bugfix: List view failed to show up because of uninitialized parser object.
* bugfix: An error in a basket view did not get shown in the front end.

2020-02-13 Franz Holzinger <[email protected]>
* bugfix for TYPO3 9.5: Do not use cObj->substituteMarkerArrayCached.
Expand Down
145 changes: 74 additions & 71 deletions control/class.tx_ttproducts_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public function &run ($pibaseClass, &$errorCode, $content = '', $bRunAjax = fals
}

switch($theCode) {
case 'CONTROL': // this will come with tt_products 3.1
case 'CONTROL': // this will be introduced with tt_products 3.1
continue 2;
break;
case 'SEARCH':
Expand Down Expand Up @@ -728,81 +728,84 @@ public function &run ($pibaseClass, &$errorCode, $content = '', $bRunAjax = fals
}
$contentTmp = 'error';
}
}

if ($errorCode[0]) {

$messageArr = array();
$i = 0;

$errorConf = array();
if (isset($this->conf['error.'])) {
$errorConf = $this->conf['error.'];
$urlObj = GeneralUtility::makeInstance('tx_ttproducts_url_view');
}

foreach ($errorCode as $key => $indice) {

if (
isset($errorConf[$indice . '.']) &&
isset($errorConf[$indice . '.']['redirect.']) &&
isset($errorConf[$indice . '.']['redirect.']['pid'])
) {
$pid = $errorConf[$indice . '.']['redirect.']['pid'];
$url = tx_div2007_alpha5::getTypoLink_URL_fh003(
$this->cObj,
$pid,
$urlObj->getLinkParams(
'product,article',
'',
true,
false
),
'',
array()
);

if ($url != '') {
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
}
}

if ($key == 0) {
$messageArr = explode('|', $message = $languageObj->getLabel($indice));
$contentTmp .= '<b>' . $languageObj->getLabel('tt_products') . ': ' . $messageArr[0] . '</b>';
} else {
$contentTmp .= '<b>' . $indice . $messageArr[$i] . '</b>';
}
$i++;
}
$errorCode = array();
}

if ($contentTmp == 'error') {
$fileName = 'EXT:'.TT_PRODUCTS_EXT.'/template/products_help.tmpl';
$helpTemplate = \JambageCom\Div2007\Utility\FrontendUtility::fileResource($fileName);
$content .=
\JambageCom\Div2007\Utility\ViewUtility::displayHelpPage(
$languageObj,
if ($errorCode[0]) {
$messageArr = array();
$i = 0;
$errorConf = array();
if (isset($this->conf['error.'])) {
$errorConf = $this->conf['error.'];
$urlObj = GeneralUtility::makeInstance('tx_ttproducts_url_view');
}

foreach ($errorCode as $key => $indice) {
if (
isset($errorConf[$indice . '.']) &&
isset($errorConf[$indice . '.']['redirect.']) &&
isset($errorConf[$indice . '.']['redirect.']['pid'])
) {
$pid = $errorConf[$indice . '.']['redirect.']['pid'];
$url = tx_div2007_alpha5::getTypoLink_URL_fh003(
$this->cObj,
$helpTemplate,
TT_PRODUCTS_EXT,
$errorMessage,
$theCode
$pid,
$urlObj->getLinkParams(
'product,article',
'',
true,
false
),
'',
array()
);
$bErrorFound = true;
unset($errorMessage);
}

if (intval($this->conf['wrapInCode'])) {
$content .= tx_div2007_alpha5::wrapContentCode_fh004($contentTmp,$theCode,$pibaseObj->prefixId,$this->cObj->data['uid']);
} else if (!$bErrorFound) {
$content .= $contentTmp;
}
}
if ($url != '') {
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
}
}

if ($key == 0) {
$messageArr = explode('|', $message = $languageObj->getLabel($indice));
$contentTmp .= '<b>' . $languageObj->getLabel('tt_products') . ': ' . $messageArr[0] . '</b>';
} else {
$contentTmp .= '<b>' . $indice . $messageArr[$i] . '</b>';
}
$i++;
}
$errorCode = array();
}

if ($errorMessage) {
$content = '<p><b>'.$errorMessage.'</b></p>';
}
if ($contentTmp == 'error') {
$fileName = 'EXT:' . TT_PRODUCTS_EXT . '/template/products_help.tmpl';
$helpTemplate = \JambageCom\Div2007\Utility\FrontendUtility::fileResource($fileName);
$content .=
\JambageCom\Div2007\Utility\ViewUtility::displayHelpPage(
$languageObj,
$this->cObj,
$helpTemplate,
TT_PRODUCTS_EXT,
$errorMessage,
$theCode
);
$bErrorFound = true;
unset($errorMessage);
}

if (intval($this->conf['wrapInCode'])) {
$content .=
tx_div2007_alpha5::wrapContentCode_fh004(
$contentTmp,
$theCode,
$pibaseObj->prefixId,
$this->cObj->data['uid']
);
} else if (!$bErrorFound) {
$content .= $contentTmp;
}

if ($errorMessage) {
$content = '<p><b>' . $errorMessage . '</b></p>';
}

if ($bRunAjax || !intval($this->conf['wrapInBaseClass'])) {
$rc = $content;
Expand Down

0 comments on commit c745680

Please sign in to comment.