Suppose package:Learning and module: Custom
Module.xml looks like
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Learning_Custom" setup_version="2.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
And then create a layout xml following path -> app/code/Learning/Custom/view/frontend/layout/catalog_product_prices.xml
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd">
<referenceBlock name="render.product.prices">
<arguments>
<argument name="default" xsi:type="array">
<item name="prices" xsi:type="array">
<item name="tier_price" xsi:type="array">
<item name="render_template" xsi:type="string">Learning_Custom::product/price/tier_prices.phtml
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</layout>
Create template inside your module or copy base template file inside your module path should be ->
app/code/Learning/Custom/view/frontend/templates/product/price/tier_prices.phtml
There is a factory method that you can use, and this is the addFilterToMap()
. Where Magento 2 rendering filter just replace the subjects of the conditions based on the mapped fields
you can call it either in _initSelect or _renderFiltersBefore method.
for a simple column which already existing in the selection (good to resolve ambiguous errors)
$this
->addFilterToMap('customer_id', 'ce.entity_id');
but in your case need to map an expression as
$this
->addFilterToMap(
'customer_name ',
new \Zend_Db_Expr('CONCAT(ce.firstname," <",ce.email,">")')
);
so the condition part of the query will be
... WHERE (CONCAT(ce.firstname," <",ce.email,">") LIKE '%@yippie.com%') ...
``` instead of
... WHERE (customer_name LIKE '%@yippie.com%') ...
also, you can use another collection related factory method to use expressions in the `SELECT` part of the query
$this
->addExpressionFieldToSelect(
'firstname',
new \Zend_Db_Expr('CONCAT(ce.firstname," <",ce.email,">")'),
[]
)
instead of
$this->getSelect()->columns('CONCAT(ce.firstname," <",ce.email,">") as firstname');
Best Answer
it disappeared after I removed this line from my grid xml
which was located inside "columns" and then "argument" tags