代码之家  ›  专栏  ›  技术社区  ›  Stacker1427

在Shopware 6管理中显示(并按其排序)客户注册时间

  •  0
  • Stacker1427  · 技术社区  · 2 年前

    我们可以在Shopware 6管理客户概述中添加客户注册时间列吗?有没有一个功能,或者我们应该为此开发一个扩展?

    0 回复  |  直到 2 年前
        1
  •  2
  •   dneustadt    2 年前

    自从你 just asked 关于覆盖组件的问题。你有没有试过看看这些组件,了解它们是如何工作的?这应该是你的第一步,也许你一开始就不必问这个问题了。

    回答你的问题:是的,你必须写一个分机。

    const { Component } = Shopware;
    
    Component.override('sw-customer-list', {
        template,
        
        methods: {
            getCustomerColumns() {
                const columns = this.$super('getCustomerColumns');
    
                columns.push({
                    property: 'createdAt',
                    label: 'Registered/Created at',
                    allowResize: true,
                    visible: true,
                    useCustomSort: true,
                });
    
                return columns;
            },
        },
    });
    
    {% block sw_customer_list_grid_columns %}
        {% parent %}
        <template #column-createdAt="{ item }">
            {{ item.createdAt | date({hour: '2-digit', minute: '2-digit'}) }}
        </template>
    {% endblock %}