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)
Spam and unrelated posts will be removed immediately!
Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12

Creating a subcomponent

Post by Bananamoon » 19 Aug 2015, 09:57

Hi! :-) (sorry for spamming this forum!)

I'm trying to overwrite the default breadcrumb, but am not sure how to do this.
I know how to create a new component, and was just wondering if this goes the same way for a subcomponent?

So from a default subcomponent it becomes a component that you have to add in the shop config file in order to show it on a page, or am I wrong in this?

Thanks again for your help! :-)

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

Re: Creating a subcomponent

Post by aimeos » 19 Aug 2015, 10:39

Bananamoon wrote: I'm trying to overwrite the default breadcrumb, but am not sure how to do this.
I know how to create a new component, and was just wondering if this goes the same way for a subcomponent?

So from a default subcomponent it becomes a component that you have to add in the shop config file in order to show it on a page, or am I wrong in this?
Every question is welcome! :-)

You can create a new breadcrumb template if you want to change the layout: https://aimeos.org/docs/Developers/Html ... _templates
If you need more information in your template and want to overwrite the breadcrumb component, you can extends the existing implementation and overwrite the _setViewParams() method:
https://aimeos.org/docs/Developers/Html ... rams.28.29

Does this answer your question?

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12

Re: Creating a subcomponent

Post by Bananamoon » 19 Aug 2015, 11:05

aimeos wrote:
Bananamoon wrote: I'm trying to overwrite the default breadcrumb, but am not sure how to do this.
I know how to create a new component, and was just wondering if this goes the same way for a subcomponent?

So from a default subcomponent it becomes a component that you have to add in the shop config file in order to show it on a page, or am I wrong in this?
Every question is welcome! :-)

You can create a new breadcrumb template if you want to change the layout: https://aimeos.org/docs/Developers/Html ... _templates
If you need more information in your template and want to overwrite the breadcrumb component, you can extends the existing implementation and overwrite the _setViewParams() method:
https://aimeos.org/docs/Developers/Html ... rams.28.29

Does this answer your question?
Thanks for the info! Altho I'm still not sure how to implement the template.
I copied the

Code: Select all

Client/Html/Catalog/Stage/Breadcrumb/Default.php 
to

Code: Select all

ext/ai-project/client/html/src/Client/Html/Catalog/Mystage/Default.php
I extended like this:

Code: Select all

class Client_Html_Catalog_Optistage_Default
	extends Client_Html_Catalog_Stage_Default

I'm not sure if this is the correct way, since it doesn't seem to use this file so far. Am I missing something?
Thanks again for your help :-)

On side node, could you also check my other question please? laravel-package-f18/modify-the-basket-m ... -t468.html :oops: Thank you!

Luke
Posts: 13
Joined: 14 Aug 2015, 21:34

Re: Creating a subcomponent

Post by Luke » 19 Aug 2015, 12:38

Hi,

I am also having a similar issue, did you manage to fix it or is there someone on the board who could help ?

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

Re: Creating a subcomponent

Post by aimeos » 19 Aug 2015, 14:10

Bananamoon wrote: Thanks for the info! Altho I'm still not sure how to implement the template.
I copied the

Code: Select all

Client/Html/Catalog/Stage/Breadcrumb/Default.php 
to

Code: Select all

ext/ai-project/client/html/src/Client/Html/Catalog/Mystage/Default.php
I extended like this:

Code: Select all

class Client_Html_Catalog_Optistage_Default
	extends Client_Html_Catalog_Stage_Default

I'm not sure if this is the correct way, since it doesn't seem to use this file so far. Am I missing something?
It's much easier, if you only want to change the template. You don't need to create a new component (Optistage) but only configure a new template for the breadcrumb body of the existing catalog stage breadcrumb: https://aimeos.org/docs/Configuration/C ... plate-body

Place it in your Aimeos extension and it will be used after you cleared the content cache (if you didn't disable content caching by default in your dev environment).

Bananamoon
Posts: 26
Joined: 22 Jun 2015, 09:12

Re: Creating a subcomponent

Post by Bananamoon » 19 Aug 2015, 14:26

aimeos wrote:
Bananamoon wrote: Thanks for the info! Altho I'm still not sure how to implement the template.
I copied the

Code: Select all

Client/Html/Catalog/Stage/Breadcrumb/Default.php 
to

Code: Select all

ext/ai-project/client/html/src/Client/Html/Catalog/Mystage/Default.php
I extended like this:

Code: Select all

class Client_Html_Catalog_Optistage_Default
	extends Client_Html_Catalog_Stage_Default

I'm not sure if this is the correct way, since it doesn't seem to use this file so far. Am I missing something?
It's much easier, if you only want to change the template. You don't need to create a new component (Optistage) but only configure a new template for the breadcrumb body of the existing catalog stage breadcrumb: https://aimeos.org/docs/Configuration/C ... plate-body

Place it in your Aimeos extension and it will be used after you cleared the content cache (if you didn't disable content caching by default in your dev environment).
Yay! It all works! :-) Thank you so much for your help!

Luke
Posts: 13
Joined: 14 Aug 2015, 21:34

Re: Creating a subcomponent

Post by Luke » 19 Aug 2015, 14:38

Hi,

I am having a similar issue, I am wanting to override the item details default.php
path = ext/ai-rotex/client/html/src/Client/Html/Catalog/Detail

I want to remove the social from the subpaths but it's not working any ideas what I am doing wrong.
my new class =

Code: Select all

class Client_Html_Catalog_RotexDetail_Default
   extends Client_Html_Catalog_Detail_Default

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

Re: Creating a subcomponent

Post by aimeos » 19 Aug 2015, 15:00

Luke wrote:Hi,

I am having a similar issue, I am wanting to override the item details default.php
path = ext/ai-rotex/client/html/src/Client/Html/Catalog/Detail

I want to remove the social from the subpaths but it's not working any ideas what I am doing wrong.
Very simple: Only configure the https://aimeos.org/docs/Configuration/C ... t/subparts setting and leave out the "social" string.

Luke
Posts: 13
Joined: 14 Aug 2015, 21:34

Re: Creating a subcomponent

Post by Luke » 19 Aug 2015, 15:43

Hey,

That is exactly what I have done but it doesn't seem to be working, what could my new class name be ? it cannot be the same name as the one I am extending can it.

Luke
Posts: 13
Joined: 14 Aug 2015, 21:34

Re: Creating a subcomponent

Post by Luke » 19 Aug 2015, 15:48

are you able to give me an example directory structure and class name / filename

Post Reply