Quantcast
Channel: OXID Community Forum
Viewing all articles
Browse latest Browse all 6951

Variant select menu as HTML select

$
0
0
Hello,

I need to change the fancy variant drop-down box of the Azure theme to a standard HTML <select> box.

From looking at widget/product/selectbox.tpl and oxarticlevariant.js, I simply can't figure out how to achieve this. The code from here seems to be old as it creates template errors.

Here is what I have in selectbox.tpl so far:
Code:

[{assign var="oSelections" value=$oSelectionList->getSelections()}]
[{assign var="oActiveSelection" value=$oSelectionList->getActiveSelection()}]

[{if $oSelections}]
<div class="variantSelector">
    <label>[{$oSelectionList->getLabel()}]</label>
    <select class="variants">
        <option>
            [{if $sFieldName == "sel" }]
                [{ oxmultilang ident="PLEASE_CHOOSE" }]
            [{else}]
                [{ oxmultilang ident="CHOOSE_VARIANT" }]
            [{/if}]
        </option>
    [{foreach from=$oSelections item=oSelection}]
        [{if !$oSelection->isDisabled()}]
            <option value="[{$oSelection->getValue()}]" [{if $oSelection->isActive()}]selected="selected"[{/if}]>[{$oSelection->getName()}]</option>
        [{/if}]
    [{/foreach}]
    </select>
</div>
[{else}]
    <a href="[{ $_productLink }]" class="variantMessage">
    [{if $sFieldName == "sel" }]
        [{ oxmultilang ident="PLEASE_CHOOSE" }]
    [{else}]
        [{ oxmultilang ident="CHOOSE_VARIANT" }]
    [{/if}]
    </a>
[{/if}]

This will create the standard html drop-down box just fine. It also contains some sort of variant ids as the value for the option tags and the name of the variants. But I don't know how to go about it from there. The oxarticlevariant.js heavily confuses me and I don't really get what most of the code in there is supposed to do.

When I changed the drop-down menus for the listlocator, I could simply create an onChange-event that redirects to the link that's saved as the value of the <option>-tag. Ideally, I'd want something like that in this case, but calling the "getLink()" Method of "oSelection" only yields a '#'.

It doesn't need to be fancy AJAX-magic. A full page reload with the variant selection saved would be just fine.

Viewing all articles
Browse latest Browse all 6951

Trending Articles