Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

is it possible to override a module's yaml info

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-11-2015, 09:12 AM
 
cvaughan02 cvaughan02 is offline
 

Member
  
Join Date: Mar 2014
Location: st. louis, mo
Posts: 22
 

Default 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.

any direction would be appraciated.
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS.
Reply With Quote
  #2  
Old 05-11-2015, 09:42 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
qualiteam (05-19-2015)
  #3  
Old 05-11-2015, 10:01 AM
 
cvaughan02 cvaughan02 is offline
 

Member
  
Join Date: Mar 2014
Location: st. louis, mo
Posts: 22
 

Default Re: is it possible to override a module's yaml info

Quote:
Originally Posted by totaltec
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.

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.
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS.
Reply With Quote
  #4  
Old 05-11-2015, 10:25 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #5  
Old 05-11-2015, 12:07 PM
 
cvaughan02 cvaughan02 is offline
 

Member
  
Join Date: Mar 2014
Location: st. louis, mo
Posts: 22
 

Default 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.
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS.
Reply With Quote
  #6  
Old 05-11-2015, 04:43 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #7  
Old 05-11-2015, 04:45 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #8  
Old 05-12-2015, 05:26 AM
 
cvaughan02 cvaughan02 is offline
 

Member
  
Join Date: Mar 2014
Location: st. louis, mo
Posts: 22
 

Default Re: is it possible to override a module's yaml info

Quote:
Originally Posted by totaltec
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.

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?
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS.
Reply With Quote
  #9  
Old 05-12-2015, 08:30 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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:
/** * Brand page view * * @ListChild (list="admin.center", zone="admin") */ class Brand extends \XLite\View\AView { /** * Return list of allowed targets * * @return array */ public static function getAllowedTargets() { return array_merge(parent::getAllowedTargets(), array('brand')); }

this is the method I would override in my decorator. It may be other places, this is just the first I found.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #10  
Old 05-12-2015, 10:13 AM
 
cvaughan02 cvaughan02 is offline
 

Member
  
Join Date: Mar 2014
Location: st. louis, mo
Posts: 22
 

Default Re: is it possible to override a module's yaml info

Quote:
Originally Posted by totaltec
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:
/** * Brand page view * * @ListChild (list="admin.center", zone="admin") */ class Brand extends \XLite\View\AView { /** * Return list of allowed targets * * @return array */ public static function getAllowedTargets() { return array_merge(parent::getAllowedTargets(), array('brand')); }

this is the method I would override in my decorator. It may be other places, this is just the first I found.


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
__________________
SEEK HAPPINESS. EVERYTHING ELSE IS DETAILS.
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:20 PM.

   

 
X-Cart forums © 2001-2020