【发布时间】:2016-09-30 13:48:31
【问题描述】:
我是新手 Magento2 开发人员。 现在我正在制作一个小模块,但我被困在一个地方。 我用founded example 构建了管理网格,这是我的 di.xml:
<preference for="Magento\Catalog\Model\Product" type="Vendor\Module\Model\Product" />
<virtualType name="Vendor\Module\Model\ResourceModel\Grid\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">vendor_module</argument>
<argument name="resourceModel" xsi:type="string">Vendor\Module\Model\ResourceModel\Grid</argument>
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="grid_record_grid_list_data_source" xsi:type="string">Vendor\Module\Model\ResourceModel\Grid\Grid\Collection</item>
</argument>
</arguments>
</type>
我还使用带有硬编码列的布局 XML 文件:
...
<column name="customer" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">false</item>
<item name="label" xsi:type="string" translate="true">Customer</item>
</item>
</argument>
</column>
...
我的表格有如下列:产品 ID、客户 ID、价格、状态
我的问题是:
- 如何将客户 ID 转换为名字+姓氏?
- “status” 列有 3 种不同的状态(0、1 和 2) - 如何将它们转换为人类可读的单词? (未定义,好,坏)
- 如何在同一网格中添加另一列,例如 $price + 10%?
【问题讨论】:
标签: php e-commerce magento2