creating managers

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

creating managers

Post by mahammadareef » 14 Nov 2022, 07:08

I wanted to fetch the data from my newly created table called customer_contact and show it in the admin panel including all the default options like add new delete update search filter etc ...,

User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

Re: creating managers

Post by mahammadareef » 14 Nov 2022, 07:55

please explain it in step by step process wih reference

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

Re: creating manager and admin panel

Post by aimeos » 14 Nov 2022, 17:27

Create an Aimeos migration first in the ./setup/default/schema/contact.php directory of your extension so your table will be automatically created and updated like this one:
https://github.com/aimeos/aimeos-core/b ... review.php
The corresponding setup task should be like this one in the ./setup/Contact.php directory of your extension:
https://github.com/aimeos/aimeos-core/b ... Review.php
Documentation for migrations and setup tasks is available here:
https://aimeos.org/docs/latest/infrastr ... igrations/

Next, create a manager and item for your new data domain in ./src/MShop/Contact/Manager/Standard.php, ./src/Contact/Item/Standard.php and ./src/MShop/Contact/Exception.php like this one:
https://github.com/aimeos/aimeos-core/t ... hop/Review
You can copy, paste and adapt the files. The corresponding config must be in ./config/mshop/contact.php and should look like this one:
https://github.com/aimeos/aimeos-core/b ... review.php

Finally, create the class file for the admin backend in ./src/Admin/JQAdm/Contact/Standard.php like this one in your extension:
https://github.com/aimeos/ai-admin-jqad ... andard.php
Create the corresponding templates like here:
https://github.com/aimeos/ai-admin-jqad ... adm/review
Configure the permissions and navbar entry of your new admin backend panel like here in the ./config/admin/jqadm/ directory of your extension:
https://github.com/aimeos/ai-admin-jqad ... dmin/jqadm
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

Re: creating managers

Post by mahammadareef » 15 Nov 2022, 11:53

i created the contact table migration using laravel style, is it possible to get this data and show it in aimeos admin panel

User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

Re: creating managers

Post by mahammadareef » 15 Nov 2022, 14:00

I created the manager class it showing me this error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mshop/contact/manager/counts' at line 1: mshop/contact/manager/counts

help me fix this

thank you in advance team aimeos

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

Re: creating managers

Post by aimeos » 16 Nov 2022, 10:17

Yes, you can also use Laravel migrations to create the table.
mahammadareef wrote: 15 Nov 2022, 14:00 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mshop/contact/manager/counts' at line 1: mshop/contact/manager/counts
That means that the configuration of the SQL statement for "mshop/contact/manager/counts" is missing (and probably all other SQL statements you have to add to the configuration for your new manager).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

Re: creating managers

Post by mahammadareef » 18 Nov 2022, 13:51

Thank you team for helping me understand aimeos ,

now i want to understand the logic behind this code (manager config file)

Code: Select all

'count' => array(
			'ansi' => '
				SELECT COUNT(*) AS "count"
				FROM (
					SELECT mrev."id"
					FROM "mshop_review" mrev
					:joins
					WHERE :cond
					GROUP BY mrev."id"
					ORDER BY mrev."id"
					OFFSET 0 ROWS FETCH NEXT 10000 ROWS ONLY
				) AS list
			',
			'mysql' => '
				SELECT COUNT(*) AS "count"
				FROM (
					SELECT mrev."id"
					FROM "mshop_review" mrev
					:joins
					WHERE :cond
					GROUP BY mrev."id"
					ORDER BY mrev."id"
					LIMIT 10000 OFFSET 0
				) AS list
			'
		),
What is the purpose to use ansi+mysql array and how count array triggerred

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

Re: creating managers

Post by aimeos » 19 Nov 2022, 08:23

Aimeos supports different database implementations (MySQL, PostgreSQL, SQL Server, etc.) and not all understand the same SQL syntax. The ANSI SQL syntax is supported by most database implementations but e.g. not by MySQL (the difference is the LIMIT/OFFSET part). Therefore, two different SQL statements must be provided, one for MySQL and one for the rest.

The right one is chosen by the getCachedStatement() method which requires the configuration key without the implementation specific postfix, e.g. "mshop/review/manager/count"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kdim95
Advanced
Posts: 195
Joined: 26 Aug 2022, 12:17

Re: creating managers

Post by kdim95 » 25 Nov 2022, 11:01

Hello,

Thanks for the information posted here.

I am confused by one part of the setup here:
https://github.com/aimeos/aimeos-core/b ... Review.php

Why does it say $db = $this->db( 'db-review' ); , the database is being set to 'db-review'?
If my database is under a different name, should I put that name in here instead?

EDIT:
Nevermind, I found the answer in the docs:
If no connection for db-mydomain is configured, it will automatically fall back to the default connection.

kdim95
Advanced
Posts: 195
Joined: 26 Aug 2022, 12:17

Re: creating managers

Post by kdim95 » 25 Nov 2022, 13:39

I don't understand how to execute the task for the table creation.

Some help please?

Post Reply