CMS extension

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: CMS extension

Post by aimeos » 24 Feb 2021, 08:13

Please use dev-master, we've renamed the branch to be in line with all others.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: CMS extension

Post by MikaelNazarenko » 24 Feb 2021, 13:48

ok, I have updated the components. But when I clicked to add new content item I got JS error :(

And the page is not displayed in tree (

Seems tree is not implemented yet ?

JS error seems related to this file

https://github.com/aimeos/ai-cms-grapes ... /custom.js

line 199,

Code: Select all

			{
			id: 'views',
			buttons  : [{
/*				id: 'open-sm',
				command: 'open-sm',
				className: 'fa fa-paint-brush',
			},{
*/				id: 'open-tm',
				command: 'open-tm',
				className: 'fa fa-cog',
			},{
/*				id: 'open-layers',
				command: 'open-layers',
				className: 'fa fa-bars',
			},{
*/				id: 'open-blocks',
				command: 'open-blocks',
				className: 'fa fa-th-large',
				active: true,
			}],
		}
I will try to fix JS grapejs error with my custom extension, but why the editor looks such empty ? I thought there should be more functions etc )
Attachments
Screenshot from 2021-02-24 15-46-12.png
Screenshot from 2021-02-24 15-46-12.png (135.08 KiB) Viewed 10204 times

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: CMS extension

Post by MikaelNazarenko » 24 Feb 2021, 19:36

I tried to extend cms table:

Code: Select all

return [
	'table' => [
        'mshop_cms' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
            $table = $schema->getTable( 'mshop_cms' );

            $table->addColumn( 'parentid', 'integer', ['notnull' => false] );
            $table->addColumn( 'level', 'smallint', [] );
            $table->addColumn( 'nleft', 'integer', [] );
            $table->addColumn( 'nright', 'integer', [] );

            return $schema;
        },
	],
];
But got error:

Code: Select all

Doctrine\DBAL\Schema\SchemaException  : There is no table with name 'aimeosdev.mshop_cms' in the schema.
schema from my custom extension is executed before the grapesjs extension's schema.. I think it is the cause. But why my extension is first ? In the ext folder my extension is on last place

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: CMS extension

Post by aimeos » 25 Feb 2021, 17:10

MikaelNazarenko wrote: 24 Feb 2021, 13:48 ok, I have updated the components. But when I clicked to add new content item I got JS error :(

I will try to fix JS grapejs error with my custom extension, but why the editor looks such empty ? I thought there should be more functions etc )
Tried on a fresh installation with aimeos/ai-cms-grapesjs:dev-master and it works without any JS error. The error causes that the panels on the right are not displaed.
MikaelNazarenko wrote: 24 Feb 2021, 13:48 And the page is not displayed in tree (
Seems tree is not implemented yet ?
No, that's up to you.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: CMS extension

Post by aimeos » 25 Feb 2021, 17:13

MikaelNazarenko wrote: 24 Feb 2021, 19:36 schema from my custom extension is executed before the grapesjs extension's schema.. I think it is the cause. But why my extension is first ? In the ext folder my extension is on last place
The order in the ext folder doesn't matter, only the dependencies in the "depends" section in the manifest.php file of your extension. But you need to add your schema update and your code for displaying the tree directly to the ai-cms-grapesjs extension so it will be included by default in the future.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: CMS extension

Post by MikaelNazarenko » 25 Feb 2021, 17:34

Ok, thanks! I got it) I will make pull requests later, after I test it with my custom extension)

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: CMS extension

Post by MikaelNazarenko » 01 Mar 2021, 11:50

Hi,

You said:

"But you need to add your schema update and your code for displaying the tree directly to the ai-cms-grapesjs extension so it will be included by default in the future"

But why I can't extend mshop_cms page with normal way in my extension? Why do I get the error? You did not add some config for mshop_cms somewhere ? Because I am able to extend users, order, product and other aimeos tables..

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: CMS extension

Post by aimeos » 01 Mar 2021, 11:54

MikaelNazarenko wrote: 01 Mar 2021, 11:50 But why I can't extend mshop_cms page with normal way in my extension? Why do I get the error? You did not add some config for mshop_cms somewhere ? Because I am able to extend users, order, product and other aimeos tables..
You can but then it won't be in the aimeos/ai-cms-grapesjs extension. Instead of implementing it just for you, please create a PR with the changes in the aimeos/ai-cms-grapesjs extension so it will be available for all.

The error you've described is caused by a wrong execution order due to a missing dependency in you manifest.php file. If you add "ai-cms-grapesjs" in the "depends" section of your manifest.php file, that the order will be correct and the "mshop_cms" table will be available.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MikaelNazarenko
Expert
Posts: 274
Joined: 27 Jun 2019, 16:19

Re: CMS extension

Post by MikaelNazarenko » 01 Mar 2021, 12:53

This is my manifest.php:

<?php

Code: Select all

return array(
	'name' => 'custom',
	'depends' => array(
		'aimeos-core',
		'ai-admin-jqadm',
		'ai-admin-jsonadm',
		'ai-client-html',
		'ai-client-jsonapi',
		'ai-controller-jobs',
		'ai-controller-frontend',
        'ai-cms-grapesjs'
	),
	'include' => array(
		'lib/custom/src',
		'client/html/src',
		'client/jsonapi/src',
		'controller/common/src',
		'controller/frontend/src',
		'controller/jobs/src',
		'admin/jsonadm/src',
		'admin/jqadm/src',
	),
	'i18n' => array(
		'admin' => 'admin/i18n',
		'admin/jsonadm' => 'admin/jsonadm/i18n',
		'client' => 'client/i18n',
		'client/code' => 'client/i18n/code',
		'controller/common' => 'controller/common/i18n',
		'controller/frontend' => 'controller/frontend/i18n',
		'controller/jobs' => 'controller/jobs/i18n',
		'mshop' => 'lib/custom/i18n',
	),
	'config' => array(
		'config',
	),
	'custom' => array(
		'admin/jqadm' => array(
			'admin/jqadm/manifest.jsb2',
		),
		'admin/jqadm/templates' => array(
			'admin/jqadm/templates',
		),
		'admin/jsonadm/templates' => array(
			'admin/jsonadm/templates',
		),
		'client/html/templates' => array(
			'client/html/templates',
		),
		'client/jsonapi/templates' => array(
			'client/jsonapi/templates',
		),
		'controller/jobs' => array(
			'controller/jobs/src',
		),
		'controller/jobs/templates' => array(
			'controller/jobs/templates',
			'client/html/templates',
		),
	),
	'setup' => array(
		'lib/custom/setup',
	),
);
And still this error :(

Code: Select all

 Doctrine\DBAL\Schema\SchemaException  : There is no table with name 'aimeosdev.mshop_cms' in the schema

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: CMS extension

Post by aimeos » 03 Mar 2021, 10:53

We've found the problem:
The name in the manifest.php file was still "ai-cms-grapejs" instead of "ai-cms-grapesjs". This has been fixed now and adding columns should work now.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply