Jump to content

Edit History

sakonn

sakonn


Specifing problem

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.

trans-error.thumb.png.714ac278356373ce3b08e594ac9cfa0f.png

 

 

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.

image.thumb.png.a2bda1fae5f7e67f83debf3c3d8afa41.png

 

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

sakonn

sakonn

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.

trans-error.thumb.png.714ac278356373ce3b08e594ac9cfa0f.png

 

Except that I have found that I am not able to use different language at all.

image.thumb.png.a2bda1fae5f7e67f83debf3c3d8afa41.png

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

×
×
  • Create New...