Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

warning - Message

Important notice: This wiki is scheduled to be disabled in 2021. We are in the process of migrating content to the official documentation on docs.typo3.org. If you find information here that is missing from the official documentation, please feel free to get in contact with us on TYPO3 Slack (Channel: #t3docs-sig-wiki-migration).

Kb shop

From TYPO3Wiki
Jump to navigation Jump to search
Content Type: Extension Note for the extension kb shop (kb_shop).
It is a list of tips indented to supplement the documentation. For more information about the extension, see the extension home page


error - This page is a candidate for deletion

Reason: Information is very old and outdated

If you disagree with its deletion, please explain why at Category talk:Candidates for speedy deletion or improve the page and remove the {{delete}} tag.

This notice should remain for a minimum of 1 week after it was placed on the page. If a discussion is still ongoing, it should remain until a consensus is reached or a decision has been made about the removal, after which the page will either be deleted or this notice removed.

Remember to check what links here and the the page history before deleting.

Updating kb_shop to work with recent versions of TYPO3 (>=4.2.8)

There will be no more support for kb_shop, it is marked as deprecated and there will be no future development. However if you have an instance of kb_shop running somewhere, and wont rebuild your listing/shop system using "kb_kickstarter" / "kb_display" then you'll have problems when updating to recent TYPO3 versions (>=4.2.8)

If you have forms in your listing/shop pages You'll get errors like: "Fatal error: Call to a member function loadJavascriptLib() on a non-object in /srv/www/vhosts/intranet/typo3_src-4.2.8/t3lib/class.t3lib_tceforms.php on line 5460"

To fix this problem you'll have to make some changes to one file in the kb_shop extension. You can either try to apply the patch at the bottom of this wiki page, or update the Extension from TER (to 0.2.4) if you did not make any custom modifications to the shop extension (Make a backup of the current extension !!!)

Or you can do the changes manually: In the file "kb_shop/pi1/class.tx_kbshop_pi1.php" locate the method "renderForms":

function renderForms(&$markers, &$subparts, $content, $conf, $type = 'listing', $actUid = 0) {

At the very beginning you'll find the following code:

if (!$this->tceforms) {
   $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
   $this->tceforms->doSaveFieldName = 'doSave';
   $this->tceforms->backPath = 'typo3/';
   [...]
   $this->tceforms->enableTabMenu = 0;
   $this->tceforms->fieldTemplate = '###FIELD_ITEM###';
}

At the bottom of this first code block, add the two lines:

$GLOBALS['SOBE'] = new stdClass();
$GLOBALS['SOBE']->doc = t3lib_div::makeInstance('template');

It should look like the following piece of code afterwards:

if (!$this->tceforms) {
   $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
   $this->tceforms->doSaveFieldName = 'doSave';
   $this->tceforms->backPath = 'typo3/';
   [...]
   $this->tceforms->enableTabMenu = 0;
   $this->tceforms->fieldTemplate = '###FIELD_ITEM###';
   $GLOBALS['SOBE'] = new stdClass();
   $GLOBALS['SOBE']->doc = t3lib_div::makeInstance('template');
}

At the end of this method "renderForms" you'll find the following code:

$markers['###ACTION_submit###'] = $submitButton;
$markers['###HIDDENFIELDS###'] = $hidden.implode(chr(10), $this->tceforms->hiddenFieldAccum);

Simply add the below lines at the very bottom of this method, below the above mentioned lines:

$jsLibs = implode("\n", array_unique($GLOBALS['SOBE']->doc->JScodeLibArray));
$jsLibs = str_replace('src="contrib', 'src="typo3/contrib', $jsLibs);
$jsLibs = str_replace('src="../t3lib', 'src="t3lib', $jsLibs);	
$jsLibs = str_replace('src="md5.js', 'src="typo3/md5.js', $jsLibs);	
$this->preJS .= $jsLibs;

The whole thing at the bottom of the method should look like this afterwards:

$markers['###ACTION_submit###'] = $submitButton;
$markers['###HIDDENFIELDS###'] = $hidden.implode(chr(10), $this->tceforms->hiddenFieldAccum);
$jsLibs = implode("\n", array_unique($GLOBALS['SOBE']->doc->JScodeLibArray));
$jsLibs = str_replace('src="contrib', 'src="typo3/contrib', $jsLibs);
$jsLibs = str_replace('src="../t3lib', 'src="t3lib', $jsLibs);	
$jsLibs = str_replace('src="md5.js', 'src="typo3/md5.js', $jsLibs);	
$this->preJS .= $jsLibs;

At the very top of the file, where the "require_once" statements can be found, you'll have to include an additional file. Make the following change:

Before:

require_once(PATH_t3lib.'class.t3lib_beuserauth.php');
require_once(PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
require_once(t3lib_extMgm::extPath('lang').'lang.php');

Add the line:

require_once(PATH_typo3.'template.php');

So it look like the following code afterwards:

require_once(PATH_t3lib.'class.t3lib_beuserauth.php');
require_once(PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
require_once(t3lib_extMgm::extPath('lang').'lang.php');
require_once(PATH_typo3.'template.php');

Below is a .diff attached for the latest version of kb_shop from TER. The version in TER will also get updated. But if you are using a custom modified version of the listing/shopping system and you can not simply update the extension from TER, or apply the diff, you'll have to perform the above changes manually. Sorry.

File:Kb shop patch 4-2-8.txt

To apply the patch change into the directory of "kb_shop". There type:

patch -p 1 < Kb shop patch 4-2-8.txt

The patch should succeed without any missing hunks - else you'll have to apply above described changes manually. Good Luck!