Jump to content
thirty bees forum
  • 0

Shop association in HelperForm


wakabayashi

Question

In my helperForm I want to use the inbuilt shop selector. The select tree shows up, but I can't manage to set up the tplvars correctly. Strangely it doesn't matter what I put under 'name' (blabla). The checkboxes always have the name "checkBoxShopAssoconfiguration".

``` if (Shop::isFeatureActive()) { $inputs[] = array( 'type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'blabla', ); }

$fields_form = array(
    'form' => array(
        'legend' => array(
            'title' => ('Add Link'),
            'icon' => 'icon-cogs'
        ),
        'input' => $inputs,
        'submit' => array(
            'title' => ('Update'),
            'class' => 'btn btn-default pull-right'
        )
    )
);

$helper = new HelperForm();
$helper->submit_action = 'saveLink';
$helper->default_form_language = $this->context->language->id;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name .'&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');

$vars['blabla'][3] = 0;

$helper->tpl_vars = array(
    'fields_value' => $vars,
    'languages' => $this->context->controller->getLanguages(),
    'id_language' => $this->context->language->id,
);

```

How do I need to set up tpl_vars, so that only the shops with an entry are selected? Let's say I have 3 shops and only in the first two shops is an entry. I thought, I have to do like this:

$vars['blabla'][1] = 1; $vars['blabla'][2] = 1; $vars['blabla'][3] = 0;

That's the way I do for lang fields, but this is not working. It selects always all 3 shops.

Thanks for your help! If something is unclear, please tell me where you need better explanation.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

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...