Jump to content

Modifying the Six template to display the configurable options even if the "Hidden" checkbox is selected


kea

Recommended Posts

Hi,

I have created configurable options for the product.
I have the "Hidden"
checkbox selected because I do not want to show them in the order form. Everything works great here. The problem is that they have also been hidden in the client's arena.

I want to edit the template to show the upgrade configurable options in the client arena, even if the "Hidden" checkbox is selected.

I found the code in the template (six/upgrade.tpl) responsible for displaying these options:

 

{elseif $type eq "configoptions"}

        <p>{$LANG.upgradechooseconfigoptions}</p>

        {if $errormessage}
            {include file="$template/includes/alert.tpl" type="error" errorshtml=$errormessage}
        {/if}

        <form method="post" action="{$smarty.server.PHP_SELF}">
            <input type="hidden" name="step" value="2" />
            <input type="hidden" name="type" value="{$type}" />
            <input type="hidden" name="id" value="{$id}" />

            <table class="table table-striped">
                <thead>
                    <tr>
                        <th></th>
                        <th>{$LANG.upgradecurrentconfig}</th>
                        <th></th>
                        <th>{$LANG.upgradenewconfig}</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach key=num item=configoption from=$configoptions}
                        <tr>
                            <td>{$configoption.optionname}</td>
                            <td>
                                {if $configoption.optiontype eq 1 || $configoption.optiontype eq 2}
                                    {$configoption.selectedname}
                                {elseif $configoption.optiontype eq 3}
                                    {if $configoption.selectedqty}{$LANG.yes}{else}{$LANG.no}{/if}
                                {elseif $configoption.optiontype eq 4}
                                    {$configoption.selectedqty} x {$configoption.options.0.name}
                                {/if}
                            </td>
                            <td>=></td>
                            <td>
                                {if $configoption.optiontype eq 1 || $configoption.optiontype eq 2}
                                    <select name="configoption[{$configoption.id}]">
                                        {foreach key=num item=option from=$configoption.options}
                                            {if $option.selected}<option value="{$option.id}" selected>{$LANG.upgradenochange}</option>{else}<option value="{$option.id}">{$option.nameonly} {$option.price}{/if}</option>
                                        {/foreach}
                                    </select>
                                {elseif $configoption.optiontype eq 3}
                                    <input type="checkbox" name="configoption[{$configoption.id}]" value="1"{if $configoption.selectedqty} checked{/if}> {$configoption.options.0.name}
                                {elseif $configoption.optiontype eq 4}
                                    <input type="text" name="configoption[{$configoption.id}]" value="{$configoption.selectedqty}" size="5"> x {$configoption.options.0.name}
                                {/if}
                            </td>
                        </tr>
                    {/foreach}
                </tbody>
            </table>

            <p class="text-center">
                <input type="submit" value="{$LANG.ordercontinuebutton}" class="btn btn-primary" />
            </p>

        </form>
    {/if}


Can anyone help me to modify this code, to display the configurable options even if the "Hidden" checkbox is selected?

Link to comment
Share on other sites

On 27/03/2019 at 09:19, kea said:

I have created configurable options for the product. I have the "Hidden" checkbox selected because I do not want to show them in the order form. Everything works great here. The problem is that they have also been hidden in the client's area.

if you hide a configurable option, then it's hidden everywhere - there's no default way to unhide it.

On 27/03/2019 at 09:19, kea said:

I want to edit the template to show the upgrade configurable options in the client arena, even if the "Hidden" checkbox is selected.

it can't be done in the template... a hidden configurable option group isn't passed to the template, so don't think of it as being there, but hidden - it's not available for the template to use.

as the docs says...

Quote

Hiding is useful for when you want to remove an option from the order forms that you no longer offer to new signups, but don't want to lose the selections for existing customers

it's not really meant to be used in the way you're trying to use it...

On 27/03/2019 at 09:19, kea said:

Can anyone help me to modify this code, to display the configurable options even if the "Hidden" checkbox is selected?

as I said, you can't unhide options that are hidden, they're not there at all - so no modifications to the template can show them...

it will be easier to do this the other way around... show but hide them, rather than hide then try to show them.

so unhide them from the configurable options settings (e.g untick the hidden checkbox), and then hide them in the cart ordering process... either by editing the configureproduct.tpl template and using an if statement (or in_array if multiple confiigurable options are being hidden), or use an action hook to remove them from the appropriate array... in the upgrade template(s), you won't have to make any changes as the options are no longer hidden. 🙂

Link to comment
Share on other sites

Thank you for answering and explaining 🙂

When "Hidden"
checkbox is unchecked, then an additional step is added to the ordering process.

I would like to remove this step (configuration of add-ons) from the ordering process at all. Is this possible?

Link to comment
Share on other sites

On 28/03/2019 at 14:09, kea said:

When "Hidden" checkbox is unchecked, then an additional step is added to the ordering process.

aaah... so before unhiding them, there were NO configurable options at all during the order process ??

On 28/03/2019 at 14:09, kea said:

I would like to remove this step (configuration of add-ons) from the ordering process at all. Is this possible?

even if you remove them from the array during the configureproduct stage with a hook, they're still added to the order by the time you get to viewcart - which if they were free, would purely be a visual tweak... but if they're priced then that alters the total amounts etc...

i've got a feeling that you may have to do this the way that you were originally trying to, e.g hide them via the settings but then write a hook to add them during the upgrade stages.

is there any particular reason that they need to be hidden during ordering ??

Link to comment
Share on other sites

On 3/30/2019 at 1:50 PM, brian! said:

aaah... so before unhiding them, there were NO configurable options at all during the order process ??

Exactly

On 3/30/2019 at 1:50 PM, brian! said:

even if you remove them from the array during the configureproduct stage with a hook, they're still added to the order by the time you get to viewcart - which if they were free, would purely be a visual tweak... but if they're priced then that alters the total amounts etc...

i've got a feeling that you may have to do this the way that you were originally trying to, e.g hide them via the settings but then write a hook to add them during the upgrade stages.

I understand.

On 3/30/2019 at 1:50 PM, brian! said:

is there any particular reason that they need to be hidden during ordering ?? 

Yes, I want to simplify the ordering process as much as possible. I am afraid that the additional step may affect the conversion, and in my case this additional step is completely unnecessary.

Link to comment
Share on other sites

One option is to use "defaults" in the configurable options so that there is no need to change them and just add a blurb to the name that by default it will be fine for most .  If you do that and don't set a price for that option, you could then hide them / remove them in a hook and the total wont change.  Or use the first option as a "this is optional" . 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated