sakonn Posted February 6, 2020 Share Posted February 6, 2020 (edited) Hello, I am on prestashop 1.7.6.2 and using custom theme which I want to translate but I am getting the error and blank translation screen. Except that I have found that when I swich front end of my store to different language it's not working and throwing this error. I am not sure if it's related to translations of not, but this code is causing it: # The function itself protected function buildTemplateProduct($products) { $template_products = []; foreach ($products as $product) { $product = (new ProductAssembler($this->context)) ->assembleProduct($product); $presenterFactory = new ProductPresenterFactory($this->context); $presentationSettings = $presenterFactory->getPresentationSettings(); $presenter = new ProductListingPresenter( new ImageRetriever( $this->context->link ), $this->context->link, new PriceFormatter(), new ProductColorsRetriever(), $this->context->getTranslator() ); $template_products[] = $presenter->present( $presentationSettings, $product, $this->context->language ); } return $template_products; } # The products array is deffined at different place but this is the content $products = $category->getProducts( (int)$this->context->language->id, 1, (int)$block['num'], 'date_add', 'ASC' ); I found the for each error resolved here but I didn't find right code to modify. https://github.com/PrestaShop/PrestaShop/issues/12295 Thanks for any help Edited February 6, 2020 by sakonn Specifing problem (see edit history) Link to comment Share on other sites More sharing options...
JBW Posted February 7, 2020 Share Posted February 7, 2020 Jxcategoryproducts sounds like a 3rd party Module - please contact the module deveolper. In the meantime you could try disabling the module while doing translation. Link to comment Share on other sites More sharing options...
sakonn Posted February 7, 2020 Author Share Posted February 7, 2020 Thanks. I found the error in the module and fixed it. It was enough to check the $products variable before foreach function. if(is_array($products)){ foreach($products as $product){ ... } } This fixed the back end translation page also. Link to comment Share on other sites More sharing options...
weasam Posted February 28, 2022 Share Posted February 28, 2022 (edited) On 2/7/2020 at 4:35 PM, JBW said: Jxcategoryproducts sounds like a 3rd party Module - please contact the module deveolper. In the meantime you could try disabling the module while doing translation. I believe he buy the theme from templatemonster, Cuz I had purchased from it as well, same thing happened , after sales may not help him to fix for their responsibility @sakonn Edited February 28, 2022 by weasam (see edit history) 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