ok based on your recommended reading, I went back and simplified using Resource Router. I had used it before, but never using a callback etc. like this. I was able to get the routing part to work so I was able to eliminate pretty much all of the conditionals and the switchee statements. However, I am still not getting the results I would expect.
When I am logged in as a customer if I got to the announcement screen, based on the setting currently in the entries, I would expect to get 1 result. That is what I get if I put the low search results tag in a blank template by itself and hard wire the customer number instead of using a variable.
Now, Here’s my code, this is the initial controller template that a customer login user gets routed to for announcements:
{stash:embed:layouts:backend-base} {exp:stash:set type="global"} {stash:pg_title}Announcements{/stash:pg_title} {/exp:stash:set} {exp:stash:extend name="block:content" with="partials:announcement-list-customer"} {stash:embed:models:customer process="start" parse="yes"}
This is the model template pulling the customer company id:
{exp:stash:set type="global"} {stash:custCompany} {exp:zoo_visitor:details} {visitor:customer_business}{visitor:customer_business:entry_id}{/visitor:customer_business} {/exp:zoo_visitor:details} {stash:custCompany} {/exp:stash:set}
And this is the partial that should be returning the list of announcements (expecting 1 result):
<p>{stash:custCompany}</p> <p>{custCompany}</p> {exp:low_search:results channel="announcements" dynamic="no" limit="10" paginate="bottom" default:child:announcement_related_customers="{stash:custCompany}" parse="inward"} {if low_search_no_results}<p>You have no announcements at this time.</p>{/if} <div class="announcement{exp:channel_images:images entry_id='{entry_id}' limit='1' category='thumbnail'}-image{/exp:channel_images:images}-row"> <div class="row"> {exp:channel_images:images entry_id='{entry_id}' limit="1" category='thumbnail'} <div class="image-wrapper"> <img class="announcement-image" src="{image:url:thumbnail}" alt="{image:title}"> </div> {/exp:channel_images:images} <div class="announcement-content-wrapper"> <h3>{title}</h3> {announcement_blurb} <div class="date-posted">Date Posted: {entry_date format="%n-%j-%y"}</div> <a href="{path='login/announcements/{url_title}'}" class="btn btn-default">VIEW</a> </div> </div> </div> {paginate} {pagination_links} {pagination-code} {/pagination_links} {/paginate} {/exp:low_search:results}
I have the two paragraph tags at the top because I was trying to verify how the variable tag should be written to verify the output.
The output I am getting is the no results output. The weird thing is the paragraph tags are not there either. I would expect even if it didn’t return a value I would at least see the empty paragraph tags in the returned html but they aren’t there either. That makes me wonder if there is some sort of caching going on.
|