1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Checkout - step 3 alteration

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Aug 12, 2015.

  1. jason1971 Customer

    Hi Guys,

    I would like to amend part of the checkout process in step3.tpl

    Currently all the extra field options are lined up one after another going down (which makes completing the form seem very long), is there a way I could manually add each individual extra field? So that I can place them in wherever I want also so I can add some 'user tips' for completing each individual field.

    Currently the extra fields are displayed using
    {modulehook function="tpl_addlisting"}
    {$extra_listing_fields}

    If this is not possible or way to complex, is there a way to have the extra fields lined up next to each other in two's going down ?

    Cheers Jason
  2. Mike-N-Tosh Owner

    Hi Jason,

    The short simple answer is that it is complex. Because of the feature that we allow extra fields to be assigned individually to a category(ies), the php code that gets extra fields, has to determine which extra fields are available for the individual listing category. In other words a seller placing a listing in category 1 may have different extra fields than a listing in category 2.

    However, if your extra fields are set so that ALL extra fields that you created are available in ALL categories, then {$extra_listing_fields} code will always be the same. If this is the way that you have it set up, then you could simply look at the source code of the page after it is rendered in your BROWSER and simply copy the portion of html code for the extra fields section and manually add it to your template file however you wish as long as you, of course follow the html form syntax rules keeping all of the extra field elements within the form. (replacing the {$extra_listing_fields}).

    Bear in mind that {modulehook function="tpl_addlisting"} is a module hook and has nothing to do with the extra fields unless, of course you actually have a module installed that is using that function and is manipulating the extra fields.
  3. freeze2 Super Moderator

    I was just looking at one of my installations and I believe you can accomplish this by using some CSS.
  4. jason1971 Customer

    Cheers guys for the help.

    Mike I used the simple option as you suggested (should have thought of it myself :oops:) to copy the source code and place it where I like which has worked a treat.

    As it now looks so good I would like to do the same with the usermodifylisting.tpl file, however, I know this is not simply a case of copying the source code.
    The only 3 types of fields I use with the extra fields are a single text line, multi text line and dropdown field.

    For the single line and multi text lines I assume it would be along these lines..

    <input name="opt5" id="opt5" type="text" value="{get_extra_field id=$entry.id fid=5}" size="{$smarty.const.FIELD_SIZE}"/>

    <textarea name="opt5" id="opt5" cols="75" rows="23">{get_extra_field id=$entry.id fid=5}</textarea>

    But it is the dropdown options I am unsure about....

    * Sea views:<br />
    <select id="opt7" name="opt7">
    <option value="No" {if $opt7 =="No"} Selected{/if}>No</option>

    <option value="Yes"{if $opt7 =="Yes"} Selected{/if}>Yes</option>






    I know this is not correct, but I don't know how to setup the correct format for the {if} statement part.




    Any ideas please

    Many thanks for your time
    Jason.
  5. Mike-N-Tosh Owner

    Jason,

    This is entirely different, due to the fact that the fields have already been assigned a value. However, in your particular case having narrowed this down to only needing to do this with known field id's and only in one extra field type (drop down/select menu), you may be able to simply capture the value to do your comparison.

    Use the same code for the extra fields forms as you did in the step3 checkout, but use the smarty plugin to get the individual values as you've already shown in your post above for the values. Now for your drop down menus...
    I haven't tried/tested this, but smarty has a capture function available and it may work here. Essentially, you tell smarty to capture something and assign it to a name instead of displaying it.
    Try it like this:
    Code:
    {capture name="opt7"}
      {get_extra_field id=$entry.id fid=7}
    {/capture}
    <option value="THIS COMES FROM YOUR step3 CODE" {if $smarty.capture.opt7 == $smarty.post.opt7} SELECTED{/if}>THIS COMES FROM YOUR step3 CODE</option>
    
  6. jason1971 Customer

    Hi Mike,

    For some strange reason when I set up both a single text line and multi text line using {get_extra_field id=$entry.id fid=18} the value does not show up, however, when I use {get_extra_field id=$id fid=18} without the entry part the value does show up.

    I have tested both options with the code you gave me but neither of them seem to work.

    This is how have got it set up

    {capture name="opt7"}
    {get_extra_field id=$entry.id fid=7}
    I have tried changing this to {get_extra_field id=$id fid=7} but still no joy, I have also even tried it using {get_extra_field id=$view fid=7} :mad:
    {/capture}
    <select id="opt7" name="opt7">
    <option value="No" {if $smarty.capture.opt7 == $smarty.post.opt7} SELECTED{/if}>No</option>
    <option value="Yes" {if $smarty.capture.opt7 == $smarty.post.opt7} SELECTED{/if}>Yes</option>
    </select>

    Any ideas on what the issue could be ???????

    Cheers Jason
  7. Mike-N-Tosh Owner

    Jason,

    The listing in that template is $id. As you know, to find out what variables are available, you should use the Smarty {debug}. So, with that said, the plugin should be id=$id.

    I would suggest that you see if indeed that both the variables are being shown/available in the template. In other words, try just showing each variable separately to see if they are actually showing in the template.

    Try: {get_extra_field id=$id fid=7} {$smarty.post.opt7} just in the template by themselves to see if they show. Obviously, if they both don't show, then the comparison isn't going to work.

    If it doesn't show, then I'm afraid it's back to the much more complex solutions that I mentioned earlier in this thread.
  8. jason1971 Customer

    Hi Mike,
    I already tried the debug and found these two which were related to what I need
    {$extra_listing_fields} "<p><label for="opt14">* Property post..."
    {$extra_listing_fields_validation} "if (frm.opt14.value == "") { alert("P..."


    This option {get_extra_field id=$id fid=7} works and shows up as it should.
    This option {$smarty.post.opt7} does not show anything.

    Does this mean game over Mike ?
  9. Mike-N-Tosh Owner

    Try this instead, when using the code from step3 (so you already have all of the options including the values):
    {if $smarty.capture.opt7 == "XXXX"} SELECTED{/if} <-- Where XXXX = the name of the value for the option.
    Code:
    <option value="opt1value" {if $smarty.capture.opt7 == "opt1value"} SELECTED{/if} />opt1value</option>
  10. jason1971 Customer

    Still no joy Mike :(
  11. Mike-N-Tosh Owner

    OK, Jason,

    I think I figured out why it wasn't working. Apparently when you "capture" it for some stupid reason, adds a space before and after the text string!

    So, simply try adding the smarty "strip" modifier to replace the spaces with nothing like this:
    {if $smarty.capture.opt7|strip:'' == "XXXX"} SELECTED{/if} <-- Where XXXX = the name of the value for the option.

    This worked for me.
  12. jason1971 Customer

    Mike

    You're a genius thank you soooooooooooooooooooooooooooooooooooo much, worked like a charm.

    I am truly grateful Jason;)
  13. Mike-N-Tosh Owner

    Glad we were able to get that sorted for you.

Share This Page