Configurable Product Images
3 min
Klevu, by default, will sync the variant product image for each variant. It will also sync the configurable product image as a fallback.
The pipeline for variant images looks like this
findImageToUse:
pipeline: Pipeline\Fallback
stages:
klevuImage:
import: Klevu_IndexingProducts::etc/pipeline/product/attributes/images/klevu_image.yml
image:
import: Klevu_IndexingProducts::etc/pipeline/product/attributes/images/base_image.yml
klevuImageParent:
import: Klevu_IndexingProducts::etc/pipeline/product/attributes/images/parent_product/klevu_image.yml
imageParent:
import: Klevu_IndexingProducts::etc/pipeline/product/attributes/images/parent_product/base_image.yml
placeholder:
import: Klevu_IndexingProducts::etc/pipeline/product/attributes/images/placeholder_image.yml
default:
stages:
getImage:
pipeline: Stage\StaticValue
args:
value: nullThis Fallback pipeline will return an image patch as soon as it finds one it can use.
- Get the Variant Klevu Image
- Get the Variant Base Image
- Get the Configurable Klevu Image
- Get the Configurable Base Image
- Get the Placeholder image. Placeholder is set before the pipeline begins and also uses a fallback
- Get the Klevu Image Placeholder
- Get the Base Image Placeholder
- Finally if none of the above are set, return null.
Remove Variant Images
If you wish to always sync the configurable product image only then we can update the pipeline to remove the variant product images.
Create a pipeline override file
stages:
iterateIndexingRecords:
stages:
processProduct:
stages:
variantProduct: # target variant products only
stages:
generateRecord:
stages:
attributes:
stages:
image:
stages:
findImageToUse:
removeStages:
- klevuImage
- image
Then add the pipeline override YAML file to the pipelines for Add and Update
<!-- Inject an override into the override filepath provider for Add -->
<!-- We inject the same file into Add and Update as we sync the same data, however they use different providers-->
<virtualType name="Klevu\IndexingProducts\Service\Provider\PipelineConfigurationOverridesFilepathsProvider\Add">
<arguments>
<argument name="pipelineConfigurationOverrideFilepaths" xsi:type="array">
<item name="remove_variant_image_override_add"
xsi:type="string">Vendor_Module::etc/pipeline/add_update.yml</item>
</argument>
</arguments>
</virtualType>
<!-- Inject an override into the override filepath provider for Update -->
<!-- We inject the same file into Add and Update as we sync the same data, however they use different providers-->
<virtualType name="Klevu\IndexingProducts\Service\Provider\PipelineConfigurationOverridesFilepathsProvider\Update">
<arguments>
<argument name="pipelineConfigurationOverrideFilepaths" xsi:type="array">
<item name="remove_variant_image_override_update"
xsi:type="string">Vendor_Module::etc/pipeline/add_update.yml</item>
</argument>
</arguments>
</virtualType>See Pipeline Customisation for more information on how to customise pipelines.