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
35 changes: 35 additions & 0 deletions Classes/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Extcode\CartProducts\Domain\Repository\CategoryRepository;
use Extcode\CartProducts\Domain\Repository\Product\ProductRepository;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Cache\CacheDataCollector;
use TYPO3\CMS\Core\Cache\CacheTag;
use TYPO3\CMS\Core\Pagination\SlidingWindowPagination;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -52,6 +54,8 @@ protected function initializeAction(): void
);

$this->settings['addToCartByAjax'] = isset($this->settings['addToCartByAjax']) ? (int)$this->settings['addToCartByAjax'] : 0;

$this->addPageCacheTags(['tx_cartproducts']);
}

/**
Expand Down Expand Up @@ -168,6 +172,7 @@ public function listAction(int $currentPage = 1): ResponseInterface

$this->assignCurrencyTranslationData();

$this->addProductCacheTags($products);
return $this->htmlResponse();
}

Expand All @@ -183,6 +188,7 @@ public function showAction(?Product $product = null): ResponseInterface

$this->assignCurrencyTranslationData();

$this->addProductCacheTags($product instanceof Product ? [$product] : []);
return $this->htmlResponse();
}

Expand All @@ -196,6 +202,8 @@ public function showFormAction(?Product $product = null): ResponseInterface
$this->view->assign('cartSettings', $this->cartConfiguration['settings']);

$this->assignCurrencyTranslationData();

$this->addProductCacheTags($product instanceof Product ? [$product] : []);
return $this->htmlResponse();
}

Expand All @@ -208,6 +216,7 @@ public function teaserAction(): ResponseInterface

$this->assignCurrencyTranslationData();

$this->addProductCacheTags($products);
return $this->htmlResponse();
}

Expand Down Expand Up @@ -303,6 +312,32 @@ protected function assignCurrencyTranslationData()
$this->view->assign('currencyTranslationData', $currencyTranslationData);
}

/**
* @param iterable<Product> $products
*/
private function addProductCacheTags(iterable $products): void
{
$cacheTags = [];
foreach ($products as $product) {
$cacheTags[] = 'tx_cartproducts_product_' . $product->getUid();
}
$this->addPageCacheTags($cacheTags);
}

/**
* @param list<string> $cacheTags
*/
private function addPageCacheTags(array $cacheTags): void
{
$cacheDataCollector = $this->request->getAttribute('frontend.cache.collector');
if (!$cacheDataCollector instanceof CacheDataCollector) {
return;
}
foreach ($cacheTags as $cacheTag) {
$cacheDataCollector->addCacheTags(new CacheTag($cacheTag));
}
}

protected function restoreSession(): void
{
$cart = $this->sessionHandler->restoreCart($this->cartConfiguration['settings']['cart']['pid']);
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Services/EventListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
[
'event' => StockEvent::class,
'identifier' => 'cart-products--order--stock--flush-cache',
'after' => 'cart-books--order--stock--handle-stock',
'after' => 'cart-products--order--stock--handle-stock',
]
)
;
Expand Down
18 changes: 14 additions & 4 deletions Documentation/Changelog/7.2/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@
:local:
:depth: 1

7.2.0
-----

Features
^^^^^^^^
~~~~~~~~

* :doc:`#274 - Add WatchlistItemHandler <Feature-274-AddWatchlistItemHandler>`

Bugfixes
~~~~~~~~

* Fix label path of related products in the product TCA (`#264 <https://github.com/extcode/cart_products/pull/264>`__)
* Prepend extension name to upgrade wizard identifier (`#273 <https://github.com/extcode/cart_products/pull/273>`__)

.. toctree::
:maxdepth: 1
:titlesonly:
:hidden:
:glob:

Feature-*
*-*
45 changes: 45 additions & 0 deletions Documentation/Changelog/7.3/Index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.. include:: ../../Includes.rst.txt

7.3 Changes
===========

**Table of contents**

.. contents::
:local:
:depth: 1

7.3.3
-----

Tasks
~~~~~

* Check spelling with typos (`#311 <https://github.com/extcode/cart_products/pull/311>`__)
* List the changes of each release in the changelog

7.3.2
-----

Bugfixes
~~~~~~~~

* Use verdict() in IfBestSpecialPriceAvailableViewHelper for Fluid 4 (`#308 <https://github.com/extcode/cart_products/pull/308>`__)

7.3.1
-----

Bugfixes
~~~~~~~~

* Correct stock handling for backend variants (`#281 <https://github.com/extcode/cart_products/pull/281>`__)
* Add missing value for area divider item (`#286 <https://github.com/extcode/cart_products/pull/286>`__)
* Skip objects that are not a category in CategoryRepository (`#297 <https://github.com/extcode/cart_products/pull/297>`__)

7.3.0
-----

Compatibility
~~~~~~~~~~~~~

* PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 (was ~8.2.0 || ~8.3.0 || ~8.4.0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. include:: ../../Includes.rst.txt

=====================================================
Breaking: #287 - Price columns as fixed-point numbers
=====================================================

See `Pull Request 287 <https://github.com/extcode/cart_products/pull/287>`__

Description
===========

The price columns in the database changed from ``double(11,2)`` to
``decimal(17,5)`` to store prices without rounding errors and with more
than two decimal places:

* ``tx_cartproducts_domain_model_product_product``: ``price``,
``price_measure``, ``base_price_measure``, ``service_attribute1``,
``service_attribute2``, ``service_attribute3``
* ``tx_cartproducts_domain_model_product_specialprice``: ``price``
* ``tx_cartproducts_domain_model_product_quantitydiscount``: ``price``
* ``tx_cartproducts_domain_model_product_bevariant``: ``price``,
``price_measure``

Affected Installations
======================

All installations updating from cart_products 7.x.

Own queries or extensions which read these columns directly get the values
as numeric strings instead of floats from the database.

Migration
=========

Update the database schema, e.g. with the database analyzer in the install
tool or with ``vendor/bin/typo3 extension:setup``. The existing prices are
kept.

Cast the values of these columns in own queries, e.g. with ``(float)``.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. include:: ../../Includes.rst.txt

=============================================================
Breaking: #287 - Remove addCacheTags() from ProductController
=============================================================

See `Pull Request 287 <https://github.com/extcode/cart_products/pull/287>`__

Description
===========

The protected method
``\Extcode\CartProducts\Controller\ProductController::addCacheTags()`` was
removed, because it used ``$GLOBALS['TSFE']``, which no longer exists in
TYPO3 v14.

Affected Installations
======================

All installations with an own controller extending the ``ProductController``
which calls or overrides ``addCacheTags()``.

Migration
=========

Add cache tags with the cache data collector of the request:

.. code-block:: php

$this->request->getAttribute('frontend.cache.collector')->addCacheTags(
new \TYPO3\CMS\Core\Cache\CacheTag('tx_cartproducts_product_' . $product->getUid())
);
50 changes: 50 additions & 0 deletions Documentation/Changelog/8.0/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,53 @@
.. contents::
:local:
:depth: 1

8.0.2
-----

Bugfixes
~~~~~~~~

* Tag the page cache with the shown products again (`#313 <https://github.com/extcode/cart_products/pull/313>`__)
* Flush the cache after handling the stock of products (`#313 <https://github.com/extcode/cart_products/pull/313>`__)

Tasks
~~~~~

* Check spelling with typos (`#310 <https://github.com/extcode/cart_products/pull/310>`__)
* List the changes of each release in the changelog

8.0.1
-----

Tasks
~~~~~

* Run tests and linters via Build/Scripts (`#295 <https://github.com/extcode/cart_products/pull/295>`__, `#300 <https://github.com/extcode/cart_products/pull/300>`__)

8.0.0
-----

Compatibility
~~~~~~~~~~~~~

* TYPO3 ^14.3 (was ^13.4)
* extcode/cart ^12.0 (was ^11.0)

Breaking
~~~~~~~~

* :doc:`#287 - Price columns as fixed-point numbers <Breaking-287-PriceColumnsAsFixedPointNumbers>`
* :doc:`#287 - Remove addCacheTags() from ProductController <Breaking-287-RemoveAddCacheTagsFromProductController>`

Bugfixes
~~~~~~~~

* Correct stock handling for backend variants (`#281 <https://github.com/extcode/cart_products/pull/281>`__)
* Add missing value for area divider item (`#286 <https://github.com/extcode/cart_products/pull/286>`__)

.. toctree::
:hidden:
:glob:

*-*
1 change: 1 addition & 0 deletions Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ChangeLog
:titlesonly:

8.0/Index
7.3/Index
7.2/Index
7.1/Index
7.0/Index
Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
interlink-shortcode="extcode/cart-products"
/>
<project title="Cart Products"
release="8.0.1"
release="8.0.2"
version="8.0"
copyright="2018 - 2026"
/>
Expand Down
Loading