cart
cart copied to clipboard
order number adjustments
Using EXT:cart 8.2.0 on TYPO3 10.4.31 on php 7.3 - According to https://docs.typo3.org/p/extcode/cart/8.2/en-us/AdministratorManual/Configuration/Order/NumberGeneratorConfiguration/Index.html the order number generation can be altered by an EXT:myextension/Configuration/Services.yaml file. But when pasting the example from the documentation into such a file, the whole system crashes with the exception:
(1/1) Symfony\Component\DependencyInjection\Exception\RuntimeException Invalid constructor argument 4 for service "Extcode\Cart\EventListener\Order\Create\OrderNumber": argument 2 must be defined before. Check your service definition.
Is the example wrong?
Also there are Typoscript constants for altering the order number generation, but they seem to have zero effect:
plugin.tx_cart {
orderNumber {
# cat=plugin.cart//0600; type=text; label= Prefix (prepend) for order confirmation number (e.g. DE).
prefix =
# cat=plugin.cart//0610; type=text; label= Suffix (append) for order confirmation number (e.g. O).
suffix =
# cat=plugin.cart//0620; type=int+; label= Offset for order confirmation number: The offset is added to the order confirmation number (e.g. if the offset is 999 the first order confirmation number will be 1000).
offset =
}
}
And what is actually the preferred way to alter the order number generation? The Services.yaml or the Typoscript constants?
Add the defaults-Section in your Services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
public: false
Extcode\Cart\EventListener\Order\Create\OrderNumber:
arguments:
$persistenceManager: '@TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager'
$options:
...
Thanks, now it works. This shoud better be updated in the documentation.
@mkrappitz Thanks for your feedback! It helped cleaning up the code, see #455.
I did not change the documentation because other extensions do it the same way (see e.g. https://docs.typo3.org/p/mask/mask/7.2/en-us/API/Loader.html?highlight=services#registering-loaders or https://docs.typo3.org/p/tomasnorre/crawler/11.0/en-us/Features/Events/Index.html?highlight=services)
I guess after the Services.yaml
now being around for a while developers got used to it which might have not been the case when you got the problem.
As the issue seems to be solved and the cleanup has a PR I will close this ticket.