Jump to content

Is HelperOptions ... of any use?


Appwards

Recommended Posts

Hi all,

 

I just spent a couple of frustrating hours trying to get HelperOptions to work.

I mean: Instead of using HelperForm the HelperOptions must make my life easier by storing values for me, right?

 

But after frustrating a long time over the crappy documentation (sorry about that, but I really feel the documentation regarding module development is very, very poor) I figured out that I still have to add a method somewhere to store the new values for the configuration options.

 

The documentation section regarding the "select" type says the most cryptical and useless thing:

['list'] => array(list do display as options)

 

 

That helped nothing at all and after quite a lot of time I finally figured out that the format of that field should be:

array(
   array('<the value you put in the identifier array field>' => <the first value>, 'name' => "Your textual field description"),
   array('<the value you put in the identifier array field>' => <the other value>, 'name' => "Other textual field description"),
);

But now I'm done and the form "works" as in: It goes back to my module's main config page saying that the configuration has been stored, but nothing has been added to the config table (2 out of 3 items weren't there yet) and the one that was already there hasn't changed.

 

However I do get a nice and green "The settings have been successfully updated." message.

 

 

So, what's the deal with this helper? Does it actually help or is it some sort of alias of HelperForm?

 

Sorry for the sour tone of voice but I could have just used something I already built before using HelperForm rather than loosing a lot of precious time for ..well... nothing.

 

Link to comment
Share on other sites

While documentation could be better, think you missed to read parts for HelperForm where are all explained.

 

http://doc.prestashop.com/display/PS16/Using+the+HelperForm+class#UsingtheHelperFormclass-Selector

 

says enough for start, with two examples. 

 

And why it is not saving well that depends of your code where you check if submit  is done.

Check some code from default modules.

 

Also good start in module development is Prestashop module generator 

https://validator.prestashop.com/generator

Link to comment
Share on other sites

Hey, thanks for your response.

I seems I did read over that section. 

That doesn't change my opinion over the documentation though and I still don't get the point of the Option Helper as it seems to be pretty much the same thing as the HelperForm.

 

But I'll definately have a look at that generator.

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