logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
sweeperqb  
#1 Posted : Friday, May 20, 2022 12:10:36 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Starting to work on converting our existing design from AC7 to AC9. In AC7 we did extensive modification of core files. We are trying to avoid that in AC9. However, we hit another roadblock..

We're trying to add Google's Open Sans webfont to our theme. We tried copying the /Views/Shared/_Base.layout.cshtml into our Theme and adding the reference to the HTML head. However, none of the pages picked up the custom layout even though we created ~/Themes/Custom/Views/_ViewStart.cshtml and pointed it at ~/Themes/Custom/Views/Shared/_Base.layout.cshtml. I think it is because almost all of the page-level view files are hard-coded to use ~/Views/Shared/_Base.layout.cshtml. I'm not sure why they don't rely on _ViewStart.cshtml? This is an example ofwhat prevents us from using a custom base layout...

Code:
@model int
@{
    // SET BASE LAYOUT. SYSTEM REQUIRED
    Layout = "~/Views/Shared/_Base.layout.cshtml";

    // RENDER PAGE TEMPLATE FOR THIS CATEGORY
    Html.RenderAction("PageTemplate", "Product", new { Id = Model });
}


I also tried adding <Include Path="https://fonts.googleapis.com/css2?family=Open+Sans&amp;display=swap" /> to the Theme.config file, but it doesn't end up getting included either.

So what is the preferred way to include external style/font resources?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

sweeperqb  
#2 Posted : Friday, May 20, 2022 12:30:14 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
So I found a work-around. Performed a search for _Base.layout.cshtml and found that there were only 3 files referencing it...

  • ~/Views/Category/Index.cshtml
  • ~/Views/Product/Index.cshtml
  • ~/Views/Webpage/Index.cshtml

I simply copied those views into our custom theme and updated to point to ~/Themes/Custom/Views/Shared/_Base.layout.cshtml. I was able to add the Google web fonts to that file and now they are properly loaded for the site.

With plugins and the ability to override views, we should be able to do quite a bit of customization without touching core files :)
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.