Jump to content
thirty bees forum
  • 0

Error installing a module to add registration fields


Raymond

Question

Hello

I tried to install a module to add new fields to the registration form, I got an internal server error, switched on debug and got this below...

What should I do to solve it?

Thank you

ThirtyBeesException

Cannot use string offset as an array

in file modules/registrationfields/registrationfields.php at line 302

Source file: modules/registrationfields/registrationfields.php

283:        $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
284:        $this->fields_form = array();
285:
286:        $helper->identifier = $this->identifier;
287:        $helper->submit_action = 'submitConfiguration';
288:        $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
289:        $helper->token = Tools::getAdminTokenLite('AdminModules');
290:        $helper->tpl_vars = array(
291:            'fields_value' => $this->getConfigFieldsValues(),
292:            'languages' => $this->context->controller->getLanguages(),
293:            'id_language' => $this->context->language->id
294:        );
295:        return $helper->generateForm(array($fields_form));
296:    }
297:
298:    public function getConfigFieldsValues()
299:    {
300:        $return = '';
301:        foreach (Language::getLanguages(false) as $lang) {
302:            $return['REGISTRATION_FIELDS_HEADING'][(int)$lang['id_lang']] = Tools::getValue('REGISTRATION_FIELDS_HEADING_'.(int)$lang['id_lang'], Configuration::get('REGISTRATION_FIELDS_HEADING', (int)$lang['id_lang']));
303:        }
304:        return $return;
305:    }
306:
307:    public function hookActionCustomerAccountAdd($params)
308:    {
309:        $id_customer = (int)$this->context->cookie->id_customer;
310:        $objModel = new Fields();
311:        $objModel->saveFieldValues(Tools::getValue('fields'), $id_customer);
312:    }

Stack trace

1. modules/registrationfields/registrationfields.php:291 source RegistrationFields->getConfigFieldsValues()
272:                'submit' => array(
273:                    'title' => $this->l('Save'),
274:                )
275:            ),
276:        );
277:
278:        $helper = new HelperForm();
279:        $helper->show_toolbar = false;
280:        $helper->table = $this->table;
281:        $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
282:        $helper->default_form_language = $lang->id;
283:        $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
284:        $this->fields_form = array();
285:
286:        $helper->identifier = $this->identifier;
287:        $helper->submit_action = 'submitConfiguration';
288:        $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
289:        $helper->token = Tools::getAdminTokenLite('AdminModules');
290:        $helper->tpl_vars = array(
291:            'fields_value' => $this->getConfigFieldsValues(),
292:            'languages' => $this->context->controller->getLanguages(),
293:            'id_language' => $this->context->language->id
294:        );
295:        return $helper->generateForm(array($fields_form));
296:    }
297:
298:    public function getConfigFieldsValues()
299:    {
300:        $return = '';
301:        foreach (Language::getLanguages(false) as $lang) {
2. modules/registrationfields/registrationfields.php:252 source RegistrationFields->renderForm()
233:        Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'fmm_registration_fields_shop');
234:
235:        return true;
236:    }
237:
238:    public function getContent()
239:    {
240:        $output = '';
241:        if (Tools::isSubmit('submitConfiguration')) {
242:            $message_trads = array();
243:            foreach ($_POST as $key => $value) {
244:                if (preg_match('/REGISTRATION_FIELDS_HEADING_/i', $key)) {
245:                    $id_lang = preg_split('/REGISTRATION_FIELDS_HEADING_/i', $key);
246:                    $message_trads[(int)$id_lang[1]] = $value;
247:                }
248:            }
249:            Configuration::updateValue('REGISTRATION_FIELDS_HEADING', $message_trads, true);
250:            $output .= $this->displayConfirmation($this->l('Configuration updated'));
251:        }
252:        return $output.$this->renderForm();
253:    }
254:
255:    public function renderForm()
256:    {
257:        $fields_form = array(
258:            'form' => array(
259:                'legend' => array(
260:                    'title' => $this->l('Configuration'),
261:                    'icon' => 'icon-cogs'
262:                ),
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Thank you Data

I will do it

By the way, I uninstalled that module and did something else in the meanwhile,  i updated another module, for GDPR... apparently worked, but then browsing in the configuration pages of the module I got this new error, which made the website throw the same error whatever menu item I click now

Thank you

ThirtyBeesException

Cannot make static method ObjectModelCore::createDatabase() non static in class CustomObjectModel

in file modules/gdprpro/src/CustomObjectModel.php at line 201

Source file: modules/gdprpro/src/CustomObjectModel.php

182:            }
183:            $sql .= $field_name . ' ' . $field['db_type'];
184:            if (isset($field['required']) && $field['required']) {
185:                $sql .= ' NOT NULL';
186:            }
187:            if (isset($field['default'])) {
188:                $sql .= ' DEFAULT "' . pSQL($field['default']) . '"';
189:            }
190:            $sql .= ',';
191:        }
192:        $sql = trim($sql, ',');
193:        $sql .= ')';
194:        Db::getInstance()->execute($sql);
195:        //create multilang tables
196:        if ($multilang) {
197:            $sql = 'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . $muchTableMuchProtected . '_lang (';
198:            $sql .= pSQL($definition['primary']) . ' INTEGER UNSIGNED NOT NULL,';
199:            $sql .= 'id_lang INTEGER UNSIGNED NOT NULL,';
200:            if ($definition['multilang_shop']) {
201:                $sql .= 'id_shop INTEGER UNSIGNED NOT NULL,';
202:            }
203:            foreach ($definition['fields'] as $field_name => $field) {
204:                $field = $this->sanitizeColumnDefinition($field);
205:                if ($field_name === $definition['primary']) {
206:                    continue;
207:                }
208:                if (!$field['lang']) {
209:                    continue;
210:                }
211:                $sql .= pSQL($field_name) . ' ' . pSQL($field['db_type']);

Stack trace

1. modules/gdprpro/src/CustomObjectModel.php source Fatal error()
1:<?php
2:/**
3: * PrestaChamps
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Commercial License
8: * you can't distribute, modify or sell this code
9: *
10: * DISCLAIMER
11: *
12: * Do not edit or add to this file
13: * If you need help please contact leo@prestachamps.com
14: *
15: * @author    PrestaChamps <leo@prestachamps.com>
16: * @copyright PrestaChamps
17: * @license   commercial
18: */
19:
20:/**
21: * Class CustomObjectModel
22: */
23:abstract class CustomObjectModel extends ObjectModel
24:{
25:    /**
26:     * Return informations of the columns that exists in the
27:     * table relative to the ObjectModel. If the Model has multilang enabled,
28:     * this method also returns information about the multilang table.
29:     */
30:    public function getDatabaseColumns()
Link to comment
Share on other sites

  • 0
25 minutes ago, Raymond said:

Thank you Data

I will do it

By the way, I uninstalled that module and did something else in the meanwhile,  i updated another module, for GDPR... apparently worked, but then browsing in the configuration pages of the module I got this new error, which made the website throw the same error whatever menu item I click now

Thank you

ThirtyBeesException

Cannot make static method ObjectModelCore::createDatabase() non static in class CustomObjectModel

Bummer. This gdprpro module is not compatible with thirtybees.

Link to comment
Share on other sites

  • 0

Hi Data

Bummer, yes, that is a bad new. However until the version 2.1.18 worked. I reverted to the last functional version I have... Too bad 😞

Which module for the GDPR would you suggest that is surely compatible with TB and that hopefully will keep being so?

Thank you

Link to comment
Share on other sites

  • 0

I recalled that the GDPR module had the same problem since start with TB, and I already got help here back then, at that time you suggested to do the following found in this post, I did the same, seems that works again:

I now try to install the module for the registration fields, thank you.

Link to comment
Share on other sites

  • 0

Hello

I did what you said on the registration fields module, it could be installed, but entering it to configure it do shows only a line to add a registration field and a save button, and nothing else as it should.

Trying to save the new registration field output that the field was saved and shows nothing else again but the same line to add a new registration field, seems that cannot work on TB.1.3 as it is done now.

TB in this case does not output debug information tough, what should I do to get information from the system when does not throw error reports with debug mode on?

Thank you

Link to comment
Share on other sites

  • 0
56 minutes ago, Raymond said:

Hello

I did what you said on the registration fields module, it could be installed, but entering it to configure it do shows only a line to add a registration field and a save button, and nothing else as it should.

Trying to save the new registration field output that the field was saved and shows nothing else again but the same line to add a new registration field, seems that cannot work on TB.1.3 as it is done now.

TB in this case does not output debug information tough, what should I do to get information from the system when does not throw error reports with debug mode on?

Thank you

Are you sure that it does not work? From the code excerpt you posted, it looks like that's exactly what module configuration page should do. 

The module installs Menu item so you should look there for more functionality. If unsure, ask module author

Link to comment
Share on other sites

  • 0

Hello

Yes I double checked, does not work,

This is the manual of the module, all what in the manual is said that should be shown in the configuration panel of the module is not showing up, only the other panel reachable via the tab menu is showing up probably correctly, ut I ma not sure that works well, I cannot test the rest and I have no idea where to get the error log, nothing is show despite the debug mode is active.

I will ask them, but i guess they will simply answer that is not for TB, that I bought it years ago and so on... who knows... maybe not...

The question that rose from that is: if existing, which logs one can check in TB to find problems that do not throw an error while debug mode is on?

However

It is a bit of a long frustrating story overall...

I bought that module in 2017, did work fine, then I stopped using it when upgraded to PS 1.6as the fields I needed could be covered recycling the SIRET, APE and DNI fields, this was even an advantage since GDPR started because all the GDPR modules surely do collect all data from those fields, while it is not sure that can collect data form new fields one add by hand or with modules (and of course one tends to not choose the complicate way, what works out of the box generally is better, does not seem a good idea to fiddle everywhere every time isn't it?).

When I switched to TB I could use the same arrangement.

Until TB 1.2 all went fine, with some workaround I could cover all basic aspects of registration, GDPR, including the possibility for the clients to delete their own account without having to ask for, having to delete the data upon request is just extra work for the merchant (the result is exactly the same, if the client want to delete data one has to delete it , that's it)

Now with TB 1.3 I can't understand why the SIRET, APE DNI and also the other fields that can be added in the address format in the country do not show up in the registration form...

Are those SIRET DNI APE OTHER fields definitely disabled?

Is there a way to use it still?

So I thought to get back to that custom registration fields module and see if I could put it in use again but seems that I am out of luck at this point

Needless to say that just as it happened with many other modules, also expensive ones, I did not like this custom registration fields ting very much, it had its own issues too at the time, but at least worked for a while... and this point is quite important to be noted to better understand what is the final feeling I had using PS and that I do not want to get again...

The reason for which I threw PS under the bus is that I constantly had to fiddle with the very basic things to no avail, it had been somehow a continuos loss of time for relatively "simple" basic things that should be as solid as the foundations of a system...

The real trouble is that the world changed, while TB, PS and practically also all the others did not not change as much, today IMHO an e-commerce platform must have built in as basic core all these features required by GDPR and similar laws around the world.

It is not just a matter of paying some money and time to get these features, the major problem is about reliability and security, it is all about to be reasonably sure that at least all these feature required by law in a growing amount of countries will work fine in the time also after updates and upgrades of the core.

To get a clearer vision of what is happening I found this article: https://www.endpointprotector.com/blog/data-protection-legislation-around-the-world/

 
Quote

 

"How many countries have some form of data protection law?

The number of countries that have enacted data protection laws is constantly growing. Currently, there are more than 120 countries that had put in place legislation to secure the protection of data and privacy. The EU’s General Data Protection Regulation (GDPR), implemented in May 2018, brought data protection into the public eye and onto legislative agendas the world over. Considered a landmark privacy law and a milestone for the digital age, the GDPR has introduced new rights for individuals, such as the Right to be Forgotten and the Right to Portability."

https://www.endpointprotector.com/blog/data-protection-legislation-around-the-world/

 

On the other side how many e-commerce platform do come out of the box with the features required built in and secured to be maintained in the time along with the ongoing core development?

Maybe 0, nul , zero...

Let's suppose that all these laws never existed or that will be ceased, so, let's go beyond the fact that these laws do exist, what's wrong in having a system that can be settled in such a way to build a transparent fair relation between services/goods' suppliers and the customers?

Having easy way to clear pretty well forehand what the agreements are, get the clear consent of the users, let the users review, modify, retrieve and delete their own data/consents and/or delete their own account does not sound strange at all to me... this at least, I do not want to comment all the rest about these rules, but that part is quite understandable and shareable I think...

just my 5 cents on this topic...

Thank you for the help

 

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