paul@gh Posted December 19, 2019 Share Posted December 19, 2019 Hello ! We need to display a default "No Picture" image when a variant has no image on its own instead of displaying ALL the product images. In order to achieve this we needed to change the behavior of the ImageRetriever class. Replacing return (0 === count($filteredImages)) ? $images : $filteredImages; By return (0 === count($filteredImages)) ? [ $this->getNoPictureImage($language) ] : $filteredImages; As we do not want to modify Core code base, we had to Extends the ImageRetriever class Override the ProductPresenterFactoryCode class in order to instantiate our ImageRetriever class instead of the core one. It is working as intended for us. Pros No modification of the Core classes Cons A lot of overridden code. Even if we extends the core classes (ProductPresenterFactoryCore and ImageRetriever), we had to override every properties and methods as they are not intended to be extended (private property, ...). In my opinion this is really bad. We should be able to alter core behavior without relying on so much code override. Link to comment Share on other sites More sharing options...
selectshop.at Posted December 19, 2019 Share Posted December 19, 2019 Hi, please open own topics and don't add your question to topics not related to your problem. I'm splitting your topic from the one you added your post. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now