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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:

- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
nix_path: nixpkgs=channel:nixos-26.05

- name: Run Acceptance Tests PHP8.2
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-acceptance
Expand Down
3 changes: 3 additions & 0 deletions Classes/Domain/Repository/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function findAllAsArray(?Category $selectedCategory = null): array
$categories = [];
// Transform categories to array
foreach ($localCategories as $localCategory) {
if (($localCategory instanceof Category) === false) {
continue;
}
$newCategory = [
'uid' => $localCategory->getUid(),
'title' => $localCategory->getTitle(),
Expand Down
1 change: 1 addition & 0 deletions Classes/Hooks/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class DataHandler
{
public function __construct(private readonly CacheManager $cacheManager) {}

/**
* Flushes the cache if a news record was edited.
* This happens on two levels: by UID and by PID.
Expand Down
2 changes: 0 additions & 2 deletions Configuration/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

declare(strict_types=1);

namespace Extcode\CartProducts\Configuration;

use Extcode\CartProducts\Handler\WatchlistItemHandler;
use Extcode\CartProducts\Hooks\DataHandler;
use Extcode\CartProducts\Reaction\UpdateStockReaction;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Acceptance/Support/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Codappix\Typo3PhpDatasets\PhpDataSet;
use Codeception\Event\SuiteEvent;
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;
use Extcode\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;

final class Environment extends BackendEnvironment
{
Expand Down
3 changes: 0 additions & 3 deletions Tests/Acceptance/Support/Tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Codeception\Actor;
use Extcode\CartProducts\Tests\Acceptance\Support\_generated\TesterActions;
use TYPO3\TestingFramework\Core\Acceptance\Step\FrameSteps;

/**
* @method void wantToTest($text)
Expand All @@ -31,7 +30,5 @@ class Tester extends Actor
{
use TesterActions;

use FrameSteps;

protected int $retryNum = 2;
}
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@
"typo3/class-alias-loader": true,
"sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": true,
"phpstan/extension-installer": true
}
},
"lock": false,
"sort-packages": true
},
"extra": {
"typo3/cms": {
"extension-key": "cart_products",
"web-dir": ".build/public"
}
},
"version": "8.0.0",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"ext-pdo": "*",
"extcode/cart": "dev-main as 12.0.0",
"extcode/cart": "^12.0",
"typo3/cms-core": "^14.3",
"typo3/cms-extbase": "^14.3",
"typo3/cms-fluid": "^14.3"
Expand All @@ -64,6 +63,7 @@
"codeception/codeception": "^5.0",
"codeception/module-db": "^3.1",
"codeception/module-webdriver": "^4.0",
"extcode/testing-framework": "dev-main",
"friendsofphp/php-cs-fixer": "^3.64",
"helmich/typo3-typoscript-lint": "^3.1",
"phpstan/extension-installer": "^1.4",
Expand All @@ -76,7 +76,6 @@
"typo3/cms-fluid-styled-content": "^14.3",
"typo3/cms-install": "^14.3",
"typo3/cms-reactions": "^14.3",
"typo3/testing-framework": "^9.3",
"werkraummedia/watchlist": "^3.0",
"ssch/typo3-rector": "^3.11"
},
Expand Down
198 changes: 109 additions & 89 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,114 @@
use Extcode\CartProducts\Controller\ProductController;
use Extcode\CartProducts\Hooks\DataHandler;
use Extcode\CartProducts\Hooks\DatamapDataHandlerHook;
use TYPO3\CMS\Extbase\Domain\Model\Category;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

$_LLL_be = 'LLL:EXT:cart_products/Resources/Private/Language/locallang_be.xlf:';

// configure plugins
ExtensionUtility::configurePlugin(
'cart_products',
'ShowProduct',
[
ProductController::class => 'show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'ListProducts',
[
ProductController::class => 'list, show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'TeaserProducts',
[
ProductController::class => 'teaser, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'SingleProduct',
[
ProductController::class => 'show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'ProductPartial',
[
ProductController::class => 'showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

// Cart Hooks

// processDatamapClass Hook

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['cartproducts_allowed']
= DatamapDataHandlerHook::class;

// clearCachePostProc Hook

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['cartproducts_clearcache']
= DataHandler::class . '->clearCachePostProc';

// register "cartproducts:" namespace
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['cartproducts'][]
= 'Extcode\\CartProducts\\ViewHelpers';

// register listTemplateLayouts
$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_products']['templateLayouts']['list_products'][] = [$_LLL_be . 'flexforms_template.templateLayout.table', 'table'];
$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_products']['templateLayouts']['list_products'][] = [$_LLL_be . 'flexforms_template.templateLayout.grid', 'grid'];
$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_products']['templateLayouts']['teaser_products'][] = [$_LLL_be . 'flexforms_template.templateLayout.table', 'table'];
$GLOBALS['TYPO3_CONF_VARS']['EXT']['cart_products']['templateLayouts']['teaser_products'][] = [$_LLL_be . 'flexforms_template.templateLayout.grid', 'grid'];

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][Category::class] = [
'className' => \Extcode\CartProducts\Domain\Model\Category::class,
];
(static function (string $extKey): void {
$_LLL_be = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_be.xlf:';

if (is_array($GLOBALS['TYPO3_CONF_VARS'] ?? null) === false) {
throw new \Exception('$GLOBALS[\'TYPO3_CONF_VARS\'] is not an array', 1774601240);
}

ArrayUtility::mergeRecursiveWithOverrule(
$GLOBALS['TYPO3_CONF_VARS'],
[
'EXT' => [
$extKey => [
'templateLayouts' => [
'list_products' => [
'table' => [$_LLL_be . 'flexforms_template.templateLayout.table', 'table'],
'grid' => [$_LLL_be . 'flexforms_template.templateLayout.grid', 'grid'],
],
'teaser_products' => [
'table' => [$_LLL_be . 'flexforms_template.templateLayout.table', 'table'],
'grid' => [$_LLL_be . 'flexforms_template.templateLayout.grid', 'grid'],
],
],
],
],
'SC_OPTIONS' => [
't3lib/class.t3lib_tcemain.php' => [
'processDatamapClass' => [
'cartproducts_allowed' => DatamapDataHandlerHook::class,
],
'clearCachePostProc' => [
'cartproducts_clearcache' => DataHandler::class . '->clearCachePostProc',
],
],
],
'SYS' => [
'fluid' => [
'namespaces' => [
'cartproducts' => [
1 => 'Extcode\\CartProducts\\ViewHelpers',
],
],
],
],
]
);

// configure plugins
ExtensionUtility::configurePlugin(
'cart_products',
'ShowProduct',
[
ProductController::class => 'show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'ListProducts',
[
ProductController::class => 'list, show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'TeaserProducts',
[
ProductController::class => 'teaser, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'SingleProduct',
[
ProductController::class => 'show, showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

ExtensionUtility::configurePlugin(
'cart_products',
'ProductPartial',
[
ProductController::class => 'showForm',
],
[
ProductController::class => 'showForm',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);

})('cart_products');
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ let
in pkgs.mkShellNoCC {
name = "TYPO3 Extension extcode/cart-products";
buildInputs = [
pkgs.cacert
php
composer
projectInstall
Expand Down
Loading