Page 1 of 1

Custom Pages in Foreign Language

Posted: Fri Mar 15, 2013 12:59 pm
by RWAP
When you set up several custom pages under one section (thematic), you see a list of the pages when you click on that section name (in the header/footer or wherever you placed it).

However, if you are viewing the site in a foreign language, the English titles of the pages appear when you click on the section name.

To overcome this, edit class\Action\CustomPage.php

Find:

Code: Select all

        $pages      = array_slice($pages, $bottomCut, $maxListed);
Change this to:

Code: Select all

        $pages      = array_slice($pages, $bottomCut, $maxListed);
        foreach ($pages as &$cPage){
        	$customPage=CustomPage::getInstanceFromDB($this->db,$cPage['id']);
        	$title = $customPage->getTitle($this->context->language);
            $cPage['title'] = strip_tags($title) ? $title : $customPage->getTitle($this->context->siteOptions['defaultLanguage']);
        }

Re: Custom Pages in Foreign Language

Posted: Fri Mar 15, 2013 1:04 pm
by RWAP
I have also had a couple of issues when creating a new custom page - the date can be set to 00/00/0000 (!)

The issue looks to be in class\Action\Admin\CustomPages.php, where appears the line:

Code: Select all

                $data['date']  = $par['displayedDate'];
This should surely be:

Code: Select all

                $data['date']  = $par['date'];

Re: Custom Pages in Foreign Language

Posted: Thu May 09, 2013 2:14 pm
by RWAP
The page title will also always appear in the default language for the site, rather than the user's default.

To overcome this in class\Action\CustomPage.php, find:

Code: Select all

        $title = strip_tags($title) ? $thematic->getName($this->context->siteOptions['defaultLanguage']) : $title;
Change this to:

Code: Select all

        $title = strip_tags($title) ? $title : $thematic->getName($this->context->siteOptions['defaultLanguage']);
I have also changed the code in the first post to correct an issue