Shopify menu and breadcrumbs shows all duplicated links as active - menu

We have a problem with our site developed by Shopify. When we have the same link in two menus, it shows both as active no matter where the customer comes from. Is there a way to prevent this?
This is how we handled the menu active links:
<summary class="menu-drawer__menu-item list-menu__item link link--text focus-inset{% if link.child_active %} menu-drawer__menu-item--active{% endif %}">{{ link.title | escape }</summary>

Related

Shopware 6: logo automatically in documents

Is there a way to automatically output the logo of a sales channel in the documents (invoice, delivery bill, etc.) without having to create a separate document for each sales channel?
Thanks for your help :-)
Unfortunately, I have not found an approach so far.
I think it currently isn't possible to differentiate between sales channels with the document settings in the administration.
You could create a media custom field for the sales channel, upload the logo there and then use the custom field in the document template.
Go to Settings > System > Custom Fields
Add a new set and assign it to Sales Channels
Within the new set create a new custom field
As type choose Media and think of a unique technical name
In the sidebar to the left go to the sales channel you want to upload a logo for
Scroll down to the custom fields of the sales channel and upload the logo with the new media custom field
Save the sales channel
Then you'll need a plugin to extend the document template. Within your plugin create the template extension e.g. at {pluginRoot}/src/Resources/views/documents/base.html.twig
with the content:
{% sw_extends '#Framework/documents/base.html.twig' %}
{% block document_header %}
{% if context.salesChannel.customFields.custom_test_media is defined %}
{% set media = searchMedia([context.salesChannel.customFields.custom_test_media], context.context) %}
{# #var item \Shopware\Core\Content\Media\MediaEntity #}
{% for item in media %}
<img src="{{ item.url }}" class="logo"/>
{% endfor %}
{% endif %}
{% endblock %}
with custom_test_media being the technical name of the media custom field you created earlier.
Here is a video how to change Shopwares Document Logos the easy way using the WYSIWYG Document Editor:
https://youtu.be/fGBMDmVMPvA?t=162
The easiest way to change your documents is by customizing them with the WYSIWYG Document Editor. The live preview will save you a lot of time and money in comparison to going back and forth 1000 times between making adjustments in your Twig Templates and generating new PDFs for testing.
Check it out:
https://store.shopware.com/appli81810362453/wysiwyg-dokumenten-editor-pdf-rechnungen-lieferscheine-gutschriften-stornos-designen.html
I am the developer, which created the WYSIWYG Document Editor Shopware 6 App. Feel free to ask me any questions about the App. I am happy to help you.

How to test if Apostrophe is in "editor mode" in a twig template

I am wanting to apply conditional CSS and template code while my Apostrophe CMS installation in "editor mode." However I have not been able to find anything in the documentation.
I have attempted to use the data.global object and the data.page object with no luck.
I am hoping to use something like
{% if data.global.edit %}
<br>
<br>
{% endif %}
You can check for data.page._edit or data.piece._edit, depending on whether it's a page template or a show.html template for a piece, to see if a user has editing privileges. If you're using apostrophe-workflow and you want to see if the user is in draft mode (edit mode) vs live mode you can check data.workflowMode as well.

Sending entry data to embedded template

I have a basic ecommerce site which has a products page, in which a full overview of the products is displayed, including thumbnails, brief description, etc. On the same page, and other pages on the site, there is a sidebar which lists the products by title only.
Since the sidebar is reused around the site I want to set this as an embedded template.
With this setup, must I retrieve all the products from the database twice; once in the main Products page, and again in the sidebar? Or is there any way to speed things up on the Products page by retrieving the entries once in the parent template and passing them to the embedded page?
For example:
products parent template:
<html>
{exp:channel:entries channel='products'}
// display full product info
{/exp:channel:entries}
{embed='includes/_products_sidbar' data={entries}} // ^ Can I pass all the data from the above loop to this embedded template?
</html>
embed:
{if data}
// if we already have the data available then use it without having to get it all again from the database
{else:if}
// if not then use another entries loop:
{exp:channel:entries channel='products'}
// display a list of products
{/exp:channel:entries}
{/if}
I think you are better of using a different approach. Have a look at layouts:
https://docs.expressionengine.com/latest/templates/layouts.html
or, if that's not possible, you can use stash https://github.com/croxton/Stash too.
oh yeah, you'll get better help on https://expressionengine.stackexchange.com/

Redirection from localhost:3000 to localhost:3000/home

I have issues to understand the Apostrophe CMS. I follow the tutorial in [Creating your first project][1] and stop just before the point where things become interesting.
I can open my basic/default website with localhost:3000 and see the content of the home.html file, while localhost:3000/home throws an error. Here is my home.html file:
my-project\lib\modules\apostrophe-pages\views\pages\home.html
{#
This is an example home page template. It inherits and extends a layout template
that lives in lib/modules/apostrophe-templates/views/outerLayout.html
#}
{% extends data.outerLayout %}
{% block title %}{{ super() }} | Home{% endblock %}
{% block main %}
<div class="main-content">
<h3>Hello world!
{% if not data.user %}
<a class="login-link" href="/login">Login</a>
{% endif %}
</h3>
<p>This is a very barebones Apostrophe project.
Now, get to work and make a real website!</p>
</div>
{% endblock %}
Where is the setting that apostrophe knows that home.html is the first (start) page which needs to be rendered?
And vice versa, I have seen a page when I call localhost:3000, apostrophe redirects directly to localhost:3000/home. Where is the setting that I tell apostrophe move automatically from localhost:3000 to localhost:3000/home?
I'm the lead developer of Apostrophe at P'unk Avenue.
Generally speaking, on a web site the "home page" is so named because it appears at "/" (at the root), not because it actually has the URL "/home". In Apostrophe the home page is always at "/" (*). Generally speaking this looks more professional than giving the home page a longer URL.
But if you really need "/home" to work for some reason, for instance to support legacy URLs and keep links from breaking, you can use the apostrophe-redirects module to add a redirect from /home and any other legacy URLs.
You could also make a subpage of the home page and set its slug to /home, but that would be a strange solution because it wouldn't be... well, it wouldn't be the home page. (The slug of the home page itself cannot be edited in Apostrophe.)
A ticket could be opened to add the ability for the home page to not have the slug "/", and for "/" to redirect to whatever the slug of the home page has been set to, but a good case would have to be made for why the feature is necessary.
(*) The only exception would be when using the apostrophe-workflow module, in which case you might have separate home pages for different languages, but you still wouldn't have "/home" in this scenario.

How to add menu items to the Communities menu in IBM Connections?

I wish to add a new menu item/link (e.g. "Stack Overflow") at the end of the menu in the screenshot below.
The new link URL would end in the community_uuid e.g. http://example.stackoverflow.com/some-page#community_uuid
Is there any good documentation available to show how this is done?
Immediately I thought of three things:
1 - Custom CSS for a community, so you could somehow add/change or maybe create a landing spot for a dom manipulation event which adds it.
In order to change the CSS, You should look at:
http://infolib.lotus.com/resources/oneui/3.0/docPublic/components/menu.htm
It's the navbar role.
In a folder such as /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/conServerCell/Communities.ear/comm.web.war/nav/common/styles/orangeTheme/
2 -
You may also want to look at /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/conServerCell/LotusConnections-config/widgets-config.xml
specifically
you could add a StackOverflow widget, when loaded it automatically opens up a new window, and transfers the person back to the previous page. ... a little bit of a kluge...
3 - Look for /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/conServerCell/Communities.ear/comm.web.war/nav/templates/page.jsp
find the line
<div class="lotusMenu" id="lotusMenu" style="display:none;" role="navigation" aria-label="Main navigation"><div class="lotusBottomCorner"><div class="lotusInner">
<div id="lotusMenuTree"></div>
</div></div></div>
You could modify the very end to add some custom link for you.
Just some quick thoughts...

Resources