Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
haylau

Panda theme or general issues?

Question

@Jonny 

Just upgraded to 1.1 stable from 1.08. And then upgraded Panda to the latest version.

Now, when I go to Preferences > Themes > Advanced Settings (to change columns per page etc) I get the following error. Any ideas?

 

ThirtyBeesException
Property Meta->page length (69) must be between 0 and 64
in file classes/ObjectModel.php at line 1036
Source file: classes/ObjectModel.php
1017:     * @throws PrestaShopException
1018:     *
1019:     * @since   1.0.0
1020:     * @version 1.0.0 Initial version
1021:     */
1022:    public function validateFields($die = true, $errorReturn = false)
1023:    {
1024:        foreach ($this->def['fields'] as $field => $data) {
1025:            if (!empty($data['lang'])) {
1026:                continue;
1027:            }
1028:
1029:            if (is_array($this->update_fields) && empty($this->update_fields[$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']) {
1030:                continue;
1031:            }
1032:
1033:            $message = $this->validateField($field, $this->$field);
1034:            if ($message !== true) {
1035:                if ($die) {
1036:                    throw new PrestaShopException($message);
1037:                }
1038:
1039:                return $errorReturn ? $message : false;
1040:            }
1041:        }
1042:
1043:        return true;
1044:    }
1045:
1046:    /**
Stack trace
1. classes/ObjectModel.php:324 source ObjectModelCore->validateFields()
2. classes/ObjectModel.php:586 source ObjectModelCore->getFields()
3. controllers/admin/AdminThemesController.php:269 source ObjectModelCore->add()
4. classes/controller/AdminController.php:2461 source AdminThemesControllerCore->renderForm()
5. controllers/admin/AdminThemesController.php:1753 source AdminControllerCore->initContent()
6. classes/controller/Controller.php:208 source AdminThemesControllerCore->initContent()
7. classes/Dispatcher.php:837 source ControllerCore->run()
8. nimda/index.php:63 source DispatcherCore->dispatch()

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

The problem is that there is some module with long controller name. Controller name is used to compose page key in form:

module-<module_name>-<controller_name>

for example

module-paypal-plussubmit

Thirtybees has limit 64 characters for these meta page entries. If (( module name lenth + controller name length + 8 ) > 64) then this error is thrown, because the resulting page key can't fit database column.

This limit is obviously too small, we should increase it for the next version of tb. I've created github issue to increase this limit.

Meanwhile, you can do this to fix the situation:

Edit file classes/Meta.php and change size of the page property to 128:

 'page'         => ['type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 64],

to

 'page'         => ['type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 128],

You will also have to connect to your phpadmin and modify table schema (you might need to change table name tb_meta according to your database prefix):

ALTER TABLE `tb_meta` MODIFY `page` varchar(128) NOT NULL;

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0

Bytw: in my case (also a Panda issue), I did not have to implement the MySQL update. Just thought I'd let you know.
Just implemented the changes to Meta.php and problem went away. Thank you

Edited by Theo

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Theo said:

Bytw: in my case (also a Panda issue), I did not have to implement the MySQL update. Just thought I'd let you know.
Just implemented the changes to Meta.php and problem went away. Thank you

This is potentially a bad idea. You should check the data table in question because what you are probably going to find is truncated data. Depending on how MySQL is configured it will silently truncate strings that are too long. Trying to insert 500 characters into a VARCHAR(255)? It might just insert the first 255 characters and not give any error. This causes weird problems down the road when you try to retrieve that data and you only get part of what you expect to get.

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, dynambee said:

This is potentially a bad idea. You should check the data table in question

Perhaps you're right. However, I couldn't find the entry in question ('page') using phpMyAdmin (it's not in tb_meta).
So before I just added a new entry to the table, I refreshed - and all was good. Or so it seemed.
So should I add an entry to tb_meta table for 'page' or is it in another table somewhere? (I'm on 30Bz 1.1.0)

Edited by Theo

Share this post


Link to post
Share on other sites
  • 0
38 minutes ago, Theo said:

Perhaps you're right. However, I couldn't find the entry in question ('page') using phpMyAdmin (it's not in tb_meta).
So before I just added a new entry to the table, I refreshed - and all was good. Or so it seemed.
So should I add an entry to tb_meta table for 'page' or is it in another table somewhere? 

It's not an entry in the table, it's the table column named `page`. If you run this command on an SQL server:

SHOW CREATE TABLE tb_meta;

You will see something very similar to this:

CREATE TABLE `tb_meta` (
  `id_meta` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `page` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `configurable` tinyint(1) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (`id_meta`),
  UNIQUE KEY `page` (`page`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

As you can see, the `page` column is there and is a varchar(64) which means it can hold up to 64 characters per entry. The command provided by @datakick changes that from a varchar(64) to a varchar(128) so that it can hold up to 128 characters per entry.

Share this post


Link to post
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...