# Question
Title: Datagrab with MSM selecting wrong site entry on XML import
I’m using datagrab 1.9.2 on EE 2.10.1 with MSM. I have an xml import that’s working fine overall, however, in some instances datagrab is selecting the wrong entry. Basically it’s grabbing an entry for site id 1 instead of site id 2, the site datagrab is importing on. Here are the details.

I have site 1 & 2. Each site shares an entry titled Plan 2100 (same entry title, different content). The entry id of the Plan 2100 on site 1 is 7264 and for site 2 it’s 1466. I’m importing these entries into a matrix with a playa field (I attached a screenshot so you can see the setup). Everything is working perfectly except for these two entries that share the same entry title.

It appears datagrab isn’t honoring the site id. When I run the import on site 1, it inerts the plan 2100 entry with the entry id for site 2—id 1466 instead of 7264. My thinking is datagrab should ignore the data for other site ids other than the site it’s running on. However, this doesn’t seem to be the case.

I’ve looked in the database and this is how I discovered the wrong entry id was being selected upon import.

If I go into the EE CP it looks like the correct entry is selected in the playa drop down, but it is fact the wrong entry id, and won’t display in the front end. If I reselect the entry title in the playa drop down and save, it works correctly and it chooses the correct entry id.

I've confirmed my playa field setup is limited to entries of the site I'm on.

So, in a nutshell, it appears datagrab isn’t honoring the site id for some entries using a matrix/playa combo. Has anyone else experienced this problem and perhaps found a solution? Please let me know if you need further explanation.

Thanks for your help!

More info added: Here are some screenshots from the database to help understand the issue.

In this screenshot I've retrieved all entries with an entry title of Plan 2100. There are two results, one for site\_id 1 and one for site\_id 2.: http://screencast.com/t/daZVAYOf

After importing the XML via datagrab, you can see the Plan 2100 from site\_id 2 was incorrectly inserted into site 1. Then, in the CP, I re-selected Plan 2100 from the playa drop down and this resulted in the addition of the Plan 2100 from site\_id 1 being added to the matrix: http://screencast.com/t/sGNNq0N0i

# Answer
I fixed this by inserting the following after line 213 in datagrab\_matrix.php:

$this-\>EE-\>db-\>where( 'site\_id', $this-\>EE-\>config-\>item('site\_id') );

Basically the datagrab import wasn't taking the site\_id into consideration.
> 0 votes

---
Tags: multi-site-manager, datagrab, xml
---


title: Search Results Links Not Working

text:
# Question
Title: Search Results Links Not Working
I have a simple search form. When the results are displayed, it doesn't show the template group / template in the URL. It shows just the entry URL. I'm using the {auto\_path} variable. I realize I could go into each channel and change the URL, but is there an easier way?

```
{exp:search:search_results switch="resultRowOne|resultRowTwo"}

<tr class="{switch}">
    <td width="30%" valign="top"><b><a href="{auto_path}">{title}</a></b></td>
    <td width="30%" valign="top">{excerpt}</td>
    <td width="10%" valign="top">{entry_date format="%m/%d/%y"}</td>
</tr>

{/exp:search:search_results}

```

# Answer
No, there's not an easier way, however in the sites I've built I don't usually mess with the channel path settings. Instead I usually use a conditional based on the channel short name to form the search results and link. Keep it all in the template, ya know?
> 0 votes

---
Tags: search, channel
---


title: Comma in Text Input

text:
# Question
Title: Comma in Text Input
I have a channel field **Text Input** where I need to store numbers with comma as a **string**.

I set the fields *Field Content* to `All`.

Unfortunately, if I enter a comma in the field, like in `2,5`, the field value is changed to `2.0000` after publishing. But I need it to stay the string `2,5`. My database is full of the strings like this.

Why is this happening? Does the channel still think it is a decimal or number even though I set it to `All`?

I read this article: Expresso-store - Comma in quantity field

But I can't change the existing content in my database and also I need the data to be strings.

The version is 2.10.1

# Answer
> 1 votes
"My database is full of the strings like this" - so you already have the values correctly stored in EE entries? Or are you referring to a different database?

"I set the field**s** Field Content to `All`." - this sounds like the problem, I'm guessing you have text formatting on with override on publish page and you're setting All on the publish page.

Go to Admin -\> Channel Administration -\> Channel Fields, then select the field group and then select the field in question "Field Content". You mentioned it's a Text input field:

Scroll down till you see the *Field Options*:

Select the `Default Text Formatting` option to **None** and the `Allow override on publish page?` to **No**. I have fields with these settings and it honours exactly what I've entered.

Still Issues? Check that you are using the native Text Input field, not a third party field, and that there's not an extension saving or parsing the data (Publisher, Better Workflow, etc). Best way to check is just disabling extensions and saving an entry again - checking the results in the database.

---
Tags: custom-fields, fieldtype, channel-fields
---


title: Fatal Error When Sending Freeform

text:
# Question
Title: Fatal Error When Sending Freeform
I am Receiving "Fatal error: Using $this when not in object context in /libraries/Core.php on line 575" on sending FreeForm, i am using ee 2.10.1 and freeform 4.2.4

# Answer
> 0 votes
I made the changes outlined in this post and it solved my issues.

---
Tags: solspace-freeform, error, core, fatal, act
---


# Question
Title: Processing a specific section of a template, after it's loaded
I have a template containing sections and I'd like to process just the tagdata that is contained between the tags related to the button, and only when the button is selected (not when the page renders):

```
{exp:plugin:foo}
 <button>process</button>
    some content….
{/exp:plugin:foo}

some other content
{exp:plugin:foo}
 <button>process</button>
    some more content….
{/exp:plugin:foo}

```

I need to pass the relevant content (the tagdata from between the same tags as the button that has been pressed) to a custom function where I process it (to create a file), but I need to be able to pick out the data from within the selected tags, not the whole page, and I need to trigger this event after the page has fully loaded.

How do I deal with the button action, calling 'ACT=' doesn't let me use '$this-\>EE-\>TMPL-\>tagdata'?

Is there an easy way to parse and pick out the tagdata I need once the template data is available?

# Answer
Thanks for adding some details, but I'm still slightly confused. I'll lay out an attempt (too long for a comment anyways).

You have some content that you want processed (into a file format?), but not until a browser event is triggered. Some clarification about ways to write modules for ExpressionEngine may help.

A module can return data in multiple ways. One way is to return tag data when the template engine calls your module. Another way is to use ACTion id's to return data via AJAX and/or GET/POST requests. A third way (not pertinent) is to import your module into other modules, or extract your logic into a library that can be included in different places in an addon.

You want to process some data presented in a template, but also want to use the same logic to be able to render some data on the fly on an already rendered template. Your module can do this with basically little modification.

So one way to get params to be processed is to get it selectively from the request context:

```
if (AJAX_REQUEST) {

    // get from AJAX param
    $my_param = ee()->input->get_post('my_param');
} else {

    // get from template param
    $my_param = ee()->TMPL->fetch_param('my_param');
}

```

From there, you simply proceed as you normally would with your module method's logic. When it comes time to return that information, you can do so, again, with the appropriate method based on request context:

```
if (AJAX_REQUEST) {

    // return (make sure this is JSONified for ease of use)
    ee()->output->send_ajax_response($this->return_data);
} else {

    // return template tag data
    return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array($this->return_data));
}

```

So with this methodology, you can use the same method to process and present information when the template is rendered but you can also use a jQuery AJAX request to that ACTion id (with the parameters as part of the request instead of as template params) to do the same thing.

If you don't need to reuse your logic, then this answer won't help you. If you simply need to asynchronously process data, just use jQuery and AJAX to hit a module method.

```
<script>
$(document).ready(function() {
    $("#my_button").click(function() {

        // get info from already rendered stuff
        var my_param = $("#my_already_rendered_element").val();

        $.get( '/?ACT=12345', {my_param:my_param}, function(data){

            // dump returned dynamic info into an element
            $('#my_dynamic_element').val(data.dynamic_return_var);
        });

    });
});
</script>

```

If this isn't helping, add another edit to your question that clearly maps out the data path you're seeking, as I may not be understanding you still.
> 2 votes

---
Tags: tags
---


# Question
Title: This form has expired. Please refresh and try again. in EE 3.0.5 File Manager
Attempting to upload a file in EE3 file manager triggers an error that says 'This form has expired. Please refresh and try again'. I have tried some config solutions that seem to have worked from EE2 version users such as disabling secure form protection:

```
$config['disable_csrf_protection'] = "y";

```

Also tried including the following as another user suggested here:

```
$config['cookie_domain'] = "";
$config['cookie_path'] = "";
$config['cookie_prefix'] = "";
$config['admin_session_type'] = "s";
$config['user_session_type'] = "c";
$config['require_ip_for_login'] = "n";
$config['require_ip_for_posting'] = "n";
$config['secure_forms'] = "n";

```

This did remove the error message, however now the upload page merely refreshes when you try to submit the upload. The upload does not complete and is not confirmed.

I've not seen many people have this issue when using File Manager, it seems to be mainly a login issue.

# Answer
Issue resolved. Uploading a smaller file size seems to have done the trick. Still requires:

```
$config['disable_csrf_protection'] = "y";

```
> 1 votes

---
Tags: file-uploads, file-manager, ee3
---


# Question
Title: 'Clear' button for Freeform forms that clears all fields?
Does anyone know the best way to add a 'Clear' button to Freeform forms that would clear all fields?

# Answer
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset

I don't believe there is an option to add a default `Clear Form` button, but you really just need the tiniest bit of JavaScript and HTML. Depending on the way you use FreeForm, hard code the HTML for the button at the bottom of your form. If you use an automated output and don't build the form's elements yourself, use jQuery to insert it where you need. Example (place after `Submit` button):

```
$(document).ready(function(){

    // add button
    $('#my_freeform_form_element submit').after('<button id="clear_form">');

    // add clear functionality
    $('#clear_form').click(function(){
        document.getElementById("my_freeform_form_element").reset();
    });
});

```
> 1 votes

---
Tags: solspace-freeform
---


# Question
Title: Password reset link taking me to homepage
When I request the password reset, it generates a URL:

http://mywebsite.com?S=0&D=cp&C=login&M=reset\_password&resetcode=rt4RTVHl

However, this takes me to the homepage of the site, not the password reset page.

Any ideas why this might be. Using the native members module 2.1

EE version 2.9.3

Thanks

# Answer
It may be that you didn't set your CP URL correctly.

You can set it with a config override (v3 docs). For example:

```
$config['cp_url'] = 'http://example.com/admin.php';

```

EE v2 docs reference here
> 1 votes

# Answer
When running EE 2.9.2, a default install password reset URL should have this structure:

https://mywebsite.com/admin.php?S=0&D=cp&C=login&M=reset\_password&resetcode=%generated\_reset\_code%

I would suspect what Alex mentioned; you probably don't have your CP URL set correctly, or you are overridding it somewhere.

Look at the link you have; it has a query string attached to the homepage and not to any apparent administrative scripts or paths. I believe only ACTion URL query strings have any value at your homepage in EE, besides any that you generate and use yourself in your homepage template (or if an EE addon does).
> 1 votes

---
Tags: ee2, members
---


# Question
Title: How do I display alternative text when there are no active entries in a channel?
I have an events channel that displays brief information about upcoming events. Those entries are set to 'expire' when they pass a certain date. When there aren't any pending events I would like to display alternative text like “There are no upcoming events at this time. Sign up for a our Newsletter to keep up to date.”

I tried the following but it does not work because there isn't a case where there aren't any entries at all:

```
{if total_entries != 0}
<h2>{title}</h2>
<p>{event_dates}<br />
    {event_location}</p>
    {event_summary}
{if:else}
<p>There are no upcoming events at this time. Sign up for a our <a href="/contact/newsletter">Newsletter</a> to keep up to date.    </p>
{/if}

```

Is there a way to set a condition for when there aren't any entries that aren't expired?

# Answer
The reason your code is not working is because if ExpressionEngine does not return any results, then it doesn't even parse the tags - thus {total\_entries} does not even exist in that context. Also note - it is {total\_results}, not {total\_entries}.

To help with this issue, EE has developed the {if no\_results} conditional. Using that, your code should look as follows...

```
{if no_results}
     <p>There are no upcoming events at this time. Sign up for a our <a href="/contact/newsletter">Newsletter</a> to keep up to date.    </p>
{/if}
<h2>{title}</h2>
<p>
    {event_dates}<br />
    {event_location}
</p>
{event_summary}

```

ExpressionEngine will automatically count anything not within the 'no\_results' tag as displaying if there ARE results.
> 3 votes

---
Tags: conditionals, advanced-conditionals
---


# Question
Title: All new entry tabs are blank (date, categories etc)
I wonder if anyone else has had problems with all the fields disappearing from new entry tabs? I have the tabs but no drop downs etc. I've also stopped receiving comment notifications? I'm on EE 2.10

Cheers

Andy

# Answer
One thing you could try is while editing an entry, openening the sidebar and clicking 'Reset Layout'. You may need to save and then reopen.

This solves issues like that for me sometimes.
> 0 votes

---
Tags: control-panel, ee
---


# Question
Title: Unable to open entries after creating Playa field
I have just installed Playa but after I created a Playa field I can't edit or publish any entries in the admin panel anymore. When I try to publish or create an entry I get a spinner until it ends with an error "Fatal error: Maximum execution time of 300 seconds exceeded in /home/hospl/public\_html/system/codeigniter/system/core/Loader.php on line 341". As soon as I remove the just created playa field I can publish or edit an entry again.

I have EE 2.9.2 running on PHP 5.4.45, Apache2.2.31 and MySQL 5.5.47.

After some further investigation I noticed that when I am in the edit playa field window and I select a single channel with only a few entries I can publish or edit an entry again from the admin panel. As soon as I select a channel in the edit playa field window with a lot of entries (around 30k) the error message comes up again when publishing or editing an entry in the admin panel.

So the issue seems to be triggered by the number of entries in the selected channel of the playa field.

Not sure what to do next, is there a limit to the number of entries in a channel for Playa to work or are there other options I can consider like adding indexes or caching to improve performance and thereby make it work? I am not sure what to do next so any help would be great!

Regards, Tammo

# Answer
> 0 votes
It isn't a matter of being limited to a number of entries, but rather there are just way to many (30k??!!) entries for the system to be able to pull/display before the page times out. Your best bet would be to set the desired sorting option (newest first?) and then limit the number of entries it returns (say to like, 100).

I cannot think of a feasible reason they would need access to all 30,000 and this will substantially speed up load time to the point where the page will not timeout.

---
Tags: playa
---


# Question
Title: How can i display single image on front-end by using matrix module?
I want to display single image on front-end by using matrix module. when I am uploading 2 image in slider I can see both image in slider but if i upload single image i can not see image at front-end.It display nothing.So Can you please help me to resolve this issue.

```
{exp:channel:entries channel="page" dynamic="yes"}
    {middle_slider}
        <div class="item" style="background-image: url('{slide_image}');">
            {if hide_one_page_middle_slider_quot == "No"}
                <img alt="img" src="{site_url}/assets/images/quote-left.png">
            {/if}
            {slide_content}
            {author}
        </div>
    {/middle_slider}
{/exp:channel:entries}

```

# Answer
> 0 votes
Owl carousel will give you an error if you have 1 item and use loop=true. Add onInitialize to check how many items the carousel contains. If the carousel has 1 or less items, set loop to false:

```
$('.owl-carousel').owlCarousel({
    loop:true,
    onInitialize: function (event) {
        if ($('.owl-carousel .item').length <= 1) {
           this.settings.loop = false;
        }
    }
  })

```

---
Tags: matrix
---


title: NavEE manual links target not working

text:
# Question
Title: NavEE manual links target not working
Am using EE 2.10.2 and NavEE 2.2.10

Whenever am assigning target blank or parent or any target to manual links it is not working. Probably a bug, not sure.

Did anyone encounter this?

# Answer
> 0 votes
My bad, should have included the variable {target} in the attribute, target="{target}"

---
Tags: navee
---


title: Cartthrob and cart update queries

text:
# Question
Title: Cartthrob and cart update queries
I'm really struggling to reduce the number of database queries on a Cartthrob install.

As I look at the EE output profiler, I see that most of the queries are

```
UPDATE `exp_cartthrob_cart` SET `cart` = ........

```

Being called from the Cart Model and the update\_cart() method.

From my research, the query will happen whenever save\_cart() or save() methods are called, which happens very often.

As the size of my cart increases the number of queries gets really high. I've seen over 100 of the same looking query.

I've tried optimizing my templates, but even adding 1 tag such as {exp:cartthrob:checkout\_form} or {exp:cartthrob:cart\_items\_info} can add 30 or so of these update queries.

There has to be a way to reduce these, but it's beyond my skill to find. I'd appreciate any advice or assistance you may have.

---

This question is similar to How to prevent CartThrob from making hundreds of SQL queries and running extremely slow?

# Answer
> 0 votes
Following up on my own question here—I've been communicating with Cart Throb and they are optimizing a few methods that will reduce the number of queries in a future release.

---
Tags: cartthrob, database, performance
---


# Question
Title: Redirect to entry with true value for certain field?
What I'm hoping to achieve is for someone visiting `/events` on my site to be redirected to the current event's page ( `/events/{url_title}` ). However, this redirect would be dynamic to check for the one entry I have marked as the current entry, via a custom `current_entry` field I've created (only one entry would be marked as true for this).

Is this possible to achieve without leveraging a plugin? I've only managed to get as far as hardcoding the redirect...

```
    {if last_segment == 'grid'}

        {redirect='events/grid/sxsw'}

    {if:else}

```

# Answer
You could perhaps leverage the `search` param on a channel entries tag.

https://docs.expressionengine.com/latest/channel/channel\_entries.html#search-field-name

Possible Example:

```
{if last_segment == 'grid'}

    {exp:channel:entries
        channel="events"
        limit="1"
        search:current_entry="Yes"}

        {redirect='events/grid/{url_title}'}

    {/exp:channel:entries}

{if:else}

    ... whatever else you were planning

{/if}

```

This would depend on your `current_entry` field having a value of "Yes" for the entry you want to feature. There is, however, an easier way to go about this that wouldn't require your custom field. Provided that you only have one featured entry at a time, you can tag that entry as "Sticky". It's under the `Options` tab on a channel entry form ("Make Entry Sticky"). Then do the same thing but drop needing a custom field. A sticky entry should always come up first in a channel entries loop.

```
{exp:channel:entries
    channel="events"
    limit="1"}

    {redirect='events/grid/{url_title}'}

{/exp:channel:entries}

```
> 0 votes

---
Tags: redirects, url-title
---


# Question
Title: How to get width, height from file field within a matrix cell
I have a site with a matrix field that stores images (file field) in one matrix cell and captions in another. I am trying to get the file field to output the height and width of the image. Here is my code.

```
{matrix_field_name}
  {gallery_image_field}{width}x{height}{/gallery_image_field}
{/matrix_field_name}

```

So this code does output the width and height but it also outputs the path to the file. Something like this

```
http://sitename.com/image/image.jpg800x600

```

Does anyone know how to get it to only output the dimensions?

EE 2.9.2 and Matrix 2.6.1

In answer to the question if there was more code. There is.

```
  <div id="project_gallery" class="my-gallery clearfix" itemscope itemtype="http://schema.org/ImageGallery">
    {cf_project_gallery}
      <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
        <a href="{cell_1}" itemprop="contentUrl" data-size="{cell_1}{width}x{height}{/cell_1}">
          {exp:ce_img:pair src="{cell_1}" width="92" height="69" crop="yes|left,top" allow_scale_larger="yes"}
            <img class="gallery_img" src="{made}" itemprop="thumbnail" alt="{cell_2}" />
          {/exp:ce_img:pair}
        </a>
        <figcaption itemprop="caption description">{cell_2}</figcaption>
      </figure>
    {/cf_project_gallery}
  </div>

```

This is the full code minus the channel entries tag which has a bunch more code in between so I have not included. I just used a paired down version for simplicity of explanation in my original post.

I tried just stripping down the code like in your example and it did output the correct data. I think EE was getting confused on the first {cell\_1} being the opening tag which makes sense I guess. I rewrote it to this.

```
  <div id="project_gallery" class="my-gallery clearfix" itemscope itemtype="http://schema.org/ImageGallery">
    {cf_project_gallery}
      <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
        <a href="{cell_1}{cell_1}" itemprop="contentUrl" data-size="{width}x{height}{/cell_1}">
          {exp:ce_img:pair src="{cell_1}" width="92" height="69" crop="yes|left,top" allow_scale_larger="yes"}
            <img class="gallery_img" src="{made}" itemprop="thumbnail" alt="{cell_2}" />
          {/exp:ce_img:pair}
        </a>
        <figcaption itemprop="caption description">{cell_2}</figcaption>
      </figure>
    {/cf_project_gallery}
  </div>

```

And that did the trick. I didn't notice it originally but in the first version it was not outputting the path to the image on the first cell\_1 so that's what eventually clued me in.

# Answer
> 0 votes
With the code you provided I get the desired output (800x600). Is there more code in your template? There could be an error there.

I use EE 2.10.1 and Matrix 2.6.1.

---
Tags: matrix, file-field
---


# Question
Title: Solspace User Login Form - Custom Error page
I can't get the "error page" parameter to work with the Solspace login form. https://solspace.com/expressionengine/user/docs/error\_page/

Anyone know if it is supported by the login form? See my code below:

```
{exp:member:login_form
    return="{last_page_visited}"
    error_page="site/login-error"}

```

If not, any other suggestions outside of the "Custom System Msgs" module.

# Answer
It is because User does not have it's own login template and uses the native EE login form, therefore any User parameters, such as error\_page, won't function there. https://solspace.com/expressionengine/user/docs/login/ "User does not have it's own Login template tag, as the ExpressionEngine Login\_Form tag is pretty sufficient."
> 1 votes

---
Tags: members, solspace-user
---


# Question
Title: Query exp_channel_data but exclude expired entries
I'm on EE2.10.1, and trying to grab unique countries from a channel that has one field for "country name" and one field for "country code". So I've got the following query:

```
{exp:query sql="SELECT DISTINCT field_id_47 AS country_code, field_id_46 AS country FROM exp_channel_data WHERE channel_id='4' ORDER BY field_id_46 ASC"}
    <option value="{country_code}">{country}</option>
{/exp:query}

```

... which works great, except: I need to exclude expired entries (but include future entries). I think it probably involves doing a JOIN on exp\_channel\_titles, but my SQL isn't really up to it!

Anyone know what the correct query should be? Thanks loads!

# Answer
try something like this:

```
SELECT DISTINCT
d.field_id_47 AS country_code,
d.field_id_46 AS country
FROM exp_channel_data d
LEFT JOIN exp_channel_titles t ON d.channel_id = t.channel_id
WHERE t.channel_id='4'
AND ( t.expiration_date = 0 OR t.expiration_date >= UNIX_TIMESTAMP() )
ORDER BY d.field_id_46 ASC

```
> 0 votes

---
Tags: ee2, query, query-module
---


# Question
Title: For a list of events, get the first occurrence of each event, programmatically
In an add-on, I'd like to get a list of entries (events) ordered by the first upcoming occurrence of that event. For example:

* Event X: 2016-01-05 and 2016-01-08 (2 occurrences)
* Event Y: 2016-01-07, 2016-01-08 and 2016-01-09 (3 occurrences)
* Event Z: 2016-01-04 and 2016-01-09 (2 occurrences)

On 2016-01-02, I should get a list of Z, X, Y. On 2016-01-06, I should get a list of Y, X, Z.

I'm not sure where to begin here. Querying the `calendar_events_occurrences` seems incomplete.

# Answer
Okay, I was able to get what I needed, mainly with the help of a query similar to this one:

```
SELECT entry_id, MIN(start_date) AS start
FROM (
    (SELECT entry_id, start_date FROM exp_calendar_events)
    UNION
    (SELECT entry_id, start_date FROM exp_calendar_events_occurrences)
) AS events
WHERE start_date >= '20160101'
GROUP BY entry_id
ORDER BY start ASC

```

...which gives me all entry/event IDs in the order of their first occurrence, from the given date onward.
> 1 votes

# Answer
If I understand your question properly, the template tag you'd want to use is Calendar:Cal

This tag allows you to display a chronological list of events with all occurrences. You can also check out the Getting Started documentation which explains the differences between each Calendar tag, used to achieve different things. :)

So, if you're making a Day view page you code might look something like this:

```
{exp:calendar:cal
    pad_short_weeks="n"
    {if segment_3 == ''}
        date_range_start="today"
        date_range_end="today"
    {/if}
    {if segment_3 != ''}
        date_range_start="{segment_3}-{segment_4}-{segment_5}"
        date_range_end="{segment_3}-{segment_4}-{segment_5}"
    {/if}
    }
    {display_each_day}
        <div class="header">
            <div style="float: left; width: 20%;">
                <a href="{path='calendar/day'}{prev_day format="%Y/%m/%d"}/">
                    Yesterday
                </a>
            </div>
            <div style="float: left; width: 60%; text-align: center;">
                <h1>{date format="%l, %F %d, %Y"} ({day_event_total} events)</h1>
            </div>
            <div style="float: right; text-align: right; width: 20%;">
                <a href="{path='calendar/day'}{next_day format="%Y/%m/%d"}/">
                    Tomorrow
                </a>
            </div>
            <br style="clear: both;" />
        </div>
        {display_each_hour}
            <h2>
                {date format="%g:%i %a"} ({hour_event_total} events)
            </h2>
            {events}
            <div class="event">
                <div class="head">
                    <h2>
                        <a href="{path='calendar/events'}{event_id}/">
                            {event_title}
                        </a>
                    </h2>
                {if event_all_day}
                    <p>
                        {event_start_date format="%Y-%m-%d"}
                        {if event_end_date}
                            - {event_end_date format="%Y-%m-%d"}
                        {/if}
                    </p>
                {if:else}
                    <p>
                        {event_start_date format="%Y-%m-%d %H:%i"}
                        {if event_end_date}
                            - {event_end_date format="%Y-%m-%d %H:%i"}
                        {/if}
                    </p>
                    <p>
                        This event lasts {event_duration_days} days
                        {event_duration_hours} hours
                        {event_duration_minutes} minutes.
                    </p>
                {/if}
                    <p>
                        From calendar:
                        <a href="{path='calendar/calendars'}{event_calendar_id}/">
                            {event_calendar_title}
                        </a>
                    </p>
                </div>
                <div class="body">
                    <p>
                        Details: {event_summary}<br />
                        Location: {event_location}
                    </p>
                </div>
            </div>
            {/events}
        {/display_each_hour}
    {/display_each_day}
{/exp:calendar:cal}

```
> 0 votes

---
Tags: solspace, add-on-development, solspace-calendar
---


title: Email errors Broken pipe

text:
# Question
Title: Email errors Broken pipe
I all of a sudden cannot email in EE. When sending through Firemail I get a million errors like the following. EE 2.9.3 and FireMail 1.9.3. Was working earlier, can't image why this would happen all of a sudden

A PHP Error was encountered

```
Severity: Notice

Message: fwrite() [function.fwrite]: send of 11 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2073

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/user/public_html/home/admin/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 446

```

# Answer
I had something similar happen to me with CodeIgniter (which forms the base of Expression Engine).

This occurs when the SMTP server disappears in the process of sending a mail. fwrite() has a bug to be giving a wrong return (in a loop) in that occasion (see https://bugs.php.net/bug.php?id=39598 and http://php.net/manual/en/function.fwrite.php#96951).

Anticipation on the return value of the send() function is what I did: have it returned a "mail not send" message to the user so further corresponding action could be taken.

```
$is_send = $this->email->send(FALSE);

```
> 0 votes

---
Tags: email
---


# Question
Title: Displaying categories across sites with Multi Site manager
I have a Multi Site Manager installation with Sites A and B set up.

Site A contains a channel, "Foo" which has a number of category groups assigned to it.

On Site A, I can easily show a list of categories with:

```
{exp:channel:categories category_group="1" style="linear" show_empty="yes"}
{category_name}<br>
{/exp:channel:categories}

```

This outputs a list of category names as expected.

I need to do the same on Site B. But using the same code shows nothing. I tried adding a site parameter, a site\_id parameter, specifying the channel name, specifying the sitename:channel name. All to no avail.

How can I show the list of categories on Site B?

# Answer
I have done it in the past this way:

```
{exp:query sql="SELECT cat_id, cat_name, cat_url_title FROM exp_categories WHERE group_id = 'xxx'"}

```
> 0 votes

# Answer
Using the **show="category\_ids"** should work, though that's the individual category ids. Not sure about category groups.

Also, maybe not specific to this, but **relaxed\_categories="yes"** helps with a lot of category indicator URL problems working with MSM.

GWcode Categories may help, as well: http://gwcode.com/add-ons/gwcode-categories
> 0 votes

---
Tags: categories, multi-site-manager
---


# Question
Title: Wygwam 2.7: How Can I Customize the Image Properties Modal?
I would like to customize Wygwam's Image Properties modal to display the following options only:

* Upload image files from local HD
* Add Alt text
* Add a caption

I don't want site members to be able to:

* See existing images
* Resize images
* Style images
* Use other advanced options

Many thanks!

# Answer
Honestly, I'm not sure theres a way to do this. You can customize parts of CKEditor 3 (the WYSIWYG editor Wygwam uses) like the images or link dialog windows because they are each separate JS files. Just copy the file and start hacking away.

But the actual uploading of files is handled by either CKFinder (CKeditor's counterpart), the build-in EE file manager, or anther third-party alternative like Assets. And as far as I know, none of them allow you to only upload files or even just see files the current users has uploaded but none of the others.

There might be a way to use DevDemon's Channel Images to accomplish this. It creates an upload directory for each entry and only uploads images there. So the user would only be allowed access to that entry's images.

Channel Images also has a Wygwam button that let's the user insert an image from Channel Images. It's pretty plain. You pick and image and it drop in an `<img>` tag. You should be able to hack it to create a `<figcaption>` for instance because it's built in JS like any other CKEditor button.
> 0 votes

# Answer
I've been using the "Advisory Title" in Advanced properties. It makes a "title" attribute. Then using jQuery to render an html caption from the attribute of the image tag. It's OK, but the content requires that you code things like quotes, apostrophes etc. as htmlchars, like ' or " (instead of " and '); or it will ruin your markup.

When the image is placed in the copy when editing in Wygwam, right click on it, and you will see a menu item for image properties. Find "Advisory Title" and write your caption in there. Make sure there are no (" or ') characters. Wygwam will save the content. Then you can pull out the value using jQuery and create a caption directly beneath the image.

One thing to try would be to see if settings can be changed in the Wygwam channel to allow quotes and store them as html characters. A problem with this method is that it is probably not what the title attribute is for.
> 0 votes

---
Tags: wygwam
---


title: Postmaster error with Mandrill App

text:
# Question
Title: Postmaster error with Mandrill App
I am using Profile:Edit to register new members, then using Postmaster to trigger emails when they have registered and been approved.

I am currently having a problem with Postmaster when I use the "screen\_name" field when registering in Profile:Edit. I receive this error.

```
Error

Mandrill Service - Error: The requested URL returned error: 500 Internal Server Error
history.go(-1);”]« Back

```

Even though I am getting this error, the member still registered to the site, but the Postmaster email is not triggered. But if I remove screen\_name in the registration form the member is registered and an email is triggered.

I have right now username, screen name, and email all as the email address of the registered member, and would like to add some uniqueness to screen\_name.

Has anyone come into an error like this using postmaster?

# Answer
> 0 votes
I get these errors in mandrill when there is a tag instead of an email address.

---
Tags: postmaster, profile-edit
---


title: An Error Was Encountered

text:
# Question
Title: An Error Was Encountered
In the admin CP, I receive this error: "This form has expired. Please refresh and try again."

This happens when I try to change a template, create one, or save anything to the site. Refreshing and trying again does nothing, my only solution is to switch browsers or clear browser caches, log in again, and try again which fixes the problem very temporarily. It happens every time I start working on the site again after being off of it, and it sometimes starts happening in the middle of working. Site is in development still, haven't even started editing channels yet.

Any ideas would be appreciated.

Multi-site v 2.9.3

# Answer
> 1 votes
EE changed it's security specs from 2.8. If your are having difficulties with Codeigniter's CSRF protection on your local machine I would add this variable to your config.php file

`$config[‘disable_csrf_protection’] = “y”;`

---
Tags: templates
---


# Question
Title: Formatting date does not follow localisation settings!
**Although I have set in the CP the localisation settings to Swedish,** also for superadin and my users, and I have installed the **Swedish foreign language** pack the date formattings in my Templates still are English, this is unwanted I cannot work with this.

Day 4 in the week should be 'torsdag' **(=Swedish)** but it remains 'Thursday'.

I do not understand how this really works. Is there a simple native way to solve this?

Thanks a lot for answering.

# Answer
> 1 votes
The localisation settings only adjusts the language in the control panel. I can recommend the add on Date/Time Language Converter to adjust dates to the correct language in your templates.

---
Tags: ee2, language, date-format
---


title: Expresso Store: Wrong tax calculation

text:
# Question
Title: Expresso Store: Wrong tax calculation
**Software**

EE: v2.10.1

Expresso Store: v2.5.1

**Scenario**

Cart contains 1 product priced at 1600 (tax included in price)

Shipping is free, that is 0

Tax is 25%

**Store outputs**

```
{order_total} = 1600

```

So far so good.

```
{tax_percent} = 25%

```

This too, is correct, but then:

```
{order_tax} = 320

```

Correct me if I'm wrong, but 25% of 1600 = 400. I don't understand why Store outputs 320 (ie calculates tax using 20% instead of 25%, which is 320).

I've since checked for this issue on other client sites with the same setup, and indeed there too, this is happening.. which is kind of a problem.

Can anybody advice? It would be much appreciated! Thanks in advance!

# Answer
This happens because the actual price of the item without tax is not 1200 as you are assuming the actual price of the item without tax would be $1280.

```
(1280 * .25) + 1280 = 1600
(product price * tax rate) + product price = tax inclusive total price

```

For example if I had a product that was $20 tax inclusive with 25% tax applied the item price without tax would be $16 oppose to $15 which would happen when you try to take 25% from the total price of $20
> 2 votes

---
Tags: expresso-store, expresso
---


# Question
Title: Importing nested categories with Datagrab
Having difficulties importing nested categories from a CSV. Currently I have a single categories column, formatted as follows: 'parentcategoryname, subcategoryname'.

The subcategories all have unique URIs but their names are not unique. So, the subcategory with the correct name will be selected on import, but it will be under the incorrect parent category.

Is there a way to import nested categories, and I just have my CSV set up incorrectly?

EE version 2.9.2, Datagrab version 1.9.2

# Answer
From the Developer:

Use a slash ‘/‘ to separate subcategories, so you can do something like, 'Category / SubCategory'

The delimiter is hard-coded but if you want to change it is around line 1420 of models/datagrab\_model.php:

$delim\_cats = explode('/', $cat);
> 3 votes

---
Tags: categories, datagrab, import
---


title: Solspace Calendar - Category Filtering

text:
# Question
Title: Solspace Calendar - Category Filtering
I need to have the Solspace Calendar filtered by categories. Is there any working templates out there for reference?

# Answer
> 2 votes
Use the documentation to determine how you should configure your templates.

https://solspace.com/expressionengine/calendar/docs/

Try using this parameter to filter by category:

https://solspace.com/expressionengine/calendar/docs/cal/#category

You'll have to be more specific about what you're trying to do for anyone to give you a good example. As for "working templates", EE and how you retrieve parameters for your tags varies widely so again, if you could be more specific perhaps we could help you better.

---
Tags: categories, solspace, calendar
---


# Question
Title: Can you get a categories count within the channel entries tag?
I'm referring to EE docs on categories looping pair within channel entries tag. I'm looking for a count and total count param. Is there a way to pull this information out?

Here is the code -- I'd like to have a count within the wrapped {categories} {/categories} tag pair:

```
              {exp:channel:entries
                    channel="division"
                    orderby="title"
                    sort="asc"
                    entry_id="not 3870"
                    status="open|closed"
                    {global:disable_default}
                    }
                        <li class="{title}">
                            <a>{title}</a>
                            <div class="nav_dropdown">
                            {division_tagline}
                            <hr/>

                            {categories}
                              <div id="sport_group" class="{title}-width">
                                <h3>{category_name}</h3>

                                    {exp:playa:children site="nxtsports" status="open|closed" field="division_brands" disable="" category="{category_id}"}
                                        <a href="{brand_url}" target="blank"><img class="brand_logo" src="{brand_logo}"></a>
                                    {/exp:playa:children}
                                </div>
                            {/categories}

                            </div>
                        </li>
                {/exp:channel:entries}

```

# Answer
You can get a category count without using PHP using a if statement on a string built by the {categories} tag inside of the entry's exp:channel:entries tags. such as this:

```
{exp:channel:entries}
    {if {categories}1{/categories}=='1'}

        entry has 1 category

    {if:else}

        entry has multiple categories.
        {!-- i.e.: if '111' == entry has 3 categories  --}

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

```
> 2 votes

# Answer
Granted this is not the ideal way of getting the total\_results and count in the categories tag pair, but it "works" and I've never have found an alternate solution. You have to enable PHP and set it to parse on output.

```
<?php $count = 0; ?>
{categories}
    <?php $count++; ?>
    This is the <?php echo $count; ?> category for this entry.
{/categories}

```

You can then use $count where ever you need to display it.

```
There are <?php echo $count; ?> categories for this entry.
```

I would love to hear if someone had a better solution.
> 0 votes

---
Tags: categories
---


# Question
Title: Comparing the siteURL variable to the current URL
I am quite new to Expression Engine and am trying to get a handle on the template system. I have a nav with items that I want to set to active if they link to the current page

I have the link built like this so far:

```
<a href="{site_url}ranges/view/{url_title}">
   {menu_label}
</a>

```

The comparison I want to do is as follows:

if ((site\_url + 'ranges/view' + url\_title) == current\_url) -\> output class="active"

I have tried the following but I get a Parse/Syntax Error:

```
<a href="{site_url}ranges/view/{url_title}" {if (site_url + 'ranges/view/' + url_title) == current_url}class="active"{/if}>
   {menu_label}
</a>

```

What am I doing wrong?

# Answer
> 0 votes
Do you really want to compare the whole url? If not, it is easier to only compare the entry url\_title and the url\_title from the current url like this:

```
{if url_title == segment_3}class="active"{/if}

```

Here you can find more information about url segments.

# Answer
> 0 votes
I expect that you're getting parse errors as EE can't handle the "+" symbol, as it's for mathematical addition, not concatenation.

But fundamentally it won't work as {site\_url} is parsed late, so can't be used in conditionals, see here for parse order details or more depth here on the EE website.

I've written out the solution in another Stack Exchange post, which is to use a custom config variable, the alternative is replace site\_url and hard code the protocol & domain, but that's not good if you have multiple environments.

Be aware of the downfalls of comparing url\_title with segment\_3 in a conditional, as this will match true even if there is a segment\_4 in the url.

---
Tags: templates, site-url
---


# Question
Title: Cannot make stash:get to show up inside exp:channel tag
Problem:

A value set is not parsed inside a channel:entries tag.

The value is actually set (and parsed with the embed on the page).

Also, when I hard-code the value in te channel:entries tag the result appears, so there is nothing wrong with the channel code.

I want get this value:

```
{exp:stash:set
     name="MedlemLetterAuthor"
 }
    {exp:channel:entries
        channel="member_profiles"
        dynamic_parameters="search:member_letter"
        orderby="title"
        sort="asc"
        dynamic="off"}
    {author_id}|
    {/exp:channel:entries}
 {/exp:stash:set}

```

## This is my embed:

```
begin test
    just for testing: {exp:stash:get
         name="MedlemLetterAuthor"
     }
end test

{exp:stash:parse
process="end"
trim="yes"}

        {exp:channel:entries
                            channel="kcvast_arbet|kcvast_offentlig"
                            disable="pagination|category-fields|member-data"
                            dynamic="no"
                            author_id="{stash:MedlemLetterAuthor}"
                            orderby="author_id"
                            parse="inward"
                            }
                            {off-gest-bilder
                            cover_only="yes"
                            }some channel code here
    {/exp:channel:entries}

```

---

## This appears on my page

```
begin test
    just for testing:

        8|

        46|

end test

```

---

# Answer
In your embed code you have pasted it looks like you have an extra pipe character in your author\_id parameter

```
author_id="{stash:get name="MedlemLetterAuthor"}|"parse="inward"

```

makes it a little hard to understand what the code is supposed to be. Perhaps its just a typo. The other thing to try would be what is suggested in this thread.

https://devot-ee.com/add-ons/support/stash/viewthread/7166

Sometimes I find using single quotes within double quotes of parameters helps as well for example

```
author_id="{stash:get name='MedlemLetterAuthor'}"

```
> 1 votes

# Answer
Looking at the output the stash is capturing white space and EE doesn't like that for var values.

When setting your initial stash, add the param `trim="yes"` \- this will remove any whitespace.

**Update** Your stash var: MedlemLetterAuthor should output in 1 line: 1|38|9999 etc. As I wrote initially add the trim to THE FIRST SET STASH!!!!!!
> 0 votes

---
Tags: stash, channel, parse-order, embeds
---


# Question
Title: Has Cartthrob been updated to work with ExpressionEngine 3.x?
We are currently running 2.6 on EE 2.10.1 and are looking to upgrade to 3.x. I can see 2.7 is available to download but does that have full EE 3 support?

And if so, is there a migration guide? We use a number of Cartthrob hooks too so we'd need to understand any changes that may affect our own add-ons.

# Answer
> 4 votes
(I work at Vector; we own CartThrob)

We haven't released an EE3 version yet but we're actively working on it and pretty close. We hope to share a more exact timeline with the community very shortly!

# Answer
> 0 votes
I don't think it's available yet, but they're working on it: https://twitter.com/cartthrob/status/654290601026977792

---
Tags: cartthrob
---


# Question
Title: Replace "Add File" link with a single file upload input?
I've been developing a website for an artist to feature and sell their artwork. Each piece of artwork has its own channel entry, and currently, there are a number of "File" fields so the artist can upload various views (e.g., landscape, portrait) for each artwork.

They've created all of the artwork entries and are now going back through and adding all of the various view images. However, they find EE's upload process tedious for this particular work.

Basically, they want to bypass EE's built-in file browser entirely. They'd like to replace the "Add File" link with a single file upload input field à la the old nGen File fieldtype so they can upload images directly.

I've looked and looked and can't find anything to fit the bill. I thought the "Show existing files?" option for "File" fieldtypes might be the solution, but that's only on the front-end, not the CP.

The site is currently running on v2.10.1, FWIW.

# Answer
> 0 votes
As it turns out, I was able to develop an alternative solution using the Channel Images add-on.

---
Tags: file-uploads
---


# Question
Title: Will changing the order of Channel Images categories screw anything up?
I've set up a "Channel Images" field that has a comma-separated list of categories. The client wants to modify the order of that list. If I change the order of those categories, will that mess anything up? Will any existing category assignments be lost?

# Answer
Haven't used channel images but technically speaking, changing order of categories is purely a visual order, EE refers categories internally by ID.

Simply changing an order does not generally affect anything assigned to it.
> 0 votes

---
Tags: channel-images
---


# Question
Title: Charge Stripe billing address erroring if it includes a hyphen
I am getting a "Must be a valid string" error on the billing name field in a charge form if the name contains a hyphen.

Any idea where that is coming from? I can't track it down.

# Answer
> 0 votes
I got an email back from Charge, you need to edit That's just one change in mod.charge.php, changing the regex to :

```
preg_match("/[^\pL\d\s\-]/u", $val, $matches);

```

They are working on a fix for this at the moment.

---
Tags: stripe, charge
---


# Question
Title: Create list of authors, but no repetion (LOW search)
We have build a site where members publish images in entrees which are tagged ( one or more tags). By using Profile:edit there also exists a channel with Member\_data like name and adress. The author\_id of entries in Images is therefore the same as one entry in Member\_data.

My client wants to be able to search for tags, see in the result a collection of images and (in a sidebar) a list of all the authors as links to their own Profile Template.

My problem is that the authorlist show authors more than once ( if more than one image-entry of that author has been found).

I must therefore create, per search result, a dynamic index of authors, and I do not know how.

Is there someone that has done this before? Is this someting for the query module, or is there an addon?

Thanks for pointing me in the right direction.

# Answer
I made it work with Stash, set list, end get list with the tag 'unique' to filter author\_id.

Getting the data (=search result):

I only want author, and (for the url) channel of the entry, author\_id and entry\_id.

```
 {exp:stash:set_list name="my_list" parse_tags="yes" parse_depth="2"}
{exp:low_search:results
  query="{segment_2}"
  status="not closed"
  disable="member_data|category_fields"
  require_all="category"
}
 {stash:item_title}{author}{/stash:item_title}
 {stash:item_artist_id}{author_id}{/stash:item_artist_id}
 {stash:item_id}{entry_id}{/stash:item_id}
 {stash:item_channel}{channel_name}{/stash:item_channel}
{/exp:low_search:results}
 {/exp:stash:set_list}

```

then printing the data, filtered by author\_id (which I want to be unique)

```
<ul class="li_LinkRColumn">
{exp:stash:get_list name="my_list" unique="item_artist_id"}
    <li><a href="{path='Kcvast/konstnar/{item_artist_id}/{item_channel}/{item_id}'}">{item_title}</a></li>
{/exp:stash:get_list}
    </ul>

```
> 0 votes

# Answer
Low Search will always return **channel entries**, whether that be News articles or Member data (which is a channel in your case).

For your search results, you basically want two lists:

1. Unique entries from the channel "Images";
2. Unique entries from the channel "Member\_data".

The tricky thing is that #2 is related to #1 in the sense that you should only show entries from the Member\_data channel that share an author\_id with the entries from Images.

This is not something Low Search can do out of the box. You'd need some custom filters/extensions in order to make it work. You can contact me for a quote.
> 0 votes

---
Tags: search, low-search, query, filter, query-module
---


# Question
Title: Can channels be loaded dynamically based on url segments
Im constructing a website with four 'microsites' that have roughly identical page structures. Another relevant point here is that while the content and page structures will be effectively identical, the visual aesthetic (colors, textures, type) will be substantially different.

For example, each microsite will contain:
-home
-about
-services
-etc

These pages will occur on all of the 'microsites', hence the desire to make a template that will structure all the 'about' pages. Ideally this would then grab the appropriate style/content information based on a url segment. There may instances where one microsite will contain a page that another does not.

*In response to comment, for clarity*
urls would occur something like this:

```
site.com/tour/home
site.com/tour/about
site.com/tour/services
site.com/tour/rfp

site.com/play/home
site.com/play/about
site.com/play/services
site.com/play/rfp

```

**The vital bit to this is that the structure is identical.<br>The aesthetic and content are specific to each microsite and page thereof.**

I would like to use the same template for each page so in the event the layout changes im only updating the 'home' template in one location rather than for each 'microsite'. Im really not sure how to best approach this using standard channel/template/entry setup.

My initial theory was to setup channels for each of the repeated pages. For example, I would have a channel dedicated to 'home' pages, a channel dedicated to 'services', etc. This would only seem to work if I was able to load channels dynamically based on url segments. I fully admit that this maybe a flawed approach that may not even work, but I can't think of a better solution.

Im totally open to any ideas (unorthodox or not). Thanks in advance.

# Answer
You could silo out different sites using the Multiple Site Manager:

https://ellislab.com/expressionengine/user-guide/cp/sites/

But depending on your amount of actual pages needed, you could just use the Structure add-on. I've found it works very well on smaller sites.

http://buildwithstructure.com
> 0 votes

# Answer
Would you not just give your templates a body tag of `class={segment_1}` and craft your CSS to use the body tag to differentiate which styles are served.

So like /site\_1 or /site\_2 Each template would have

```
<body class='{segment_1}">

```

Then your CSS would have

```
.site_1 .aclass:xxxx

.site_2 .aclass: yyyy

```

Sorry for formatting, on mobile atm.
> 0 votes

# Answer
Yes. I use a mixture of stash, switchee and native ee. all of my 'template' groups (essential for url segs) simply load in my master template with a number of prliminary variables. e.g.:

```
{embed="_global/.master"
    nav_channel="{segment_1}"   {!-- Channel for entries to be listed from this page/section --}
    nav_id="02"                 {!-- The navigation position of this section - css class for nav selection --}
    url_title="{last_segment}"  {!-- usually last_segment --}
    page_preset="default"
}

```

then within my master I have a case by case check (switchee) on the URL then depending on the URL/URL segment I load in the template(s) for the content. So using this, depending on the URL segment you could load in a different style sheet in your head, different content segment areas in the body, and different footer, etc.

Stash is used to 'store' all my field content. this way I declare it once in my 'master' then can call it up in my templates no matter how deep my templates go, instead of having to embed and re-embed (though you may not have that problem with a small site).

Hope this helps
> 0 votes

---
Tags: channel-entries, segments, pages, dynamic
---


# Question
Title: How can I send an automated email to pending members after they complete the registration form?
I manually approve/validate member applications, so I don't need a member activation key email. What I am looking for is an automated email that pending members receive after submitting the registration form that tells them that we have received their info and that they will be approved shortly. I'm not very familiar with EE yet, so any help is appreciated.

# Answer
There's a free add-on that does just that: https://devot-ee.com/add-ons/registration-emails
> 1 votes

---
Tags: forms, email, automation
---


title: Lang text with control panel interface

text:
# Question
Title: Lang text with control panel interface
On a new project, the client requires that it be possible to add/modify all text.

I will be using channel entries to hold majority of the 'content' text, but I am more perplexed by how I should allow text editing for hard coded items, like button text, headers, navigation etc.

Ideally, I would like to be able to code variables into the templates without any wrapping tags. Essentially like a global variable. For example:

```
<input type="submit" val="{lang_login_btn}" />

```

`{lang_login_btn}` being the variable.

The text all needs to be manageable by the client, so there has to be some kind of control panel interface, or at the very least a 'lang' document.

What would you recommend for this?

A custom module? If so, is it possible to have a module that can output variables like this without the use of wrapping tags?

I have built many plugins and extensions, but only basic modules without control panel interface.

Any direction would be greatly appreciated.

# Answer
> 1 votes
You can either use built-in Global Variables feature or Low Variables add-on

Both will work same way, you'll just place {variable\_name} in your templates, without any other special tags, but you may find Low Variables interface easier to manage variables, as they all are presented on same page.

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


title: EE Contact Form With No Redirection

text:
# Question
Title: EE Contact Form With No Redirection
I am using EE's built in contact form feature ({exp:email:contact\_form}) on my site and it works great.

The issue I have is that the user is shown the following EE page on submit:

This looks really unprofessional and breaks the experience of the site. Is there a way I can stop this page from being shown? I have tried playing around with the redirect settings but no luck.

Alternatively would there be a way to style the page? For e.g If I was able to add classes to the elements on the page I could hide them in CSS

# Answer
> 0 votes
You can use the parameter return to set the page you want to go to.

The message page can be styled in the control panel. Go to design -\> message templates -\> user message.

---
Tags: redirects, css, email-contact-form
---


# Question
Title: What is the difference between Expression Engine 2 and 3? Why should I upgrade all of my sites?
I have 5 websites that are all running on Expression Engine 2.5 - what, in simple dot point form has changed about ExpressionEngine in version 3. Whats been added, removed and updated?

Would it simplify maintaining all 5 sites that are similar in there setup?

The EE website isn't very clear on the improvements

# Answer
I'll attempt to keep this answer opinion free!

Your first stop should be the EE3 changelog, and also catching up on the EllisLab blog over the past 6 months. But you'll also need to look at the EE2 changelog to see all the changes since your version that are also included in EE3.

The main changes are the infrastructure and Control Panel but it's where the v3 platform can take you into the future as it's far better structured for expansion, flexibility and new features.

Your websites are already running an old version from May 2012 - this should be considered for an upgrade anyway to the latest v2.x version, if only for the security updates! If you don't appreciate the need for updating regularly, then best read up about Drupal and the millions of websites with possible compromises from attacks in Oct 2014.

But ultimately the answer comes down to what your websites (or clients) want to do, if you/they are happy with the websites and don't need to change as they have all the functionality they need for the future, then there is no point. if you/they want to continue to expand the sites in the future, then you will need to factor in an upgrade at some point in the future as more and more add-on developers have stopped releasing updates for EE2 add-ons to focus on EE3.

There are still EE1 websites in the wild, because that version still suits the requirements of the owners. So there is no essential requirement to upgrade to EE3 unless you outgrow EE2.
> 12 votes

---
Tags: ee2, multi-site-manager, ee2-upgrades, update, ee3
---


title: search:title doesn't work

text:
# Question
Title: search:title doesn't work
this doesn't seem to work, since you can only "search" in custom fields:

```
{exp:channel:entries channel="#" search:title="foo"}

```

Is there any way to easily achieve this ? Preferably without adding any custom fields or using advanced search add-ons.

# Answer
> 9 votes
You're correct that the native `search:field_name` param only works on custom fields and not titles, annoyingly, so we do need an addon to do this.

Stash is overkill for this use case though and requires a lot of code to get the (fairly simple) job done.

I'd use another fine Croxton product instead: the Search Fields Plugin, just wrap it around your `{exp:channel:entries}` tag:

```
{exp:search_fields
    search:title="keyword"
    channel="my_channel"
    parse="inward"}
    {exp:channel:entries entry_id="{search_results}" disable="member_data|categories" dynamic="no" orderby="title" sort="asc" limit="10"}
        <a href="{page_url}">{title}</a>
    {/exp:channel:entries}
{/exp:search_fields}

```

# Answer
> 3 votes
I'd just use the query module:

`{exp:query sql="SELECT entry_id FROM exp_channel_titles WHERE title LIKE '%searchterm%' and weblog_id='1' " backspace="1"}{entry_id}|{/exp:query}`

That would pull a list of entry\_ids for a given channel, that you could then use in a channel:entries tag or where ever else you needed it.

Stash would work but would pull a lot more data that was then just discarded, and this approach works with a base EE install.

# Answer
> 2 votes
You could use Title Master or MX Title Control to create a custom title field that could then be searched. This has a couple other benefits for the client UX by having them enter information only once in the publish form and can break apart things like management team names that can then be sorted by last name, etc. I've had some trouble with Structure and Title Master (who hasn't had SOME trouble with Structure?) but if you're not using Structure or your channel title isn't tied to your URL title directly then this should't be an issue. Haven't tried MX Title Control in a long time but the support forum does note some quirks with it as well.

**Update:** An update to Title Master makes my comment above moot. The two play nicely together again.

# Answer
> 1 votes
Seems like there should be an obvious answer but that being said, I'd use stash:

```
//Open up a stash list
{exp:stash:set_list parse_tags="yes" name="my_entries"}
//Open up your channel
{exp:channel:entries channel="#" disable="Whatever"}
//Capture the entry title
{stash:entry_title}{title}{/stash:entry_title}
//Maybe even a description
{stash:entry_desc}{desc}{/stash:entry_desc}
{/exp:channel:entries}
//Close stash
{exp:stash:set_list}

//Now display the results matching a regex string to the entry title
{exp:stash:get_list name="my_entries" match=[#foo#] against="entry_title"}
{entry_title}//Display the title of any results
{entry_desc}// And the description or any other value(s) caught initially
{/exp:stash:get_list}

```

I haven't looked at the EE docs for a while but using Stash alot lately and this should work.

# Answer
> 0 votes
Thank you for this! I was looking for a solution for the end user to enter a keyword into a custom field and display related entries and searched everywhere. This works!

---
Tags: ee2, add-on, channel-entries, search
---


# Question
Title: Outputting a Matrix inside of a Playa field
I've found a couple other posts regarding same issue, but can't seem to resolve with any solutions out there.

Everything is outputting fine except content in tag pair `{studies_outline_block}`, which is a matrix field inside a playa field inside of a matrix field.

Any help is much appreciated.

```
<?php $i = 1; ?>

{exp:channel:entries channel="pages"}
    {studies_projects}
        <div class="col-sm-6 col-md-4 col-lg-3 col-xs-12">
            <div class="project-box ">
                <img src="{image}" alt="{cat_name} category image">
                <h3>{cat_name}</h3>
            </div>
            <ul>
                {playa_projects}
                    <?php $count = $i++; ?>
                    <li><a class="fancybox" href="#inline-<?php echo $count; ?>" title="{studies_caption}">{title}</a></li>
                    <div id="inline-<?php echo $count; ?>" style="display:none;">
                        <div id="slider<?php echo $count; ?>" class="flexslider slider-js">
                            <div class="flex-heading">
                                <div class="col-md-6">
                                    <h2>{project_name}</h2>
                                </div>
                                {studies_outline_block}
                                        <div class="col-md-2 project-name">
                                            <h3>Project Size</h3>
                                            {content_1}
                                        </div>

                                        <div class="col-md-2 project-name">
                                            <h3>Project Cost</h3>
                                            {content_2}
                                        </div>
                                        <div class="col-md-2 project-name">
                                            <h3>Project Use</h3>
                                            {content_3}
                                        </div>
                                {/studies_outline_block}
                            </div>
                            <ul class="slides">
                                {studies_image_gallery}
                                    <li><img src="{url}" /></li>
                                {/studies_image_gallery}
                            </ul>
                        </div>
                        <div id="carousel<?php echo $count; ?>" class="flexslider carousel-js">
                            <ul class="slides">
                                {studies_image_gallery}
                                    <li><img src="{url}" /></li>
                                {/studies_image_gallery}
                            </ul>
                        </div>
                    </div>
                {/playa_projects}
            </ul>
        </div>
    {/studies_projects}
{/exp:channel:entries}

```

# Answer
Was able to resolve using the var\_prefix parameter. Here's the correct code:

```
<?php $i = 1; ?>

{exp:channel:entries channel="pages" dynamic="off"}
    {studies_projects}
        <div class="col-sm-6 col-md-4 col-lg-3 col-xs-12">
            <div class="project-box ">
                <img src="{image}" alt="{cat_name} category image">
                <h3>{cat_name}</h3>
            </div>
            <ul>
                {playa_projects var_prefix="playafield"}
                    <?php $count = $i++; ?>
                    <li><a class="fancybox" href="#inline-<?php echo $count; ?>" title="{studies_caption}">{playafield:title}</a></li>
                    <div id="inline-<?php echo $count; ?>" style="display: none;">
                        <div id="slider<?php echo $count; ?>" class="flexslider slider-js">
                            <div class="flex-heading">
                                <div class="col-md-6">
                                    <h2>{playafield:project_name}</h2>
                                </div>
                                {playafield:studies_outline_block var_prefix="nested_matrix"}
                                    {if nested_matrix:content_1}
                                        <div class="col-md-2 project-name">
                                            <h3>Project Size</h3>
                                            {nested_matrix:content_1}
                                        </div>
                                    {/if}
                                    {if nested_matrix:content_2}
                                        <div class="col-md-2 project-name">
                                            <h3>Project Cost</h3>
                                            {nested_matrix:content_2}
                                        </div>
                                    {/if}
                                    {if nested_matrix:content_3}
                                        <div class="col-md-2 project-name">
                                            <h3>Project Use</h3>
                                            {nested_matrix:content_3}
                                        </div>
                                    {/if}
                                {/playafield:studies_outline_block}
                            </div>
                            <ul class="slides">
                                {studies_image_gallery}
                                    <li><img src="{playafield:url}" /></li>
                                {/studies_image_gallery}
                            </ul>
                        </div>
                        <div id="carousel<?php echo $count; ?>" class="flexslider carousel-js">
                            <ul class="slides">
                                {studies_image_gallery}
                                    <li><img src="{playafield:url}" /></li>
                                {/studies_image_gallery}
                            </ul>
                        </div>
                    </div>
                {/playa_projects}
            </ul>
        </div>
    {/studies_projects}
{/exp:channel:entries}

```
> 0 votes

---
Tags: matrix, templates, playa
---


# Question
Title: Exp:resso Store - Auto-Calculate Shipping Based on Address
Looking for a bit of help with Exp:resso Store's USPS shipping plugin. Either I'm not looking at the correct page in the documentation, or it just isn't fully documented. Being new to this, it makes no sense to me. Your help is appreciated. :)

I WAS using the native, built in shipping feature that comes with the Store module itself. I had 2 shipping rules in place, but as my husband pointed out, if they only order one, tiny thing, it's unfair to charge the flat rate postage. Indeed.

Thinking it would help, I purchased the USPS shipping plugin. I have it installed, and have my USPS API username in place. I have it set to Variable Container Size, International Mailtype set to ALL, even though I do not ship outside of the U.S, and have "Priority" checked under "Service - US Only". (As a sidenote, regardless of unchecking all of the international options and saving my preferences, I come back only to find them re-checked.)

I implemented this code on my FIRST checkout page:

```
<td>Shipping</td>
<td colspan="2">
<select name="shipping_method">
<option value="">Select a shipping method...</option>
{shipping_methods}
<option value="{method_id}">{method_title} ({method_price})</option>
{/shipping_methods}
</select>

{if error:shipping_method}
<p class="TCBHelpBlock">
{error:shipping_method}</p>
{/if}
</td>
<td style="text-align:right">
{order_shipping}
</td>

```

What I'm aiming for is shipping to be calculated based on the customer's address, which I realize isn't input until the 2nd checkout page; however, what's happening on the first page is one of 2 things: If I already have shipping rules in place in the native shipping feature, it automatically puts the shipping amount next to the dropdown, regardless of whether or not it's selected, or B) if I delete the native shipping rules I created, I'm left with a select field with no options.

I presumed that the USPS Shipping plugin would have automatically placed "Priority Mail" in the dropdown list, but it isn't.

What am I doing wrong? Is there a fully detailed example code somewhere that I can peek?

Sorry for the length; just trying to give all the details...

Thanks!

# Answer
> 0 votes
USPS, UPS, and FedEx all require that you at least have the users zip, state and city entered for it to work. As of Store 2 the shipping drop down will only show shipping options eligible for your address (this prevents seeing international shipping rates for example if you live in the US and it is coming from the US. You will need to either move your shipping option selection until after your users enter their shipping information or have the user create an account and save their shipping details before going through the checkout process.

---
Tags: expresso-store
---


# Question
Title: Low Variables causes php 7 warnings in ee 3.1
I get some errors when using Low Variables in EE 3.1 with php 7.

I don't have the issue when using php 5.6. So I'm using that. But it would be nice to use php 7.

Is there any road map for making Low Variables compatible with PHP 7?

# Answer
> 2 votes
No, there is no roadmap for making LV—or any other Low add-on—compatible with PHP7.

---
Tags: php, low-variables, ee3
---


title: Server 500 error on installation

text:
# Question
Title: Server 500 error on installation
I'm getting a server error on going to admin.php to do an install. The error details read '\[the website\] may be down for maintenance or configured incorrectly'. PHP is running OK. I've used the EE installation wizard to check the database settings. I've tried versions 2.10.2, 2.10.1, 2.9.2. Checked the ownership prefs, tried an installation without renaming the system folder. There is no htaccess file on the server. I've installed EE many times with the same host. I can't see what's going wrong.

# Answer
It turned out to be a pretty basic error - wrong version of PHP on the server.
> 0 votes

---
Tags: server, install
---


title: log in to EE with wildcard subdomains

text:
# Question
Title: log in to EE with wildcard subdomains
I have a unique scenario in that I'd like to log into a single EE site but with a wildcard subdomain.

for example:

```
dev.example.com
staging.example.com
fishfood.example.com
anything.example.com
*.example.com

```

I'd like to be able to log into any one of these sites and stay logged into them all.

The examples I've seen involve knowing the number of domains for which to set the cookies, but in my case I can't anticipate every possible subdomain.

Any suggestions?

# Answer
> 0 votes
Here was my final solution. Within my config file, take apart the url with PHP and create a custom cookie\_domain config.

The only downside is that in order for cookies to work properly across all subdomains I have to serve the site from www.example.com and not from example.com

```
$host = $_SERVER['HTTP_HOST'];
$host_array = explode('.', $host);
$subdomain = array_shift($host_array);
$extension = array_pop($host_array);
$domain = array_shift($host_array);

$env_config['allow_multi_logins'] = "y";
$env_config['cookie_domain'] = "." . $domain . "." . $extension;
$env_config['cookie_prefix'] = "";

```

---
Tags: members, cookies, authentication
---


title: EE 3.1: Cannot save templates as file

text:
# Question
Title: EE 3.1: Cannot save templates as file
I get the following errors in EE3.1:

```
mkdir(): Invalid path
ee/EllisLab/ExpressionEngine/Library/Filesystem/Filesystem.php, line 87

```

and

```
file_put_contents(): Filename cannot be empty
ee/EllisLab/ExpressionEngine/Library/Filesystem/Filesystem.php, line 74

```

What could be the issue?

# Answer
> 0 votes
A temporary fix with a patch coming: https://support.ellislab.com/bugs/detail/21507/creating-template-group-results-in-errors-.-3.1

---
Tags: templates, ee3, template-manager
---


# Question
Title: Is it possible to search Solspace Calendar dates with Supersearch
I'm using Solspace's Calendar module to assign multiple dates to entries and I need the option to search through these entries by date using the Solspace Supersearch module, i've not come accross any docs on this. If I look at the field in the exp\_channel\_data table its just assigning the id of the calendar being used. Thanks!

# Answer
> 0 votes
This is not possible out-of-the-box, but there is a workaround:

Depending on how exactly you plan to search for Calendar events, you could use the Solspace Preparse add-on. What you could do is create a new field that is used to parse the calendar data in a plain string text value (you could format the date however you please).

The Preparse field will populate data (in this case from Calendar) after you publish/update the entry, and insert whatever data you've told it to (using a regular EE template) back into your Preparse field for the entry. That would mean you then have a field that is searchable by Super Search. :)

You could then attempt to run a range (from/to) search on it in your search form.

---
Tags: solspace-calendar, supersearch
---


# Question
Title: Enable "search:" Parameter in Custom Add-On Channel Entries Method (EE2)
I'm extending the Channel module `entries()` method in my custom plugin and am trying to figure out how to include the `search:` parameter. I get that the search parameters are an array accessed via `ee()->TMPL->search_fields`, but I can't figure out how to pass that data to the method. Here's what I have (simplified):

```
public function entries()
{
    $channel = ee()->TMPL->fetch_param('channel');
    $search_fields = ee()->TMPL->search_fields;

    return $this->_channel_entries($channel, $search_fields);
}

private function _channel_entries( $channel='', $search_fields=array() )
{
    ee()->TMPL->tagparams = array(
        'channel' = $channel,
        'disable' = 'member_data|pagination|categories'
    );

    ee()->TMPL->search_fields = $search_fields;

    if (! class_exists('channel'))
  {
      require_once PATH_MOD.'channel/mod.channel.php';
  }

  $channel = new Channel;

  return $channel->entries();
}

```

How do I give the `entries()` method access to the `search_fields` data?

# Answer
> 1 votes
If those methods are in your own plugin/module, then the `search:foo` parameters *won't* be added to the `search_fields` property. That only happens for the channel:entries tag. For any other tag, those parameters are present in the `ee()->TMPL->tagparams` array. So, to pass them on to the native Channel::entries(), read the param from the `tagparams` array, strip the `search:` prefix from the key, and set the `search_fields` array before calling the `entries` method.

---
Tags: ee2, channel-entries, add-on-development
---


title: Upgrading module from EE2 > EE3

text:
# Question
Title: Upgrading module from EE2 > EE3
Can I confirm that if a custom module does not have a control panel interface, conversion from EE2 \> EE3 only requires the following changes:

* Create a *addon.setup.php* file

# Answer
> 2 votes
Generally yes, you only need to add addon.setup.php. There of course could be some deprecated code etc.

---
Tags: ee2, add-on-development, module, plugin, ee3
---


title: GWCategories + Stash

text:
# Question
Title: GWCategories + Stash
I'm using GwCategories to get all subcategories from a certain parent category (in this case, main\_cat\_id). Within this list, I'm adding a nested list, training\_list\_{cat\_id}.

In my template, I can see the categories listed, but the nested list shows nothing. Now, I know that one of the subcategories has the ID 60. I replace {cat\_id} in the example below by a hard-coded 60, the list does show. So I'm having a bit of a parsing issue here, I guess.

This is my (somewhat stripped) code:

```
{exp:stash:set_list name="categories_list" parse_tags="yes"}
    {exp:gwcode_categories custom_fields="yes" channel="channel" cat_id="{main_cat_id}" depth="2"}
        {stash:category_name}{cat_name}{/stash:category_name}
        {stash:category_id}{cat_id}{/stash:category_id}

        {exp:stash:set_list:nested name="training_list_{cat_id}" parse_tags="yes"}
            {exp:channel:entries channel="channel" dynamic="no" category="{cat_id}"}
                {stash:entry_id}{entry_id}{/stash:entry_id}
                {stash:title}{title} - {cat_id}{/stash:title}
            {/exp:channel:entries}
        {/exp:stash:set_list:nested}
    {/exp:gwcode_categories}
{/exp:stash:set_list}

```

Thanks!

# Answer
I think this is a parse order issue, you may need to add `parse="inward"` to your nested `set_list`. Using this means that it will parse the variable in your `name` parameter early on.
> 0 votes

# Answer
You need to add `parse_depth="2"` to the outermost set\_list tag.

This is required so that both the gwcode\_categories tag and the inner set\_list tag are parsed *before* the outermost set\_list captures it's row data.

As per example here: https://github.com/croxton/Stash/wiki/Lists#three-and-more-dimensional-lists
> 0 votes

---
Tags: categories, stash, gwcode-categories, nested-list, mustash
---


# Question
Title: Expresso Store: Prevent prices from being rounded up
Okay, I've run into unsual cituation with Exp:resso Store and hope that the community will be able to help.

The site I'm working on is selling prints and the purchase's price is built depending on print dimentions. So in the backend, the item's price is set per square cm, then on front-end I have simple Javascript calculator which turns the width and height that user inputs into square area. Which, multiplied to the item's cost per cm, is the order subtotal.

Such setup means that the price for square cm is quite low (and minumum order is 0.5 square meter)

I have "Currency Decimal Places" setting set to "8".

But I found out I can't really enter amount like "0.000095"as the item price - it's getting rounded to "0.00010000" when the entry is saved.

Can anyone suggest what do do here to prevent rounding?

Or maybe some alternative solution which would allow me to charge for the print based on its square area?

Running Store 2.3.1 on EE 2.9.0

Thanks a lot!

# Answer
> 2 votes
Appears that the restriction on number of decimals is set directly in database.

I've got it fixed by running these queries:

> ALTER TABLE \`exp\_store\_products\` CHANGE \`price\` \`price\` DECIMAL( 19, 8 ) NULL DEFAULT NULL ;
>
> ALTER TABLE \`exp\_store\_order\_items\` CHANGE \`price\` \`price\` DECIMAL( 19, 8 ) NOT NULL DEFAULT '0.0000';
>
> ALTER TABLE \`exp\_store\_order\_items\` CHANGE \`regular\_price\` \`regular\_price\` DECIMAL( 19, 8 ) NOT NULL DEFAULT '0.0000';

---
Tags: expresso-store
---


# Question
Title: Solspace Freeform File Upload links in CP
Looking at the File Field Uploads screen in Freeform, there are three links to the file, File Name (opens a modal), a Download button, and Front End Link.

Only the Front End Link works for me. If I click on File Name the modal says:

> The requested content cannot be loaded. Please try again later.

If I click on the Download button I get an EE error screen saying:

> An Error Was Encountered
>
> File filename.jpg does not exist.

My directory isn't above webroot or anything like that - any reason why these other links to the file aren't working?

It's Freeform 4.2.2 on EE 2.10.1

# Answer
Seems to be a bug with Freeform not using the full path to the file.

in the file:

```
system/expressionengine/third_party/freeform/default_fields/freeform_ft.file_upload.php

```

line 273, change this:

```
$mime = get_mime_by_extension($filename);

```

to this:

```
$mime = get_mime_by_extension($file_path);

```
> 0 votes

---
Tags: solspace-freeform
---


title: EE3 Template Viewing Revisions Problem

text:
# Question
Title: EE3 Template Viewing Revisions Problem
I'm currently testing the latest EE3 version and for some reason, when trying to view any revisions, all that keeps getting displayed is the latest version. This issue occurs across all template groups. I was previously running EE3.0.3 and just updated EE3.0.4 and it still persists.

Upon further inspection, each view button URL links to the same current template revision number. It's the only issue I found not quite working right in EE thus far. The following is my current setup

EE 3.0.4 MAMP Pro 3.3 PhP 5.6.10 MySQL 5.5.42

Any guidance would be greatly appreciated, thanks!

# Answer
> 0 votes
If the links are the same (while they should not be) then this must be a bug, and you are encouraged to report it directly to EllisLab using their bugtracker

# Answer
> 0 votes
There was indeed a bug concerning revisions. It should be fixed in EE 3.1.1.

---
Tags: ee, revisions
---


title: Conditional for entire entries loop

text:
# Question
Title: Conditional for entire entries loop
I'm using expresso store and apart from regular products I have gift boxes which contain multiple products. They are a separate channel and I'm using playa to pick the products for each gift box entry.

what I need to do is check the stock level for each individual product and if any of those products are out of stock then the gift box should not be available for purchase.

If I put the conditional inside the loop then I will get 3-4 results and I only need one of them to be 0 in order to hide the add to cart button.

So I need a conditional that will wrap around all of the related entries for the gift box and if any of the items have a stock level of 0 it should disable to button.

EDIT: so the code I have for normal products is as follows:

```
{if total_stock > 0}
<input type="submit" name="submit" value="add to cart"/>
{if:else}
<p>Product is unavailable</p>
{/if}

```

what I need for gift boxes should be something like:

```
{if "{exp:playa:children field="gift_products"}{stock}{/exp:playa:children}"
 *="0"}
<p>Product is unavailable</p>
{if:else}
<input type="submit" name="submit" value="add to cart"/>
{/if}

```

so if the stock level of multiple related products is 0 add to cart should not be available

# Answer
> 1 votes
You can't obviously check for just one of them out of stock numerically, so you have to concatenate them together with a key identifier, so for each loop start the total stock with a character "#", then if "#0" exists, you know that one of the items is out (albeit you won't know which).

So assuming product A has 5, Product B has 0 and Product C has 2, your loop will output something like this: "#5#0#2"

```
{if "{exp:playa:children field="gift_products" var_prefix="product"}{exp:store:product entry_id="{product:entry_id}"}#{total_stock}{/exp:store:product}{/exp:playa:children}" *= "#0"}
    <p>Product is unavailable</p>
{if:else}
    <input type="submit" name="submit" value="add to cart"/>
{/if}

```

I've added the product tag pair as I'm assuming it's needed, along with the var\_prefix parameter, but not tested the exact syntax, may well require tweaking.

---
Tags: expresso-store, conditionals, advanced-conditionals
---


title: What's a Wholesale ordering solution?

text:
# Question
Title: What's a Wholesale ordering solution?
We have hundreds of products that are purchased in bulk. It would be easiest if a user could go down a list and mark quantities and then submit an order.

There doesn't have to be a checkout, because orders have to be approved before moving forward with payment, and most orders are at least $5,000.

Has anyone heard of solution that can achieve this in EE?

We've tried FreeForm, but we've maxed out the number of fields allowed.

# Answer
I expect any of the 3 main ecommerce add-ons will suffice, but personally I'd recommend Expresso Store. It has a multi-product add to basket ability, so you can list out many products, the user can then work down a list you display from entries, add quantities to and then submit (add to basket). Each product would be priced on a single entity/blob, then let Store do the quantity calculations. This will also allow you to utilise a basket, which then opens more options for your design, UX, and project future scope.

You don't have to utilise the payment gateway, just simply use a dummy gateway and setup the email (in Expresso Store) to the client to inform them that their request has been received and an email (again in Store) that gets sent to you with what they have ordered (requested), along with their contact details for you to contact them and fulfill.

If project budget is an issue and you can't stretch to an ecom module, you should be able to still do it via Freeform but not using a field for each product (which sounds like your issue), but consolidate all the products and quantities into a single field via JavaScript and store in Freeform as a multi-select field.
> 0 votes

---
Tags: forms, checkout, shopping-cart, bulk
---


# Question
Title: WCOD in when loging in to Control Panel after moving servers
I'm out of ideas here, and posting this as a last resort hopping you can give me some ideas where the problem might lie.

I moved servers recently, and I don't know whether this is a problem that might have caused the issue I'm having now is I didn't clear the cache before exporting all the files (forgot).

But the problem is after moving servers Front End works fine, database works fine. But when I try and login to CP I get WCOD :(

I've increase PHP memory to 128MB that did not seem to fix the issue. Cleared the cache/ cookies on my computer, cleared .htaccess file etc.

Link to website

I tried looking up online and reading other questions but that didn't seem to do it for me. This seemed to be most related question

I'm not asking you to fix this for me but maybe to direct me to the right direction here. As I said this is my last resort :)

ALSO:

When using search functionality in banner I get an error "The search path contains an error. Please contact the system administrator."

Here is Search template code:

```
{exp:search:simple_form channel="blog_post|quotes_article" result_page="search/results" no_result_page="search/no-results" where="all" results="15" search_in="everywhere" status="open"}
                <input type="text" name="keywords" id="search-input" placeholder="I'm looking for...">
                <button type="submit">Search</button>
            {/exp:search:simple_form}

```

Thanks again,

# Answer
Start with setting `$debug= 1;` in your /system/index.php

It's most likely an extension. or try setting this in your config file. https://docs.expressionengine.com/v2/general/system\_configuration\_overrides.html#allow-extensions

```
#allow_extensions = 'n'

```
> 0 votes

---
Tags: control-panel, white-screen-of-death, server-migration
---


# Question
Title: Attempting to access file outside of directory - when trying to access member profile
I had other issues with avatars, but a fresh install of 3.1.1 seemed to resolve that. Now, when I went into the member profile on a fresh install, it displayed proper the first time. When I went back in the second time, I got this error:

```
Exception Caught

Attempting to access file outside of directory.
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Service\File\Directory.php:28

Stack Trace: hide details

#0
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Library\Filesystem\Filesystem.php(306): EllisLab\ExpressionEngine\Service\File\Directory->normalize('facebook_1.png')

#1
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Controller\Members\Profile\Settings.php(120): EllisLab\ExpressionEngine\Library\Filesystem\Filesystem->exists('facebook_1.png')

#2
[internal function]: EllisLab\ExpressionEngine\Controller\Members\Profile\Settings->index()

#3
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Core\Core.php(191): call_user_func_array(Array, Array)

#4
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Core\Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)

#5
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Boot\boot.php(138): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))

#6
C:\GIT\Production\stkhomes.net\public_html\admin\index.php(143): require_once('C:\\GIT\\Producti...')

#6
C:\GIT\Production\stkhomes.net\public_html\admin\index.php(143): require_once('C:\\GIT\\Producti...')

```

This happens on both production server and development server.

PHP Version 5.3.29 EE Version 3.1.1

---

\*** UPDATE

It is happening here:

```
protected function normalize($path)
    {
        $path = $this->root.'/'.$path;

        if (strpos($path, '..') !== 0)
        {
            throw new FilesystemException('Attempting to access file outside of directory.');
        }

        return $path;
    }

```

If I echo out the path, it is : `C:/GIT/Production/stkhomes.net/public_html/images/avatars/facebook_1.png`

The statement should equate to `False` thus returning the variable `$path`.

If I comment out this section:

```
if (strpos($path, '..') !== 0)
            {
                throw new FilesystemException('Attempting to access file outside of directory.');
            }

```

The page loads fine.

# Answer
> 0 votes
This code appears to be expecting `$this->root` to be a relative file path (think something like `../my_web_root/`), but is instead getting a full server path (`C:/GIT/production/etc`).

Check all of your file upload preferences and path settings for your installations are correct. If you're 100% sure your paths are correct, this sounds like a possible bug, possibly connected to Windows file paths. I would recommend contacting EllisLab at team@ellislab.com.

---
Tags: members, ee3
---


title: Automated deployment (Wordmove for EE)

text:
# Question
Title: Automated deployment (Wordmove for EE)
I've been trying to figure out a way for executing automated deployment of EE sites via Capistrano or similar.

I've come across various tutorials but all require Git on the server, and most don't include DB migration.

I was wondering if there is a similar tool to Wordmove out there for EE? I really like that it uses rsync and sql commands for the migration so no special software is needed on the server side, only SSH access.

I know this has already been asked a million times, but figured with EE3 out now, and given the age of some of the questions, I thought it might be worth rehashing.

# Answer
> 0 votes
After struggling with Capistrano and building various one-off bash scripts for deployment I decided to build my own move tools.

Drum-roll..... Introducing **eemove**! Automated deployment for ExpressionEngine sites: https://github.com/sparkison/eemove

Currently in an alpha state so likely to be bugs. Can grab the generated/executable jar file using the release tab of the repo.

All comments, suggestions, etc. welcome!

---
Tags: mysql, ee, sql
---


# Question
Title: Can a custom field be populated by external JSON?
I'm building the marketing portion of a larger system, where a catalog of products is in a separate database. I need a custom `select` field that represents the products in the catalog, so I can relate products to blog posts. How can I populate this field via JSON, in real (or near-real) time? Has anyone done this before?

All I need to store is an ID in EE, which I can later use to pull in the full details of the product on demand so what's displayed is up to date.

# Answer
The easiest way (ie. cheapest) is to not re-invent the wheel and use an EE addon to do it for you, we have used DataGrab (https://devot-ee.com/add-ons/datagrab) to do something similar, it may work for you - give it a look.
> 0 votes

---
Tags: custom-fields, json
---


title: Truncate string with EE 3

text:
# Question
Title: Truncate string with EE 3
There used to be all kinds of plugins for EE 2 that let you shorten a variable (or any string, really), some from EllisLab as well as a number of third-party ones. Some let you specify the number of words, some were even HTML aware, etc.

What are my options at this point for working with EE 3? I haven't seen one of them converted. Do I really have to use raw PHP?

# Answer
I was going to convert them for you, when I found that both HTML-Attribute-Content and Word-Limit already have compatible branchs.
> 1 votes

# Answer
In the spirit of providing additional options, check out Streeng as well.
> 1 votes

---
Tags: plugin, ee3, string
---