-
-
Save aragon999/881f325ead3a5975e600626aacfaa2f2 to your computer and use it in GitHub Desktop.
Erweitern von sw-order-list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from 'src/core/shopware'; | |
import template from './sw-order-list.html.twig'; | |
import deDE from '../../../../snippet/de-DE.json'; | |
import enGB from '../../../../snippet/en-GB.json'; | |
Shopware.Locale.extend('de-DE', deDE); | |
Shopware.Locale.extend('en-GB', enGB); | |
Shopware.Component.override('sw-order-list', { | |
template, | |
computed : { | |
orderColumns() { | |
let columns = this.getOrderColumns(); | |
columns.push({ | |
property: 'deliveries', | |
label: 'sw-order.list.trackingnumber', | |
align: 'left' | |
},{ | |
property: 'countryId', | |
label: 'sw-order.list.country', | |
align: 'left' | |
}); | |
return columns; | |
}, | |
orderCriteria() { | |
const criteria = this.$super('orderCriteria'); | |
criteria.getAssociation('billingAddress').addAssociation('country'); | |
return criteria; | |
} | |
}, | |
methods : { | |
getTrackingNumbers(order){ | |
var trackingNumbers = ""; | |
order.deliveries.forEach(function(item){ | |
trackingNumbers += item.trackingCodes.join(", "); | |
}); | |
return trackingNumbers; | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% block sw_order_list_grid_columns %} | |
{% parent %} | |
{% block sw_order_list_grid_columns_trackingcodes %} | |
<template #column-deliveries="{ item }"> | |
{{ getTrackingNumbers(item)}} | |
</template> | |
{% endblock %} | |
{% block sw_order_list_grid_columns_country %} | |
<template #column-countryId="{ item }"> | |
{% if item.billingAddress.countryId == 'c75aecfa9a764755803a7be2805f1b20' %}DE | |
{% elseif item.billingAddress.countryId == 'c2178f4f4542406495afaec4d8ed905e' %}AT | |
{% elseif item.billingAddress.countryId == 'f2b9ae01e7464501b1b21578987ac194' %}BE | |
{% elseif item.billingAddress.countryId == 'acd8a04a06d2451b8d90785a74df1c36' %}CH | |
{% elseif item.billingAddress.countryId == 'b08ab3c94f4a4be591947fb2619b8249' %}ES | |
{% elseif item.billingAddress.countryId == 'cc8898ac4034474b98954d061f70c743' %}FI | |
{% elseif item.billingAddress.countryId == 'f56f9a8basd74428e8e1937d279e2e28c' %}FR | |
{% elseif item.billingAddress.countryId == '1067d451f17843d297e5304ddbe7bbb8' %}HU | |
{% elseif item.billingAddress.countryId == 'ae359689afe9488b86198fa559fe746d' %}IT | |
{% else %} | |
{{ item.billingAddress.countryId }} | |
{% endif %} | |
</template> | |
{% endblock %} | |
{% endblock %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment