BroadleafCommerce / LegacyDemoSite

The New Broadleaf Commerce Demo Site
129 stars 626 forks source link

Translations not working when using page templates #203

Closed disano357 closed 7 years ago

disano357 commented 7 years ago

Hi,

we encountered a bug when trying to use the translations for pages. When you add a translation for instance for a body and you add it through the admin interface, the recorded put into the database in the entity_type column is PageTemplate. When visiting the desired page, no translation are shown. When I delete the Template word from PageTemplate and leave only Page in the column. The translations are shown.

When inspecting the Translation command in the admin interface I see the following:

<a class="show-translations" href="/admindemo/translation?ceilingEntity=org.broadleafcommerce.cms.page.domain.PageTemplate&amp;entityId=13&amp;propertyName=pageTemplate%7Cbody&amp;isRte=true"> <i class="blc-icon-globe" style="color: #94AF39; vertical-align: middle;"></i><span>Translation</span> </a>

When I remove the Template from PageTemplate: <a class="show-translations" href="/admindemo/translation?ceilingEntity=org.broadleafcommerce.cms.page.domain.Page&amp;entityId=13&amp;propertyName=pageTemplate%7Cbody&amp;isRte=true"> <i class="blc-icon-globe" style="color: #94AF39; vertical-align: middle;"></i><span>Translation</span> </a>

I can insert the translation with out any trouble and can also see the prepopulated translation. The

When I inspect the online demo the following line is their:

<a class="show-translations" href="/admin/translation?ceilingEntity=org.broadleafcommerce.cms.page.domain.Page&amp;entityId=1&amp;propertyName=pageTemplate%7Cheader&amp;isRte=false"> <i class="blc-icon-globe" style="color: #94AF39; vertical-align: middle;"></i><span>Translations</span> </a>

Is their a work around?

disano357 commented 7 years ago

I think this might be a configuration mistake on my side, but I couldn't find it. So I extended the AdminTranslationController wiht my, To be precise I overrided two methods:

You need check the entityForm.ceilingEntity property, if its set to: org.broadleafcommerce.cms.page.domain.PageTemplate

change it to: org.broadleafcommerce.cms.page.domain.Page

This is in my opinion an hack, but because I can't find a better solution, at the moment it will do.