|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
danielpro Smarty Rookie
Joined: 04 May 2016 Posts: 5
|
Posted: Thu May 05, 2016 8:36 pm Post subject: Field radio and effect selection in the summary |
|
|
Hello,
I have an online store based on the system Shoper built in Smarty template.
I would like to add in a basket option selection for the customer invoice or receipt.
The file index.tpl responsible for the place of choice for example: a method of payment or proof of purchase of put this code:
Code: |
{php}
function formularz() {
?>
<form action="step3.tpl" method="post">
<input type="radio" name="mailing" value="checked" />Receipt
<input type="radio" name ="mailing" value="checked=" />Invoice
</form>
<?php
}
{/php}
|
However, in summary, where I would like to found the information about the choice of the customer (receipt or invoice) put this code:
Code: |
{php}
if (isset($_POST["submit"])) {
<p>Invoice</p>
} else {
<p>Receipt</p>
}
}
{/php}
|
Please let me know if I'm doing it right and where possibly there is an error, because the transition from index.tpl to step3.tpl (the cart summary) page does not open, only a white background. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu May 05, 2016 10:53 pm Post subject: |
|
|
No, you're doing it wrong.
Never pur PHP code into templates. |
|
Back to top |
|
danielpro Smarty Rookie
Joined: 04 May 2016 Posts: 5
|
Posted: Fri May 06, 2016 7:23 am Post subject: |
|
|
In that case, can someone help me on how the code should look like? And you can not paste the template code php? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
danielpro Smarty Rookie
Joined: 04 May 2016 Posts: 5
|
Posted: Fri May 06, 2016 8:55 am Post subject: |
|
|
ok, now in the file index.tpl I have this code, which is responsible for the selection confirmation (invoice / receipt)
Code: |
{php}
function formularz() {
?>
<form action="step3.tpl" method="post">
<input type="radio" name="mailing1" value="1" />Paragon
<input type="radio" name="mailing2" value="0" />Faktura
</form>
<?php
}
{/php}
|
and in the summary file I have this code:
Code: |
{if ($smarty.post.mailing1)}
Paragon
{else}
Faktura
{/if}
|
Unfortunately, what options I choose not to have always the same result |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri May 06, 2016 2:27 pm Post subject: |
|
|
Read the topic again. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|