Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Publisher is affecting matrix :total_rows field when previewing drafts

Status Resolved
Add-on / Version Publisher 1.6.3
Severity
EE Version 2.9.0

GabrielVH

Jun 12, 2015

Hi,

Publisher seems to be knocking out the matrix total_rows (and potentially others) fields.

I have tested this by echoing the total_rows field by itself into the template, and on the live site this is either 1 or more, but when previewing Publisher drafts it is always 0.

I have also made sure to run the P&T update link in Publisher settings.

Any ideas?

#1

BoldMinded (Brian)

Hi there. Can you share the template code in which you’re using the total rows variable? So it works fine when viewing a published version of an entry, but not a draft? I assume the Matrix rows themselves work fine, but its just that variable that is not reporting the correct value?

Also, can you try upgrading to 1.6.4 that I just released yesterday to see if it fixes the issue and to make sure we’re both working from the same codebase?

#2

GabrielVH

Hi, sure:

This is my early-parsed, low-variable EE module code that is inserted into the page, which all works fine. (Truncated, just to show use of a module using total_rows).

{exp:switchee variable="{channel_short_name}" parse="inward"}

...

  {case value="hero_module"}
    {exp:stash:append_list name="modules" context="@URI" scope="site" parse_tags="yes"}
      {stash:module_type}hero{/stash:module_type}
      {stash:entry_id}{entry_id}{/stash:entry_id}
      {stash:hm_total_panes}{hm_panes:total_rows}{/stash:hm_total_panes}
      {stash:hm_margin_bottom}{hm_margin_bottom}{/stash:hm_margin_bottom}
      {exp:stash:set_list name="panes_{entry_id}" parse="yes" scope="site"}
        {hm_panes}
          {stash:row_count}{row_count}{/stash:row_count}
          {stash:background_image}{background_image}{/stash:background_image}
          {stash:header}{header}{/stash:header}
          {stash:body}{body}{/stash:body}
          {stash:btn_text}{btn_text}{/stash:btn_text}
          {stash:btn_url}{btn_url}{/stash:btn_url}
          {stash:btn_target}{btn_target}{/stash:btn_target}
        {/hm_panes}
      {/exp:stash:set_list}
    {/exp:stash:append_list}
  {/case}

...

{/exp:switchee}

If you wish, I could give you access to the BitBucket repo and some guidance on the flow and where things are kept. For now though I’ll try the 1.6.4 update you mentioned, and will report back as soon as I can.

Cheers!

#3

GabrielVH

Sorry for the double-reply, but devot:ee is still only showing 1.6.3?

https://devot-ee.com/add-ons/publisher

#4

BoldMinded (Brian)

Oops, fixed. Try downloading again.

#5

BoldMinded (Brian)

Ok, do me a favor and output the Matrix row without Stash, Switchee etc. Create a new template with an entries tag and the Matrix tag please… just enough to re-create the issue without introducing other add-ons into the mix.

#6

GabrielVH

No worries, thanks.

Well, it’s more interesting now - because where once previously it was just the field being set to 0, now the entire playa-related entries are missing..! Haha

Though, I do have another request that could potentially alleviate the impact of the first.

Structure pages are said to be automatically configured for draft previewing, but is there a way to turn this off / disable it? As I need to use a different page layout, non-cached etc and while Publisher is doing it’s job of using the same page for the previews, it means that the draft preview actually makes it’s way to replace the actual cache of the live page.

#7

GabrielVH

I’ll work on your other reply now.

#8

GabrielVH

Ok, I have created this template:

{pg_modules} is a playa field.

{exp:channel:entries channel="pages" entry_id="2" status="{publisher:entry_status}"}

  {!-- PAGE MODULE SETUP --}

  {pg_modules}
  {if "{channel_short_name}"=="hero_module"}
    <div class="module">
      Entry ID: {entry_id} <br>
      Total Rows:{hm_panes:total_rows} <br>
      Margin Bottom: {hm_margin_bottom} <br>
        {hm_panes}
        <div>
          Row Count: {row_count} <br>
          Background Image: {background_image} <br>
          Header: {header} <br>
          Body: {body} <br>
          Btn Text: {btn_text} <br>
          Btn URL: {btn_url} <br>
          Btn Target: {btn_target} <br>
        </div>
        {/hm_panes}
    </div>
  {/if}
  {/pg_modules}

{/exp:channel:entries}

Using this URL to access it: http://localhost:4576/pages/test

If I add the Publisher draft URL parameters: http://localhost:4576/pages/test?publisher_status=draft&publisher_key=FgEYhCoV This page is blank.

If I remove the {if} statement that’s locking it to one specific module (related channel) then the other modules echo their information successfully, but the ones we are looking for are still absent.

#9

GabrielVH

Ok, I think I have found the issue - and it’s quite a silly, but obvious thing so please allow me to hit my head against the wall..!

But the entries that weren’t showing up in the draft view of the parent page, is that those child entries have no drafts to show! If I save one of them as a draft, and then draft-preview the parent page, it works fine.

So I guess I now have the question of, through the playa field, can I force the non-draft status?

{pg_modules status="{publisher:entry_status}"}

Perhaps?

But, I still now need to get over the issue of being able to set my own preview template for Structure pages - can I do that?

#10

BoldMinded (Brian)

Can you simplify it even more by just using the entries tag and calling the entry you know the Matrix field exists in that is having a problem?

#11

BoldMinded (Brian)

You can’t set a preview template in Structure directly. Have you tried using the Preview Templates settings instead?

#12

GabrielVH

I have done, but it seems to ignore whatever I put in there (e.g. /pages/preview/{entry_id}) and always tries to preview the page using it’s Structure URL.

#13

GabrielVH

Here’s my Preview Templates settings: http://cloud.roberttolton.com/image/011z1l0u231n

#14

GabrielVH

So, manually going to the page preview works: http://localhost:4576/pages/preview/2?publisher_status=draft&publisher_key=8NEhnvae

I just need Publisher to use the custom setting I’ve given it, rather than trying to do it automatically with Structure.

#15

BoldMinded (Brian)

I’d have to change the order on things for that to happen, not sure what the side effects could be. I’ll have to think on that one a bit.

#16

BoldMinded (Brian)

Comment has been marked private.

#17

GabrielVH

Hi,

Thanks for the custom build - it does indeed seem to work! Is this going to be a default feature, or perhaps something toggle-able in the Settings? Or does it just check to see if anything has been custom defined in the templates preview, and overrides?

Cheers!

#18

BoldMinded (Brian)

It’ll be included in the next release. Its probably the way it should be been functioning originally. It makes more sense for the template previews to trump any other rules/logic.

Login to reply