You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
jotalops
changed the title
reference data filters in product_model_index by reference not working
reference data filters of reference data attributes not working in product_model_index
Apr 16, 2020
jotalops
changed the title
reference data filters of reference data attributes not working in product_model_index
filters of reference data attributes not working in product_model_index
Apr 17, 2020
In version 2.4 of the bundle ( akeneo 2.3 )
if we do a simple search by an attribute of type reference data simple or multiple we dont't found any results.
+++++++++++++++++
$pqbFactory = $this->getContainer()->get('pim_catalog.query.product_model_query_builder_factory');
/* @var ProductAndProductModelQueryBuilder $pqb */
$pqb = $pqbFactory->create(['default_locale' => 'en_US', 'default_scope' => 'ecommerce']);
$pqb->addFilter('rd_brand', 'IN', [$brandCode]);
+++++++++++++++++
debugging the error I found that the index product_model_index is not used by the reference data normalizers
to resolve the issue we must add that index to the normalizers:
ReferenceDataCollectionNormalizer.php
ReferenceDataNormalizer.php
we must include in the supportsNormalization method that index
....
use Pim\Component\Catalog\Normalizer\Indexing\ProductModel\ProductModelNormalizer as ProductModelNormalizer2;
....
public function supportsNormalization($data, $format = null)
{
return $data instanceof ReferenceDataCollectionValue && (
ProductNormalizer::INDEXING_FORMAT_PRODUCT_INDEX === $format ||
ProductModelNormalizer::INDEXING_FORMAT_PRODUCT_AND_MODEL_INDEX === $format
|| ProductModelNormalizer2::INDEXING_FORMAT_PRODUCT_MODEL_INDEX
);
}
......
public function supportsNormalization($data, $format = null)
{
return $data instanceof ReferenceDataValue && (
ProductNormalizer::INDEXING_FORMAT_PRODUCT_INDEX === $format ||
ProductModelNormalizer::INDEXING_FORMAT_PRODUCT_AND_MODEL_INDEX === $format
|| ProductModelNormalizer2::INDEXING_FORMAT_PRODUCT_MODEL_INDEX
);
}
I attached the fix
ProductValue.zip
The text was updated successfully, but these errors were encountered: