Issues with creating Subparts

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!
jafo66
Posts: 65
Joined: 06 Mar 2024, 04:42

Issues with creating Subparts

Post by jafo66 » 15 Apr 2024, 13:35

In building out item subparts, I found a few issues in the docs that should be fixed:
  1. In the template code snippet example for the subpart, it is missing the "vue" class in the div
  2. Also in the template code, the divs at the end should be closing divs, they are missing the slashes
  3. In order to get subparts working, I had to add the following into my parent get method:

    Code: Select all

    $view->set('itemSubparts', $this->getSubClientNames());
    I'm not entirely sure that is the best way to handle it but once I did that, the "link" showed up on the screen. This could be a bug in the parent class because I could tell from logging that the getSubClientNames() method was being called.
I hope this helps and maybe someone else will benefit as well.

Environment:

Code: Select all

Php version: 8.2.15

Versions: 
aimeos/ai-laravel                  2023.10.5  
aimeos/aimeos-laravel              2023.10.8  
inertiajs/inertia-laravel          v0.6.11    
laravel/framework                  v10.48.3   
laravel/jetstream                  v4.3.1     
laravel/serializable-closure       v1.3.3     
spatie/laravel-ignition            2.4.2      

OS version: MacOs 14.4

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

Re: Issues with creating Subparts

Post by aimeos » 15 Apr 2024, 15:41

jafo66 wrote: 15 Apr 2024, 13:35 [*]In the template code snippet example for the subpart, it is missing the "vue" class in the div
The vue CSS class is already in the example template ( "<div class="col-xl-6 vue"):
https://aimeos.org/docs/latest/admin/jq ... /#template

Or did you mean somewhere else?
jafo66 wrote: 15 Apr 2024, 13:35 [*]Also in the template code, the divs at the end should be closing divs, they are missing the slashes
That has been fixed.
jafo66 wrote: 15 Apr 2024, 13:35 [*]In order to get subparts working, I had to add the following into my parent get method:

Code: Select all

$view->set('itemSubparts', $this->getSubClientNames());
I'm not entirely sure that is the best way to handle it but once I did that, the "link" showed up on the screen. This could be a bug in the parent class because I could tell from logging that the getSubClientNames() method was being called.
We've added documentation for the data() method where this should be added:
https://aimeos.org/docs/latest/admin/jq ... nels/#data

Thank you very much for pointing out the issues! :-)
We've fixed them already and we appreciate any contributions to make the Aimeos docs better.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jafo66
Posts: 65
Joined: 06 Mar 2024, 04:42

Re: Issues with creating Subparts

Post by jafo66 » 15 Apr 2024, 21:02

Thanks for the updates.

Where the "vue" class needs to be is a tad confusing. I now have it working without the vue class included anywhere in the subpart code. It is in the parent code, so I'm not sure I follow when / where that should get included.

On the data() method, I implemented the method from the docs but it doesn't seem to be called automatically. Should I be including it in the get() method call?

Thanks!
aimeos wrote: 15 Apr 2024, 15:41
jafo66 wrote: 15 Apr 2024, 13:35 [*]In the template code snippet example for the subpart, it is missing the "vue" class in the div
The vue CSS class is already in the example template ( "<div class="col-xl-6 vue"):
https://aimeos.org/docs/latest/admin/jq ... /#template

Or did you mean somewhere else?
jafo66 wrote: 15 Apr 2024, 13:35 [*]Also in the template code, the divs at the end should be closing divs, they are missing the slashes
That has been fixed.
jafo66 wrote: 15 Apr 2024, 13:35 [*]In order to get subparts working, I had to add the following into my parent get method:

Code: Select all

$view->set('itemSubparts', $this->getSubClientNames());
I'm not entirely sure that is the best way to handle it but once I did that, the "link" showed up on the screen. This could be a bug in the parent class because I could tell from logging that the getSubClientNames() method was being called.
We've added documentation for the data() method where this should be added:
https://aimeos.org/docs/latest/admin/jq ... nels/#data

Thank you very much for pointing out the issues! :-)
We've fixed them already and we appreciate any contributions to make the Aimeos docs better.

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

Re: Issues with creating Subparts

Post by aimeos » 17 Apr 2024, 07:59

jafo66 wrote: 15 Apr 2024, 21:02 Where the "vue" class needs to be is a tad confusing. I now have it working without the vue class included anywhere in the subpart code. It is in the parent code, so I'm not sure I follow when / where that should get included.
The "vue" CSS class creates an own instance of a Vue application for the HTML within. If you add that class at a parent node which contains the basic tab including all subparts, then this single Vue application will used for every VueJS related code in all panel item and subpart templates. But there will be conflicts if you do that and add a "vue" class to the subpart template too!
jafo66 wrote: 15 Apr 2024, 21:02 On the data() method, I implemented the method from the docs but it doesn't seem to be called automatically. Should I be including it in the get() method call?
Yes, you need to use this in every method where you need the data added to the templates:
$view = $this->object()->data( $this->view() );

We've updated the docs accordingly. Thanks for the hint!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply