我是新手Magento2开发人员。 现在我正在制作一个小模块,并且卡在一个地方。 我建管理网格founded example这里是我di.xml:在Magento 2的后端修改自定义网格
<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转换为名字+姓氏?
- 列“状态”有3种不同的状态(0,1和2) - 我如何将它们转换为人类可读的单词? (undefined,good,bad)
- 如何添加到同一网格另一列例如$ price + 10%?
非常感谢! –