1

We are still having some trouble with this. We need to display the daily deals for today from businesses that match the current category. I thought I would take one last shot at seeing if you can help. I have also broken down our objective in case I said something that confused things.

Channel: Daily Deal

  1. Field: (Playa) Deal-Owner [Applebees on Charles] (selected from the list of entries in the “business-listing” channel)
  2. Field: Title [Applebees Deal]
  3. Field: Monday-deal [example: 15% Off Senior Meals]
  4. Field: Tuesday-deal [example: 10% Off Junior Meals]
  5. Field: Tuesday-deal [example: 10% Off Junior Meals]

Channel: Business-Listing

  1. Title [Applebees on Charles]
  2. City [Denver]
  3. State [CO]
  4. Status (options: Super Enhanced, Enhanced, Basic) [Enhanced]
  5. Categories: Zone [Central]

The daily deal channel has a 1 to 1 playa relationship field which connects the deal to the business. The business listing has all the relevant data about the business (address, etc) The Business is classified to a “Zone” (one of 5 locations) that is used in the URL {segment_1}.

We are attempting to view a Zone home page (segment_1 is populated with the zone name that matches the business category name).

Phonebook.com/central

On the page, only 6 daily deals are listed. The daily deals are comprised of the deal information (corresponds with the day of the week), the business name, the business city and business state.

Example: (assuming you are viewing the page on Monday)

15% Off Senior Meals Applebees on Charles - Denver, CO

Our thinking (as shown in the code below) is: Select the daily deals that have a “Monday” deal. Of those, find the associated businesses and filter to identify only those that coincide with the zone we are viewing. Of the filtered deals/businesses, show the information about the business and the deal information – and show 6 entries on the page.

The code below is what we believe should work (assuming some of it is located in embed files, but have put it all together in hopes that it will make sense).

{exp:channel:entries channel="daily-deals" orderby="random" search:monday-deal="not IS_EMPTY" limit="6"}
{if monday-deal}
{exp:playa:children field="deal-owner" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic"}
{exp:playa:parent channel="daily-deals"}{friday-deal}{/exp:playa:parent}<br>{title} - {city},{state} 
{/exp:playa:children}
{/if}
{/exp:channel:entries}

Unfortunately, something is not working. We have tried many variations, but something seems out of line. Either we cannot get the code to limit to 6 entries, or it returns only 3 entries (because the code picks up all deals and limits to 6, but of the 6, it includes those with no deal on Monday (or from different zones).

_________UPDATE_________

Ok - we have made some progress on this question and are using the code below.

Basically we need to filter the PARENT by the CHILD category (which in our case we would like to pull from segment_1 using LowSeg2 addon) Is there a way to filter the parent exp:channel:entries by a child category? {segment_1_category_id}

 {exp:channel:entries channel="daily-deals" orderby="random" search:monday-deal="not IS_EMPTY" limit="6"}
<h2>{monday-deal}<br /></h2>
{deal-owner status="Super Enhanced|Enhanced|Basic" disable="members" category="{segment_1_category_id}"}
    {if no_children} no kids {/if}
    {categories show_group="1"}category_name: {category_name}<br />{/categories}
    deal_owner: {title}
{/deal-owner}
{/exp:channel:entries}

1 Answer 1

1
{exp:channel:entries channel="business-listing" category="{segment_1_category_id}"}
  {exp:playa:parents channel="daily-deals" limit="6"}
    {title} ({entry_id})<br>
  {/exp:playa:parents}
{/exp:channel:entries}

Does this give you the right set of entries?

12
  • No, the limit doesn't work on the playa:parents tag (not sure why not??) Apr 18, 2013 at 15:23
  • Hey DD - I actually threw that code into a template on your site, with some additions to show your particular content. You can see the output at pt_test/parents. It looks like none of the businesses showing have parents. Does the data I'm getting look at all right to you?
    – Lisa
    Apr 18, 2013 at 16:53
  • The backend is built so when a daily deal entry is published, you would pick a business-listing (via playa field) that the deals belong to. When entering a deal you would enter a monday-deal, tuesday-deal, wednesday-deal etc. (minimum of one deal, max of seven deals.) Apr 18, 2013 at 18:51
  • ALSO, we have 8-10,000 business listings in the site at this point, so we dont want to start with the businesses being pulled in first because it will impact performance. Apr 18, 2013 at 18:55
  • Would it work to pull the child category into the exp:channel:entries to filter the entries at the outermost level? Could we do this with PHP? Im new to using PHP, but am willing to try it if anyone has any ideas. Apr 18, 2013 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.