Hey guys.i have created an extension for product s...
# suitecommerce
s
Hey guys.i have created an extension for product slider. And i want to add that slider to home.how can i do that ? Is there any way by which i can set this slider view as a child view of the home view. Bcz i haven't seen any home component in container object.
s
First of all, I would use one of our extensions instead because it'll be less work and easier to manage (eg slideshow, featured category, or featured product).
I would also consider whether they make a good design choice as people rarely interact with sliders, especially beyond the first slide.
Finally, if you must implement one then we use the bxSlider plugin, which I wrote about 3 years ago here: https://developers.suitecommerce.com/customize-your-homepage
There are more modern blog posts that talk about other uses of this plugin
s
@Steve Goldberg ok sir. But what if someonewant to make an extension and want to use it in some pages like home or any custom module pages. Then i don't think it can be possible using extension dev tool. Can it be done ?
s
Eh? I've just told you about three extensions we wrote that uses this functionality.
s
😅Yeah i got that. Lets forgot about slider. I mean consider other custom module.
s
If you want to customise the home page then you'll need to use the layout component.
This is a generic component that applies throughout the web store application
s
Sorry to ask. Is it home component available in container object ?
Because i have never used it, and in docs also i have seen the components for pdp plp checkout and cart page etc.
s
There is no home component
You will need to use the layout component, as I said
s
Ok sir. May i ask for a sample code on it ?
s
container.getComponent('Layout')
s
Ohh..sir last question. I don't think u would like to answer it, but still....
I haven't worked with extension dev tool. So in 19.2 i created a custom module in sca dev tool. I deployed that to prod ac and their templates too. But still the templates are not reflecting. Moreover it throws error for those template files.
s
Are those templates included in your manifest file?
s
I dont think you will accept this request,but it would be great if you could write a post on 19.2 folder structure and its way of working. A request.
Yes sir. Those files are in manifest.
s
Wait, are you adding new templates via an extension and then trying to call them in your SCA 19.2 developer tools?
s
I have seen some d.ts file in productDetails module and other module and didn't get how they work.
s
We recommend doing a TypeScript training course
s
No sir. First deployed the js from sca dev tool and then deployed those templates from theme dev tool
s
OK, so not the extension developer tools
s
Yeah on my list. A bit busy in live tasks😅
Yes. no ext dev tool involved.
s
I'm surprised your employers expect you to use TypeScript without training you first
So, to clarify your issue: you've created a new view in your SCA directory and you've reference a template in your theme that you've created and it's throwing an error?
s
Yes sir
s
And you've activated the theme?
s
Yes sir.
s
And what is the error you're getting?
s
That Those templates are needed by those view.
s
Could you give me the exact error please.
If the names are sensitive, you can change them
s
Sir. I got that those d.ts files are declaration files for templates. But why home module doesn't contain those d.ts file while other modules do.
Ok sir thanks for helping. I will try it again,as you said there may be case mismatch,and i will ask if i get something.
s
That isn't what I was implying.
s
No sir. That was an additional question about d.ts files. What you told about the template file naming,i understood.
s
I wasn't saying anything about template file naming
I'm stepping out of this conversation, it's not going anywhere!
Good luck!
p
Sohan, if you work creating an Extension, you won't have these issues. An Extension can have Templates, scss and also JS. (As opposed to working with the 19.2 TypeScript core + Theme tool which you seem to be doing).
s
@PabloZ thank you sir for your response. Can you suggest me any way for this issue ? Actually one of our customer want a particular custom view in homepage.AFAIK, we can't do this using extension dev tool right ? It seems there is no way to add the extension as a dependency to homeview. Steve sir suggested me to use getLayout(), but i don't how it can solve this issue.
p
Sure. 2 things: 1) extensibility apis are one thing, and extension packaging is another. You can still create an extension (which will only be guaranteed compatible with your SCA in your current version) that customizes the home view with _.extend and such 2) That being said, Steve is right and with the layout component you are able to place a new child view in almost any view, and the home is not an exception. Something like this mountToApp: function mountToApp(container) { var layout = container.getComponent('Layout'); layout.addChildViews( 'Home.View', { 'PLACEHOLDER_DIV_ID': { 'NEW_CHILDVIEW_TO_ADD_ID.View': { childViewIndex: 1, childViewConstructor: function cmsHomeSlider() { return new YourChildView({}); } } } } ); }
s
@PabloZ wow.thanks for this example sir.