Creating a subcomponent

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)
User avatar
aimeos
Administrator
Posts: 2934
Joined: 01 Jan 1970, 00:00

Re: Creating a subcomponent

Post by aimeos » 03 Sep 2015, 10:52

Bananamoon wrote: Yay Error gone! Altho I have no clue what to do now, since I thought that this file would extend/overwrite this file:

Code: Select all

class Client_Html_Basket_Mini_Main_Default
	extends Client_Html_Abstract
Yes, it extends (no inheritance) the basket/mini component dynamically but doesn't overwrite it. You can now assign more data to the view and use it in the templates.
Bananamoon wrote: I'm at loss, I guess I made the wrong extension or something? :P
My main purpose is to show the products I put in my basket, instead of just the amount of products. I would like to add that to the cache so it loads quicker, so I figured I have to extend/overwrite above file and rewrite the _setViewParams.
OK, you have two options to fetch the product data depending on your basket content and display it:

1.) You can change your decorator to decorate the "basket/mini/main" subpart instead of the "basket/min" component so the resulting HTML will be cached. In this case you have to overwrite the existing "basket/mini/main" template and add your additional HTML code there, but this isn't the best option because this leads to a tight coupling of both and will make it hard to reuse it.

2.) Instead, I would recommend to create a new "basket/mini/product" subpart (https://aimeos.org/docs/Developers/Html ... w_subparts) that is independent of the "main" subpart. In that subpart, you have more freedom. This can be reused in other projects as well and we would love to get a pull request to integrate it into the core so you don't have to care about updates in the future :-)

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12
Location: Herentals
Contact:

Re: Creating a subcomponent

Post by Bananamoon » 03 Sep 2015, 12:22

aimeos wrote:
Bananamoon wrote: Yay Error gone! Altho I have no clue what to do now, since I thought that this file would extend/overwrite this file:

Code: Select all

class Client_Html_Basket_Mini_Main_Default
	extends Client_Html_Abstract
Yes, it extends (no inheritance) the basket/mini component dynamically but doesn't overwrite it. You can now assign more data to the view and use it in the templates.
Bananamoon wrote: I'm at loss, I guess I made the wrong extension or something? :P
My main purpose is to show the products I put in my basket, instead of just the amount of products. I would like to add that to the cache so it loads quicker, so I figured I have to extend/overwrite above file and rewrite the _setViewParams.
OK, you have two options to fetch the product data depending on your basket content and display it:

1.) You can change your decorator to decorate the "basket/mini/main" subpart instead of the "basket/min" component so the resulting HTML will be cached. In this case you have to overwrite the existing "basket/mini/main" template and add your additional HTML code there, but this isn't the best option because this leads to a tight coupling of both and will make it hard to reuse it.

2.) Instead, I would recommend to create a new "basket/mini/product" subpart (https://aimeos.org/docs/Developers/Html ... w_subparts) that is independent of the "main" subpart. In that subpart, you have more freedom. This can be reused in other projects as well and we would love to get a pull request to integrate it into the core so you don't have to care about updates in the future :-)
Yay! I'd love to send a pull request! :D
Do you also need the HTML files with it? These have a different style than your shop, so I'm not sure if it's useful.

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

Re: Creating a subcomponent

Post by aimeos » 04 Sep 2015, 08:32

Bananamoon wrote: Yay! I'd love to send a pull request! :D
Do you also need the HTML files with it? These have a different style than your shop, so I'm not sure if it's useful.
Great! :-D
Yes, the structural HTML would be needed and maybe the basic CSS. We can adapt the styles later

Thanks in advance :-)

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12
Location: Herentals
Contact:

Re: Creating a subcomponent

Post by Bananamoon » 14 Sep 2015, 09:52

aimeos wrote:
Bananamoon wrote: Yay! I'd love to send a pull request! :D
Do you also need the HTML files with it? These have a different style than your shop, so I'm not sure if it's useful.
Great! :-D
Yes, the structural HTML would be needed and maybe the basic CSS. We can adapt the styles later

Thanks in advance :-)
Hi! I'm sorry for the immense delay, I had another project that needed to be finished :)
Sooo, I'm implementing my changes so I can send you a pull request, altho I'm having a bit of an issue when it comes to the basic CSS. I'm using foundation and the whole basket menu is implemented in there.
I would create the basic style, so it matches your current theme, but I'm not really sure how I run my fork locally? Do I just put the Aimeos folder into the vendor folder of a new laravel project? or?

Thanks for the help!

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

Re: Creating a subcomponent

Post by aimeos » 14 Sep 2015, 11:06

Bananamoon wrote: Hi! I'm sorry for the immense delay, I had another project that needed to be finished :)
Don't excuse, that's normal ;-)
Bananamoon wrote: I would create the basic style, so it matches your current theme, but I'm not really sure how I run my fork locally? Do I just put the Aimeos folder into the vendor folder of a new laravel project? or?
Yes, the simplest way is to link your clone to the "./vendor/aimeos/aimeos-core" directory of your Laravel application. Beware that all CSS changes must be done in "./public/packages/aimeos/shop/themes" to see them (or you link "./vendor/aimeos/aimeos-core/client/html/themes" directly to "./public/packages/aimeos/shop/themes").

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12
Location: Herentals
Contact:

Re: Creating a subcomponent

Post by Bananamoon » 14 Sep 2015, 12:08

aimeos wrote:
Bananamoon wrote: Hi! I'm sorry for the immense delay, I had another project that needed to be finished :)
Don't excuse, that's normal ;-)
Bananamoon wrote: I would create the basic style, so it matches your current theme, but I'm not really sure how I run my fork locally? Do I just put the Aimeos folder into the vendor folder of a new laravel project? or?
Yes, the simplest way is to link your clone to the "./vendor/aimeos/aimeos-core" directory of your Laravel application. Beware that all CSS changes must be done in "./public/packages/aimeos/shop/themes" to see them (or you link "./vendor/aimeos/aimeos-core/client/html/themes" directly to "./public/packages/aimeos/shop/themes").
Right, I'm trying this atm and am getting the following error:

View [app] not found.

I followed the Aimeos guide for installing the package. Not sure what I'm missing?

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

Re: Creating a subcomponent

Post by aimeos » 14 Sep 2015, 12:12

Bananamoon wrote: Right, I'm trying this atm and am getting the following error:

View [app] not found.

I followed the Aimeos guide for installing the package. Not sure what I'm missing?
You need the base view for your application: https://github.com/aimeos/aimeos-laravel#setup
Install the package like in the documentation first and then remove the "./vendor/aimeos/aimeos-core" directory and replace it with a link to your cloned repository. Otherwise, the configuration, views and assets are not copied.

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12
Location: Herentals
Contact:

Re: Creating a subcomponent

Post by Bananamoon » 14 Sep 2015, 12:52

aimeos wrote:
Bananamoon wrote: Right, I'm trying this atm and am getting the following error:

View [app] not found.

I followed the Aimeos guide for installing the package. Not sure what I'm missing?
You need the base view for your application: https://github.com/aimeos/aimeos-laravel#setup
Install the package like in the documentation first and then remove the "./vendor/aimeos/aimeos-core" directory and replace it with a link to your cloned repository. Otherwise, the configuration, views and assets are not copied.
Okay! I think I have send a pull request! :)

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12
Location: Herentals
Contact:

Re: Creating a subcomponent

Post by Bananamoon » 14 Sep 2015, 12:56

aimeos wrote:
Bananamoon wrote: Right, I'm trying this atm and am getting the following error:

View [app] not found.

I followed the Aimeos guide for installing the package. Not sure what I'm missing?
You need the base view for your application: https://github.com/aimeos/aimeos-laravel#setup
Install the package like in the documentation first and then remove the "./vendor/aimeos/aimeos-core" directory and replace it with a link to your cloned repository. Otherwise, the configuration, views and assets are not copied.
On a side note, where do I find the template that has the 'order' of each view?
On the list view there are 2 paginations (above the products and underneath the products), and the promos are above the top pagination. I would like to move them underneath the pagination, so they merge with the normal products. Altho I have no clue where I can find this layout.

So basic question: How can I move around the total layout? :D

Thank you!

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

Re: Creating a subcomponent

Post by aimeos » 14 Sep 2015, 14:06

Bananamoon wrote: So basic question: How can I move around the total layout? :D
You can change the order of the catalog list component with this configuration option:
https://aimeos.org/docs/Configuration/C ... t/subparts

Post Reply