Jump to content

Product Attribute as Check box?


Recommended Posts

Good day. There was such problem: it is necessary to implement for the goods the possibility of adding several goods to the basket, with the chosen sizes. I am digging through the AttributeGroup.php files.

private $groupTypeAvailable = array(
    'select',
    'checkbox',
    'color',
);

Next AdminAttributesController.php

 

$group_type = array(
        array(
            'id' => 'select',
            'name' => $this->trans('Drop-down list', array(), 'Admin.Global')
        ),
        array(
            'id' => 'checkbox',
            'name' => $this->trans('Radio buttons', array(), 'Admin.Global')
        ),
        array(
            'id' => 'color',
            'name' => $this->trans('Color or texture', array(), 'Admin.Catalog.Feature')
        ),
    );

and in  product-variants.tpl

 

{elseif $group.group_type == 'checkbox'}
    <ul id="group_{$id_attribute_group}">
      {foreach from=$group.attributes key=id_attribute item=group_attribute}
        <li class="input-container float-xs-left">
          <label>
            <input class="" type="checkbox" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}">
            <span class="radio-label">{$group_attribute.name}</span>
          </label>
        </li>
      {/foreach}
    </ul>
  {/if}

For this I can choose several checkboxes, but the last selected is added to the basket.

введите сюда описание изображения

Edited by ttkeino (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...