Right bar content, develop generic widget?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 Jahre weitere
Hello,

Just wondering if anyone had an opinion on this please.

I wish to add some content to the right hand bar, and change it regularly, to do this I think I could edit _ColumnsThree.cshtml each time, but this seems hard work.

I notice there is

@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeRightSideColumn })

So it must include widgets there. Are there any generic widgets I can download to display html please? Or can anyone point me towards a way to write one? I would like to edit the content from within the admin area.

Many thanks,

Russ
12 Jahre weitere
Hello, I'm still struggling to find a way, can anyone help please? It'd be great if the content from a topic could be inserted on the page somewhere.

Thank you
12 Jahre weitere
Hi Russ,

I'm fairly new to MVC and this is all untested but to include a topic block on in the right hand column (3 page layout) I would give this a go.

Go to Presentation/Nop.Web/Views/Home/Index.cshtml

look at

@Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })


I figure set up a new topic with a system name of RightSideColumn and put the following modified code in where you require the topic block. You may have to change some css to get it to size correctly?

@Html.Action("TopicBlock", "Topic", new { systemName = "RightSideColumn" })


into file Presentation/Nop.Web/Views/Shared/_ColumnsThree.cshtml

dont forget to put

<div class="clear">
        </div>


between items as in the original files

as I say all untested as I don't have time atm.

HTH

Dave
12 Jahre weitere
That is so simple and perfect, thank you very much!!

I was halfway there, I had already put my html directly into _ColumnsThree.cshtml, but didn't realise I can just call a topic to be displayed, thanks nopCommerce!

So in summary again for anyone else I have done the following

In Nop.Web -> Views -> Shared -> _ColumnsThree.cshtml I have added

inside the <div class="master-wrapper-leftside-3">

        @Html.Action("InfoBlock", "Common")
        <div class="clear">
        </div>
        
        //New code
        @Html.Action("TopicBlock", "Topic", new { systemName = "LeftSideAdvertising" })
        <div class="clear">
        </div>
        //End new code  
        
        @Html.Action("ManufacturerNavigation", "Catalog", new { currentManufacturerId = currentManufacturerId })
        <div class="clear">
        </div>


and inside <div class="master-wrapper-rightside-3">

   @Html.Action("MiniShoppingCart", "ShoppingCart")
        <div class="clear">
        </div>
        
        //New code
        @Html.Action("TopicBlock", "Topic", new { systemName = "RightSideAdvertising" })
        <div class="clear">
        </div>
        //End new code            
        
        @Html.Action("NewsletterBox", "Newsletter")
        <div class="clear">
        </div>


I also applied the leftsideadvertising code to _CollumnsTwo.cshtml for consistency between pages.

Then I have created two new topics, LeftSideAdvertising and RightSideAdvertising. I've then put the html straight in, in my case something like

<div class="block">
<div class="title">Advertising!</div>
HERE IS MY ADVERT!
<div class="clear"></div>
</div>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.