Trigger a cron job on custom form submit in magento 2?Create a custom cron jobMagento 2 cron job for custom modulemagento 2 captcha not rendering if I override layout xmlMagento cron job disappearingMagento 2 : Problem while adding custom button order view page?Magento2 Cron job not runningTurning off custom cron jobMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsHow to create custom form in Magento 2.2.3
Adding a (stair/baby) gate without facing walls
Constant Scan spooling
Can I shorten this filter, that finds disk sizes over 100G?
What is the most 'environmentally friendly' way to learn to fly?
What is my clock telling me to do?
Should students have access to past exams or an exam bank?
"Fewer errors means better products" or "Fewer errors mean better products"?
When did J.K. Rowling decide to make Harry and Ginny a couple?
Can the additional attack from a Samurai's Rapid Strike have advantage?
Went to a big 4 but got fired for underperformance in a year recently - Now every one thinks I'm pro - How to balance expectations?
Does the problem of P vs NP come under the category of Operational Research?
Can birds evolve without trees?
A conjectural trigonometric identity
What is the significance of $(logname)?
How can flights operated by the same company have such different prices when marketed by another?
Why do MS SQL Server SEQUENCEs not have an ORDER parameter like Oracle?
Is this mechanically safe?
Why do we need a voltage divider when we get the same voltage at the output as the input?
PI 4 screen rotation from the terminal
Is it really a problem to declare that a visitor to the UK is my "girlfriend", in terms of her successfully getting a Standard Visitor visa?
Accurately recalling the key - can everyone do it?
Overful hbox (How to make the sentence in a table into 2 line?)
Python π = 1 + (1/2) + (1/3) + (1/4) - (1/5) + (1/6) + (1/7) + (1/8) + (1/9) - (1/10) ...1748 Euler
Why have both: BJT and FET transistors on IC output?
Trigger a cron job on custom form submit in magento 2?
Create a custom cron jobMagento 2 cron job for custom modulemagento 2 captcha not rendering if I override layout xmlMagento cron job disappearingMagento 2 : Problem while adding custom button order view page?Magento2 Cron job not runningTurning off custom cron jobMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsHow to create custom form in Magento 2.2.3
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Can I trigger a cron job at the time of form submission?
Actually, I need to download a product pdf when the form gets submitted.
But my pdf file has a large amount of data. So the site gets slow down.
So that I have moved on to cron.
I've successfully set a cron by referring this link.
Here is my code,
/etc/crontab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="test_cronjob" instance="TestCatalogPrintCronPdfdownload" method="execute">
<schedule>*/1 * * * *</schedule>
</job>
</group>
</config>
Cron/Pdfdownload.php
<?php
namespace TestCatalogPrintCron;
class Pdfdownload extends MagentoFrameworkAppActionAction
// doing my stuff on here
?>
And my form in the template file,
form.phtml
<form action="<?php echo $block->getFormAction() ?>" method="post" class="downloadPDF-account">
<label>Brochure Name: <input name="pdfname" type="text" /></label>
<input type="submit" value="Download" />
</form>
Actually now in this form action <?php echo $block->getFormAction() ?>'
, I given my controller path.
But I need to run my cron file (TestCatalogPrintCronPdfdownload
) on here.
If I'm doing the same stuff on my controller, means it takes too much time and slow down my site.
Please help me. I am a novice in magento and I am stuck at this point. Thank you in advance!!
magento2 cron
add a comment |
Can I trigger a cron job at the time of form submission?
Actually, I need to download a product pdf when the form gets submitted.
But my pdf file has a large amount of data. So the site gets slow down.
So that I have moved on to cron.
I've successfully set a cron by referring this link.
Here is my code,
/etc/crontab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="test_cronjob" instance="TestCatalogPrintCronPdfdownload" method="execute">
<schedule>*/1 * * * *</schedule>
</job>
</group>
</config>
Cron/Pdfdownload.php
<?php
namespace TestCatalogPrintCron;
class Pdfdownload extends MagentoFrameworkAppActionAction
// doing my stuff on here
?>
And my form in the template file,
form.phtml
<form action="<?php echo $block->getFormAction() ?>" method="post" class="downloadPDF-account">
<label>Brochure Name: <input name="pdfname" type="text" /></label>
<input type="submit" value="Download" />
</form>
Actually now in this form action <?php echo $block->getFormAction() ?>'
, I given my controller path.
But I need to run my cron file (TestCatalogPrintCronPdfdownload
) on here.
If I'm doing the same stuff on my controller, means it takes too much time and slow down my site.
Please help me. I am a novice in magento and I am stuck at this point. Thank you in advance!!
magento2 cron
add a comment |
Can I trigger a cron job at the time of form submission?
Actually, I need to download a product pdf when the form gets submitted.
But my pdf file has a large amount of data. So the site gets slow down.
So that I have moved on to cron.
I've successfully set a cron by referring this link.
Here is my code,
/etc/crontab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="test_cronjob" instance="TestCatalogPrintCronPdfdownload" method="execute">
<schedule>*/1 * * * *</schedule>
</job>
</group>
</config>
Cron/Pdfdownload.php
<?php
namespace TestCatalogPrintCron;
class Pdfdownload extends MagentoFrameworkAppActionAction
// doing my stuff on here
?>
And my form in the template file,
form.phtml
<form action="<?php echo $block->getFormAction() ?>" method="post" class="downloadPDF-account">
<label>Brochure Name: <input name="pdfname" type="text" /></label>
<input type="submit" value="Download" />
</form>
Actually now in this form action <?php echo $block->getFormAction() ?>'
, I given my controller path.
But I need to run my cron file (TestCatalogPrintCronPdfdownload
) on here.
If I'm doing the same stuff on my controller, means it takes too much time and slow down my site.
Please help me. I am a novice in magento and I am stuck at this point. Thank you in advance!!
magento2 cron
Can I trigger a cron job at the time of form submission?
Actually, I need to download a product pdf when the form gets submitted.
But my pdf file has a large amount of data. So the site gets slow down.
So that I have moved on to cron.
I've successfully set a cron by referring this link.
Here is my code,
/etc/crontab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="test_cronjob" instance="TestCatalogPrintCronPdfdownload" method="execute">
<schedule>*/1 * * * *</schedule>
</job>
</group>
</config>
Cron/Pdfdownload.php
<?php
namespace TestCatalogPrintCron;
class Pdfdownload extends MagentoFrameworkAppActionAction
// doing my stuff on here
?>
And my form in the template file,
form.phtml
<form action="<?php echo $block->getFormAction() ?>" method="post" class="downloadPDF-account">
<label>Brochure Name: <input name="pdfname" type="text" /></label>
<input type="submit" value="Download" />
</form>
Actually now in this form action <?php echo $block->getFormAction() ?>'
, I given my controller path.
But I need to run my cron file (TestCatalogPrintCronPdfdownload
) on here.
If I'm doing the same stuff on my controller, means it takes too much time and slow down my site.
Please help me. I am a novice in magento and I am stuck at this point. Thank you in advance!!
magento2 cron
magento2 cron
edited Jul 23 at 9:46
Faisal Sheikh
3511 silver badge11 bronze badges
3511 silver badge11 bronze badges
asked Jul 23 at 9:37
RamyaRamya
258 bronze badges
258 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
No, you cannot trigger a cron on any particular event. But you can do something like this in your case.
- Save the form in the database as submitted.
- Run a cron job maybe every minute. Check if there is any form submitted and email is not sent. Here generate the PDF and send it to
the customer via email as an attachment.
- Mark the record as email sent so that next time when cron is executed it will not resend the email.
Hope it finds helpful.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282975%2ftrigger-a-cron-job-on-custom-form-submit-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No, you cannot trigger a cron on any particular event. But you can do something like this in your case.
- Save the form in the database as submitted.
- Run a cron job maybe every minute. Check if there is any form submitted and email is not sent. Here generate the PDF and send it to
the customer via email as an attachment.
- Mark the record as email sent so that next time when cron is executed it will not resend the email.
Hope it finds helpful.
add a comment |
No, you cannot trigger a cron on any particular event. But you can do something like this in your case.
- Save the form in the database as submitted.
- Run a cron job maybe every minute. Check if there is any form submitted and email is not sent. Here generate the PDF and send it to
the customer via email as an attachment.
- Mark the record as email sent so that next time when cron is executed it will not resend the email.
Hope it finds helpful.
add a comment |
No, you cannot trigger a cron on any particular event. But you can do something like this in your case.
- Save the form in the database as submitted.
- Run a cron job maybe every minute. Check if there is any form submitted and email is not sent. Here generate the PDF and send it to
the customer via email as an attachment.
- Mark the record as email sent so that next time when cron is executed it will not resend the email.
Hope it finds helpful.
No, you cannot trigger a cron on any particular event. But you can do something like this in your case.
- Save the form in the database as submitted.
- Run a cron job maybe every minute. Check if there is any form submitted and email is not sent. Here generate the PDF and send it to
the customer via email as an attachment.
- Mark the record as email sent so that next time when cron is executed it will not resend the email.
Hope it finds helpful.
edited Jul 23 at 10:11
Raj Mohan R
1,7993 silver badges13 bronze badges
1,7993 silver badges13 bronze badges
answered Jul 23 at 9:54
Abdul PathanAbdul Pathan
8772 silver badges11 bronze badges
8772 silver badges11 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282975%2ftrigger-a-cron-job-on-custom-form-submit-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown