Indexing
...
Pipelines
Pipelines Customisation
18 min
making customisations to existing klevu pipelines before adding attributes to your pipeline yaml, please ensure they have been registered with klevu https //docs klevu com/klevu magento v4/attributes#daeae note any customisations made via these methods will override the auto generated pipeline configuration files found in var/klevu/indexing/pipeline during development, it may be useful to edit (in a non production environment) these auto generated yaml files to test out customisations before copying the yaml to a custom override file these files will be regenerated and can be deleted once the customisation override has been created adding pipeline stages note all these examples could be combined into one pipelineconfigurationoverridefilepaths file they have been split into multiple files, as we do in the modules, to make them easier to read example 1 add meta description and meta title to the default (simple, virtual, downloadable product types) product data during the add action first, in your module add or update etc/di xml add a virtual type for klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add and pass in an array of pipelineconfigurationoverridefilepaths vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="defaultproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update default yml\</item> \</argument> \</arguments> \</virtualtype> if the same changes are required during an update (almost always the case) then we’d also make the same change to klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="defaultproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update default yml\</item> \</argument> \</arguments> \</virtualtype> create the yaml file vendor/module/etc/pipeline/add update default yml stages iterateindexingrecordsbatch stages iterateindexingrecords stages processproduct stages default # product type stages generaterecord stages attributes addstages # add attribute data to the existing pipeline \# add stages accepts an array of stages to be added meta description import vendor module etc/pipeline/product/attributes/meta description yml meta title import vendor module etc/pipeline/product/attributes/meta title yml and add the 2 referenced file (this code could also be added to the above yaml, but it is more readable when split into multiple files) vendor/module/etc/pipeline/product/attributes/meta description yml stages getvalue pipeline stage\extract args extraction currentproduct getmetadescription() transformations \ striptags(null, \["script"]) \ escapehtml \ tostring vendor/module/etc/pipeline/product/attributes/meta description yml stages getvalue pipeline stage\extract args extraction currentproduct getmetatitle() transformations \ escapehtml \ tostring example 2 add color and size to configurable variant product data during the sync action first, in your module add or update etc/di xml add a virtual type klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add and pass in an array of pipelineconfigurationoverridefilepaths vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="variantproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update variant yml\</item> \</argument> \</arguments> \</virtualtype> if the same changes are required during an update then we’d also make this change to klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="variantproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update variant yml\</item> \</argument> \</arguments> \</virtualtype> create the yaml file vendor/module/etc/pipeline/add update variant yml stages iterateindexingrecordsbatch stages iterateindexingrecords stages processproduct stages variantproduct # product type stages generaterecord stages attributes addstages # add attribute data to the existing pipeline \# add stages accepts an array of stages to be added color import vendor module etc/pipeline/product/attributes/color yml size import vendor module etc/pipeline/product/attributes/size yml and add the 2 referenced file (this code could also be added to the above yaml, but it is more readable when split into multiple files) vendor/module/etc/pipeline/product/attributes/color yml stages getvalue pipeline stage\extract args extraction currentproduct transformations \ getattributetext("color") \ tostring \ trim vendor/module/etc/pipeline/product/attributes/color yml stages getvalue pipeline stage\extract args extraction currentproduct transformations \ getattributetext("size") \ tostring \ trim updating existing pipeline stages this works the same as adding a new pipeline stage in this example, we will append extra data to the description first, in your module add or update etc/di xml add a virtual type klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add and pass in an array of pipelineconfigurationoverridefilepaths vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="defaultproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update default yml\</item> \</argument> \</arguments> \</virtualtype> if the same changes are required during an update then we’d also make this change to klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="variantproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update default yml\</item> \</argument> \</arguments> \</virtualtype> create the yaml file vendor/module/etc/pipeline/add update default yml stages iterateindexingrecordsbatch stages iterateindexingrecords stages processproduct stages default # product type stages generaterecord stages attributes addstages # can also be used to override existing stage definitions description import vendor module etc/pipeline/product/attributes/description yml append the product name and sku to the end of the description vendor/module/etc/pipeline/product/attributes/description yml stages getvalue pipeline stage\extract args extraction currentproduct getdescription() transformations \ append(" ", $currentproduct getname(), " ", $currentproduct getsku()) \ striptags(null, \["script"]) \ escapehtml removing pipeline stages in this example, we will remove the rating and rating count from any configurable variant so indexing falls back to using the parent values first, in your module add or update etc/di xml add a virtual type klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add and pass in an array of pipelineconfigurationoverridefilepaths vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\add"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="variantproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update variant yml\</item> \</argument> \</arguments> \</virtualtype> if the same changes are required during an update then we’d also make this change to klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\provider\pipelineconfigurationoverridesfilepathsprovider\update"> \<arguments> \<argument name="pipelineconfigurationoverridefilepaths" xsi\ type="array"> \<item name="variantproductcustomisation" xsi\ type="string">vendor module etc/pipeline/add update variant yml\</item> \</argument> \</arguments> \</virtualtype> create the injected customisation yaml file vendor/module/etc/pipeline/add update variant yml stages iterateindexingrecordsbatch stages iterateindexingrecords stages processproduct stages variantproduct # product type stages generaterecord stages attributes removestages # remove attribute data from the existing pipeline \# remove stages accepts an array of stages to be removed \ rating \ ratingcount example module an example module with yaml files for common attributes that could be useful contains examples of how to change data synced for existing attributes add stages to pipelines add different attributes for different products types add new product types remove attributes remove attributes from data if some condition is met (in this case if the value is null) list of attribute yaml files present in the module color gender manufacturer meta description meta keywords meta title new sale size weight https //archbee doc uploads s3 amazonaws com/y9igf1t4mq0xfqfm13rfy jkml7voketv1f07jznak0 20241203 170853 zip this is not a production ready module and is intended as an example only do not install this module in a production environment