ExpressionEngine: Multiple channels issue with custom URL's - expressionengine

On this page:
http://build.jhousemedia3.com/pleasanton/shop/district-profile/stoneridge-shopping-center/
The URL is formatted like so
http://build.jhousemedia3.com/pleasanton/[channel]/[template]/[query parameter]
I'm running an exp:channel:entries query using the last segment of the URL (segment_4)
What's happening is that when I run it from this URL I can't pull in data from any other channel except the specific shopping districts channel. If I were to change that last segment to /?id=28 (or something similar) I can pull data from multiple channels.
Any ideas?
Code for pulling the profile of a shopping district based on the URL:
{exp:channel:entries url_title="{segment_4}" limit="1" channel="shopping_districts"}
<h2 class="upper"><span class="greenlight">{title}</span></h2>
{if center_website}
<div class="greyroundbox right"><a href="{center_website}" class="external-link" target='_blank'>Visit the Website</a></div>
{/if}
<p>{shopping_center_description}</p>
<div class="clear"></div>
{/exp:channel:entries}
Code for pulling in any business data
{exp:channel:entries channel="businesses"}
<li class="{switch='first|'}">
<p>
{business_name}
{categories_shopping}<br />
{if phone}
<strong>Phone</strong>: {phone}<br />
{/if}
<strong>Address</strong>: {address_1}<br />
{if address_2}
{address_2}<br />
{/if}
{city}, {state}, {zip}<br />
{if website}
<em>{website}</em>
{/if}
</p>
</li>
{/exp:channel:entries}

Maybe obvious, but have you added dynamic="no" to your other loop?
{exp:channel:entries channel="businesses" dynamic="no"}

Related

Divs and H tags inside of A tags

In Kentico, I am trying to put an image and an h3 tag inside an a tag in an Editable Text web part, but Kentico rewrites the code and splits the a tags, making 2 a tags, one around the image and one around the h3. How would I get this to stop?
Here is what I am trying to write:
<div class="brick">
<a href="/virtualvalley/studentresources.aspx">
<img alt="" class="img-responsive" src="/Virtual-Valley/document-library-(1)/images/default.jpg" />
<h3>Student Resources</h3>
</a>
</div>
And here is what Kentico rewrites it as:
<div class="brick">
<a href="/virtualvalley/studentresources.aspx">
<img alt="" class="img-responsive" src="/Virtual-Valley/document-library-(1)/images/default.jpg" />
</a>
<h3>
Student Resources
</h3>
</div>

How to show a message if there are no products inside a category with exp:resso store plugin?

I'm using the latest version of EE2 and a plugin called Exp:resso store.
I have products assigned to a category and for the most part all of this is working fine. Below is my code:
<div class="col-md-7">
{exp:channel:categories channel="products" style="linear"}
<section class="section accordion repeater">
<h3>
{category_name}
<div class="icon">
<img src="/assets/local/img/plus-icon.jpg" alt="">
</div>
</h3>
<div class="accordion-content">
{exp:store:search orderby="title" sort="asc" category="{category_id}"}
{exp:store:product entry_id="{entry_id}"}
<p class="accordion-download">
{title} - {price}
<span><img src="/assets/local/img/add-to-cart.jpg" alt="">Add to cart</span>
</p>
{/exp:store:product}
{/exp:store:search}
</div>
</section>
{/exp:channel:categories}
</div>
I'm trying to find a way to show a No products exist message if the category doesn't have anything inside of it. I've tried using {count}, {total_results} & {total_rows} to check if there aren't any products. Problem is everything I try is obviously wrong because nothing gets output :/
Thanks in advance
The store search tag is a wrapper for the channel entries tag pair so you would need to use the {if no_results} tag pair.
<div class="col-md-7">
{exp:channel:categories channel="products" style="linear"}
<section class="section accordion repeater">
<h3>
{category_name}
<div class="icon">
<img src="/assets/local/img/plus-icon.jpg" alt="">
</div>
</h3>
<div class="accordion-content">
{exp:store:search orderby="title" sort="asc" category="{category_id}"}
{exp:store:product entry_id="{entry_id}"}
<p class="accordion-download">
{title} - {price}
<span><img src="/assets/local/img/add-to-cart.jpg" alt="">Add to cart</span>
</p>
{/exp:store:product}
{if no_results}
There are no products
{/if}
{/exp:store:search}
</div>
</section>
{/exp:channel:categories}
</div>
Should also be mentioned if you are not creating a form for the to add the products to the cart you could use the {store_field_short_name:price} variable to reduce the number of queries on your page. Most store things such as sku, weight, measurements can all be access by using the field short name followed by :variable

Expression Engine list category entry only

With the code below, I am currently showing all the categories for the channel, but I only need to show the category or categories for each entry. They have been checkboxed in each seperate entry.
What am I missing?
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in {exp:channel:categories channel="news" style="linear" show_empty="no"}
{category_name},{/exp:channel:categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}
Problem was, I was using regular channel type tags for categories. The correct code for this is....
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in
{categories backspace="1"}
{category_name},
{/categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}

ExpressionEngine pagination - one template, multiple channels

I've create a blog using a few templates in ExpressionEngine 2, but am struggling with how to get pagination implemented in the main/list view. I can obviously reduce the entry limit and apply the paginate attribute to the channel tag, but it doesn't work properly. It simply outputs the pagination links, but each link simply goes to a standalone page with only the newest entry.
I feel as though I may be missing something obvious, but I'm really not sure. I'd appreciate it if anyone has any input/suggestions as to how to properly implement things.
{exp:channel:entries channel="notes_entry|notes_link|notes_photo|notes_quote|notes_video" limit="20" orderby="date"}
{if channel_short_name == 'notes_link'}
<div class="link">
<h2>{title}</h2>
{notes-link-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_quote'}
<div class="quote">
<h2>{title}</h2>
<blockquote>{notes-quote}</blockquote>
<span class="source">{notes-quote-source}</span>
{notes-quote-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_entry'}
<div class="entry">
<h2>{title}</h2>
<span class="author">Written by {author}</span>
<p>{notes-entry-summary} <span>Read More…</span></p>
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_photo'}
<div class="photo">
<h2>{title}</h2>
<img src="{notes-photo-upload}" alt="" />
{notes-photo-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_video'}
<div class="video">
<h2>{title}</h2>
<div class="video-container">
<!-- start of embed code -->
{notes-video-embed}
<!-- end of embed code -->
</div>
{notes-video-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{/if}
{/exp:channel:entries}
Here's a simplified example of paginating multiple channel entries, using the Agile Records theme:
{exp:channel:entries channel="about|news" dynamic="on" limit="5" paginate="bottom"}
<p>
{if channel_short_name == "about"}
<!-- Link to the About Section Entries -->
{title}
{if:else}
<!-- Link to the News Section Entries -->
{title}
{/if}
</p>
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:channel:entries}
The output of the paginate tag pair results in the following markup:
<p>
Page 1 of 5 pages
<strong>1</strong>
2
3
>
Last ›
</p>
Which looks like the following unstyled HTML in a browser:
The creative use of the {channel_short_name} conditional allows this single code block to link to each respective section's correct single entry page URL:
About the Label
Getting to Know ExpressionEngine

ExpressionEngine SafeCracker Form Does Not Submit and Simply Refreshes Page

I have the following contact form, but it does not seem to be submitting when I have completed all of the fields as required. The page just refreshes to show the same form with the data filled in.
{exp:safecracker channel="contact_us" id="form-contact" return="contact-us/thanks" datepicker="no" error_handling="inline" include_jquery="no" rules:cf_contact_us_email="valid_email"}
<fieldset>
<legend>Your contact details</legend>
<ul>
<li><label>{label:cf_contact_us_title}</label>{field:cf_contact_us_title}{if required} *{/if}</li>
{if error:cf_contact_us_title}<li class="error">{error:cf_contact_us_title}</li>{/if}
<li><label>{label:cf_contact_us_name}</label>{field:cf_contact_us_name}{if required} *{/if}</li>
{if error:cf_contact_us_name}<li class="error">{error:cf_contact_us_name}</li>{/if}
<li><label>{label:cf_contact_us_address}</label>{field:cf_contact_us_address}{if required} *{/if}</li>
{if error:cf_contact_us_address}<li class="error">{error:cf_contact_us_address}</li>{/if}
<li><label>{label:cf_contact_us_towncity}</label>{field:cf_contact_us_towncity}{if required} *{/if}</li>
{if error:cf_contact_us_towncity}<li class="error">{error:cf_contact_us_towncity}</li>{/if}
<li><label>{label:cf_contact_us_postcode}</label>{field:cf_contact_us_postcode}{if required} *{/if}</li>
{if error:cf_contact_us_postcode}<li class="error">{error:cf_contact_us_postcode}</li>{/if}
<li><label>{label:cf_contact_us_telephone}</label>{field:cf_contact_us_telephone}{if required} *{/if}</li>
{if error:cf_contact_us_telephone}<li class="error">{error:cf_contact_us_telephone}</li>{/if}
<li><label>{label:cf_contact_us_email}</label>{field:cf_contact_us_email}{if required} *{/if}</li>
{if error:cf_contact_us_email}<li class="error">{error:cf_contact_us_email}</li>{/if}
<li class="inset"><label>{label:cf_contact_us_method}</label></li>
<li>{field:cf_contact_us_method}{if required} *{/if}<br>{error:cf_contact_us_method}</li>
{if error:cf_contact_us_method}<li class="error">{error:cf_contact_us_method}</li>{/if}
<li><label>{label:cf_contact_us_enquiry}</label>{field:cf_contact_us_enquiry}{if required} *{/if}</li>
{if error:cf_contact_us_enquiry}<li class="error">{error:cf_contact_us_enquiry}</li>{/if}
<li class="checkbox-first">{field:cf_contact_us_terms} Terms and Conditions{if required} *{/if}</li>
{if error:cf_contact_us_terms}<li class="error">{error:cf_contact_us_terms}</li>{/if}
<span class="clearfix"></span>
<li class="form-button"><input type="submit" class="submit rounded" name="send" value="Send" /></li>
</ul>
</fieldset>
{/exp:safecracker}
I wondered if anyone might be able to help me figure this out. It’s likely something incredibly obvious.
Try removing the error_handling="inline" parameter, which will allow you to see the actual error message(s) SafeCracker is presenting to you thru the User Message Templates.
In looking over your code, your SafeCracker form seems to be missing the Title {title} field, which I believe is required by SafeCracker — either thru a hidden input or supplied by the user.
To troubleshoot your SafeCracker form:
Remove the Error Handling Parameter
Include the Entry Title Field {title}
Doing this will allow you to:
See the Full Error Message
Submit the Entry to ExpressionEngine
Once you have everything working, you can change the error handling parameter back to inline.

Resources