Inhalte aufrufen

Profilbild

MVC Route block not working

Page Builder

  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
5 Antworten zu diesem Thema

#1 Yoram

Yoram

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 37 Beiträge

Geschrieben: 11 May 2020 - 11:02

Hello,

 

I want to import the news overview page on my homepage as a page builder block. I found a video that explains exactly what i want to do.(https://www.youtube....h?v=rsTuHDK47rQ) But if i try, it doesn't work, i get an error. The image is attached.

 

Is there something i'm doeing wrong?

Angehängte Bilder


Smartstore: Website | Webshop


#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 11 May 2020 - 13:18

Also add the area parameter to your template route:

{
  "Area": "",
  "Controller": "News",
  "Action": "HomePageNews"
}

  • stefanmueller und Yoram gefällt das

Marcus Gesing

Smartstore AG


#3 Yoram

Yoram

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 37 Beiträge

Geschrieben: 13 May 2020 - 08:06

Thanks Marcus for your answer. It is working now. You have to turn on the setting "Show on home page" in Settings > News settings. But that makes you see the news section 2 times on the homepage, in the MVC Block and on the original place. Is there a way to hide the original one?

 

I tried to turn of the setting and do someting like this, but that didn't work.

{
  "Area": "",
  "Controller": "News",
  "Action": "List",
  "command": {"PageSize": 3, "PageNumber": 0}

}


Smartstore: Website | Webshop


#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 13 May 2020 - 11:24

You can hide it using CSS in \Themes\Flex\Content\_user.scss:
.news-list-homepage {
    display: none;
}

Marcus Gesing

Smartstore AG


#5 Yoram

Yoram

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 37 Beiträge

Geschrieben: 13 May 2020 - 12:04

I tried that also, but it hides both news overviews. Thats because the class name is the same for both. For now i solved it to comment out the render action in index.cshtml. Not the best practice, but it works.


Smartstore: Website | Webshop


#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 13 May 2020 - 15:19

You can adjust the above CSS selector to only get the desired block. Something like ".page-body > .news-list-homepage".


Marcus Gesing

Smartstore AG



Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: Page Builder