How can I make changes on database and retrieve as per new changes?

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!
Nimesh Prajapati
Posts: 5
Joined: 19 Jun 2019, 09:36

How can I make changes on database and retrieve as per new changes?

Post by Nimesh Prajapati » 15 Jul 2019, 05:40

Hey Aimeos,

I have a question and I hope that you get understood by the title of the topic.

If I am not wrong that your database query call through vendor/aimeos/aimeos-core classes. Now what i need to know that how can I add my own field in database and fire queries on that field or if i would have added new table for any customize module so how can I retrieve data as per my need?

for example i want to show specific categories from all categories on home page.

And yes I am working with below versions,

PHP 7
Laravel Version 5.8
Aimeos Version 2019.04
Windows 10

so can you please help me out on this.

Best Regards

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

Re: How can I make changes on database and retrieve as per new changes?

Post by aimeos » 15 Jul 2019, 13:37

Nimesh Prajapati wrote: 15 Jul 2019, 05:40 If I am not wrong that your database query call through vendor/aimeos/aimeos-core classes. Now what i need to know that how can I add my own field in database and fire queries on that field or if i would have added new table for any customize module so how can I retrieve data as per my need?
After you've added a setup file for extending the database you have to:
- Create a new config file with the SQL queries to need to adapt
- Create a new item class which extends from the original one and add the getter/setter methods as well as extend the toArray() and fromArray() methods
- Create a new manager class which extends from the original one and overwrite the methods you need to adapt (createItemBase() is important for createing the items)
- Copy the catalog item-standard.php template from the JQAdm package and adapt it
Nimesh Prajapati wrote: 15 Jul 2019, 05:40 for example i want to show specific categories from all categories on home page.
Guess, you want to add a column to indicate if the category should be shown in the frontend or not?

The "official" way we would love to get a PR from you for would be to implement properties for the MShop catalog domain ( e.g. use the customer domain as reference):
- copy&paste the table setup (https://github.com/aimeos/aimeos-core/b ... r.php#L180)
- copy&paste the property SQL statements (https://github.com/aimeos/aimeos-core/b ... r.php#L310)
- copy&paste the property classes (https://github.com/aimeos/aimeos-core/t ... r/Property)
- adapt the catalog manager class (https://github.com/aimeos/aimeos-core/b ... se.php#L26)
- copy&paste the tests (https://github.com/aimeos/aimeos-core/t ... r/Property)
- copy&paste the JQAdm class (https://github.com/aimeos/ai-admin-jqad ... r/Property)
- copy&paste the JQAdm template (https://github.com/aimeos/ai-admin-jqad ... andard.php)
- adapt the JQAdm config file (https://github.com/aimeos/ai-admin-jqad ... dm.php#L67)

Then, set a property (e.g. type: "home", value: "1") for the categories you would like to show. You can retreive all categories for that property with:

Code: Select all

$manager = \Aimeos\MShop:create( $context, 'catalog' );
$search = $manager->createSearch( true );
$fcn = $search->createFunction( 'catalog:prop', ['home', null, '1'] );
$search->setConditions( $search->compare( '!=', $fcn, null );
$items = $manager->searchItems( $search, ['text', 'product'] );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Nimesh Prajapati
Posts: 5
Joined: 19 Jun 2019, 09:36

Re: How can I make changes on database and retrieve as per new changes?

Post by Nimesh Prajapati » 16 Jul 2019, 05:04

Hey Aimeos,

Thank you very much for your support and quick response. I got your point what you have explained me and understand it very well but there is also one thing that I want to know.

I have created my own extension and I have downloaded it from your extensions. So can you please give me example to how to set or else tell me where to all the things on my own extensions.

Best Regards,
Nimesh Prajapati

Post Reply