Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Field radio and effect selection in the summary

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
danielpro
Smarty Rookie


Joined: 04 May 2016
Posts: 5

PostPosted: Thu May 05, 2016 8:36 pm    Post subject: Field radio and effect selection in the summary Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu May 05, 2016 10:53 pm    Post subject: Reply with quote

No, you're doing it wrong.
Never pur PHP code into templates.
Back to top
View user's profile Send private message
danielpro
Smarty Rookie


Joined: 04 May 2016
Posts: 5

PostPosted: Fri May 06, 2016 7:23 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 06, 2016 8:51 am    Post subject: Reply with quote

http://www.smarty.net/docs/en/plugins.tpl
Back to top
View user's profile Send private message
danielpro
Smarty Rookie


Joined: 04 May 2016
Posts: 5

PostPosted: Fri May 06, 2016 8:55 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 06, 2016 2:27 pm    Post subject: Reply with quote

Read the topic again.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP