Open mihob opened 1 day ago
Fixed for the next release. To get this early, run composer require verbb/events:"dev-craft-5 as 3.0.3"
.
Thanks!
@engram-design There is another problem, the link is generated incorrectly in the e-mail.
We have a link to download the tickets in our order confirmation.
If the email is sent in the frontend via the queue worker, the link is incorrect: https://example.test/de/index.php?p=actions/events/downloads/pdf&number=xxxx&site=german
It does not work because the language slug is added.
However, if I trigger the email in the CP or use the function in the frontend, the link is correct.
Update: If I trigger the email in the CP, it uses the CP base url, which is also incorrect. We use a subdomain for the control panel.
So whether the link has a site
param shouldn't matter, as the actionUrl looks correct to me. And it shouldn't matter whether it's a CP or Site URL, as this is an action URL, it should resolve to any Craft endpoint, and the p
param is going to trigger a controller action. I'll test on my end just in case.
Hmm, but I shouldn't use the CP base url when I send the e-mail from the CP. After all, the e-mail is sent to the customer, who has no access to the CP and should not know the URL.
It should always use a correct frontend url, or at least let me force this.
We generate the link using UrlHelper::actionUrl
which is going to resolve to an action endpoint to hit our controller. Typically, this looks like:
https://example.test/actions/events/downloads/pdf?number=xxxx
I can see from the format of your URL that you're not using pathInfo
so that's added as a query string.
From the looks of things if this is triggered in the context of a CP request, it's going to use the prependCpTrigger
and the CP base URL for that.
I'm not sure how you're triggering emails on the site and CP?
You can resend e-mails in the CP via an order:
I get three different links, depending on the “location” of the mailing:
Regularly via the frontend store (e-mail is sent via the queue, should be a console request): https://example.test/de/index.php/actions/events/downloads/pdf?number=xxx&site=german
Output in the frontend template (should be a site request): https://example.test/de/index.php/?p=actions/events/downloads/pdf?number=xxx&site=german
Sending the email again via the control panel (should be a cp request): https://cms.example.test/de/index.php?p=/actions/events/downloads/pdf?number=xxx&site=german
Is there a better way to generate a frontend url of the download?
Describe the bug
When I try to download a ticket in the frontend I get the following error:
The url for the download was generated with the following function:
craft.events.getOrderPdfUrl(order)
Steps to reproduce
Craft CMS version
5.5.2
Plugin version
3.0.3
Multi-site?
YES
Additional context
No response