首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Shopware6 :管理模块不可更新

Shopware6 :管理模块不可更新
EN

Stack Overflow用户
提问于 2022-05-11 16:23:25
回答 2查看 93关注 0票数 0

在管理面板中使用搜索栏时,Shopware的默认功能不显示公司名称。我们有一些客户只填写公司字段,而不使用第一个和lastName中的文本(他们在添加"_“)。因此,我在自定义主题中从vendor/shopware/administration/Resources/app/administration/src/app/component/structure/sw-search-bar-item/复制了结构,并将其注册到我的main.js文件中,但是我在自定义主题(sw-search-bar-item.hml.twig)中所做的每一项更改在管理中都没有任何影响。

下面是默认的商店软件文件的内容:

代码语言:javascript
运行
复制
{% block sw_search_bar_item %}
<!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events -->
<li
    class="sw-search-bar-item sw-search-bar-item--v2"
    :class="componentClasses"
    @mouseenter="onMouseEnter($event)"
>

    {% block sw_search_bar_item_icon %}
    <sw-icon
        v-if="iconName"
        :name="iconName"
        :color="iconColor"
    />
    {% endblock %}

    {% block sw_search_bar_item_customer %}
    <router-link
        v-if="type === 'customer'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.customer.detail.base', params: { id: item.id } }"
        @click.native="onClickSearchResult('customer', item.id)"
    >
        {% block sw_search_bar_item_customer_label %}
        <span
            class="sw-search-bar-item__label"
        >
            {% block sw_search_bar_item_customer_label_name %}
                <sw-highlight-text
                        :search-term="searchTerm"
                        :text="`${item.firstName} ${item.lastName}`"
                />
            {% endblock %}

            {% block sw_search_bar_item_customer_label_number %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.customerNumber"
            />
            {% endblock %}
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_product %}
    <router-link
        v-else-if="type === 'product'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.product.detail.base', params: { id: item.id } }"
        @click.native="onClickSearchResult('product', item.id)"
    >

        {% block sw_search_bar_item_product_label %}
        <span
            class="sw-search-bar-item__label"
        >
            {% block sw_search_bar_item_product_label_name %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="productDisplayName"
            />
            {% endblock %}

            {% block sw_search_bar_item_product_label_number %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.productNumber"
            />
            {% endblock %}
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_category %}
    <router-link
        v-else-if="type === 'category'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.category.detail', params: { id: item.id } }"
        @click.native="onClickSearchResult('category', item.id)"
    >

        {% block sw_search_bar_item_category_label %}
        <span class="sw-search-bar-item__label">
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.name"
            />
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_order %}
    <router-link
        v-else-if="type === 'order'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.order.detail', params: { id: item.id } }"
        @click.native="onClickSearchResult('order', item.id)"
    >

        {% block sw_search_bar_item_order_label %}
        <span
            class="sw-search-bar-item__label"
        >
            {% block sw_search_bar_item_order_label_name %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="`${item.orderCustomer.firstName} ${item.orderCustomer.lastName}`"
            />
            {% endblock %}

            {% block sw_search_bar_item_order_label_number %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.orderNumber"
            />
            {% endblock %}
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_media %}
    <router-link
        v-else-if="type === 'media'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.media.index', params: { folderId: item.mediaFolderId }, query: { term: item.fileName } }"
        @click.native="onClickSearchResult('media', item.id)"
    >

        {% block sw_search_bar_item_media_label %}
        <span class="sw-search-bar-item__label">
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item | mediaName"
            />
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_cms_page %}
    <router-link
        v-else-if="type === 'cms_page'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.cms.detail', params: { id: item.id } }"
        @click.native="onClickSearchResult('cms_page', item.id)"
    >

        {% block sw_search_bar_item_cms_page_label %}
        <span class="sw-search-bar-item__label">
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.name"
            />
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_landing_page %}
    <router-link
        v-else-if="type === 'landing_page'"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: 'sw.category.landingPageDetail.base', params: { id: item.id } }"
        @click.native="onClickSearchResult('landing_page', item.id)"
    >

        {% block sw_search_bar_item_cms_landing_page_label %}
        <span class="sw-search-bar-item__label">
            <sw-highlight-text
                :search-term="searchTerm"
                :text="item.name"
            />
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_module %}
    <router-link
        v-else-if="['frequently_used', 'module'].includes(type)"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="routeName"
    >
        {% block sw_search_bar_item_module_label %}
        <span
            class="sw-search-bar-item__label"
        >
            {% block sw_search_bar_item_module_label_module %}
            <sw-highlight-text
                :search-term="searchTerm"
                :text="moduleName"
            />
            {% endblock %}

            {% block sw_search_bar_item_module_label_shortcut %}
            <sw-shortcut-overview-item
                v-if="shortcut"
                title=""
                :content="shortcut"
            />
            {% endblock %}

            {% block sw_search_bar_item_module_label_action %}
            <sw-highlight-text
                :text="$tc(`global.sw-search-bar-item.${item.action ? 'typeLabelAction': 'typeLabelModule'}`)"
            />
            {% endblock %}
        </span>
        {% endblock %}
    </router-link>
    {% endblock %}

    {% block sw_search_bar_item_other_entity %}
    <router-link
        v-else-if="detailRoute && displayValue.length > 0"
        ref="routerLink"
        class="sw-search-bar-item__link"
        :to="{ name: detailRoute, params: { id: item.id } }"
    >

        {% block sw_search_bar_item_other_entity_label %}
        <span class="sw-search-bar-item__label">
            <sw-highlight-text
                :search-term="searchTerm"
                :text="displayValue"
            />
        </span>
        {% endblock %}

    </router-link>
    {% endblock %}
</li>
{% endblock %}

下面是我需要修改的行::text="${item.firstName} ${item.lastName}" :text="${item.orderCustomer.firstName} ${item.orderCustomer.lastName}"

我只是在前面的文件中复制了整个内容,并将这两行更改为::text="${item.firstName} ${item.lastName} ${item.company}"

:text="${item.orderCustomer.firstName} ${item.orderCustomer.lastName} ${item.orderCustomer.company}"

有什么问题吗?

以下是我的main.js文件内容:

导入'./app/component/structure/sw-search-bar-item';

你可以在附图中看到我文件夹的结构

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-06-01 14:30:22

显然,这是一个来自其他地方的问题,因为我只是在另一个实例上复制了相同的文件和相同的内容,而且.它运作得很好

票数 0
EN

Stack Overflow用户

发布于 2022-05-24 05:40:58

我认为您必须以不同的方式覆盖树枝模板,因为它包含在Javascript中:

,第一个参数是要重写的组件,第二个参数是该组件的新twig模板。从'./src/extension/sw-order-detail/sw-order-细节.detail‘;Component.override('sw-order-detail',{ template,})导入模板;

有关源https://webkul.com/blog/how-to-override-a-component-in-shopware-6/,请参见此处

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72204476

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档