![]() |
is it possible to override a module's yaml info
I have a client that wants to modify the "brands" module to say "designer". I've accomplished this almost everywhere, except that the menu item and the url (?target=brands) are set in the yaml file.
obviously i'm trying to accomplish this while maintaining upgradability.:roll: any direction would be appraciated. |
Re: is it possible to override a module's yaml info
Can you post a copy of the yaml? Are you talking about the admin side of customer side? I am sure that there is a way to do this in your own module. yaml files usually just insert data into the database, that is later referenced by a php file. We just have to find the file that references it, and decorate that class in our own module.
|
Re: is it possible to override a module's yaml info
Quote:
Here's the part of the yaml I was thinking I'd override: XLite\Module\CDev\SimpleCMS\Model\Menu: - link: '?target=brands' type: P position: 150 translations: - code: en name: 'Brands' - code: ru name: 'Бренды' as you can see, it places the literal string there, so I wasn't sure how to modify that. Although, I'm thinking maybe I could use my own yaml and insert my own menu item and then remove theirs from the menu ( I think that's an option). however, that'd still leave '?target=brands' as a valid url that could get crawled, which might ding us for seo purposes. Ideally, I want to accomplish this without a bunch of manual steps in the backend, so it will be easily migratable to other stores. thanks for the reply. |
Re: is it possible to override a module's yaml info
Okay yes as you expect, this is just a menu item. The best way to fix this is just a simple edit of the menu. Then you can edit the language variable.
If it was your own module then this would be something to change, but since it a purchased one just make the change manually in the admin. |
Re: is it possible to override a module's yaml info
ok, so that didn't work like I was thinking :(
I got the menu saying what I want, but how do I make ?target=designers point to the brands page (where ?target=brands currently goes). Basically, how do I setup in a module what target goes where. |
Re: is it possible to override a module's yaml info
I'd search the module itself for the word brand and the word target. Then you will hopefully find the php file and method you need to decorate. I have several tutorials where I demonstrate these techniques.
|
Re: is it possible to override a module's yaml info
But don't edit the module files directly, decorate them with your own custom module. Watch my tutorials and read/watch Tony's. Then if you still need help, we will be here.
|
Re: is it possible to override a module's yaml info
Quote:
that's how I found the yaml file. it was the only place. I'm assuming this is an xcart thing more than a module thing, or its possible they're loading the info from a variable where it wouldn't show up in a content search. I'm still looking though. I guess, my question is, in the url when we get ?target=[somevalue], where in xcart controls what that does? because that url structure is not unique to this module. My Account goes to '?target=order_list'. So, where are targets defined, I guess? |
Re: is it possible to override a module's yaml info
I was able to get my hands on a copy of the Brands module.
In Module/QSL/ShopByBrand/View/Brand.php I see this method: Code:
/** this is the method I would override in my decorator. It may be other places, this is just the first I found. |
Re: is it possible to override a module's yaml info
Quote:
Ahhhh, thank you! I will try that shortly. I'm pretty sure that's what i need though. I saw this function early on in my search, but I hadn't figured out I was looking for targets yet.. its much more relevant now :D |
Re: is it possible to override a module's yaml info
Hi guys,
Although you can edit the menu and change the link from "?target=brands" to something else, this won't change the URL to the page itself. What the link says is that it is a page handled by "brands" controller. Once you change the "target" value, you link to a different controller class and everything will stop working. The controller class for the page is \XLite\Module\QSL\ShopByBrand\Controller\Customer\ Brands. So, here is what you are to do in your custom module/theme: 1. Add a new controller class for the new target that you need and extend it from \XLite\Module\QSL\ShopByBrand\Controller\Customer\ Brands controller to inherit all the methods necessary for the page. 2. Decorate \XLite\Module\QSL\ShopByBrand\Controller\Customer\ Brands and make it redirect users to your new controller if the target is "brands". 3. Decorate \XLite\Module\QSL\ShopByBrand\View\BrandsPage::get AllowedTargets() and remove "brands" item from the array and add your new target as a new item. If there are other View classes tied to "brands" target, decorate them as well. This should help and will maintain the upgradability (even if something is changed in the original module classes, it will be a few minutes of work to update your classes to adapt to the changes). |
All times are GMT -8. The time now is 03:29 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.