# Question
Title: Assets field within Playa field + EE 2.7.1 causing template code to display on front end
I just upgraded EE to 2.7.1 and am having problems with my Playa (4.4.5) fields that pull in Assets (2.1.4) data. I have a 'homepage' channel with a Playa field that pulls articles from a 'features' channel, which includes an Assets field for (a single) image. Pulling any data from the Assets field (e.g., {url}) causes the template code for the Playa field to display, as if the parser has choked.

For example, this works fine (without the Assets field):

```
{exp:channel:entries channel="homepage"}
        {home_features}
            <article>
                <h1>{title}</h1>
                <p>{feature_summary}</p>
                <a href="{page_url}">more info</a>
            </article>
        {/home_features}
{/exp:channel:entries}

```

But this (stripped-down version) doesn't:

```
{exp:channel:entries channel="homepage"}
        {home_features}
            <article>
                {feature_photo}<img src="{url}" >{/feature_photo} {!-- this is the Assets field --}
                <h1>{title}</h1>
                <p>{feature_summary}</p>
                <a href="{page_url}">more info</a>
            </article>
        {/home_features}
{/exp:channel:entries}

```

which displays the following on the page:

{home\_features}

**Homepage**

more info

{/home\_features}

('Homepage' is the title of the homepage channel entry)

Assets fields seem to be working fine elsewhere on the site, just not within Playa fields. I did sync directories and update indexes, fyi.

Help? Thx!

# Answer
> 1 votes
This ended up being an issue with variable namespacing -- the following worked:

```
{exp:channel:entries channel="homepage"}
        {home_features var_prefix="feature"}
            <article>
                {feature:feature_photo var_prefix="file"}<img src="{file:url}" >{/feature:feature_photo} {!-- this is the Assets field --}
                <h1>{feature:title}</h1>
                <p>{feature:feature_summary}</p>
                <a href="{feature:page_url}">more info</a>
            </article>
        {/home_features}
{/exp:channel:entries}

```

---
Tags: ee2, assets, playa, ee2-upgrades
---


# Question
Title: How Do I Integrate a Datepicker On a Custom Field Within a Channel Form?
I've been searching high and low and have been unable to find a basic guide for including the EE datepicker on a custom field in a Channel Form.

What code do I need to add to the following to add a datepicker to the input field?

```
    {exp:channel:form channel="event_public" return="/" datepicker="yes" }
...
      <label for="event_date">Date*</label><br />
      <input type="text" name="event_date" id="event_date" value="{event_date}" maxlength="23" size="25"><br />
...
    {/exp:channel:form}

```

Thanks!

Randy

# Answer
> 0 votes
I am pretty sure you need to add the `datepicker` class to the input. By default, that's the selector that is used for instantiate the jQuery datepicker widget.

# Answer
> 2 votes
I think it's automatically included if you make sure to have the channel form css linked:

```
<link href="{path=css/_ee_channel_form_css}" type="text/css" rel="stylesheet" media="screen">

```

---
Tags: channel-form
---


# Question
Title: What is the default track view instance?
I am writing a plugin that has some part tha shows how many times an entry is viewed.

However, I wouldn't know the track\_view instance in advance.

I tried looking at the documentation but there is no indication which is the default.

What is the default track view instance?

# Answer
The default is not to track at all. It is purely reliant on the track\_view parameter.

If your plugin always resides inside channel:entries tag, you could attempt to access the TMPL class itself and see if you can access the parameters used for the channel:entries (which will define which track\_view is used). Alternatively package the plugin with an extension which hooks into the channel entries to get the parameter - but bit overkill.

Otherwise you could pass the entry\_id to the plugin and then read the database to see which track\_view has a number and assume that (although not 100% reliable as they may use multiple track\_views for different purposes).
> 2 votes

---
Tags: tracking
---


# Question
Title: Focus Labs Master Config $env_global not working
I'm having the same issue as described below, however can't find a solution:

> Using Focus Lab's Master Config, I've set a test global variable for production, like so:
>
> $env\_global\['global\_test'\] = 'test'; Then in an embedded template I've dropped in {global\_test}. Also tried it in a non-embedded template.
>
> In both cases the output, regardless of environment, is this;
>
> {global\_test} Am I missing something here?

source: (Why wouldn't global variable parse correctly with Master Config?)

In addition, these standard Focus Labs global variables don't work either: {global:env} {global:env\_full}

I don't think it's caused by my server environment, as I have a 2nd separate site (EE 2.6.1) where it works fine, and I've tested on localhost and stage.mydomain.com

I'm guessing it's caused by a conflict with an Add-on... I'm using a long list including Stash, CE String, CE Image, Store, Low Variables, Matrix, Assets, Wygwam, Freeform, User, Taxonomy...

My site is running EE 2.6.1

Has anyone else come across and solved this issue before?

I'd be grateful for some guidance.

Many Thanks

EDIT:

Ok. I've figured out one problem...

I'd used the two standard Focus Labs variables {global:env} and {global:env\_full} in an early parsed Low Variable. I guess the reason they weren't parsing has to do with parse order. They work fine, if added directly into a template.

That still leaves me struggling to set my own custom variable in config.local.php

This doesn't work:

```
$env_global['global:google_analytics'] = 'UA-XXXXXXX-XX';

```

Whereas this does:

```
global $assign_to_config; $assign_to_config['global_vars'] = array('global:google_analytics'  => 'UA-XXXXXXX-XX');

```

# Answer
The main cause of my problem was a self-made accidental typo in config.master.php

I'd inadvertently added 'cce' to $assign\_to\_config (no idea when or how)

Wrong:

```
global $accessign_to_config;
if( ! isset($assign_to_config['global_vars']))
{
    $assign_to_config['global_vars'] = array();
}

```

Right:

```
global $assign_to_config;
if( ! isset($assign_to_config['global_vars']))
{
    $assign_to_config['global_vars'] = array();
}

```

So with that solved, my global variables still weren't parsing inside of Low Variables. There might be an alternative solution, however this worked for me:

**An early-parsed Low Variable containing the preparse parameter**

In my template:

```
{exp:low_variables:single
var="lv_google_analytics"
preparse:tracking_code="{global:google_analytics}"
}

```

The Low Variable: lv\_google\_analytics

```
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{tracking_code}']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

```
> 0 votes

---
Tags: low-variables, focus-lab-master-config, global-variables
---


title: Input Range type - Low Search

text:
# Question
Title: Input Range type - Low Search
I am working on an online directory that will allow users to use the input range type element(a slider) to search for prices. Can this be used with low search this element, or would anyone recommend any other add-ons that would allow for the slider/input range to search my db whilst still using EE.

Thanks

Jam

# Answer
> 1 votes
Low Search is front-end agnostic. That is, it doesn't really matter what input fields you use in the search form on the front-end, as long as you name them correctly, so Low Search understands them. Input fields always relate to tag parameters: the input name should be identical to the parameter you would use in the Results tag.

In the case of ranges, you can either use a single parameter (using the *from* and *to* values 1 to 10 in this example):

```
range:field_name="1;10"

```

Or split it in two parameters:

```
range-from:field_name="1" range-to:field_name="10"

```

The `field_name` is the field you're targeting for the range.

Translated to html input elements, this is:

```
<input name="range:field_name" value="1;10">

```

...and...

```
<input name="range-from:field_name" value="1">
<input name="range-to:field_name" value="10">

```

You can then get the posted values of these parameters using the parameter name, prefixed with `low_search_`, so:

* `{low_search_range:field_name}`
* `{low_search_range-from:field_name}`
* `{low_search_range-to:field_name}`

You don't need to use `<input>`s per se; you could also use `<select>`s. As long as the `name` attribute equals the parameter name.

So, as long as you make sure the names and values are as they should be, you can use any input element you like. How you implement it, is up to you.

---
Tags: search, database, low-search
---


# Question
Title: CartThrob Not Saving Custom Member Data to Profile:Edit
When someone checkouts with CartThrob a new member is added to the member\_profiles channel using Profile:Edit. However, not all the information is coming across to the member entry.

At checkout all the customer\_info is there in the CT debugger (http://cl.ly/MG0q).

We use this on checkout.php:

```
{exp:cartthrob:checkout_form
create_user="yes"
group_id="5"
class="form"
error_handling="inline"
return="membership/order_info"}

```

But when the transaction finalises most of the customer\_info resets to 0 except for the {phone} field. And that’s what ends up in the ‘Member Profile’ channel too. (http://cl.ly/MEed)

All the correct customer info from the join.php is in the ‘order’ channel but the member\_profiles channel only has the email and phone fields. We have the member fields mapped correctly in CT and are telling it to use Profile:Edit.

Our full add to cart/save customer info form, join.php, is here http://pastebin.com/wJi4QeHM

Any ideas?

EE 2.5.3 CT 2.2.2 Profile:Edit 1.0.8

# Answer
> 1 votes
It looks as though there's a known issue with the Profile:Edit addon not saving custom fields. That could be the culprit.

> There’s a problem caused by the 2.5.4 update. Specifically, safecracker entry submissions will partially fail, resulting in custom fields not getting filled in.
>
> Problem is mod.profile.php at line 878 - the exp\_security\_hashes has changed in structure and no longer has an ip\_address column.
>
> Turning off Secure Forms is a workaround.

Disabling secure form processing is generally a bad idea, but it's worth a try in your dev environment so you can verify whether that's the problem. If it is then you'll probably have to wait for a fix to be released.

# Answer
> 0 votes
I don't know if this is related but I have a similar, non-CartThrob related, issue posted here...

Are custom member fields not functional in the registration form if the setting for "field visible in registration page" is set to "No"

Data for custom member fields are not being saved for pending members who have just signed up.

# Answer
> 0 votes
As stated here http://mightybigrobot.com/forums/viewthread/7599/ this issue seems to be solved. Did this have an effect on the above problem? Askin for this update because I am working on a site with Cartthrob and Profile:edit.

For the moderators here, I wanted my post to be a comment, not an answer, did not know how to do that.

---
Tags: members, cartthrob, member-details
---


# Question
Title: Show all entries from a given custom date field
I have a channel with a custom field (type "date") called `start`. Now I want a list of all channel entries where the `start` date is today or in the future. So according the EE documentary I'm using the following:

```
{exp:channel:entries channel="calendar" dynamic="no" orderby="start" sort="asc" start_on="{current_time format='%Y-%m-%d'}" show_future_entries="yes"}
  {title}
{/exp:channel:entries}

```

But now I only get a list of all entries with the start date = today. All future entries are not shown. It is also not clear for me what field `start_on` is looking at.

How do I get this working?

# Answer
The `start_on` parameter uses the **entry\_date**, not the custom date field you defined. To target the custom field, use the `search:` parameter. Also, you need to know how EE stores its date fields: as a Unix timestamp. Which just is a large number.

With EE 2.7+, you can use Numeric matching, so you could use that too.

```
search:my_custom_date_field=">={current_time}"

```

The `{current_time}` variable without a `format` parameter will output the Unix timestamp for right now, so using that as input for the search:-parameter should give you the desired results.
> 5 votes

# Answer
Low has pointed out the why of your dilemma. There is one other solution you can consider; Solspace's date field filter, which allows you to remap the default date ordering functionality (which as Low points out is tied to the entry\_date). This way, you can apply the "proper" ordering parameters for the entries loop, making your custom field the date to use. So then you wind up with something like:

```
{exp:channel:entries
date_field="your_custom_date_field"
date_field_start="2012-12-02 12:01 AM"
date_field_stop="2012-12-04 11:59 PM"
orderby="your_custom_date_field"
sort="asc"
}
    <li><b>{title}</b> - {date_field format="%F %j, %Y at %g:%i %a"}</li>
    {if no_results}
        <li>No results found within this time range.</li>
    {/if}
{/exp:channel:entries}

```

And like you attempted to do in your entries loop before, you can then replace your date\_field\_start param value with the current time variable.

Low would certainly know better than I how this approach would compare efficiency-wise relative to using the search parameter. I've used this add-on, which is now free, and it worked great for me. Just thought I would throw another option out there even though Low's suggestion solved it for you.
> 1 votes

---
Tags: orderby
---


title: switchee code not outputting data

text:
# Question
Title: switchee code not outputting data
This is the first time i've used Switchee and it's not outputting anything.

The code looks correct. Any thoughts?

gallery\_type is a P&T Switch field.

(I've simplified the code for sake of the example and it still is not outputting anything.)

```
{exp:channel:entries channel="collections" disable="categories|category-fields|member-data|pagination" status="open" limit="1"}
{exp:switchee variable="gallery_type" parse="inward"}
{case value="portrait"}
Portrait
{/case}

{case value="landscape"}
Landscape

{/case}
{/exp:switchee}
{/exp:channel:entries}

```

# Answer
By this way, the `gallery_type` isn't being parsed by the `exp:channel:entries`.

Try this:

```
{exp:channel:entries channel="collections" disable="categories|category-fields|member-data|pagination" status="open" limit="1"}
    {exp:switchee variable="{gallery_type}" parse="inward"}
        {case value="portrait"}
            Portrait
        {/case}

        {case value="landscape"}
            Landscape

        {/case}
    {/exp:switchee}
{/exp:channel:entries}

```

Let me say that if there isn't any other module tags, you could use traditional conditionals and to have the same performance, because `exp:channel:entries` already load everything.

But, if you are using another module inside the `case`s, switchee is a good call.
> 2 votes

---
Tags: switchee
---


# Question
Title: Error when sending email via Communicate
We just moved from development server to live server and are having issues with email settings, we get the following error when trying to send an email:

```
Fatal error: Call to protected method CI_Email::_str_to_array() from context 'Tools_communicate' in .../system/expressionengine/controllers/cp/tools_communicate.php on line 627

```

Any ideas as to why this would be?

Cheers!

# Answer
> 1 votes
While I don't know exactly what would be causing the error, I can give you something to check.

Assuming your running the exact same version of EE and all addons etc, the prime suspect for me would be the PHP modules on the live server being different from production. Just pull up phpinfo on development and live servers (you can get to it from Tools \> Utilities \> PHP Info.

YOu shouldn't need to go through the whole config, just check the compile commands on each box, look for any that are missing on the development server to the live server and that should give you a hint.

If this doesn't look to be it, best you provide a bit more info on your setup, so version of EE, any email related addons your running if any, in particular any that affect email handling like Escort etc. This will help anyone else that swings by home in on the issue.

---
Tags: php, email
---


# Question
Title: Problem with Assets in Grid "Undefined index: grid_row_id; Filename: assets/ft.assets.php; Line Number: 1310"
EE 2.7.1 and Assets 2.2.1

I have a Grid fieldtype (`static-images`) with an Assets column named `image` and a few native text field & dropdown columns. When I have at least one row in the Grid, I get the following error in the frontend:

> **A PHP Error was encountered**
>
> Severity: Notice
>
> Message: Undefined index: grid\_row\_id
>
> Filename: assets/ft.assets.php
>
> Line Number: 1310

(I also get the usual "Cannot modify header information" PHP Warnings after that.)

I've reduced the template code that displays the Grid field to the following, which still triggers the PHP Notice:

```
{static-images}
    {static-images:image:url}
{/static-images}

```

Any ideas?

Free Bonus Bug! If I mark the Assets Grid column as "Required" but don't add a file, the in-column error message shows "The %s field is required." :p

# Answer
> 1 votes
Assets 2.2 requires EE 2.7.2 to work with Grid - that was mentioned in the yesterday's blog post about the release :)

---
Tags: assets, php-errors, grid, bug
---


title: Bypass EE's Template Parsing Structure

text:
# Question
Title: Bypass EE's Template Parsing Structure
I have, more or less, have these structure

```
templates
    test.group
       index.html
       another-file.html
       assets
           styles
              foo.css
           scripts
              bar.js

```

As you can see, I put some Javascript and CSS files into a template folder in JS.

I have reasons for this so let's say this is our goal.

I need to include `foo.css` and `bar.css`. To access it, I tried

```
<link href="{site_url}index.php/test/assets/styles/foo.css" rel="stylesheet" type="text/css" />

<script src="{site_url}index.php/test/assets/scripts/bar.js" type="text/javascript"></script>

```

But this does not work. What I saw was the contents of `index.html`.

Which is the correct result if you follow EEs template structure.

But I want to bypass this. I want to be able to access the css and js file.

Is there a way to do this?

# Answer
> 2 votes
So far as I know, you can't use nested folders on template groups.

Try this:

```
templates
    test.group
       index.html
       another-file.html
    styles.group
        foo.css
    scripts.group
        bar.js

```

Or, if you templates are on or below the site root, you can try this, what **isn't a good idea**:

```
<link href="{site_url}/themes/site_themes/default/test.group/assets/styles/foo.css" rel="stylesheet" type="text/css" />

<script src="{site_url}/themes/site_themes/default/test.group/assets/scripts/bar.js" type="text/javascript"></script>

```

Or this, if your {site\_url} doesn't have a trailing /.

```
<link href="{site_url}themes/site_themes/default/test.group/assets/styles/foo.css" rel="stylesheet" type="text/css" />

<script src="{site_url}themes/site_themes/default/test.group/assets/scripts/bar.js" type="text/javascript"></script>

```

By this way, depending on your server setup, **anybody can find your other templates and see them**.

# Answer
> 0 votes
Normally I keep my CSS and JS files outside of templates in an assets directory inside of the site's document root. Though EE supports using templates for CSS and JS, I've found it's rarely necessary to use them in that way.

---
Tags: templates
---


title: Is there a way to archive old entries

text:
# Question
Title: Is there a way to archive old entries
We have a large site with 100k+ entries in exp\_channel\_data The admin section straggles when trying to edit entries and change or add channel fields. It takes almost 80 seconds to add or alter a field and more than 10 seconds to list or edit an entry. Is there a way to archive old entries to a different channel (add-on maybe) or something similar? How do we deal with such large sites? You can find more about this here http://ellislab.com/forums/viewthread/238313/ Is there anything we can do about this? - or this is it? EE has its limits.

# Answer
> 1 votes
First, just note that it's safe to assume that adding more memory / faster servers for both your EE/Apache and MySQL will make things work better. 100k+ entries is enough to require more horsepower than a smaller site, but that generally can be addressed through reasonable upgrades.

That said, I was just working on a site with 75k+ entries--and we were definitely seeing performance issues around adding fields (especially because there were hundreds of fields already, with a lot of data in most of them). EE sticks all of your entry data ("custom fields") in one MySQL table, and every field change and entry change has to compete for lock access (and new fields = new MySQL columns which lock the whole table while it's being restructured).

And, just to add: this is a kind-of tricky situation where there's no one solution that matches every site's content and archiving needs.

So, you have some options, depending on what you mean by "archived."

**What worked for me:**

For the site I was just working on with 75k "archivable" entries, we simply made a usable backup of the site and DB, and then deleted the 75k entries and corresponding channel fields from the live site. These entries already were not visible on the live site, but they do need to be stored indefinitely for business reasons.

Now, we are able to bring up this backup copy of the site on a development machine if we need to access those entries. And the live site is much happier.

**Other options:**

If you want to make the Edit list faster when you're using filter by channel, you can move the old entries to a different channel(s). You need to create a new channel that has the exact same field, category and status groups as your current channel. Then, you should be able to go into an entry, and select between the current and archive channel in the Channel drop down.

If this works, then you can use MySQL to mass update change the channel\_id for the entries that you want to move to the archive channel. The channel\_id field is used in these tables in EE MySQL:

* exp\_channel\_data
* exp\_channel\_entries\_autosave
* exp\_channel\_form\_settings
* exp\_channel\_member\_groups
* exp\_channel\_titles
* exp\_channels
* exp\_comments
* exp\_entry\_versioning
* exp\_layout\_publish

At a minimum, you'll need to update the channel\_id for entries in exp\_channel\_titles and exp\_channel\_data. You'll need to update it in other tables if you're using the relevant featurs--e.g., if your entries have comments, you'll need to update in exp\_comments, too. Also, some add-ons use channel\_id, like Low Search stores the channel\_id in exp\_low\_search\_collections.

But, generally, you can handle the new channel configuration via the EE control panel, and then do a mass update via MySQL of the entry\_id \<-\> channel\_id relationships.

**Or:**

You could split your site into two EE installs, one with current entries, and one with the archived entries. These could live on two sets of Apache / DB servers. You could have these live at separate domains (e.g., example.com and archive.example.com), or use a reverse proxy to have one domain access both sites.

This would be easy to create from a MySQL backup. If your site continues to grow such that you eventually have to figure out how to move entries from the current to the archived copies of the site, that will be a little harder to deal with. But, again, developing queries in MySQL for selecting the relevant data, and then exporting it, will work.

---
Tags: add-on, channel, fields
---


# Question
Title: Cart Throb Permissions: The requested module page could not be found
Does anyone out there have Cart Throb Permissions working as it should? I have NEVER been able to get it working properly since I purchased it.

up2date EE 2.7.1 CartThrovb 2.4 and Permissions 2.3.3

I still get error:

```
The requested module page could not be found.

```

when click next page at the bottom of my permission module page. I con only access the first 50 permissions and cannot view the next page.

# Answer
> 1 votes
actually found the issue. When I did the upgrade the file Mbr\_addon\_builder.php was not deleted and it should have been.

---
Tags: cartthrob, permissions
---


# Question
Title: XID created for every page load and many non-form items increasing size exp_security_hashes table. Bug with 2.7.1?
Here's the setup:

* secure forms turned on
* empty template (there are no forms, nothing at all in the template)
* EE 2.7.1
* logged in/out (makes no difference)
* empty exp\_security\_hashes table

Every time I refresh/load the empty template in my browser an extra hash is created in the exp\_security\_hashes table.

From reading the docs I understood the XID was only created for forms. Am I missing something?

Creating a new XID for every page load on the front end doesn't seem right! Maybe 'secure forms' should be renamed 'secure site'.

Edit: And this template creates two XIDs, one for the form and the other for the (page??). Each XID is different but sames session\_id.

```
{exp:user:edit return="myprofile/success" form:id="form_2" screen_name_password_required="no" dynamic="off" }
<input type="text" name="username" value="{username}"/>
<input type="submit" name="submit">
{/exp:user:edit}

```

The XID for the page is never set to 'used' so is never cleared.

And it looks like the XIDs dont get cleared until ee()-\>security-\>garbage\_collect\_xids() is called once every 7 days.

I've raised this as a bug and await EE response, which Ill post here.

# Answer
> 1 votes
Edit: heres the bug report response from EE

> It’s really not a bug, but it would be nice if we could only generate it when needed- i.e., the template parser spots a form tag. The sticking point is ajax and how the lack of an xid would jam things up there.
>
> I know this started the devs bouncing some ideas around, but at the moment, the behavior is expected. And to be clear, it’s always generated the xid on page load- so while it would be great if they come up with a way to reduce those xid inserts, it’s not adding new overhead.

The issue i see is xids are also being created for more things than just page load and forms, which dont appear to be 'used' and cleared, resulting in quickly increasing size for exp\_security\_hashes table.

My solution for now, is to just run this via a cron job every day

```
ee()->security->garbage_collect_xids()

```

---
Tags: security, xid
---


# Question
Title: Low Search paginate_base URL with Structure & Freebie
When using the `paginate_base` parameter with `exp:low_search:results` (I'm also using Structure, Freebie) any time I reference the channel short\_name either as {segment\_1}, {freebie\_1}, {channel\_short\_name} or even hard code the channel short name, the pagination URL has the search query in the wrong place.

Using:

```
paginate_base="{freebie_1}/{freebie_2}/{freebie_3}/{freebie_4}/{freebie_5}/{freebie_6}"

```

When the URL is:

http://domain.com/yarn/title/asc/1/brand/dmc/P1?keywords=test

the generated pagination URL is:

```
http://domain.com/yarn/?keywords=yarntitle/asc/1/brand/dmc/P2?keywords=yarn

```

But if I hardcode a non-existing channel\_short\_name at {segment\_1} - for example: foo

`paginate_base="foo/{freebie_2}/{freebie_3}/{freebie_4}/{freebie_5}/{freebie_6}"`

the generated pagination URL path is correct! Eg:

```
http://local.tricotshop.co.uk/foo/title/asc/1/brand/dmc/P2?keywords=test

```

But if I use a standard `exp:channel:entries` loop (without the results query), the generated pagination URL is correct.

Can anyone tell me why this is happening and how I can fix it please?

Thanks!

# Answer
> 1 votes
Basically I was using freebie segments to dynamically add sorting and ordering parameters. Low took a look at the site and recommended that the better (and correct!) way of dynamically adding the sorting and ordering parameters in Low Search is to build the URL and include them in the query. This can be done numerous ways, but the end result looks something like:

`domain.com/channel?orderby=date&sort=desc&limit=15&custom_field=foo`

Great product, great support. Will definitely use again.

---
Tags: structure, search, low-search, pagination, freebie
---


title: Pre-populated content in Wygwam?

text:
# Question
Title: Pre-populated content in Wygwam?
Is it possible to have Wygwam (or any custom field) pre-populated with content when you create a new entry?

I'm aiming to give my client a table, with some cells already filled in.

# Answer
> 4 votes
CKEditor (which is the editor used by Wygwam) has a feature called Templates that you can use for this.

> With CKEditor content writers can select a template from a list by clicking the Templates button in the toolbar. A template is a predefined piece of HTML that is inserted into a document. Using this feature, the user does not need to start formatting the text from scratch. Designers can prepare well designed templates which helps avoid user errors before they happen.

The end user would still need to click the templates button to get the boilerplate content. So it wouldn't pre-fill the entry immediately, but it would do so with one click.

---

Alternatively, take a look at these related questions for some other approaches. Or Jeremy's answer here in this post is great, too.

1) Pre-populate a text input field

2) Pre-fill matrix field when creating new entry?

3) Auto populate a field? (In this case a Matrix cell)

# Answer
> 0 votes
I don't think this is possible. But you could easily write a small custom accessory to do it with JavaScript.

---
Tags: wygwam, custom-fields, textarea
---


title: Texture as color variation

text:
# Question
Title: Texture as color variation
I have products with different texture patterns ( See attached #patterns). \[ I am using EE 2.7.0 + Expresso store 2.0.3. \] I want these texture patterns as variation.

Configuration:

Channel: Products \[ product \] Channel Fields: Specification \[ specification \] \- Modifier type : Variation \- Name : texture \- Options : adobe, sephia, ...etc

Now through these options or any other way I want thumb to display for each variation.

Thanks, Parth

# patterns

# Answer
Set your options names the same as the image filename (without extension) and use that to pull the image.

```
{exp:store:product entry_id="{entry_id}" return="/checkout/basket"}
  {modifiers}
    {if "{modifier_name}" == "texture"}
      {modifier_options}
        <img src="your-path-to-images/{option_name}.jpg"/>
      {/modifier_options}
    {/if}
  {/modifiers}
{/exp:store:product}

```

I've not done the correct html for radio buttons and labels with images, but you get the idea.

You need to set the value for the form elements as the `{option_id}` for Store to be able to understand it.

If you have Colour/Color ;) labelling with spaces or want capitalisation and don't want to worry about it for filenaming, then you can use the `{option_id}` as the filename instead.

Docs
> 2 votes

---
Tags: expresso-store
---


title: Displaying ICS data in ExpressionEngine

text:
# Question
Title: Displaying ICS data in ExpressionEngine
I'm trying to help out with a client that manages its own in-house web server, where iCal and BusyCal are used to maintain a dozen or so calendars. These calendars are displayed for members in a portal facilitated by ExpressionEngine.

The previous developer, who is frustratingly unavailable, hacked together an add-on that parses .ics files with SG-iCalendar, turns events into a JSON feed, and uses loads of JavaScript to render them in this portal. The result is a poorly-performing calendar that's now incorrectly rendering *some* recurring events depending on how they're defined in the ICS format.

Is there a better way to reliably display calendar events in the portal without requiring the client to change the way they currently manage events? iCal, BusyCal, and Outlook all do just fine rendering these calendars accurately – but I'm not sure what to advise to help the client away from this hack and *not* waste money having me re-invent the wheel with a new parser.

# Answer
Easy iCalendar?

SolSpace Calendar (hell of a price tag though!)

Note I've not used either so can't recommend and you'd need to explore further!
> 1 votes

---
Tags: calendar, ical
---


title: Custom config files in an EE addon

text:
# Question
Title: Custom config files in an EE addon
I moved a custom addon out of system/third\_party into a third\_party folder above web root

all was well until I realized that the addon didn't account for a different third\_party folder location

I updated the paths but now I'm having some strange issues with EE not loading custom config files

I'm loading the these files in the constructor of the mcp file.

```
$this->_EE->load->add_package_path(PATH_THIRD . 'custom_addon/');
$this->_EE->load->config('custom_addon');

```

the config files seem to load fine (I don't get any errors) but I can't access the config items in the file

```
$this->_EE->config->item('some_value');

```

doesn't return anything

any idea what's up?

EE2.6.1

# Answer
I've not used load-\>config but all the other load commands allow for a second parameter:

```
$this->EE->load->model('filterdb_model', "filterDB");
$modules = $this->EE->filterDB->get_installed_modules($moduleName);

```

So the second parameter is the reference to the class. But reading the CI documentation for config doesn't seem to behave the same - it expects a boolean :(

Personally I just do this:

```
require PATH_THIRD.strtolower(get_class($this)).'/config/config.php';
$this->name = $config['name'];
$this->version = $config['version'];

```

CI Docs

Forums

Another CI reference
> 1 votes

---
Tags: add-on-development, module, extension, config
---


title: XID issue with Ajax based checkout CT

text:
# Question
Title: XID issue with Ajax based checkout CT
Thanks for taking the time to help. I am having a ready head scratcher with a single page checkout system for CT.

I have built a accordion type checkout system. First panel is the billing address and then once validated it submits via Ajax and opens the next stage - shipping etc.

Each panel has a CT checkout form in it that submits, updates info and shipping details. Each stage of the checkout works well and data is updated in the backend.

However, the last step - Actually confirming and payment, won't submit and redirect to the payment provider. I have noticed that the XID is empty. In fact, if I look at the code, the first form "billing info" has an XID. When shipping is opened, that form has a blank XID, but it submits OK.

The response coming back from the POST has different XIDs in each form. But if I view source, it doesn't show - XID is just blank.

This checkout worked before 2.7. I understand that EE has had some work done on the XID for 2.7.

I need to launch this site tomorrow and really could do with some help.

Here is a JS Fiddle with my code. I really hope someone can help. http://jsfiddle.net/KByhm/

Thanks again for taking the time to look.

# Answer
I see you're already attempting to grab the new XID from the return data of the Ajax call:

```
// update the XID hash in the form so we don't run afoul of EE's secure forms
$("input[name=XID]").val(response.XID);

```

But I fell onto this documentation the other day which I think is new and relating to new EE version handling.

Seems like if submitted by Ajax the updated XID is no longer returned as part of the form, instead it's part of the Ajax header.
> 3 votes

# Answer
YYYYYYEEEEEEEEESSSSSSSS!!!! Thank F for that.

I have got this working. Peter's answer was the right way to go. It was in the docs all along! For those that may run into a similar situation, I fixed this by adding the recommend ajaxPrefilter that is mentioned in the docs - with a little tweak to define the form.

An updated JS Fiddle: http://jsfiddle.net/aSDju/

Super sweet - I freakin' love this community. Thanks for all you input guys. I can breath easy once more.
> 2 votes

# Answer
This isnt an answer as such, just some comments. In 2.7, if secure forms is on, a form wont submit without an xid. Prior to 2.7 it would if youd created your own form tags. If xid is blank, you can add it manually like this

```
<input type="hidden" name="XID" value="{XID_HASH}" />

```

This answer may help too link Good luck
> 1 votes

# Answer
Every time you submit the form, you need to create a new XID and pass it back into the hidden input values. Essentially, each time you process the form it uses the XID token so the next time you process it without a page load, you will get that error.

It's also possible the CT devs could add some to code to reuse the last XID if an AJAX request has been detected. This is just a theory, but it could work. Below is the minimum code needed in the checkout form tag.

```
if(AJAX_REQUEST)
{
    ee()->security->restore_xid();
}

```

For more information refer to the dev docs.

http://ellislab.com/expressionengine/user-guide/development/guidelines/security.html#handling-form-hashes-in-your-add-on
> 1 votes

---
Tags: cartthrob, ajax, checkout, xid
---


# Question
Title: How can I translate the Freemember error messages into a different language?
How can I translate the Freemember error messages into a different language?

Specifically the error message like: The {field\_name} is required.

# Answer
That particular message you are looking for comes directly from ExpressionEngine. You can translate the built in EE strings in the same way (in your `system/expressionengine/language` folder).

Another option if you don't want to bother translating EE is to use the error variables as conditionals. Instead of `{error:field_name}`, you can use:

```
{if error:field_name}
    Custom error message
{/if}

```
> 3 votes

# Answer
You should be able to add a language file to the add-on.

Duplicate the directory expressionengine/third-party/add-on-name/language/english, rename it as the appropriate language then modify the file within it with your new language.

This next bit is an assumption on my part... How you tell EE to use that language is, I think, down to the locale settings for the site/member in question. If an appropriate language file exists for their selection then it will be used.
> 1 votes

# Answer
To make te translation for the tag `{error:field_name}`, you must do a translation in codeigniter. The specific form translation are in the file:

`system\codeigniter\system\language\english\form_validation_lang.php`

I don't know how the select a different language for codeigniter so I just translated the English files because I only need one language.
> 0 votes

---
Tags: freemember
---


# Question
Title: Display a custom field with Rich Text Area fieldtype
In the documentation, I don't see anything here on how to display a field with fieldtype of textarea(richtext)

How do I display that field?

# Answer
If the channel Field Type is set to 'Textarea (Rich Text)' then you can just use the Field Name as the tag - eg: `{your_rte_field}`.
> 1 votes

---
Tags: custom-fields, textarea
---


# Question
Title: Updating from Safecracker to Channel Form
I just updated to EE 2.7.1 and now using Channel Form in place of Safecracker. I can't seem to sort these two bugs:

1) Any existing 'file' custom fields behave as if they are required, throwing up the error "You did not select a file to upload." if left empty. (edit: this also happens in the CP, not just Channel Form problem)

2) The datepicker creates undefined text like this: "2013-10-01un1efine1". It does work if I use {field:my\_date} but then get the localised/fixed select menu, and the only way to remove it is to hide it using css.

I'd be interested to hear anyone else's problems with the Safecracker to Channel Form problems.

# Answer
> 1 votes
The second bug is also reported: https://support.ellislab.com/bugs/detail/19782

Try editing system/expressionengine/modules/channel/libraries/Channel\_form/ Channel\_form\_lib.php around line 966 so it looks like:

```
if ($this->datepicker)
 {
  $js_defaults['ui'][] = 'datepicker';
  $js_defaults['file'][] = 'cp/date';

}

```

You’re just adding the $js\_defaults\[‘file’\]\[\] = ‘cp/date’;.

---
Tags: safecracker, channel-form
---


title: Stash Error: "unknown cache type"

text:
# Question
Title: Stash Error: "unknown cache type"
I'm using Stash `append_list` and `get_list` tags to output a set of entries grouped by channel. Below it I have a separate channel entries loop with a simple date checker plugin:

```
{exp:channel:entries
  channel='cookies|cakes|pies'
  dynamic='no'
  cat_id='375'
  disable='member_data|pagination|category_fields'
  sort='asc'
  status='not closed'
  parse='inward'
}
  {exp:stash:append_list name='treats' context='{channel_short_name}'}
    {stash:title}{title}{/stash:title}
  {/exp:stash:append_list}
{/exp:channel:entries}

<h3>Study Materials</h3>
<ul class="study-materials">
  {exp:stash:get_list name='treats' context='cookies' process='end' parse_tags='yes' parse_conditionals='yes'}
    {title}<br>
  {/exp:stash:get_list}

  {exp:stash:get_list name='treats' context='cakes' process='end' parse_tags='yes' parse_conditionals='yes'}
    {title}<br>
  {/exp:stash:get_list}

  {exp:stash:get_list name='treats' context='pies' process='end' parse_tags='yes' parse_conditionals='yes'}
    {title}<br>
  {/exp:stash:get_list}
</ul>

{exp:channel:entries
  channel='purchased_items'
  limit='1'
  dynamic='no'
  disable='pagination|categories'
  search:purchased_id='{subscription_ids}'
  author_id='{logged_in_member_id}'
}
  {exp:entry_age type='older' days_old='365' entry_date='{entry_date}'}
    <p>Your plan has expired. <a href="{path='features-and-pricing'}">Renew.</a></p>
  {/exp:entry_age}

  {if no_results}
    <p>You are on the free plan. <a href="{path='features-and-pricing'}">Purchase a subscription</a></p>
  {/if}
{/exp:channel:entries}

```

I get this error when I access the template:

> Stash: unknown cache type defined by the type="" parameter.older

# Answer
> 1 votes
This was a Stash bug. Fixed in v2.4.3. More Info.

# Answer
> 0 votes
A couple of suggestions.

1) You have a problem with parse order. The get\_list is parsed before append\_list. Try wrapping the channel entries tag in a set\_list instead. Refer to stash docs and examples.

2) change the get\_lists to this

```
{exp:stash:get_list name='treats' context='pies'}
    {title}<br>
  {/exp:stash:get_list}

```

Removed these:

* parse\_tags='yes' - you dont have any tags inside the get\_list
* parse\_conditionals='yes' - you dont have any conditionals inside the get\_list
* process='end' - this may be further confusing the parse order

Then remove the second channel entries tag and get the top part of template working first.

---
Tags: stash
---


title: Expresso Store / Stripe

text:
# Question
Title: Expresso Store / Stripe
I have successfully implemented Stripe payments for a saas service, and all is well. Everything has been recorded in store, in my orders area. Looking in the order, I see the details of the transactions, status, reference etc.

So if I am looking at this from the saas point of view, when my next months payment gets pushed in stripe (and it will automatically as a plan billed monthly), is there anything in Expresso store which will record this as an action as part of the same payment, as a transaction on the same order?

I am looking forward - that if someone subscribed to a service, they pay the first month, then the next month they cancel or indeed keep paying, there's some notification of this so I can leave them work away or lock them out accordingly.

# Answer
Currently Store does not support recurring payments or subscriptions, it is currently a feature request so you can show your interest by voting for it.

If you need something soon you have a few options you can build an extension that listens for the request from Stripe and then does something in the system. Full extension hook documentation is available here. The other option is you could email support@exp-resso.com and see about sponsoring the feature.
> 2 votes

---
Tags: expresso-store, ecommerce, stripe
---


title: Change the email language

text:
# Question
Title: Change the email language
I think my question is very easy, but I can't find out how. I have changed the default language under Admin \> General Configuration to "Dutch". But the e-mail that are send when a user registers or does a password recovery are all in English. The Dutch file `email_date.php` does contain the translation but this English is send.

How do I fix this? Of do I need to change another language setting?

# Answer
You can alter the content of the emails (including the language) any way you like:

Log into the CP, goto Design --\> message pages --\> Email Notifications
> 1 votes

---
Tags: members
---


# Question
Title: Solspace Freeform: How to dynamically set admin notification email
Using Solspace's Freeform, how can I dynamically set the admin notification email address? Ideally i'd like to set this via Low Variables so that my client can change all of their contact information in one window.

# Answer
You can do this by putting your dynamic variable in the `admin_notify=""` parameter for `{exp:freeform:form}`. (Don't forget to use `notify_admin="yes"` as well if you haven't already enabled admin notifications in the Freeform module CP)

Here's an example using the {exp:channel:entries} tag pair and a custom channel field containing an email address called {my\_email\_address\_field}. I'm assuming a similar strategy can be used with Low Variables.

```
{exp:channel:entries /* your other parameters here */}
  {exp:freeform:form
    notify_admin="yes"
    admin_notify="my_email_address_field"
    // Your other parameters, such as form_id="" or form_name=""
    }
    // Your form
  {/exp:freeform:form}
{/exp:channel:entries}

```

Make sure my\_email\_address\_field is parsed correctly in the `admin_notify=""` parameter. You can confirm that by **turning on Template Debugging** in EE and looking for the {exp:freeform:form} tag containing admin\_notify="".
> 1 votes

---
Tags: solspace
---


# Question
Title: Using entry_id parameter with Solspace Favorites
I'm making a filter functionality where the user can do a keyword search and sort by "Newest", "Most viewed" and "Most pinned". I'm using Low Search to do the search, Solspace Tracker for counting views, and Solspace Favorites to let the user pin content.

My approach to get the results is to first do the search with Low Search (if the user did a keyword search) and stash away the resulting id's. Then insert the id's into the entry\_id parameter. This works great when I use {exp:channel:entries} and {exp:tracker:rank}, but not with {exp:favorites:rank}. Here's a stripped down example of my code:

```
{exp:favorites:rank
    entry_id="{exp:stash:get name='search_result_ids'}"
    show_unfavorited="yes"
    orderby="count"
    channel="article"
    limit="10"
    pagination="bottom"
    parse="inward"}

    entry_id = {entry_id}<br>

{/exp:favorites:rank}

```

Even if I harcode id's into the entry\_id parameter, all entries are being returned. Is this a bug, or intended behavior? It says in the documentation that "Most of the parameters available in the Channel:Entries loop are available here", which really isn't much help. "Most of" could mean that entry\_id isn't one of them, but who knows? :)

# Answer
I just did a test with hard coded entry ids like this

```
entry_id="5172|5188"

```

It returned the same results as omitting the entry id param. So i would say, yes the entry\_id is not available as a param for rank.

Note:docs say this The Favorites:Rank loop shows and ranks channel entries by the amount of times they've been saved to Favorites by members.

And it looks like you want to rank (by favorites count) unfavorited entries!

This doesnt work either

```
{exp:favorites:entries entry_id="7702|5188" } {entry_id}{/exp:favorites:entries}

```

Sorry, cant help you.
> 1 votes

---
Tags: solspace
---


# Question
Title: How do I create a list of distinct categories for related entries of a single channel entry?
I have the following setup:

1. Each entry in a parent channel a number of related child entries from a child channel. These use a standard EE relationship field called “children”.
2. The parent channel does not use categories.
3. Each entry in the child channel has a category associated to it.
4. There will be a some child entries related to a single parent entry from the same category.

Given a single parent channel entry, how do I generate a list of the categories for its related child entries without including duplicates if more than one child entry has the same category?

Here’s what I’ve tried so far, which results in duplicate entries when child entries are in the same category.

```
{exp:channel:entries limit="1" channel="parent_channel" disable="{sn_disable_standard}" required="Yes"}
    {children}
        {children:categories}
            {category_name}
        {/children:categories}<br />
    {/children}
{/exp:channel:entries}

```

Is there a plug-in that I can use to store the results in a variable, then strip out the duplicate entries?

Or can this be done using standard EE tags? Or even the query module?

# Answer
> 2 votes
So there's a couple options to solve this. Which one you choose will depend on what Addons you want to use. As far as I can tell, there's no 100% native way to solve this.

The principle is to first get all of the child entry ids. You can then use the GWcode Categories plugin `entry_id` parameter to filter by these ids. The difference is how you get the IDs in the first place.

**First option:** Store ids using stash.

```
{exp:channel:entries limit="1" channel="parent_channel"}
    {children}
        {exp:stash:append_value name="entry_ids" value="{entry_id}|"}
    {/children}
{/exp:channel:entries}

{exp:stash:parse process="end" priority="2"}
    {exp:gwcode_categories entry_id="{exp:stash:get name='entry_ids' backspace='1'}" parse="inward"}
        {cat_name}
    {/exp:gwcode_categories}
{/exp:stash:parse}

```

Note the `{exp:stash:parse process="end"}` this allows for the tags to be parsed later so that the entry ids loop is finished before the plugin tag is called.

**Second option:** Use Playa to get chid entry ids.

```
{exp:channel:entries limit="1" channel="parent_channel"}
    {exp:gwcode_categories entry_id="{children:child_ids}" parse="inward"}
        {cat_name}
    {/exp:gwcode_categories}
{/exp:channel:entries}

```

---
Tags: channel-entries, categories, relationships
---


# Question
Title: Custom Category Fields with in categories loop in LowReorder loop
I'm not getting custom category fields to echo out within a `{categories}` loop that is also within a `{exp:low_reorder:entries}` loop. Any thoughts? Just outputs as the custom category field shortname string.

# Answer
When I went to copy/paste over code, I realized I had the disabled="category\_fields" parameter on the loop. Oddly enough, when that parameter is included, you can not access a custom category field.
> 2 votes

---
Tags: add-on, categories, low-reorder
---


title: Weird Rich Text Issue

text:
# Question
Title: Weird Rich Text Issue
So I inherited another build and the content editor is the stock Rich Text field type. The content has paragraph and strong html tags in place when you View the Source in the edit entry section, but the HTML output isn't outputting those. I personally have used WYGWAM on other builds because I like the interface better and I thought that rich text would just output everything inputed through the control panel.

My question is it possible to "remove the formatting" some place that I can check? I'm not using any plugins on this page that would remove the formatting, but I'm curious why Rich Text isn't outputting the `<p>` tags or any others for that matter on output? So I wanted to check to see if there was something I was missing regarding the Rich Text editor?

This EE site is running 2.6.1.

Thanks!

# Answer
> 1 votes
Sounds like you're hitting this bug perhaps... There is a patch at the bottom:

https://support.ellislab.com/bugs/detail/19405

---
Tags: richtext, text-formatting
---


title: Bundling Plugins and Templates

text:
# Question
Title: Bundling Plugins and Templates
I looked at EE's Addons and the closest thing I can think off is to use Modules. However, the templates that I have in mind are using EE tags.

I looked at EE's pre-installed modules and they seem to use pure PHP in their view so I am not sure if that will work since I need EE tags.

Is there a way to bundle a plugin and templates together so that I can easily transfer it to another EE installation?

# Answer
You can render views from module/plugin tags fine. I've done this in the past and they work with EE tags within them, so most EE tags are available. From memory you might have issues with early global variables not being available as they're called before plugin/module tags.

So within your plugin/module, instead of returning a parsed variable array for example, you just pass your vars to the view which is located in your add-ons's /views folder.

In this case I'd have /my-addon/views/foo.php

```
return ee()->load->view('foo', $vars, TRUE);

```

Just need to set the third parameter to TRUE so the view is returned as data, as per the CI docs: http://ellislab.com/codeigniter/user-guide/general/views.html
> 2 votes

---
Tags: add-on-development
---


# Question
Title: How do I import into a Channel Images field using DataGrab?
I'm using XML and DataGrab to move our blog posts to a new home. All the other fields are migrating correctly, but I can't get the Channel Images field to use a image url that's being supplied by my XML file. Is there another way to do this? Is it even possible?

# Answer
When I looked at this about 6 months ago the unfortunate answer was it can't be done :(

http://brandnewbox.co.uk/forums/viewthread/666/

They did show interest in adding support but doesn't look to be added yet.
> 1 votes

---
Tags: channel-images, datagrab, migration
---


title: Form post values

text:
# Question
Title: Form post values
Now i had multi form in my template,this form using POST method and each form contains input hidden.Then how can I get this hidden value in next template (page)?

First page code

```
<form name="input" action="r_rss_openOneNews_Test" method="post">
<label for="urlLabel">{rss_title}</label>
<input type="submit" value="More...">
<input type="hidden" name="urlHidden" value="{rss_link}">
</form>

```

How can i get `urlHidden` value in `r_rss_openOneNews_Test` page?

Thanks,

# Answer
> 1 votes
You can use Mo’ Variables for the same.

---
Tags: forms
---


title: Sending paramters in url

text:
# Question
Title: Sending paramters in url
Any idea about How can I send paramaters in url in expression tags and get values of this paramaters in next page

In first template I wrote this code

```
<a href ='r_rss/openOneNews?url={rss_link}'>{rss_title}</a>

```

Q:How can I get `url` paramater value in next page which is `openOneNews` to can use as the following in next page `<iframe src = 'url' />`

Thanks

# Answer
You'll need an add-on for this. Mo’ Variables is a good option.

```
{get:url}

```

Maybe you should rename your variable. "url" is too common and it can create some conflicts.
> 3 votes

---
Tags: url, querystring
---


title: Using EE to power a web app prototype

text:
# Question
Title: Using EE to power a web app prototype
I'm relatively new to EE and hoping it will for me to power a web app prototype I'm working on.

Is there anyway build a public front end that allows users to edit or publish entries without logging into EE? I've not been able to find any documentation would suggest this is possible.

# Answer
> 3 votes
Safecracker used to be answer to this but now it is deprecated and replaced with "Expression Channel Form". Have a look at this. Hope this helps.

http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_form/index.html#logged-out-member-id

---
Tags: entries, users
---


# Question
Title: Any way to pass a checkbox value in Freeform (not Pro version)?
I have a contact form that has a checkbox so the user can choose to also be added to the newsletter subscription with their contact form submission. Basically this just needs to post a value of "y" and the client manually adds them to their mailing list.

The free version of Freeform no longer has a checkbox fieldtype (Freeform 3.x did). Freeform Pro is an awesome addon, but the only added feature I need is the checkbox field type.

Has anyone figured out a way to pass the value of a checkbox field with the free version?

I tried the Freeform Values extension: https://github.com/stovepot/freeform\_values.ee\_addon but I wasn't able to get it to work at all - and there is no support for it (bummer). Basically the tag I used `{freeform:value:optin_check}` shows up in the html output instead of a value.

I thought maybe I could take the value of the checkbox and pass it to a hidden text field, something like this:

```
<input type="checkbox" id="optin_check" name="optin_check" value="Yes">
<input type="hidden" id="optin" name="optin" value="">

```

What I tried with the above extension:

```
<input type="checkbox" id="optin_check" name="optin_check" value="Yes">
<input type="hidden" id="optin" name="optin" value="{freeform:value:optin_check}">

```

Any ideas on how I could get something like this to work?

**Complete Freeform code in my template:**

```
{exp:freeform:form
    collection="Contact"
    return="/contact/thanks"
    inline_errors="yes"
    require_captcha="yes"
    inline_error_return="contact/error"
    admin_notify="jessica@toolstudios.com"
    template="contact_us"
    form:id="contact-us"
}

    <p>
        <label for="first_name" class="left">First Name<br>
            <input type="text" value="" name="first_name" id="first_name">
        </label>

        <label for="last_name">Last Name<br>
            <input type="text" value="" name="last_name" id="last_name">
        </label>
    </p>

    <p>
        <label for="email" class="left">Email<br>
            <input type="email" value="" name="email" id="email">
        </label>

        <label for="confirm_email">Confirm Email<br>
            <input type="email" value="" name="confirm_email" id="confirm_email">
        </label>
    </p>

    <p>
        <label for="user_message">Message<br>
            <textarea rows="10" cols="20" id="user_message" name="user_message">
            </textarea>
        </label>
    </p>

    <p class="checkbox left">
        <input type="checkbox" checked="checked" name="optin_check[]" value="Yes">
        <label for="optin_check" class="checker">
            Yes, sign me up to recieve the newsletter!
        </label>
        <input type="hidden" id="optin" name="optin" class="optin" value="">
    </p>
    {if captcha}
    <p class="captcha">
        <label class="long">
        Please answer the security question<span class="required">*</span><br>
        {captcha}    <input type="text" name="captcha" id="captcha">
        </label>
    </p>
    {/if}
    <p class="left">
        <input type="submit" name="submit" id="submit" value="Submit">
    </p>

{/exp:freeform:form}

```

**And here's a screenshot for the visual:**

# Answer
> 2 votes
How about trying this on it's own (without a hidden input field) using the freeform\_values addon:

```
<input type="checkbox" name="optin" value="Y" {if '{freeform:value:optin}' == 'Y'}checked{/if}>

```

Just be sure that the name of your checkbox field is in fact "*optin*".

Does that work?

# Answer
> 1 votes
Try changing:

```
<input type="checkbox" id="optin_check" name="optin_check" value="Yes">

```

to :

```
<input type="checkbox" id="optin_check" name="optin_check[]" value="Yes">

```

# Answer
> 0 votes
I made it work with {freeform:field:my\_newsletter} as my\_newsletter is the name of the newsletter.

---
Tags: solspace-freeform
---


title: How to filter results by Collection?

text:
# Question
Title: How to filter results by Collection?
Here is what I have as a working example of exp:low\_search:filters tag on the result page and this works just fine. One can click on a category to show or hide entries for that particular category. Just wondering if the same can be done with collections? I mean can we show all the collections found in the query on the results page to filter results?

```
{exp:low_search:filters query="{segment_3}"}
  {exp:channel:categories channel="video" style="linear" category_group="11" parent_only="yes"}
   {if count ==  1}<ul class="category-filters">{/if}
     <li style="color: #fff;font-size: 20px;">
       <a class="btn btn-small" style="vertical-align: text-top;" href="{low_search:url toggle:category="{category_id}"}">
        {if category_id IN ({low_search_category})}
        <i class="icon icon-check red-icon" style="font-size: 160%;vertical-align: middle;"></i> {/if} {category_name}
       </a>
      </li>
    {if count == total_results}</ul>{/if}
  {/exp:channel:categories}
{/exp:low_search:filters}

```

Any help would be appreciated.

# Answer
> 1 votes
That's totally possible. Use the same principle as with categories, but using the `{collection}` variable pair to generate the collections. Pop this inside your Filters tag:

```
{collections}
    <a href="{low_search:url toggle:collection="{collection_name}"}">{collection_label}</a>
    {if collection_is_active}✓{/if}
{/collections}

```

---
Tags: low-search
---


# Question
Title: Freemember - Set to not Activation Required AND it automatically sets to Pending. How do I change this?
I've built a site using freemember and although there's "no activation requried" it automatically sets the member to "Pending" rather than "Members".

I've checked my encryption key and turned off terms of service - still no joy!

It's pretty urgent so any help would be awesome :) Thanks

# Answer
Have you set group\_id whitelist parameter and group\_id form input? https://github.com/expressodev/freemember/blob/master/docs/register\_tag.md
> 2 votes

---
Tags: members, error, freemember, activation
---


# Question
Title: Matrix PHP error "Undefined index: directory" after EE update
does anyone have an idea how I can fix this error message? It flashes up after submitting an entry and stays on screen for only a second or two.

> A PHP Error was encountered
> Severity: Notice
> Message: Undefined index: directory
> Filename: celltypes/file.php
> Line Number: 395

I'm guessing it's referring to the file fieldtype. But the images and files are OK on the page. And it only occurs on one entry.

# Answer
I recently saw this myself when updating an older site to the latest EE and Matrix. I believe it's because older versions of EE File feildtype did not allow to limit uploads to a specific directory. This corresponds to the "Allowed file upload directories" select menu on the File column in your Matrix custom field.

Just edit your Matrix custom field, re-saving the custom field settings and you should be good.
> 1 votes

---
Tags: matrix, php-errors
---


title: Member registration form error

text:
# Question
Title: Member registration form error
We recently upgraded EE (2.7.2) and run Solspace User (3.4.4) plugin.

Our client side registration form no longer works. Upon submission we get “You are not authorized to perform this action”

Any clue?

Thanks, L.

# Answer
In the Solspace changelog for Solspace User in 3.4.5 it states: "Updated User submission forms to be compatible with EE 2.7+."

I suggest updating Solspace User to the latest version so it is compatible with 2.7+. And a little Developer advice. Don't update everything when a new version comes out, unless it fixes a bug you are having, security, or add's a new feature you need. I have sites that are still on 2.4 because I have third party plug-ins, modules, fieldtypes, and accessories that haven't been updated or would change things I don't want. This is my opinion, if something works and nothing is wrong don't worry about updating.
> 2 votes

---
Tags: error, registration, member-management
---


# Question
Title: Using a custom field with the month_links tag
Does anybody have a way of using the **channel:month\_links** tag (to create a list of links to monthly archive pages) that takes it's date point from a *custom* date field rather than the entry\_date field? I have a channel where the user can enter details of journalistic articles that they have written; one of the channel fields is {publication\_date}. I want my month\_links to be in the vein of:

## Articles published in...

* June 2013
* July 2013
* August 2013
* etc

so I need the tag to hook into the publication\_date not the entry\_date. So far I can't find a way.

I realise that I could insist that users use the entry date field as the publication date, but the downside of that is that I can't change the field name (and 'entry date' is not a good label for the field, it's misleading), nor can I add field instructions.

Any ideas?

# Answer
> 2 votes
If you can overcome your objections to using the native Entry Date I'd definitely opt for using that... However, if you want to essentially rebuild the month\_links functionality yourself, you could do this with Stash (yet again!).

Try something like this, using two nested `get_list` tags: (if you're using an embedded view template you won't need the `stash:parse` tags, but they're handy here when setting and getting in the same template...)

```
{exp:channel:entries channel="articles" dynamic="no"}

    {exp:stash:append_list name="months-to-output" trim="yes"}
        {stash:month-num}{publication_date format='%m'}{/stash:month-num}
        {stash:month-title}{publication_date format='%F %Y'}{/stash:month-title}
    {/exp:stash:append_list}

    {exp:stash:append_list name="articles-by-month" context="{custom_date format='%m'}"}
        {stash:the-title}{title}{/stash:the-title}
        {stash:the-link}{url_title_path=articles}{/stash:the-link}
    {/exp:stash:append_list}

{/exp:channel:entries}

{!-- ==============================
TEST OUTPUT
=================================== --}

{exp:stash:parse process="end"}
    <ul>
    {exp:stash:get_list name="months-to-output"}
        <li>
            <h2>{month-title}</h2>
            <ul>
            {exp:stash:get_list:2 name="articles-by-month" context="{month-num}"}
                <li><a href="{the-link}">{the-title}</a></li>
            {/exp:stash:get_list:2}
            </ul>
        </li>
    {/exp:stash:get_list}
    </ul>
{/exp:stash:parse}

```

---
Tags: custom-fields, channel, entry-date
---


title: Store Data in Channel Tag Variable

text:
# Question
Title: Store Data in Channel Tag Variable
I'm using the EXP:QUERY tag to get the count of a channel. And I am basically trying to use this for page pagination, and its a custom pagination because of the type of template I'm building.

And I am trying to use the count I receive and use some math to get a page count based on the number of results I have on each page. 5 results per page. So below is what I have.

```
<?php $foo = {count} / 5; ?>
{if segment_2 <= $foo}
    <li><a class="button next" href="<? $week_count = {segment_2} + 1; echo "/page/" . $week_count; ?>">Next</a></li>
{/if}

```

I am trying to use the PHP variable $foo within the expressionengine if statement but I can't, what is a better way to do this? Without having to write out it all in PHP.

# Answer
> 1 votes
I did the math within the SQL to receive my results.

EDIT: The solution.

```
SELECT COUNT(entry_id) / 25 AS count FROM exp_channel_data WHERE channel_id = 97

```

---
Tags: php, mysql, variable
---


title: How to Push out Site Content Changes

text:
# Question
Title: How to Push out Site Content Changes
Our Expression Engine site is essentially a Style Guide for development teams. What i am looking for is a good way to push out changes to the folks that want to listen.

Is there a good plugin or feature I could use that would allow folks to subscribe by email to content pages or maybe an RSS feed tracking internal changes or even any internal features I may be missing?

Ideally not all users would need to be Expression engine users.

I've tried searching around but most of the results a I get are change logs for the actual product.

Any suggestions?

# Answer
There is an RSS module that's part of the EE base install. You may have to turn it on, but it's there. You can set up RSS feeds for any category or channel you wish, and it can contain a URL, the whole content...whatever. Here's the user manual link to using the RSS module (note that it is for EE version 2.7+, but the directions should be fairly similar even for older versions. I don't know that the RSS module has had any feature additions since version 1.5x, anyway.)

People would not have to be EE users to get the RSS feeds. All they'd need is an RSS reader.

There's also a mailing list module with the default EE install, for email lists - but I think that's for building an email list and communicating with them rather than for automatically notifying when there are changes.

I know that there are other modules out there, created by third-party developers and companies. devot-ee lists them and includes ratings on the modules themselves.
> 1 votes

# Answer
It's fairly simple to build an RSS feed with an ExpressionEngine template. There are some examples in the user guide.

In the past I've used Mailchimp's RSS to Email service to pick up new posts from an RSS feed and email them out to users.
> 1 votes

---
Tags: ee2
---


# Question
Title: Possible to setup Expresso Store default price modifiers and/or options?
We have a store we're setting and we would like to be able to setup default price modifiers and/or options per channel since there are several modifiers per product and a large number of products need to be added. Is this possible in any way?

Anticipating a 'no', is there a JS API/Event model that I can tap into? If there is a JS event for the field initialisation and a JS API to add modifiers, I could implement this myself as an extension.

# Answer
> 2 votes
There is nothing built into Store currently that would allow you to create modifiers on a per channel basis if you want the modifiers to adjust price or stock levels. There is currently a feature request for Global Product Variations that you can vote for.

If you do not not need to adjust the price, quantity or have a unique SKU for your variations you can use `input:custom_modifer_name="Custom Modifier Display Name"` of the `{exp:store:product}` tag (docs here) to create the options at the template level. For something like size you can use the following"

```
{exp:store:product entry_id="{entry_id}" input:size="Size"}

<select name="size">
  <option value="Small">Small</option>
  <option value="Medium">Medium</option>
  <option value="Large">Large</option>
</select>

{/exp:store:product}

```

---
Tags: expresso-store, javascript, fieldtype, modifiers
---


# Question
Title: Got Hacked ... Need to quickly delete 1000's of members
Got hacked! One of my client sites was hacked about 6 months ago. They got into the member pages and created 3,900 pages of members. I can delete them one page at a time. but it will take be days to get through them. Is there a work around can access the file or the use myPHP Admin? The member groups are either 'Members" or 'Pending'. There are only one member groups that I need and that is the 'Super Admin"

Thanks

# Answer
> 8 votes
If you'd prefer not to do this through a SQL query, you can also get the member list in the control panel to show more members on a page.

Go to the member list page in the CP and add these parameters to the end of the URL:

```
&group_id=4&perpage=1000

```

Make sure you check that the group\_id parameter matches the group you want to view.

If you're using this to delete members through the control panel, it will only delete 1000 members at a time. So even if you set the "perpage" parameter to 5000 and select all of those members to delete, it will only delete the first 1000.

# Answer
> 6 votes
You will need to delete the same member records from "exp\_member\_data" tables also.

You can use this SQL query and can run from PHPMYADMIN like

```
DELETE exp_members, exp_member_data
FROM exp_members
LEFT JOIN exp_member_data ON exp_member_data.member_id = exp_members.member_id
WHERE exp_members.group_id = 5

```

This query will delete all the member records having group id as 5 from both tables exp\_members and exp\_member\_data. You can change group id according to your preference and also can put more conditions in WHERE.

I would suggest you to take database backup before running the SQL.

# Answer
> 3 votes
First of all back up the database.

Then if you know that they are all fake then you can run an SQL query like:

```
DELETE
FROM `exp_members`
WHERE `group_id` = x
WHERE last_visit = 0

```

Where group\_id would be the member group and you're also checking for last visit as an extra safety net so you're not deleting your own Super Admin account or any member accounts which have been logged into.

Just use with caution and always back-up first. Double-check that you know which members are real and fake and that you have a way to distinguish in the filtering.

# Answer
> 1 votes
If this isn't a membership-based site and you only have 1 or a few legit admin accounts, another quick solution is to (after 1st backing up the db), go into exp\_members table in phpMyAdmin, select member\_id 1 (this is super admin) and optionally member\_id 2 (& 3, etc) and then Export those entries to file. On the same table, go to Operations tab, then select Empty the table (TRUNCATE). Finally, re-import the file you just exported. Do the same for member\_data table, and you are back in business.

---
Tags: spam
---


title: Playa Live Filters Not Working in MSM

text:
# Question
Title: Playa Live Filters Not Working in MSM
I have an MSM installation with two sites (EE version 2.5.5, Playa version 4.4.5). I am using Playa on Site 2. When I am logged into the CP from the URL of Site 2 (i.e. http://site2.com/admin.php), my live filters for Playa fields work as expected. However, when I am logged into the CP from Site 1's URL (i.e. http://site1.com/admin.php) and am working in the Site 2, the Playa fields don't filter properly.

Here's what I'm doing: from the channel entry form, in my Playa field, I click the plus button on the Droppanes search menu to filter by Category. However, as soon as I choose the "Category" filter option (or any other filter option), all my listed entries are grayed out, and the filter doesn't seem to limit the entries.

I read on this question (Playa Filters failing with Force SSL module in place) that filters work with an AJAX call based on your URL. I also read that you can direct Playa to the proper site index using this line in the config:

```
$config['playa_site_index'] = "https://example.com/index.php";

```

I added this line to my Site 1 config and pointed it at Site 2's URL:

```
$config['playa_site_index'] = "http://site2.com/index.php";

```

Reset my browser cache, logged back in, but still not working. Any suggestions?

# Answer
> 1 votes
Josh,

cross-domain Ajax requests simply won't work - it's a browser security thing and there's no feasible way around it.

What you should be trying to accomplish is for each MSM CP to shoot off the requests to it's respective domain, not a single silver-bullet domain, since that will work only when accessing CP from the same domain as the config settings.

Setting $config\['playa\_site\_index'\] to "/index.php" should do the trick in this case.

---
Tags: playa, multi-site-manager
---


# Question
Title: Adding module configuration settings to config.php
As here, I'm looking to set some variables for a module. Creating a DB table seems a bit overkill (or maybe it's really not). I've noticed that the Simple Commerce Module does two things: creates DB tables *and* adds to the `config.php` file. With the second method, it's using `ee()->config->_update_config`.

I cannot find any documentation on `_update_config`. It seems straight-forward enough, but I'm wondering if there's a reason I shouldn't use it.

In short, I'm looking to package a module for distribution, and I don't want to make it more complicated than it needs to be (e.g., I don't want to have to install an extension *and* a module). Is adding variable/settings to `config.php` a good idea?

# Answer
> -1 votes
I would store the settings in 'settings' column in 'exp\_modules' table.

It does not exist in early versions of EE 2.x, so in your upd.my\_module.php in function install() add

```
    $this->EE->load->dbforge();

    //----------------------------------------
    // EXP_MODULES
    // The settings column, Ellislab should have put this one in long ago.
    // No need for a seperate preferences table for each module.
    //----------------------------------------
    if ($this->EE->db->field_exists('settings', 'modules') == FALSE)
    {
        $this->EE->dbforge->add_column('modules', array('settings' => array('type' => 'TEXT') ) );
    }

```

and example save\_settings() function can look like this

```
function save_settings()
{

    if (empty($_POST))
    {
        show_error($this->EE->lang->line('unauthorized_access'));
    }

    unset($_POST['submit']);

    $this->EE->db->where('module_name', 'My_module');
    $this->EE->db->update('modules', array('settings' => serialize($_POST)));

    $this->EE->session->set_flashdata(
        'message_success',
        $this->EE->lang->line('preferences_updated')
    );

    $this->EE->functions->redirect(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=my_module'.AMP.'method=settings');
}

```

# Answer
> 0 votes
You could try:

master config where you can set environment variables and custom global variables but this isnt done via control panel. In fact, quite the opposite happens. You set a variable in master config and it cant be changed in control panel. Handy when you have certain settings that need to be locked down.

stash and set user or site variables via an input form. Save variable and define an appropriate refresh period.

---
Tags: add-on-development, configuration-variables
---


# Question
Title: How i can display all category group name?
I want to display category group name in detail page of articles is it possible and how i can do this ?

# Answer
> 1 votes
You can write simple SQL for it:

```
{exp:query sql="SELECT group_id, group_name FROM exp_category_groups WHERE site_id='1'"}
    <p>
        Category Group ID: {group_id}
        Category Group Name: {group_name}
    </p>
{/exp:query}

```

---
Tags: ee2, categories, category-group
---


# Question
Title: Simple Commerce, capture user information
I need to create a channel which editors can upload different events to and where user can then enter their details and pay to attend these events.

I was going to use channels and simple commerce to enable users to pay for these events but we'd also want to capture some information from the user such as name, email, etc. What the easiest way to capture their information?

Thanks, Julie

# Answer
> 1 votes
You should use Custom Profile Data Tag to get all the user's data. See doc from here: http://ellislab.com/expressionengine/user-guide/modules/member/#custom-profile-data-tag

---
Tags: commerce
---


# Question
Title: Solspace User - not accepting new members: Error mbr_addon_builder
I am running EE 2.7.1 and User 3.4.0

When a new member resisters the redirect does not work just loads a blank page and the membership does not process..

So I updated the Solspace User to 3.4.5 and ran the module update and get this error: Unable to load the requested class: mbr\_addon\_builder

The registration seems to be working now after the User upgrade, but I can't run module updates anymore without getting that error

Any assistance would be great!!

UPDATE: Looks like it may be related not to CartThrob. That file is in the CT Permissions library folder. Tried to remove it but still getting the error

So I tried to update Cart Throb Permission Manager 2.3.3 and then I get the same error and cannot even log into the control panel

# Answer
> 1 votes
it was a CT issue, an upgrade fixed the issue

---
Tags: cartthrob, module, upgrade, solspace-user
---


title: Routing custom URLs to Stash templates

text:
# Question
Title: Routing custom URLs to Stash templates
I'm using the Template Routes plugin to add custom URLs to my EE site. Out of the box, it's set up to use the default EE templates:

```
$config['template_routes'] = array(
  'blog/:category' => 'site/blog-category',
  'blog/:year/:pagination' => 'site/blog-yearly-archive',
  'blog/:any' => 'site/blog-single',
);

```

but I'm using Stash so my templates are located in /templates/. I was just wondering if it's possible to route the URLs to these templates instead?

I've tried just using '/templates/site/blog-category' instead but no dice :(

Thanks

# Answer
> 0 votes
Are you referring to Stash embed templates, using the `stash_file_basepath` config variable? If so, no, Template Routes cannot use those templates. Unless...

You set your stash template path to match the EE template path:

```
$config['tmpl_file_basepath'] = '/path/to/a/folder/';
$config['stash_file_basepath'] = $config['tmpl_file_basepath'].'default_site/site.group/';

```

Then in Template Routes you could call up those templates:

```
$config['template_routes'] = array(
  'blog/:any' => 'site/some_template',
);

```

# Answer
> 0 votes
Just remove the `/site/` bit, so they read `templates/blog-category`, and you should be good to go :).

---
Tags: stash, url, routing
---


# Question
Title: Weird issue with 404 redirect and no results
I'm having a strange issue (possible bug?) with the following (simplified) code

```
{if segment_1 == ""}

//Do Stuff//

{if:else}

{exp:channel:entries limit="1" status="Open" url_title="{segment_1}" dynamic="no" parse="inward"}

    {!-- If no results then paramater must be a category for product listing --}
    {if no_results}
        {exp:gwcode_categories cat_url_title="{segment_1}" parse="inward"}

            //Do Stuff//

            {if no_results}
                {redirect="404"}
            {/if}

        {/exp:gwcode_categories}

    {/if}

    ///Do Stuff///

{/exp:channel:entries}

{/if}

```

The problem is with the 404 redirect. If I set 404 page to none in the backend it correctly redirects to a default page saying: "Status: 404 Page Not Found"

However when I change the 404 setting in the backend to show a custom template, it redirects to the 404 page, regardless of whether a category is found by gwcategories or not, ie no results always ends up being true, or is not correctly parsed.

I've tried a number of permutations of the no results conditional, eg: using

{if {results\_total} != 1}{redirect="404"}{/if},

which doesn't work either. Even though testing the output of {results\_total} outputs 1, it still redirects.

Anyone got any ideas?

# Answer
> 1 votes
This is happening because of the first `parse="inward"`. You're telling to the `exp:channel:entries` to parse everything before its inside other modules variables. So, the inner `if no_results` is parsed before the `exp:gwcode_categories`.

Actually, I can't see the point of adding any of the `parse` parameters. The segment variables will be parsed before the modules and plugins in any case.

```
{if segment_1 == ""}

//Do Stuff//

{/if}
{if segment_1}

    {exp:channel:entries limit="1" status="Open" url_title="{segment_1}" dynamic="no"}

        {!-- If no results then paramater must be a category for product listing --}
        {if no_results}
            {exp:gwcode_categories cat_url_title="{segment_1}"}

                //Do Stuff//

                {if no_results}
                    {redirect="404"}
                {/if}

            {/exp:gwcode_categories}

        {/if}

        ///Do Stuff///

    {/exp:channel:entries}
{/if}

```

I also turned your advanced conditional into two simple ones to prevent the second part to be parsed without need.

---
Tags: conditionals, redirects, 404, advanced-conditionals
---


# Question
Title: How can I remove template name from url?
I want to remove template name from URL. I want to display only template\_group/entry-name. Is this possible?

# Answer
> 4 votes
You can use the Template Routes plugin to override the default routing.

You'd add something like this to your index.php:

```
$config['template_routes'] = array(
  'template_group/:any' => 'template_group/template_name'
);

```

and then just do something with the $1 value in the template.

# Answer
> 3 votes
As Robson & Bhashkar have stated, use the index template in the template group to do the channel:entries tag pair - therefore doing away with the template reference in the URL. If you target template\_group, it automatically uses the index template without you specifying /template\_group/index.

You're trying to utilise the same template (template\_group/index) for both the listing and the details - that's absolutely fine, just utilise no\_results...

Let's assume template\_group is "blog", the URLs you want are:

* /blog (listing)
* /blog/my-article (details - not /blog/details/my-article)

Assume you're accessing the entry details first, so blog/index template:

```
{exp:channel:entries
    channel="blog"
    dynamic="yes"
    require_entry="yes"
    track_views="one"
    disable="member_data|pagination"}
    {if no_results}
        {embed=blog/listing}
    {/if}

... display of blog details page   ...

{/exp:channel:entries}

```

This will attempt to pull an entry based on the URL - if it can't match it, it will fall into the no\_results conditional and embed the listing page...

Template blog/listing (note this template isn't the URL!)

```
{exp:channel:entries
    channel="news"
    dynamic="no"
    orderby="date"
    sort="desc"
    paginate="bottom" paginate_base="/blog"
    limit="10"}

    ...listing details...
{/exp:channel:entries}

```

# Answer
> 0 votes
The easiest way will be just put the code within the "index" template of that template group. By doing it, you can have the URL like template\_group/entry-name.

---
Tags: ee2
---


title: CartThrobTax being added when disabled

text:
# Question
Title: CartThrobTax being added when disabled
For some reason I cannot disable the tax on certain products. I have the no\_tax set to YES in my product channel but it is still being added.

I am running EE 2.7.0 and Cart Throb 2.4

```
{exp:channel:entries channel="products" limit="1" status="not closed" dynamic="yes"}

                        <h1>{title}</h1>

                        <p>{product_description}</p>
                        {if product_original_price && product_original_price > product_price}
                            <p>Regular Price: {product_original_price}<br />
                                <span class="sale_price">Sale Price: {product_price}</span> </p>
                        {if:else}
                            <p>Regular Price: {product_price}</p>
                        {/if}
                            {if no_tax !="Yes"}<p>Price including tax {product_price:plus_tax}</p>{/if}

                        {exp:cartthrob:add_to_cart_form
                            entry_id="{entry_id}"
                            no_tax="{no_tax}"
                            no_shipping="{no_shipping}"
                            return="shop/view_cart"}
                            <p>
                                {exp:cartthrob:item_options entry_id="{entry_id}"}
                                    {if dynamic}
                                        <label>{option_label}</label>
                                        {input}
                                    {if:else}
                                        {if options_exist}
                                            <label>{option_label}</label>
                                            {select}
                                                <option {selected} value="{option_value}">
                                                    {option_name}{if option_price_numeric > 0} +{option_price}{/if}
                                                </option>
                                            {/select}
                                        {/if}
                                    {/if}
                                {/exp:cartthrob:item_options}

                            </p>
                            <p>
                            {if "{inventory}" == "0" }
                                <strong>This item is out of stock</strong>
                            {if:else}
                                <label for="product_quantity">Quantity</label>
                                <input type="text" id="product_quantity" name="quantity" size="8"  />
                            {/if}
                            </p>
                            <input type="submit" value="Add to Cart" />

                        {/exp:cartthrob:add_to_cart_form}

            {/exp:channel:entries}

```

# Answer
I had TAX on shipping checked off!!
> 1 votes

---
Tags: cartthrob, shopping-cart
---


# Question
Title: Solspace FreeForm Pro radio group default value
We're using Pro so the client can use the GUI to easily create forms.

I've got a custom composer template to output these forms.

With radio groups I need the first radio to be pre-selected (who wouldn't want that?!), ie checked="checked". In fact it doesn't have to be the first radio button, any will do, this will simplify client-side validation.

In the Docs: http://www.solspace.com/docs/freeform/form/#freeform\_field\_field\_name outlines default\_value="VALUE", this is available to pre-select a default value.

But there's no further explanation in 'Default Fieldtypes'.

In my composer template I have this:

```
{freeform:field:{composer:field_name} default_value="Yes"}

```

When 'Yes' is available as a value for a radio button it does pre-select it. But I don't know what the values will be as the client will build the forms.

I need this (pseudo code):

```
{freeform:field:{composer:field_name} default_value="{composer:field_name[0]:data:value}"}

```

Anyone done this? Help from Solspace?

# Answer
> 0 votes
Solspace's JS solution could be more complete. As the headline feature of FreeForm Pro is Composer for CP users to create forms without coding the above code can only be written if you know what a CP member will name the radio groups, which of course you won't.

Here's my complete JQuery JS code to pre-select the first radio button in a radio group of unknown name.

```
// find all input type radio, find group names, check if none selected, if not select first radio.
var radio_array = Array();
$('input[type="radio"]').each(function(){
    radio_array.push($(this).attr('name'));
});
radio_array = sort_unique(radio_array);
var length = radio_array.length;
for (var i = 0; i < length; i++) {
    if( $('input[name="'+radio_array[i]+'"]:checked').length == 0 ) $('input[name="'+radio_array[i]+'"]:eq(0)').attr('checked', 'checked');
}

// http://stackoverflow.com/questions/4833651/javascript-array-sort-and-unique
function sort_unique(arr) {
    arr = arr.sort(function (a, b) { return a*1 - b*1; });
    var ret = [arr[0]];
    for (var i = 1; i < arr.length; i++) { // start loop at 1 as element 0 can never be a duplicate
        if (arr[i-1] !== arr[i]) {
            ret.push(arr[i]);
        }
    }
    return ret;
}

```

# Answer
> 2 votes
There are situations where it could be preferable to not have any radio buttons selected in advance, but this is for another conversation ;)

Unfortunately, it isn't possible to dynamically put a radio/checkbox group/select value as checked in the Composer Template at this time. What would be needed is a tag pair for these fields in the Composer Template, such as eg. {freeform:field:{composer:field\_name}}{/freeform:field:{composer:field\_name}}. That way you could set the first loop as "checked". Unfortunately this feature is not available at the moment.

One workaround would be to use javascript/jQuery to select your first item in the radio group. For example something like this:

```
$("input:radio[name=field_name]:first").attr('checked', true);

```

Another workaround is to use a form field that is guaranteed to always have a value selected by default/on first load: the **select** field.

---
Tags: solspace-freeform, solspace
---


title: Expresso Store - Get most popular items

text:
# Question
Title: Expresso Store - Get most popular items
I would like to list the most popular selling items from my Expresso Store, but I can't find the tags to retrieve those items (preferably filtered by EE category too). Any pointers in the right direction would be very much appreciated.

Thanks in advance!

Tom

# Answer
To the best of my knowledge, there isn't a `popularity` tag in Store. This would require a custom query or an add-on.

Something like this

```
SELECT entry_id, sku, title, COUNT(*) FROM exp_store_order_items GROUP BY entry_id ORDER BY COUNT(*) DESC;

```

Will provide most popular items based on 'what's been ordered', but what's been viewed, popular searches, and a number of 'OTHER' variants of popular also exist.
> 4 votes

# Answer
You can also use EE's native "track\_views" channel entries parameter on your individual product's page to count the views every time that page is browsed to by any user.

Eg.

{exp:channel:entries channel="products" url\_title="{segment\_2}" track\_views="one"}

You can read more about it here:

http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#channel-entries-track-views

Then you can use it with Store's search tag like this:

{exp:store:search channel="products" category="123" orderby="view\_count\_one" sort="desc"}

It's just important when searching by this "popularity" count that you then obviously sort the results descending so you get the products with the highest count first.
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Some structure tags not working after server move
Recently moved our development site onto the live hosting and now a few crucial structure tags are not working.

{structure:top:title} {structure:child\_ids} {exp:structure:entries parent\_id="{structure:page:entry\_id}"}

However the {exp:structure:nav} does work…

Any ideas? All works fine on our dev build

# Answer
Seems extensions were somehow automatically disabled when we moved onto our live server, once turned on this tags worked again.
> 0 votes

---
Tags: structure, server-migration
---


# Question
Title: EE still thinks I am logged in after logging out
I have page where the content depends on whether you are logged in or not. This is the tag that I used to check

```
{if logged_out}
   ...
{if:else}
  ...
{/if}

```

However, even if I am logged out, I always get to the second part which is meant for logged in users.

I have cleared the cache from EE and the cookies from my browser. But it did not help.

Which parts of EE should I be looking for to solve this problem?

**Some more information**

* I am using the url below to log out

`{redirect="?ACT=16&return=/sign-out/"}`
* I am using Safecracker Registration. All the kinks with upgrading to 2.7.1 have been worked out.

**UPDATE:**

I outputted some variables and I got this

```
logged_in_member_id: 1
logged_in_group_id: 1
logged_in_group_description:
logged_in_username:
logged_in_screen_name:
logged_in_email:

```

**Another UPDATE:**

I have Template A and Template B.

Template A embeds Template B.

I added code to show logged\_in status in both Templates

```
<div>
    {if logged_in}
        LOGGED IN
    {/if}

    {if logged_out}
        LOGGED OUT
    {/if}
</div>

```

The problem is that in Template A, logged\_in is FALSE

but in Template B, logged\_in is TRUE

This is weird. So {logged\_in} can be changed?

# Answer
> 1 votes
Try:

```
{redirect="{site_url}?ACT=16&return=/sign-out/"}

```

The & will probably be treated as part of the string instead of the divider between query strings.

Also try (just to keep it simple):

```
{redirect="{site_url}?ACT=16"}

```

Assuming the logout is working and it's the conditional that's at fault, try this conditional instead:

```
{if logged_out}
   ...
{/if}
{if logged_in}
  ...
{/if}

```

# Answer
> 0 votes
It's rather strange you're getting different results on different templates.

The overall problem though must have something to do with the parse order, since the {if:else} advanced conditional never really worked for me in EE when applied to a logged\_in conditional. You have to consider that an "advanced" conditional is evaluated much later in the parsing order, so it might apply to your situation if it's included inside some `{exp}` tags.

What version do you have installed? I read that some new parsing rules have been introduced with the latest EE releases. If you have the possibility to update I would do so, otherwise I would stick with:

```
{if logged_out}
   //DO SOMETHING
{/if}
{if logged_in}
  //DO SOMETHING ELSE
{/if}

```

You can also give a try to this module: http://devot-ee.com/add-ons/switchee or this one: https://github.com/croxton/ifElse I haven't tested them yet, but apparently they make the advanced conditionals parse earlier in EE templates. Share the results if you happen to try that.

---
Tags: login, logout
---