Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling of deactivated products #186

Open
paul-keller opened this issue Mar 28, 2018 · 2 comments
Open

Error handling of deactivated products #186

paul-keller opened this issue Mar 28, 2018 · 2 comments
Assignees

Comments

@paul-keller
Copy link

Trying to call a deactivated product in the frontend results in an TYPO3 Error. This should show a message like "product not found" or then be a redirect to the configuered error404 page.

Try: https://www.weingut-isele.de/weine/detail/weinsortiment/testwein/
If a link to a product is communicated in a newsletter for example and suddenly the product is out of stock and deactivated for that reason, the user gets an TYPO3 Error...

@extcode extcode self-assigned this May 8, 2018
@rintisch
Copy link
Collaborator

rintisch commented Jun 3, 2024

TYPO3 v12 has a solution for this as far as I understand it: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Routing/AdvancedRoutingConfiguration.html#aspect-fallback-value-handling

I will have a look at it later and add possible solutions to the docs.

@rintisch rintisch self-assigned this Jun 3, 2024
@rintisch
Copy link
Collaborator

rintisch commented Jun 3, 2024

@paul-keller
The issue itself is not really related to EXT:cart but to of the used product extension.

I realized that the problem is already solved in EXT:cart_products 5.x-dev:

    public function showAction(Product $product = null): ResponseInterface
    {
        if (!$product) {
            $product = $this->getProduct();
        }
        if (!$product) {
            return new ForwardResponse('list');
        }

(see source)

So if the product does no longer exists the list view will be used. This is not optimal as the URL stays the same. But you can of course adapt this behaviour in your own extension with e.g.

return $this->redirect(actionName: 'list', pageUid: <the PID of the fitting list view>);

To implement this in EXT:cart_products would also be possible if we would add a listViewPID to the flexform of the show plugin. If it's set we could use this variable to redirect to the list properly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants