Page 1 of 1

Page template does not working correctly

Posted: Sun Jul 26, 2015 8:11 am
by kunner
Hello.

When I change page template on Page menu, some error occurred.
But the error doesn't occur when I make new page.

Here is error message on the modal window.

Code: Select all

Unable to perform inspect for entity: org.broadleafcommerce.cms.page.domain.PageTemplate

org.broadleafcommerce.common.exception.ServiceException: Unable to perform inspect for entity: org.broadleafcommerce.cms.page.domain.PageTemplate
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

java.lang.NumberFormatException: null
java.lang.Long.parseLong(Long.java:552)


Please let me know how I can debug it.
Thanks.

Re: Page template does not working correctly

Posted: Mon Jul 27, 2015 5:00 am
by phillipuniverse
What is the request that gets sent?

Re: Page template does not working correctly

Posted: Mon Jul 27, 2015 5:56 am
by kunner
Thanks, phillip.

I found there is some error on switch page template in Page menu.

1. When we choose template
- First, Click the page-template lookup button.
- Second, Click any template
- Then, You can see error message in modal window.

It causes by customCriteria's value is missing.
When we choose any template, will meet 147 line in PageTemplateCustomPersistenceHandler.
There is no value on pp.getCustomCriteria()[1], so 147 line occurred error.

now I ask, How can I set pp.getCustomCriteria()[1] to parent's pageId?


2. If pageId set constant value(like 1) - I've solved it.
- First, Set the value to constant pageId.

Code: Select all

If (pageId==null){pageId=1;}


- Then you wouldn't see error statement.
- But you could see dynamic form did not changed.

It's original code(line 125~132, PageTemplateCustomPersistenceHandler.class)

Code: Select all

        List<FieldGroup> fieldGroups = new ArrayList<FieldGroup>();
        if (template != null) {
            fieldGroupXrefs = template.getFieldGroupXrefs();
        }

        if (page.getPageTemplate() != null) {
            fieldGroupXrefs = page.getPageTemplate().getFieldGroupXrefs();
        }


It need to change, like below.

Code: Select all

        List<FieldGroup> fieldGroups = new ArrayList<FieldGroup>();
        if (page.getPageTemplate() != null) {
            fieldGroupXrefs = page.getPageTemplate().getFieldGroupXrefs();
        }

        if (template != null) {
            fieldGroupXrefs = template.getFieldGroupXrefs();
        }


just switch between two if statements.


-----------------------

And let me ask again.
How can I solve the problem missing parent's pageId?

Re: Page template does not working correctly

Posted: Mon Aug 03, 2015 7:18 pm
by kunner
I think it was definitely a bug at 4.0-GA.

I've fixed it and push @github.

- Fix the problem - cannot choose any template in page menu
- Fix the problem - did not send parent's pages ID in PageTemplate modal window

https://github.com/BroadleafCommerce/Br ... /pull/1531
https://github.com/BroadleafCommerce/Br ... /pull/1532

Please look around and reflect.