# Question
Title: Low Search - not respecting hidden field/param
In my search form I have this:

```
<input type="hidden" name="programs_courses_show_in_results" value="Yes">

```

And in the results I have this:

```
{exp:low_search:results
  channel="programs_courses"
  entry_id="not 110"
  limit="100"
  query="{segment_4}"}

  {if count == 1}{total_results}{/if}

  {if count ==  1}<ol>{/if}

      <li><a href="#">{title}</a> <small>Count: {count} | Show: {programs_courses_show_in_results}</small></li>

  {if count == total_results}</ol>{/if}

  {if no_results}No search results{/if}

{/exp:low_search:results}

```

Technically, I also have some category parameters in the search form, but if I leave those alone and only hit the search button, the results show everything in the channel, not just the ones with the `programs_courses_show_in_results` field set to "Yes".

Am I missing something?

# Answer
> 2 votes
As per how parameters work, you need to prefix the var with `low_search_`.

**Edited to elaborate:**

The prefix is for outputting the parameter value as a variable. So, as shown in the docs, this:

```
<input type="hidden" name="param_name" value="param_value">

```

...results in the variable `{low_search_param_name}`. To translate that to your setup, having this in your form:

```
<input type="hidden" name="programs_courses_show_in_results" value="Yes">

```

...would mean `{low_search_programs_courses_show_in_results}` would output `Yes`.

However, you don't want just to output `Yes`. As I understand it now, `programs_courses_show_in_results` is actually a custom field that can contain the value `Yes`, so you want to filter search results and only display entries where that fields equals `Yes`, like you can with the native `exp:channel:entries` tag using the parameter `search:programs_courses_show_in_results="Yes"`.

To achieve this in Low Search, use the Field Search filter, so you can either use that exact parameter on the `exp:low_search:results` tag, or use a (hidden) field in the Form tag, thusly:

```
<input type="hidden" name="search:programs_courses_show_in_results" value="Yes">

```

...which means you can output `Yes` using `{low_search_search:programs_courses_show_in_results}`

---
Tags: low-search
---


# Question
Title: Which technologies are used in Expression engine
Expression Engine is based on codeignitor framework and codeignitor is developed using core PHP but I want to know which technologies are used by expression engine like it uses angular js,ember js etc. ?

# Answer
ExpressionEngine is a purely PHP Content Management System (CMS) framework. As you mentioned, it is currently based off of the CodeIgniter MVC framework.

As for technologies that are required to employ ExpressionEngine ...

```
-Linux or similar operating system; one capable of serving a PHP agent
-Database functionality, specifically MySQL with a MyISAM modern table engine
 -- EE 2.9+ I've been able to run in production with INNODB table engines...
-Apache 2.x
 -- Many (engineers, host partners, etc..) have been able to run EE on nginx..

```

EE depends on jQuery, a JavaScript library for front-end display. However, even the newest version (EE 2.10.1) runs on a pretty out-of-date jQuery version. There is an EE 3.0.0-beta out... but I don't know it's technologies. I've played with it and I know it has dropped CodeIgniter as it's core framework.

For frameworks like Angular etc...

EE is agnostic to those type of frameworks. EE doesn't default to using any of them. You can incorporate Angular, Ember, etc.. if you want! EE is a framework, which allows you to place other frameworks on top of it. It's your choice! It's your world.
> 1 votes

---
Tags: php, codeigniter
---


# Question
Title: How template synchronization works in Expression engine
I want to use template synchronization for subscription addon testing but when i clicked on template synchronization its not showing anything. i have copied two templates to template folder as you can see in documentation here

Things I have done for this in Global preference are :-

```
Save Template Revisions: Yes
Maximum Number of Revisions to Keep: 10
Save Template Revisions: Yes
Server path to site's templates: example.com/system/expressionengine/templates

```

Please tell me if anything else wrong or required.

# Answer
Doh! Just wrote all the below and then realised the problem - you're using the wrong path!

You've put in a domain URL, or stated an invalid path. You need to start from the servers file root with `/`. Worth reading through the below, as this would have identified the issue also.

**The original response...**

If you have those settings from the beginning, before creating any templates, it's normally not a problem, but when you have existing templates (saving to the database), then you add/change those settings, nothing will happen.

Would be helpful to know what this exactly meant: "template synchronization its not showing anything", but I'll assume that it's not listing the templates you've added...?

You have to go and edit each and every individual template and turn on "save template as file".

If you create new templates via external file, it will automatically set them to be saved as file. If you create new templates via the EE Control Panel, by default this option may be turned off (ignoring global settings), so you have to tick it. I'd recommend you don't mix external editing and Control Panel editing - just do it all in one or the other. If working externally, EE automatically detects new template groups and templates, mixing the 2 it often falls apart and gets confused, hence having to use the Sync templates screen.

If that is already done and you're still not seeing your frontend reflecting your external templates, 2 checks come to mind - double check the folder path is correct, and ensure you have the correct permissions.

You mentioned that you copied the templates into the folder \[manually\] - don't do that, instead follow the steps above: edit the template in EE and tick the save as template. After saving, if that doesn't create the file, then you have a pathing/permissions issue.

Also, you mentioned "two templates to template folder" - just to confirm: templates don't just sit in the templates folder, they sit in an initial subfolder called "default\_site" (if not using MSM) then there are subfolders within this based on the template group they're in. Template group folders have the extension .group, then the template files themselves have the extension .html. Again if you've saved the template via the EE Control Panel, then you'd see this structure created for you.
> 1 votes

---
Tags: php, codeigniter
---


title: Cartthrob credit handling

text:
# Question
Title: Cartthrob credit handling
Am new to this expression engine am using the cartthrob module to handle my shop item.The site base on credit system users can earn credits and use to purchase items in shop .I use devdemon credit module .can any one please tell me how to remove credits equal to the price of product from my credits table .Is there any idea of linking the credits table and cartthrob

Thanks in advance.

# Answer
Credits has both a CartThrob and BrilliantRetail payment gateway that you can use to allow these to pay for the items with their credits. In CartThrob you will want to go to Settings \> Payment Gateways and enable "Credits" from there you will enter your settings similar to this picture
> 1 votes

---
Tags: cartthrob, devdemon
---


# Question
Title: Limiting entry display after a conditional
I want to display 10 entries, only if they pass a conditional. Right now the channel tag will count *all* entries first, so I end up with less than 10 entries displaying (as some of those 10 don't meet the 'if').

```
{exp:channel:entries channel="tours" limit="10" sort="asc" orderby="departure_date"}
    {if departure_date > current_time}
         [TEN THINGS HERE]
    {/if}
{/exp:channel:entries}

```

I can’t use {entry\_date} as my ‘departure\_date’ - it has to be a custom field.

I tried an embed - but that’s not working for me...

# Answer
Can't the numeric matching of the search parameter help you?

```
{exp:channel:entries channel="tours" search:departure_date=">{current_time}" limit="10" sort="asc" orderby="departure_date"}
  [TEN THINGS HERE]
{/exp:channel:entries}

```
> 2 votes

# Answer
Writing your own query would probably be the most efficient way and would let you pull out exactly what you want.

https://ellislab.com/expressionengine/user-guide/add-ons/query/
> 1 votes

# Answer
I would use a PHP script to get around these kind of hassles. You can use the query module to do some manual *select*s on the database, if you really need to avoid PHP script in your template.

https://ellislab.com/expressionengine/user-guide/add-ons/query/

The ExpressionEngine template parsing engine doesn't provide any means to break out of a `{exp:channel:entries}` loop based on a conditional.

You basically need to break out of your `{exp:channel:entries}` loop once you hit ten entries that satisfy your conditional. There's no viable way to do that, even with an absurd PHP-enabled template, regardless of if it's set to parse PHP at input or output. Templating like this only affords forward progression execution.

I can help you generate a PHP script, or a query module tag, to do what you want... but you'll need to expand your question to include what your field IDs are, if you're using MSM, and other issues. Hope I'm being helpful.

**Edit**

Official edit: If any of the heavy-hitters on this forum know of a way to break out of a EE tag loop (like `{exp:channel:entries}`), please chime in. I might be an idiot.
> 0 votes

---
Tags: channel-entries, conditionals
---


# Question
Title: Why can I only send plain text e-mails with the communicate tool?
If I send an HTML e-mail using the communicate tool in the control panel it will be delivered but the body is always blank. I can send plain text e-mails with the communicate tool and the body is received. I'd like to get this resolved so I can send either HTML or plain text using the communicate tool. Any tips or suggestions on correcting this issue would be greatly appreciated thanks!

# Answer
> 0 votes
This was somehow related to the Postfix configuration on the server. Once I changed the default MTA back to Sendmail the issue was resolved!

# Answer
> 1 votes
This could be a spf issue.

I'm currently trying to problem solve the same issue with expressionengine 2.9.3 - html emails are coming through with a blank message, but plain text emails do contain the message.

If I look at the raw source of the email I can see:

```
spf=fail (google.com: domain of sales@xxx.com does not designate aaa.bbb.ccc.ddd as permitted sender)

```

So worth checking your spf record for the domain you are sending this email from with a tool like mxtoolbox \- i.e. if you are sending the email from **sales@yourdomain.com** check the spf record for **yourdomain.com**

---
Tags: email, html-email
---


title: Incomplete Orders

text:
# Question
Title: Incomplete Orders
Using Cartthrob I have a checkout order form where I would like to send a notification email to an administrator if the user enters their details but leaves the page before completing the order. This would be first step during checkout so I can capture basic details before they proceed to selecting payment terms and completing checkout. I have looked at Postmaster and can't seem to figure how to make it work in my circumstance. Any suggestions?

# Answer
> 0 votes
ObjectiveHTML wrote up all the variables you would need for Abandon Cart emails in the PostMaster documentation. PostMaster is really powerful and can do a lot of things so I recommend that you use the Getting Started guide to get to terms with all the terminology.

---
Tags: cartthrob
---


# Question
Title: Notifying member list for new topic in forum
Is there any way to change the recipients of the 'Admin Notification of New Entries' email template without making all the recipients admins?

# Answer
> 0 votes
I see one possibility, but I'm not 100% sure if this will work. If you wrote an extension that fired on this hook:

https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/global/email/index.html

You could possibly look for a conditional subject. I'm not sure what the default admin notification subject is, but if it's always the same, you could detect Admin notifications. Something like:

```
if ($data['subject'] == "Admin Notificaiton from your EE site") {

    // add to recipients string
    $data['recipients'] .= ", another@email.com, another@email.com";
}

```

The problem is that I don't necessarily know if the admin communications uses the standard Email class; I can't imagine it wouldn't, but don't have time right now to dig through the core to check for you. Good luck!

---
Tags: templates, email, forum, admin
---


# Question
Title: How to get Calendar and Event data from Solspace Calendar?
I am trying to make a template that outputs JSON, listing all events within a date range. I want to be able to display my custom channel fields in the Event channel, as well as within the Calendar channel that the event is associated with.

I have tried so many things, and cannot seem to get this to work. Not sure if I just can't find the right syntax, or if it's not possible with the Calendar tags.

Which {exp:calendar:???} tag will allow me to display custom fields from both my event and calendar channels? Thanks!

# Answer
> ### **Highly suggested reading to distinguish Calendar tags**: https://solspace.com/docs/calendar/getting\_started/

`{exp:calendar:cal}` is usually used when displaying a list of events in a chronological order. However, since it doesn't use the native EE Channel:Entries library when parsing data, it won't be able to parse some custom fields correctly, in particular those with complex data such as Playa/Relationships and Matrix/Grid.

If you do need to use the full power of Channel:Entries to parse your custom fields, you'll need to use `{exp:calendar:events}`. However, this tag is used to display information about event entries, and isn't really made to display events in a fully chronological order (again, reading the above reading material is highly suggested to distinguish both tags)

`{exp:calendar:cal}` and `{exp:calendar:events}` display data from the **Calendar: Events** channel. You can't mix both **Calendar: Calendars** and **Calendar: Events** channels with these tags.

You *could* use `{exp:channel:entries}` to display custom fields from both the **Calendar: Calendars** and **Calendar: Events** channels, but you will **not** be able to display any event data (eg. start/end dates/times, occurrences, etc), nor display data in a chronological way.

As for displaying data in JSON format, there's likely a number of ways to do this. You could use PHP to create the JSON output (using `json_encode()`). you could hand-craft the JSON output manually. There might even be a plugin that can create the JSON output for you.
> 1 votes

# Answer
Since @Solspace responded clarifying the uses and limitations of the various calendar tags, it is now clear to me that it is not possible to access both event AND calendar custom fields within one calendar tag pair. My workaround, now, is to utilize stash, and first create an index of my calendar custom fields, that I can then access from within my `{exp:calendar:cal}` tag loop, for each event I am displaying.

```
{exp:http_header content_type="application/json"}
[
{exp:stash:set_list name="calendar_data"  parse_tags="yes"}
    {exp:calendar:calendars}
        {stash:my_calendar_id}{calendar_id}{/stash:my_calendar_id}
        {stash:my_calendar_title}{title}{/stash:my_calendar_title}
        {stash:my_calendar_color}{calendar_color}{/stash:my_calendar_color}
        {stash:my_calendar_icon}{calendar_icon}{/stash:my_calendar_icon}
    {/exp:calendar:calendars}
{/exp:stash:set_list}
{exp:calendar:cal
    date_range_start="{get:start}"
    date_range_end="{get:end}"
    status="not closed"
    show_months="999"
    dynamic="no"
}
    {if event_count != 1},{/if}
    {exp:stash:get_list name="calendar_data" match="#^{event_calendar_id}$#" against="my_calendar_id"}
        {
            "id": "{event_id}-{event_count}",
            "calendar": "{event_calendar_url_title}",
            "title": {exp:json_encode}{event_title}{/exp:json_encode},
            "start": {exp:json_encode}{event_start_date format="%Y-%m-%dT%H:%i:%s"}{/exp:json_encode},
            "end": {exp:json_encode}{event_end_date format="%Y-%m-%dT%H:%i:%s"}{/exp:json_encode},
            "allDay": {if occurrence_all_day}true{if:else}false{/if},
            "url_title": {exp:json_encode}{event_url_title}{/exp:json_encode},
            "url": {exp:json_encode}/calendar/event-entry-form/{event_start_date format="%U"}/{event_start_date format="%U"}/{event_id}{/exp:json_encode},
            "icon": {exp:json_encode}{my_calendar_icon}{/exp:json_encode},
            {if event_multi_day}
                "color": {exp:json_encode}#{my_calendar_color}{/exp:json_encode},
                "textColor": {exp:json_encode}{exp:projects:contrasting_text_color hexcolor="{my_calendar_color}"}{/exp:json_encode},
            {if:else}
                "color": "#FFFFFF",
                "textColor": {exp:json_encode}#{my_calendar_color}{/exp:json_encode},
            {/if}
            "className": "{exp:tagger:tags entry_id='{entry_id}'}tag-{tagger:urlsafe_tagname} {/exp:tagger:tags}"
        }
    {/exp:stash:get_list}
{/exp:calendar:cal}
]

```

Here, I'm using a combination of other addons, like 'HTTP Header' by Rob Sanchez, JSON Encode by NobleStudios, and most importantly, Stash by Mark Croxton.
> 0 votes

---
Tags: solspace, custom-fields, solspace-calendar, calendar-events
---


# Question
Title: Listing the channel name with an image in Channel Images?
I want to have a front page gallery that is comprised of images from different channels, and I want to have the title of the channel that the image comes from to appear with the image.

My plan was to create an entry called "Front Page Gallery" and load it with stored images.

Additionally, I want to be able to create a link to the gallery section that the image is originally from.

Any ideas?

**MORE INFO**

Sort of going with parscale's suggestion below, I used instead {image:entry\_id} this way, but it didn't solve my issues:

`
{exp:channel:entries channel="portfolio" entry_id="41" limit="1" disable="categories|member_data|pagination"}
 {exp:channel_images:images entry_id="{entry_id}" exclude_category="closed"}
 From the
 {exp:low_replace find="31|32|33" replace="GallerySPACE1|GallerySPACE2|GallerySPACE3" multiple="yes"}
 {image:entry_id}
 {/exp:low_replace}
 series.
 {/exp:channel_images:images}
{/exp:channel:entries}`

So with this, I'm able to generate a caption for each image that gives the name of the entry it is originally from (e.g., "Gallery 1") by manually using Low Replace to convert the entry ID of each image to the name of the entry. But I find this really clunky and not good as new entries are added. So I'm trying to find a more automatic way to get the original entry name of the image.

Next issue is in trying to create a link from the image's entry name to the first image in it's original gallery: right now what I've got (and it's not working) is this link:

`href="{title_permalink="portfolio/gallery"}"`

But this doesn't work. What I need is this link:

`href="{title_permalink="portfolio/gallery/gallery_1"}"`

Any thoughts also as how to get the image's original entry short name into the link?

# Answer
> 1 votes
Yes you can, but you would need to look up the channel name.

If you use the {exp:channel\_images:images} tag you will see a variable {image:channel\_id}.

This can be used to look up the channel name with a simple query if you wish or write a simple switch yourself for the numbers.

# Answer
> 0 votes
How are you planning on pulling in the images from different channels? Relationships? If so, you should just be able to call the images channel using {relationship\_prefix:channel}

---
Tags: devdemon, channel-images
---


# Question
Title: How can I change URL using .htaccess RewriteRule directives?
I have a URL like http://www.psreducators.com/agent-profile/?u=donald-mark, but I want the users to see the URL as http://www.psreducators.com/agent-profile/donald-mark. (*donald-mark* is the user profile name.)

How can I achieve this using .htaccess RewriteRule directives?

# Answer
> 0 votes
One method would be to use an .htaccess RewriteRule to make URI's that look like that:

```
 http://www.psreducators.com/agent-profile/?u=[user-profile-name]

```

to be rewritten like this:

```
 http://www.psreducators.com/agent-profile/[user-profile-name]

```

For this, you would use a RewriteRule. Here is an example:

```
RewriteRule ^agent-profile.php\/?u=(.*)$ agent-profile.php/$1/ [L,NC,R=301]

```

This will capture anything after the `u=` GET param, and the place it in the `$1` of the second param of the rewrite. It will be a permanent redirect (R=301), it will ignore case when matching (remove the NC of the flags if you don't want that), and if this is matched, the .htaccess file will not bother trying any rules after it (L\[ast\]). This is untested, but should get you going.

# Answer
> 0 votes
You can try the following .htaccess rules (**tested**).

```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agent-profile/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agent-profile/index.php [L]
</IfModule>

```

Add the following code to your index.php file.

```
<?php
  header("HTTP/1.0 200");
?>

```

---
Tags: php
---


# Question
Title: Prevent encoding of ampersand in a single entry?
I am trying to embed a Facebook video in an EE channel entry.

I find that when the entry field is formatted as either `Markdown` or `XHTML` EE is rewriting part of the javascript in a way that makes the video embed break on the Facebook side.

Generally I can prevent EE from munging my javascript within entries by wrapping the script in a `CDATA` declaration.

However in this case EE's Typography engine is rewriting:

`js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";`

as

`js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";`

(`&` is rewritten to `&`)

Which gives the following error in the browser console:

> Uncaught Error: invalid version specified

My work-around is to set the field format as `None`.

Is there a way I can keep the format as XHTML short of making a global change to the site's typography settings?

I am using EE version 2.8.1

# Answer
In what context is this an issue?

```
js.src = "{your_tag}".replace("&", "&");

```

(whoa, they updated the guide theme)

https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/global/typography/index.html#id2

You could probably write your own specific extension that hits the `typography_parse_type_end` hook and simply modifies those ampersand replacements back in. This would take control away from the user; but honestly there is certainly no security risk in the JS version, but to take control of the parser's typography and allow ampersands back in could put you in precarious positions. There is a reason it gets parsed out.
> 1 votes

---
Tags: javascript, formatting
---


title: Overriding page pagination

text:
# Question
Title: Overriding page pagination
Does anybody know if there is a way / script that will allow for example my gallery pages to display in a lazy load (continuous scroll) style?

Thanks in advance

# Answer
> 0 votes
Not tried these myself, but they state they resolve the exact thing you're asking for...

Try this Infinite Scroll add-on.

Or this one Ajax Pagination.

# Answer
> 0 votes
Create an non-hidden template, let's say `pages/list`, for your list of entries and set `paginate="hidden"`:

```
{exp:channel:entries channel="news" limit="10" paginate="hidden"}
    <h2>{title}</h2>
    {body}
{/exp:channel:entries}

```

From the documentation:

> "hidden: The navigation text and links will not appear, but your entries will be paginated. (This is useful for things like JSON.)"

On the first page, call it as an `embed`:

```
{embed="pages/list"}

```

On your JS, keep calling it and increasing the pagination offset on the same amount used on the `limit` parameter: `/pages/list/P10`, `/pages/list/P20`, `/pages/list/P30`, etc, etc...

---
Tags: pagination
---


# Question
Title: How to use the SQL Manager to find which extensions use a certain hook?
How would I go about using the SQL manager to find out which extensions use a specific hook? I can't find any documentation or query examples on this...

# Answer
> 1 votes
Use this query...

```
SELECT * FROM exp_extensions WHERE hook = 'hook_youre_looking_for';

```

The `class` column will indicate what Extension it belongs to, and the `method` column will tell you what method (function) to look at in that PHP class.

# Answer
> 1 votes
look in the exp\_extensions table. you should find everything you need there

---
Tags: hook, sql
---


# Question
Title: How to synchronize Template in Expression engine
I have three sites working in EE using MSM and I am using subscription addon of http://www.devdemon.com/documentation/subscriptions/#installing-and-updating-subscriptions I have created two templates group `subs` and `subs_emails` as described on this link now this two are showing in Template synchronization but how to synchronize them as described on website http://www.devdemon.com/documentation/subscriptions/#installing-and-updating-subscriptions.

Thanks in advance.

# Answer
You will need to move the files over from `/system/expressionengine/third_party/subs/templates` over to whatever template you are using to house template as files. For example in my case I would be moving them to `/../templates/default_site` as I store my templates above webroot in a folder called templates. I have never used the Subscriptions module but make sure the folders in question have .group at the end `subs.group` & `subs_emails.group`. After you have done that you will go to Design \> Templates \> Template Synchronization and select the folders in question and click Submit.
> 0 votes

---
Tags: php, codeigniter
---


title: Solspace Tag List of Entries

text:
# Question
Title: Solspace Tag List of Entries
I would like to create a list of entries that have NOT been tagged by with a specific tag group. Does anyone have an idea how to accomplish this?

Thanks in advance!

# Answer
> 0 votes
Hrmm, with ExpresionEngine native `entries` tag, you can use the word `not` to indicate what you don't want to see. It's possible Solspace reused this logic. Have you tried adding this parameter to your tag?

```
tag_group_name="not groupyoudontwant"

```

# Answer
> 0 votes
One way to do this, though not very practical if you have a lot of entries (for performance reasons), would be to add a Tag:Tags template tag into a Channel:Entries loop. Then set it to search for a specific Tag group ID/name, and have a no\_results conditional in there. So your code would look something like this:

```
<ul>
{exp:channel:entries channel="news" limit="500"}
    {exp:tag:tags
        entry_id="{entry_id}"
        tag_group_name="whatever"
    }
        {if no_tag_results}
            <li>
                {title}:
                Message saying it doesn't have tags from this tag group and/or link to add some
            </li>
        {/if}
    {/exp:tag:tags}
{exp:channel:entries}
</ul>

```

---
Tags: solspace, solspace-tag
---


# Question
Title: loading country code selection javascript file once per site visit
On my website I am displaying a country specific icon for the visitor. I'm doing this by setting a data-country variable in the head of the html document and loading a javascript file that sets the local storage value once when the homepage is visited.

I only want to run the geo.js script once as it can be a performance hit, so I included the conditional, if the first segment is empty then load the geo.js file. But if the users first visit to the site is anywhere other than the homepage the geo.js file is not loaded and the country code is not selected.

Here is my current code:

```
<head {if segment_1 == ''}data-country="<?php $country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; echo $country_code; ?>">
{if segment_1 == ''}
  <script src="{cdn_url}{exp:setversion path='/js/geo.js'}"></script>
{/if}

```

Here are the contents of the geo.js file:

```
var countrySet = localStorage.getItem('country');

if(countrySet !== null && countrySet == 'UK') {
 window.location='http://website.com/uk';
}

// If country is not stored, get it from the <head> element

if(countrySet === null) {
var country = document.getElementsByTagName("head")[0].getAttribute("data-country");

// Store country

localStorage.setItem('country', country);
 if(country == 'UK') window.location='http://website.com/uk';
}

```

**Question**

Is there a way to load the geo.js script only once per site wide visit? Right now if I take away the conditional the script runs on each page load.

# Answer
> 1 votes
Use this Session add-on.

Add to your head (on every page):

```
{if "{exp:session_variables:get name="js_deployed"}" != "yes"}
    <script src="{cdn_url}{exp:setversion path='/js/geo.js'}"></script>
    {exp:session_variables:set name="js_deployed" value="yes"}
{/if}

```

As this will be on every page, your Javascript code would need to be updated to take them to the relevant (equivalant) page, not assume the homepage.

For country identification you might want to consider doing it server side with any one of these selection of add-ons.

Be very careful on how you handle this though, automatically redirecting someone is bad UX, as you're assuming they didn't want to go to their original destination (which may well have come from a search listing). You can get into 404 problems when you don't have the same page available in all languages. Even worse, if you ignore their original destination and force them to the homepage on language change. A typical scenario is I'm on holiday, I speak language X, I'm in location Y, you force location Y's language on me and I wanted to see langauge X.

Another more fundamental issue is SEO - imagine in your example you referenced "US" not "UK", every time the JS Googlebot (US based) visited your website and tried to access pages in any other languge they would be forced to the US version, thus they would never be able to index and explore the other languages.

The best solution is to not assume, present the user with a message on screen and ask them - they're the ones that will know what they want - not you!

---
Tags: php, javascript, segments, html
---


# Question
Title: Not showing the "Body" content area when creating a new entry
I have just installed EE V3 and have created a channel called "homepage". I have gone to create a new entry fro this channel and it comes up with the "Title" and "URL Title" but not the text editor for the body content? See screenshot below:

I am not sure if i need to enable anything or install a add-on for this?

Look forward to hearing your thoughts.

Thanks Jordan

# Answer
Well, EE 3 has been out for only about a hot minute, but if I'm not mistaken, the core architecture of EE channels hasn't changed.

Have you created a **field group**, and added **fields** to it, and then assigned that **field group** to your channel? If not, EE will only use (be default) its two standard, required fields.

https://ellislab.com/expressionengine/user-guide/cp/channel/index.html

https://ellislab.com/expressionengine/user-guide/cp/channel/fields/groups/form.html
> 1 votes

---
Tags: error, publish-layout
---


# Question
Title: Low Seg2Cat not working with category groups
Am using Low Seg2Cat. Great utility. But having problems now using it with categories in a second category group.

For categories in the initial category group it works fine. For categories in the second category group I created it generates no responses.

The behavior can be tested on a url generated by this code:

```
Segment 3 - {segment_3}<br />
Segment 3 Group ID - {segment_3_category_group_id}<br />
Segment 3 Category Name - {segment_3_category_name}<br />
Segment 3 Description - {segment_3_category_description}<br />

<h2>category source information</h2>

{exp:channel:categories}
    <a href="/pages/_categorytest/{category_url_title}">{category_name}</a> (Category ID/url: {category_id}/{category_url_title})
    {if category_description}{category_description}{/if}
{/exp:channel:categories}

```

In my dataset, categories 1-10 are in Group 1, Categories 11 and up are in Group 2.

Here is a URL generated by the above code for a category in the first group: http://2gc.eu/pages/\_categorytest/presentations

Here is a URL generated by the above code for a category in the second group: http://2gc.eu/pages/\_categorytest/balanced-scorecard

You will see that the Low Seg2Cat tags generate no data for the second example, even though there is data available.

Any idea why this is happening? I'm sure I'm doing something silly - but documentation for Low Seg2Cat implies that if you don't specify Group-ID in the tag parameters, the results are for all categories.

Grateful for whatever guidance you can offer on this. Thanks!

# Answer
Speedy response from Low - in case useful to anyone else - I had forgotten to add second group to the Low Seg2Cat CP settings.

Did this and all worked sensibly again :)

Thanks Low!
> 0 votes

---
Tags: low-seg2cat
---


title: Expresso Store - Auto Email When Paid?

text:
# Question
Title: Expresso Store - Auto Email When Paid?
Is it possible to have an email auto-generated when an order is paid?

Our system currently allows customers to order and choose manual payment. Once the order is received and confirmed, we then allow them to pay for their order by visiting the /order/order\_hash page.

Because the order was already received, it's not firing to a "new" status and we don't receive an email on payment.

Is there a way to send an email to user and admin when the order changes from "unpaid" to "paid"?

# Answer
> 0 votes
I can't say for sure if Espresso Store is supposed to do that anyways, or if there is supposed to be a simple setting for it, but almost certainly one of these hooks:

https://www.exp-resso.com/docs/extension\_hooks.html#transaction\_hooks

Could be used. I don't have that addon (I'm in education, not retail) anywhere so I'm not sure, but one of those hooks should work to grab a change in that status. Example extension method:

```
function detect_email($order)
{
    // get the current order status (i don't actually know the tables/columns...)
    $prev_order = ee()->db->select('status')
                          ->from('expresso_orders')
                          ->where('order_id', $order['order_id'])
                          ->get()->row_array();

    // compare for fun!
    if ( $order['status'] != $prev_order['status'] &&
         $order['status'] == 'paid' ) {

        // yay! we went from something else to paid!
        // use the email class to fire off some goodness
        $email_msg = "WORD SAUCE PAID DING DING : " . $order['order_id'];

        ee()->load->library('email');
        ee()->email->wordwrap = true;
        ee()->email->mailtype = "html";
        ee()->email->from("specialty@twinkies.com");
        ee()->email->to($order['contact_email']);
        ee()->email->subject("Successful pay.");
        ee()->email->message(entities_to_ascii($email_msg));
        ee()->email->message($email_msg);
        ee()->email->Send();
    }
}

```

# Answer
> 0 votes
You can setup as many order statuses as you need by going to Store \> Settings \> Order Status and create as many additional status that you would like. Then in Store \> Settings \> Email Templates you can create additional statuses for each email template you would like to be sent out.

---
Tags: expresso-store
---


title: Stash variable as a parameter

text:
# Question
Title: Stash variable as a parameter
Is it possible to use a stash variable as a parameter further down the template.

```
{exp:stash:set name="logged_in_user"}{screen_name}{/exp:stash:set}

{exp:freeform:entries form_id="0" site_id="0" search:foo="{exp:stash:get name='logged_in_user'}"}

    {freeform:field:branch} <br/>{screen_name}

{/exp:freeform:entries}

```

# Answer
> 1 votes
~~Add the parameter parse="inward" to the Freeform tag and you should be good to go.~~

It seems you can’t pass tags to the special search: parameter. Even parse="inward" doesn't work. Here you can find exactly how you can solve your issue.

---
Tags: stash
---


# Question
Title: List authors by number of posts in specific channel
I need to display a list of authors that have posted in a specific channel, sorted by number of posts in that channel. I've got this:

```
{exp:query sql="SELECT screen_name, total_entries, member_id FROM exp_members ORDER BY total_entries DESC"}
    <li>
        {screen_name} ({total_entries})
    </li>
{/exp:query}

```

... but that counts entries across all channels, not a specific one. Can't seem to find any plugins to help with this, so guessing it's going to be a more complex query.

Thanks loads for any help!

# Answer
> 1 votes
After reading up a bit on mySQL, I've found an answer, which seems to work. If anyone sees that this is horribly inefficient feel free to disagree!

```
{exp:query sql="SELECT exp_members.screen_name, COUNT(exp_channel_titles.entry_id) AS number_of_posts FROM exp_channel_titles
    LEFT JOIN exp_members
    ON exp_channel_titles.author_id=exp_members.member_id
    LEFT JOIN exp_member_data
    GROUP BY screen_name
    ORDER BY number_of_posts DESC
"}
    <li>
        {screen_name}, ({number_of_posts})
    </li>
{/exp:query}

```

---
Tags: ee2, query
---


title: external dabase connection error on EE3

text:
# Question
Title: external dabase connection error on EE3
I have upgraded the the ee with latest license version & getting following error on the template page where I am using external database

**this the code:**

```
$DB1 = $this->EE->load->database('XXXX', TRUE);

$query_str = 'SELECT * FROM `company` ';
$query = $DB1->query($query_str);

```

**Error:**

Notice Undefined property: EE\_Functions::$EE

ee/legacy/libraries/Functions.php(679) : eval()'d code, line 131 show details

```
Severity: E_NOTICE

```

Please reply as soon as possible

Thanks

# Answer
The ExpressionEngine framework probably doesn't have a pointer reference to the namespace variable `$EE` in whatever script you're executing... to be honest, I'm guessing you copied a script example from somewhere on the net. Globally, ExpressionEngine is instantiated as a class at `ee()`. Even in (later versions, 2.5.5 and up I believe) ExpressionEngine 2.x, you would have had to declare a pointer reference in your class's namespace to have access to it like that:

```
var $EE;

function __construct ()
{
    $this->EE &= ee();
}

function whatevez_homie ()
{
    $this->EE->load->database('database_from_yonder', TRUE);
}

```

Something like that. But you needn't do that. Just use it's global declaration as a class.

```
ee()->load->database('database_from_yonder', TRUE);

```

**Quick Edit**

Oh, seeing your error, it seems as though you are already accessing the class's namespace with the magic `this`. Have you tried deleting `EE` from your statement?

```
$this->load->database('database_from_yonder', TRUE);

```
> 1 votes

---
Tags: xml
---


title: Not Retrieving All Entries in Channel

text:
# Question
Title: Not Retrieving All Entries in Channel
I have a page that is supposed to return all of the entries for a channel, but it only retrieves the first. The channel is "annual-2014". The channel is assigned "publications/index" in Structure. The URL is

```
humbleisdfoundation.org/publications/annual-2014

======== publications/index ========

{if "{segment_2}" == ""}

    <h3>Publications</h3>

    <ul>

    {exp:channel:categories category_group="2" style="linear"}

        <li><a href="{category_url_title}">{category_name}</a></li>

    {/exp:channel:categories}

</ul>

{if:else}

{embed="publications/content" channelName="{segment_2}"}

{/if}

==== publications/content ======

    {exp:channel:entries channel="{embed:channelName}" orderby="date" sort="asc"}

    {absolute_results} <=== Always returns 1 even though there is more than one entry

    ...

    {/exp:channel:entries}

```

# Answer
You need to add the dynamic="off" parameter to your channel:entries tag

```
{exp:channel:entries channel="{embed:channelName}" dynamic="off" orderby="date" sort="asc"}

```
> 2 votes

---
Tags: channel-entries, structure
---


title: Integrating a calendar into cartthrob

text:
# Question
Title: Integrating a calendar into cartthrob
Has anyone successfully integrated a calendar into Cartthrob? A client wants to be able to let their users select weeks in advance when a delivery can be made. Any advice?

# Answer
> 1 votes
From memory you would just need to add a custom date field to your order to hold the shipping date.

On the front end checkout form you would then need to include the datepicker field.

Cartthrob does some magic whereby it will add the data to your order entry. You don't really need to configure it. If there's a field that matches an input on the checkout form it will store the data for you.

---
Tags: cartthrob
---


# Question
Title: How to trigger P&T Assets to Update Indexes from a template
I have created a PDF generating tool that creates certificates for members, creates a sub-folder within a one of my file upload directories, then places the file into the new directory. I am trying to figure out how I can run this script, then tell Assets to Update Indexes, via PHP probably, then the channel:form I have can see the new file/subfolder I have created.

In the Developer docs, there are hooks for assets\_create\_folder and assets\_upload\_file. These hooks look like they work in the opposite direction to what I want.

I want to tell Assets to index new folders and files that I have generated.

Is there any way to do this using PHP in a template without building an extension?

Thank you!

# Answer
I got an email back from Andris at P&T with the following:

> Hey Rowan.
>
> Indexing generally refers to a bunch of files - seems to me that you'd be doing that one file at a time. You should look into Assets\_lib-\>register\_ee\_file($filedir\_id, $path);
>
> Then if you have a Filedir with ID of, say, 8, that has a PDF file at "some/other/folder/file.pdf" that you want Assets to know about, just call ee()-\>assets\_lib-\>register\_ee\_file(8, "some/other/file.pdf");
>
> Also, make sure to load the lib beforehand.
>
> ```
> $this->EE->load->add_package_path(PATH_THIRD.'assets/');
> $this->EE->load->library('assets_lib');
>
> ```

I followed the instructions Andris gave me and with minimal effort, was able to register the files as needed.

So laser focused, i'm really happy with this solution!

In case anyone else is curious, here is some of my code for the PDF generation, imagick pdf to jpg generation, then Assets file registration.

```
<?php

$this->EE->load->add_package_path(PATH_THIRD.'assets/');
$this->EE->load->library('assets_lib');

// somewhere early in your project's loading, require the Composer autoloader
// see: http://getcomposer.org/doc/00-intro.md
require './site_assets/dompdf/vendor/autoload.php';

// disable DOMPDF's internal autoloader if you are using Composer
define('DOMPDF_ENABLE_AUTOLOAD', false);

// include DOMPDF's default configuration
require_once './site_assets/dompdf/dompdf_config.inc.php';

?>

```

... generate my $html code i want to turn into PDF ...

Handle the DOM2PDF etc.

```
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('letter','landscape');

$dompdf->render();
$pdf = $dompdf->output();

$dir = "/assets/uploads/trainee_attachments/";

$path_to_uploads = NSM_BASEPATH.$dir.$member_entry_id."/";
$url_to_uploads = "{path='".$dir."'}/".$member_entry_id."/";

if(!file_exists($path_to_uploads)){
    mkdir($path_to_uploads,0777,true);
    echo "created directory";
}
$cert_filename = $url_title."_".$format."_certificate_".$member_entry_id;
$cert_url_full = $path_to_uploads.$cert_filename;

if (file_put_contents($cert_url_full.".pdf",$pdf)){
    echo "<p>PDF Generated!</p>";
}
echo ("<a href='".$url_to_uploads.$cert_filename.".pdf'>view pdf</a><br/>");
echo ("PDF URL: ".$url_to_uploads.$cert_filename.".pdf");

// display jpg of pdf
$imagick = new Imagick();
$imagick->setResolution(300,300);
$imagick->readImage($cert_url_full.".pdf");
$imagick->writeImages($path_to_uploads.$cert_filename.'.jpg', false);

ee()->assets_lib->register_ee_file(11, $member_entry_id."/".$cert_filename.".jpg");
ee()->assets_lib->register_ee_file(11, $member_entry_id."/".$cert_filename.".pdf");

echo ("<br/>JPG URL: ".$url_to_uploads.$cert_filename.'.jpg');
echo ("<br/><a href='".$url_to_uploads.$cert_filename.".jpg' class='fancybox'><img src='".$url_to_uploads.$cert_filename.".jpg' class='img-responsive col-md-3'/></a>");
?>

```
> 2 votes

# Answer
I can help you figure out the direction you should take, but this one seems obscure and like quite a process, and I'm pretty busy right now. First, I would trace back from the ajax hit that happens when you call Assets to index a new folder from that Control Panel page. Use your browser developer tools to monitor XHR processes (this is usually under the "Network" tab of your dev tools, depends on what browser you use), and index some random folder.

When you do that, you should be able to get the ACTion ID used for indexing folders. Then, look in your `exp_actions` database table. Match up that ACTion ID, and look at what method it calls in the Assets module.

```
SELECT method FROM exp_actions
    WHERE action_id = %% your discovered action id number here in double quotes (no % signs) %%;

```

From there, you can look up that method in the Assets `web-root/system/expressionengine/third_party/assets/mod.assets.php` file. The key from there is to see if you can import the Assets module class into your own add-on (or however you've implemented your PDF generation). Then instantiate the module class, and just call the appropriate methods to index a folder.

If instantiating the Assets module class doesn't work, you at least know what code to copy to reverse engineer how Assets indexes folders.
> 1 votes

---
Tags: assets, php
---


# Question
Title: Conditionals: Use relationship fields within a grid field as variables?
I have a grid field that contains a relationship field. I want to alter the output according to whether or not a particular field in the related entry contains data or not. For instance:

```
{if grid_field:relationship_field:related_entry_content_field != ""}Do this{if:else}Do something else{/if}

```

Instead of the expected results, it prints "{if" then seems to evaluate both conditions as true.

Any ideas on how to make this work?

Edit: Here are some examples of what works and what doesn't work:

```
{exp:channel:entries channel="channel_name" search:search_field="={segment_x}" dynamic="no"}
    {grid_field}
            {!-- Grid field, then relationship field, then field from the related entry - no tag pair. This works: --}
            <h1>{grid_field:relationship_field:title}</h1>
            {!-- Same syntax as above but used in a conditional. Does not work: --}
            <h2>{if grid_field:relationship_field:title == "foo"}Foo{if:else}Not foo{/if}</h2>
            {!-- Using tag pair for the relationship field as suggested below. This works: --}
            {grid_field:relationship_field}
                <h3>{if grid_field:relationship_field:title == "foo"}Foo{if:else}Not foo{/if}</h3>
            {/grid_field:relationship_field}
    {/grid_field}
{/exp:channel:entries}

```

Here is the output from the above code:

```
Title of Related Entry (Desired result from Line 4)
{ifFooNot foo (Weird result from Line 6)
Not foo (Desired result from Lines 8 - 10)

```

Hopefully this helps someone else!

# Answer
Both Grid and Relationships are tag pairs (as both can have many), so you can't just request the end point without telling EE which end point you want (which row and which relation).

This should work:

```
{grid_field}
    {grid_field:relationship_field}
        {if grid_field:relationship_field:related_entry_content_field != ""}
            Do this
        {if:else}
            Do something else
        {/if}
    {/grid_field:relationship_field}
{/grid_field}

```

You might have to replace in the above the `if` conditional with this:

```
{if "{grid_field:relationship_field:related_entry_content_field}" != ""}

```

**Edit based on Question Update:**

The cause for the broken conditional is the the same - you have to have the relationship pair. You can implement in a single line conditional:

```
{grid_field}
    {if "{grid_field:relationship_field}{grid_field:relationship_field:related_entry_content_field}{/grid_field:relationship_field}" != ""}
        Do this
    {if:else}
        Do something else
    {/if}
{grid_field}

```

Obviously this will fail if there are multiple relationships for the same grid row.
> 0 votes

---
Tags: ee2, relationships, conditionals, grid
---


# Question
Title: Multiple people using same login at the same time
Is it acceptable to let multiple people use one member account at the same time? They will all be doing different things or even the same thing at the same time, eg: filling in a freeform form.

I know you can allow multiple logins for one account, but i just need to know if there is any complications by letting them all use the same account at the same time?

Scenario: A specific department eg: Marketing team all use a member account called 'Marketing' instead of every person in that room having their own individual account?

# Answer
Well, one issue is that you are losing **accountability**. The audit track is nil in this situation. You don't know who edited what and when, and that makes it very hard to find out the why. You can make assumptions about a team; but never about a person. Someone having a bad day? Someone thinking (even if its not true) they're about to get fired? They might do something unwanted. Also, the team dynamics of one common-use password are a nightmare. I just wouldn't go there. It is the exact reason we use forwarding for email, and don't share one email account for multiple people in general.

This is what **Member Groups** are for. Create a Member Group for Marketing, and register users to that group. It's also more common; people are used to entering their own login ID (IE email address) and own password. It also puts that responsibility on the individual. We need to avoid a SPOF here (single point of failure).
> 1 votes

---
Tags: members
---


# Question
Title: Sub Category attached to multiple Parent Categories
Long story short I have a client I’m currently working on an EE build for, they want a download page where by each download can be found by navigating through category and sub categories so on and so forth.

Now the issue I’m having is the functionality of expression engines categories module doesn’t seem to allow this kind of depth though it may well be me just getting things confused.

The structure for these categories they want is along the lines of the following:

* Category 1
    + Sub Category 1
    + Sub Category 2
    + Sub Category 3
* Category 2
    + Sub Category 4
        - Sub Sub Category 1
            * Final Sub Category 1
            * Final Sub Category 2
        - Sub Sub Category 2
        - Sub Sub Category 3
            * Final Sub Category 1
            * Final Sub Category 2
    + Sub Category 5
* Category 3
* Category 4
    + Sub Category 4
        - Sub Sub Category 1
            * Final Sub Category 1
            * Final Sub Category 2
        - Sub Sub Category 3
            * Final Sub Category 1
            * Final Sub Category 2
        - Sub Sub Category 4
    + Sub Category 5
    + Sub Category 6
* Category 5

It’s a very complex category listing but despite advice the client is adamant on retaining this structure to order their downloads. Now as you can hopefully decipher from the above is that they have multiple sub categories of varying depths which can appear as children of multiple categories as well as other sub categories.

If I attempt this kind of category setup within the standard category module in EE I can easily add categories and sub categories but it’s when I get any deeper than this which causes issues as I cannot have multiple sub categories with the same name and to my knowledge there is no way to attach a sub category to multiple parent categories.

My question for all you super duper category experts out there is, Can this kind of category depth be achieved using EE with the multiple sub categories and the linking to multiple parents? And if not are there any addons or suggestions you have that can get me on the right tracks?

Thanks in advance for any comments and answers in reply to my inane babble :)

# Answer
Is there any way tag-based navigation would work? If so, there are a number of add-ons you could look at.

If not, and if the problems you mentioned with using the native category structure render that out of the question, then I don't have a tried and true answer. However, just thinking out loud, it seems the Relationships feature might do what you're looking for.

It would be tricky to work out, but you might be able to set up a separate channel for your "categories." Your "Categories" channel would have a Grid field that would include a "ParentCategory" field, which would be a Relationship pointing at the Categories channel entries.

Because this is a Grid field, you'd be able to put in as many category relationships as you want for each - thus allowing sub-"categories" to have as many parent "categories" as necessary.

Your Downloads channel would also have a multi-select Relationships field pointing at your Categories channel entries.

Then you'd build your template with conditionals based on segments (holding "category" data) and show the Downloads entries and/or the Child "category" entries, as appropriate.

You could probably simplify your template considerably if it would be permissible to use a Javascript-based folding tree structure, which would allow you to output the full "category" structure at once rather than using conditionals to select what to show on a given pageload.
> 0 votes

---
Tags: categories, category-group, child-categories
---


# Question
Title: Possible to change encode options for each low search form?
I was able to use low search to filter entries, by getting the values of the parameters in the URL, I set No for encode query setting in the low search module.

I set it back to Yes to and tested my sitewide search form, which it needs to be encoded.

is there an encode parameter in the form tag that I can set on the fly?

If I could get this (below) to work using the query="{segment\_2}" then I won't need to set the encode setting on the fly:

```
<select name="store:price">
    <option value="0">PRICE</option>
    <option value="|10"{if get:price == "|10"} selected{/if}>up to $10</option>
    <option value="10|25"{if get:price == "10|25"} selected{/if}>$10 to $25</option>
    <option value="25|50"{if get:price == "25|50"} selected{/if}>$25 to $50</option>
    <option value="50|100"{if get:price == "50|100"} selected{/if}>$50 to $100</option>
    <option value="100|"{if get:price == "100|"} selected{/if}>$100 and up</option>
</select>

```

# Answer
> 2 votes
Right now, the Encode Query setting in Low Search is installation-wide.

However, with the right setup, you should be able to run all searches with the same setting. I can't think of a reason why you'd want one search encoded and not another.

---

To have the price option selected in the Form tag when encoding queries, use the following code:

```
{exp:low_search:form query="{segment_x}"}
    <select name="store:price">
        <option value="">PRICE</option>
        <option value="|10"{if low_search_store:price == "|10"} selected{/if}>up to $10</option>
        <option value="10|25"{if low_search_store:price == "10|25"} selected{/if}>$10 to $25</option>
        ...
    </select>
{/exp:low_search:form}

```

Make sure `{segment_x}` points to the encoded query in the URI. If you're not encoding queries, you can use the exact same code, and remove the `query` parameter.

Note that the principle of parameter names and corresponding variables applies here just as it does for any other filter.

---
Tags: expresso-store, low-search
---


# Question
Title: Cart throb only allow one item on checkout
In Cartthrob I would like to only allow the user to purchase one product on checkout. If a new product is added to the cart it replaces the one already in the cart. Any suggestions?

# Answer
> 0 votes
(I work at Vector Media Group; we make CartThrob).

Depending on your site and product setup, you may be able to do this by using a `clear_cart` tag followed by an `add_to_cart` tag. These may be able to be on the same template, which you send a person to to add to your cart, or have the empty redirect to the add. This method won't work for products where you need to pass around options and such though.

The more reliable method that would let you handle more complexity is a simple extension that fires on `add_to_cart`. It can remove the old product when the new one is added. Feel free to contact us if you need help making that!

---
Tags: cartthrob
---


# Question
Title: Solspace Calendar Entries are duplicated if they share the same day
I'm displaying events as a list (per day) but finding that if a day has more than one event, the day is duplicated, so rather than: 1 2 3 I'm getting 1 2 2 3 where there is more than one event on the 2nd, code is here:

```
<ul class=" calendar_list no-bullet">
                        {exp:calendar:cal
                            {if segment_3 == ''}date_range_start="year-month-01" date_range_end="year-month-last"{/if}
                            {if segment_3 != ""}date_range_start="{segment_3}-{segment_4}-01" date_range_end="{segment_3}-{segment_4}-last" {/if}
                             {if segment_4 == "{current_time format="%m"}"}date_range_start="today" date_range_end="{segment_3}-{segment_4}-last"{/if}

                            pad_short_weeks="n"
                            category="1"
                        }
                             {if calendar_no_results}<h3>There are no events for this month</h3>{/if}
                            {!-- {if event_count=="1"}<h1>****{event_start_date format="%F %Y"} | {event_count}</h1>{/if} --} {!-- control date format here for month/year title --}
                            <li class="calendar_list"><h4>{event_start_date format="%j"}<br /><span class="list_month">{event_start_date format="%M"}</span></h4>{!-- control date format here for day/month sub-title i.e. %j = day  %F = month  --}
                                <p>{embed="_embeds/calendar_events_by_day" my_date="{segment_3}-{segment_4}-{event_start_date format="%d"}" event_cat_id="1"}</p>
                            </li>
                        {/exp:calendar:cal}
                    </ul>

```

and embedded code '**calendar\_events\_by\_day**' here:

```
{exp:calendar:events
    date_range_start="{embed:my_date}" date_range_end="{embed:my_date}"
    category="{embed:event_cat_id}"
}
    <div class="{if event_type == "Event Type 1"}event_type1{/if}{if event_type == "Event Type 2"}event_type2{/if}{if event_type == "Event Type 3"}event_type3{/if}{if event_type == "Event Type 4"}event_type4{/if}">
    <a href="/{segment_1}/events/{url_title}" class="tips" data-toggle="tooltip" data-placement="top" title="{event_title}">**{event_title}</a><br />
    {if session!=""}{session}<br />{/if}{event_start_date format="%g"}{if event_start_minute > 0}:{event_start_minute}{/if}{if event_end_time != event_start_time && event_end_time != '00:00'}–{event_end_date format="%g"}{if event_end_minute > 0}:{event_end_minute}{/if}{event_end_date format="%a"}{if:else}{event_start_date format="%a"}{/if}<br /></div>
{/exp:calendar:events}

```

Any pointers appreciated!

# Answer
> ## Highly suggested reading to distinguish Calendar tags:
>
> https://solspace.com/docs/calendar/getting\_started/

You should only need `{exp:calendar:cal}` to display events for a day. No `{exp:calendar:events}`, no embeds.

Let's say you have this URL: `http://example.com/calendar/events/2015/12/25`

To display events on December 25th, 2015, you would need only this:

```
{exp:calendar:cal
  date_range_start="{segment_3}-{segment_4}-{segment_5}"
  date_range_end="{segment_3}-{segment_4}-{segment_5}"
  pad_short_weeks="n"}

    {events}
        // Your event data
    {/events}
{/exp:calendar:cal}

```

(Add conditionals based on segment\_X if you want something a bit more dynamic. `{current_time}` is a late-parsed variable, however, so might not parse early enough for the `{exp:calendar:cal}` tag)

If the range is *more* than 1 day and you want to display events for each day, you would add the `{display_each_day}...{/display_each_day}` tag pair around `{events}...{/events}` so that Calendar loops through each day.
> 0 votes

---
Tags: solspace
---


title: Low Search: Remember previous search

text:
# Question
Title: Low Search: Remember previous search
**Scenario:**

WHEN User searches for a random term lets say `pepe` on my initial search page.

THEN User sees the results page with lots of results.

THEN User wants to filter those results by Clicking in any of the Categories filter

THEN User sees the results of `pepe` for the specific category that he selected.

**Problem**

I'm able to do the first search and display all results independent of category. When I try to run a 2nd search on the result's page and pass the filter `category` I don't know how to make the system remember the first query or pass the value of `search:title`.

How can I achieve that?

**Initial Search Page**

```
{exp:low_search:form
  form_attribute="search-form"
  result_page="search"
  collection="article"
  search_mode="all"
}
  <fieldset>
    <label for="keywords">Search</label>
    <input type="search" name="search:title"/>
    <button type="submit">Search</button>
  </fieldset>
{/exp:low_search:form}

```

**Results Page (UPDATED WITH WORKING CODE)**

```
    <!-- Category filter-->

     {exp:low_search:form
            form_attribute="search-form"
            result_page="search"
            collection="article"
            search_mode="all"
            remember="search:title"
            query="{segment_2}"
}

<fieldset>
    {exp:channel:categories parent_only="yes" style="linear"}
        <button  name="category" value="{category_id}">{category_name}</button>
    {/exp:channel:categories}
</fieldset>

{/exp:low_search:form}

<!-- Search Results-->
{exp:low_search:results
    limit="10"
    query="{segment_2}"
    collection="article|food"
    status="open"
}
  {if count ==  1}<ol>{/if}
    <li><a href="{comment_url_title_auto_path}">{title}</a></li>
  {if count == total_results}</ol>{/if}
  {if no_results}No search results{/if}
{/exp:low_search:results}

```

# Answer
> 1 votes
Use the `remember=""` parameter on the second Form tag.

> Set to the names of the parameters you want to pass through to the next search without having input fields for them in the form.

So, instead of having the hidden input field in the second form, use `remember="search:title"`.

---

Additionally, there's a couple of things you can improve:

* Instead of using `search:title` (the Field Search filter), try using `keywords` (the Keywords filter). This will increase performance and is the preferred filter for free text searches.
* Don't add any filter parameters (like `collection` and `search_mode`) to your Form tag; they have no effect there. Add them to the Results tag instead. Also `search_mode` has been superseded by `keywords:mode` in Low Search v4.

---
Tags: low-search
---


# Question
Title: Low-search: How to get the total amount of search results?
I am trying to get the total amount of search results available for a given search term. My results are paginated. `total_results` Will give me the total amount displayed in the page, but I need the total amount available in all pages to say something like "Your search term was found in 140 pages"

How can I do that?

# Answer
> 1 votes
Use the native `{absolute_results}` variable. This is shown in the first example of the docs.

---
Tags: low-search
---


title: CartThrob issue after EE upgade

text:
# Question
Title: CartThrob issue after EE upgade
An old website has recently been updated for a client of ours, from EE 2.4.0 to EE 2.10.1.

I've been having lots of trouble with CartThrob on the staging site. I'm wondering if the licence for the staging site is causing issues (as the current site is still live while we work on it), which is why it hangs when processing orders (time out).

We've tried almost everything we can think of and still to no avail.

Thanks,

Shaun.

# Answer
> 0 votes
I work at Vector Media Group, the people behind CartThrob.

This shouldn't be license related at all. Are you on the latest version of CartThrob (2.7)? Also: do the servers have different configurations? Different versions of PHP, MySQL, etc...? And finally, does the staging site have htaccess password protection, and is it using an offsite gateway? Sometimes htaccess blocks those from working.

# Answer
> 0 votes
The lesson to this story is that if you're upgrading CartThrob and you're getting inconsistent errors, check that the email stuff is configured correctly otherwise the checkout process hangs and you will be chasing phantom errors.

If you are using a staging or dev site (as the old site is still live in this case) and you just want to test but don't care if you get an email as you will be able to see all orders in the database/admin anyway, comment out this:

```
$this->EE->cartthrob_emails->send_email($email_content, $this->order());

```

Should be around 2640 of ./system/expressionengine/third\_party/cartthrob/libraries/Cartthrob\_payments.php

But don't forget to comment it back in when you switch the site or put it live.

---
Tags: cartthrob
---


# Question
Title: How to send email report of total channel entries in Expression egnine on daily basis
hi I am new to Expression engine I am getting total channel entries using EE Tag :-

```
{exp:stats channel="products" site="default_site"}{total_entries}{/exp:stats}

```

Now I want a email report that gives me total no of channel entries on daily basis I can use cron job but i want to know how to do this procedure.

# Answer
First, make a hidden template, probably in template group called **cron**. For safety, you'll need to have some .htaccess rules that prevents anyone but your server from being able to reach this template. Then, in that template, turn on PHP. Here's an example to help (assuming a channel ID of 1):

```
<?php

// get number of products
$num_of_products = ee()->db->select()
                           ->from("channel_data")
                           ->where("channel_id", "1")
                           ->get()
                           ->num_rows();

// use the email class to send this information out
$email_msg = "Hello, we have {$num_of_products} today.";
$notify_address = "your@address.com";

ee()->load->library('email');

ee()->email->wordwrap = true;
ee()->email->mailtype = "text";
ee()->email->from("no-reply@address.com");
ee()->email->to($notify_address);
ee()->email->subject("Daily update");
// optional
// ee()->email->message(entities_to_ascii($email_msg));
ee()->email->message($email_msg);
ee()->email->Send();

?>

```

Then, using cron and curl, set a cron job to curl that address once a day. Remember to set .htaccess to deny access to that template file from any requester except self (127.0.0.1). Now you can use addons like PostMaster to make this whole process much easier, but you have to purchase them. I'm giving you a raw but free answer.
> 0 votes

---
Tags: php, codeigniter
---


# Question
Title: Using Channel Form to change the channel of an entry
I've searched the docs and don't see any native way to change an entry from one channel to another via a channel form. (In my case the 2 channels share the same field and status groups so this should be doable. Indeed, it is possible in the CP when editing entries.)

Am I missing something, or will a plugin be required here.

Thanks!

# Answer
> 0 votes
Found a solution. The channel form outputs a hidden channel\_id input

```
<input type="hidden" value="12" name="channel_id">

```

I was able to change that with javascript to the id of the new channel that I wanted to post to.

---
Tags: safecracker
---


title: Freeform file upload question

text:
# Question
Title: Freeform file upload question
We are using Freeform to allow users to apply for jobs, and we want to be able to allow them to send attachments (restricted to pdf or docs only).

How does Freeform handle multiple files with the same file name? If more than one person uploads a file called "resume.pdf", for example, does the newer one overwrite the old? Or are the files sorted in such a way as to prevent this type of situation?

# Answer
If two files are uploaded with the same file name, the file names are adjusted so one does not overwrite the other. In testing this out, I uploaded two files called sample.pdf. The second one simply got retitled to sample1.pdf.
> 2 votes

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


# Question
Title: Conditional to use date_range_start="today" instead of date_range_start="{segment_3}-{segment_4}-01" in {exp:calendar:cal} loop
I am trying to use `date_range_start="today"` instead of `date_range_start="{segment_3}-{segment_4}-01"` if the user is on the current month displayed. I have this working properly for all other months except the current month. The problem is that events that have already passed are still showing up for the current month. Is there a conditional that I could use to check if it is the current month and then use `date_range_start="today"` in that case? Below is the loop that I am using.

```
{exp:calendar:cal
    date_range_start="{segment_3}-{segment_4}-01"
    date_range_end="{segment_3}-{segment_4}-last"
    show_months="1"
    show_future_entries="yes"
    dynamic="no"
    event_limit="3"
    paginate="bottom"
    pad_short_weeks="n"}

```

# Answer
The documentation of the rendering stages says that `segment_variables`, `preload_replace:variable` and `current_time` are parsed before the modules and plugins tags.

You can use all of them to conditionally set the parameter of the `exp:calendar:cal`.

For the conditional, format the `current_time` as the `segment`.

```
{if '{current_time format="%m"}' == segment_4}
    {preload_replace:pre-date_start="today"}
{if:else}
    {preload_replace:pre-date_start="{segment_3}-{segment_4}-01"}
{/if}

{exp:calendar:cal
    date_range_start="{pre-date_start}"
    date_range_end="{segment_3}-{segment_4}-last"
    dynamic="no"
    event_limit="3"
    paginate="bottom"
    pad_short_weeks="n"}

```

I'm assuming you're using version 2.9+. If not, use two `if`s instead of an `if:else`.
> 1 votes

---
Tags: solspace-calendar
---


# Question
Title: Cannot use member id as dynamic conditional variable
I’m building a system where entries should have specific member access.

I have a parent template that checks member group which then embeds a template specific to this and then lists entries which should only display if the current member ID matches the specified entry ID. Problem is using the ‘member\_id’ or ‘logged\_in\_member\_id’ won’t work.

I’ve tried a number of ways to do this but none work.

Firstly I’ve tried directly:

```
{if '{pref_member_access}' == '{member_id}/{logged_in_member_id'}
do a thing
{/if}

```

Next I tried embedding the id:

```
{if '{pref_member_access}' == '{embed:mem_id}'}
do a thing
{/if}

```

with parent:

```
{embed="_page/.pref_list" mem_id="{member_id}/{logged_in_member_id}"}

```

and also I’ve tried with stash:

```
{exp:stash:set name="mem_id"}{member_id}/{logged_in_member_id}{/exp:stash:set}

```

These will all work and give me the correct output inside the embeded template but NOT if I try to use the output inside the conditional.

Just to clarify I am not using ‘{member\_id}/{logged\_in\_member\_id}’ as I have put it in the code above, I have used either/or

If I specify a member ID the conditional will work:

```
{embed="_page/.pref_list" mem_id="8"}
or
{exp:stash:set name="mem_id"}8{/exp:stash:set}
for example

```

even if I try to ‘stash’ the member ID at my master template it won’t work as a dynamic value either.

(you can probably ignore the stash code if you are unfamiliar with it, this isn’t really regarding that, I’m just trying to use the current logged in members ID as a dynamic value)

Any ideas?

Thanks

# Answer
Just to update my issue turned out to be, I had 'member\_data' disabled in my channel entries tag

```
disable="member_data|pagination|trackbacks"

```

after removing that I was able to use {logged\_in\_member\_id}.

...now I have another issue but I'll post that if it comes to it.

...I also somehow have 2 accounts
> 1 votes

# Answer
Try using {logged\_in\_member\_id} instead of {member\_id}. If I remember correctly it's parsed early and so should be available to your conditional.
> 0 votes

---
Tags: channel-entries
---


title: Devdemon Forms Database Error

text:
# Question
Title: Devdemon Forms Database Error
Anybody know how to fix this? Every time I save a form (creating forms) I get this error. System drops all of my changes. Started yesterday.

EE Version Installed: 2.10.0 Forms Version 3.5.2

A Database Error Occurred Error Number: 1117

Too many columns

ALTER TABLE `exp_forms_entries` ADD `fid_3189` TEXT NULL

Filename: third\_party/forms/models/forms\_model.php

Line Number: 210

# Answer
https://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html

Unfortunately, it's right there in the docs, my friend. And your error is self-explanatory. Hard limit is 4096 (for MyISAM), or 1000 (for InnoDB), but EE defaults to MyISAM. The functional limit is actually less:

https://www.percona.com/blog/2013/04/08/understanding-the-maximum-number-of-columns-in-a-mysql-table/

This is why FreeForm, upon going from 3.x to 4.x, switched from having one table with expanding columns when adding forms, to giving each form it's own table. If Devdemon Forms does it's job correctly, when you delete old forms, this should delete the field ids for those forms. I don't know, I haven't personally used Devdemon Forms. But try it; remove some old forms, or specifically (if Forms doesn't directly relate forms owning specific fields) remove fields from your Devdemon install. Check the docs for how to do this.
> 0 votes

---
Tags: devdemon, devdemon-forms
---


title: Can't upload image via Channel Forms

text:
# Question
Title: Can't upload image via Channel Forms
I have a channel form set up here where non-registered users can submit upcoming event information. The form works fine except when you try to upload an image. It generates an error message about file upload permissions.

In the file upload permissions area there isn't an option to allow uploads for non-registered users. Is there a way to allow for this?

Here is the code for the form.

```
{exp:channel:form channel="calendar_events" class="artist" return="calendar/confirmation"}

<p><label for="title"><span>*Name of Event</span>
<input type="text" name="title" id="title" value="" size="50" maxlength="100" onkeyup="liveUrlTitle();">
</label>
</p>

<p><label for="submitting_organization"><span>*Organization</span>
<input type="text" name="submitting_organization" id="submitting_organization" value="" maxlength="75" size="50">
</label>
</p>

<p><label for="submitted_by"><span>*Contact - Full Name</span>
<input type="text" name="submitted_by" id="submitted_by" value="" size="50" maxlength="100">
</label>
</p>

<p><label for="contact_phone"><span>*Contact - Phone Number</span>
<input type="text" name="contact_phone" id="contact_phone" value="" maxlength="75" size="50">
</label>
</p>

<p><label for="submitters_email"><span>*Contact - Email</span>
<input type="text" name="submitters_email" id="submitters_email" value="" maxlength="75" size="50">
</label>
</p>

<p><span>*Date and Time</span>
{exp:calendar:date_widget}
</p>

<p><label for="event_location"><span>*Event Location</span>
<input type="text" name="event_location" id="event_location" value="" maxlength="75" size="50">
</label>
</p>

<p><label for="event_address"><span>*Event Address</span>
<input type="text" name="event_address" id="event_address" value="" maxlength="75" size="50">
</label>
</p>

<label for="event_summary"><span>*Description of Event</span></label>
<textarea name="event_summary" rows="5" cols="65" >{event_summary}</textarea>
<div class="clearer"></div>
<br />
<span>Photo (optional)</span>
{field:event_thumbnail}
<br />

<p><label for="admission"><span>*Cost of Admission</span>
<input type="text" name="admission" id="admission" value="" maxlength="75" size="50">
</label>
</p>

<input type="submit" class="submit" name="submit" value="Submit">
{/exp:channel:form}

```

# Answer
> 1 votes
I can think of some possible ways to do this; but why bother when my Google-fu is mighty? Found this:

https://devot-ee.com/add-ons/logmein

And although that page hasn't been updated in a while, the last comment is from May this year giving it five stars. I would give that a try before planning some sort of hack. But it looks like it's just what you need, the example on that page even hints at doing exactly what you want:

```
{exp:logmein:now username="priveleged_guest"}

```

So you create a "Privledge Guest" member group, restrict it to nothing but file uploading to your guest uploads folder, and put that tag on your form page. Voilà!

---
Tags: safecracker, permissions
---


# Question
Title: blank lines in parsed templates where template tags / logic exists
I am noticing a lot of extra blank lines for the lines where my template logic exists. I notice this mostly when I'm building javascript.

How do I go about preventing this?

**Example:**

```
<script>
{exp:....}
{datablock}
//do some stuff here
{/datablock}
{/exp:...}
</script>

```

**will output:**

```
<script>

//do some stuff here

</script>

```

# Answer
> 1 votes
I've seen this. I think it's because the line breaks for {exp...}, {datablock} and so forth are added to the source, even if the code on those lines doesn't insert anything visibly into the page. It really kind of makes sense, when you think about it, although it definitely makes for less clean-looking source code, and marginally more HTML data that has to be sent to the browser.

If this is really an issue to you, you could use Minimee to minify your HTML. That will get rid of the line breaks, but will butcher the readability of your source.

# Answer
> 0 votes
Depending on how your script is working, you may need to escape the "{}" around the EE tags. I've only ran into this a couple of times. What does the inspector tell you?

---
Tags: templates, template-scripting
---


title: Redirect an Expired Page

text:
# Question
Title: Redirect an Expired Page
For some reason i can't figure this one out. We have deals on our site that are set to expire on certain dates. These deals are sent out via email, so someone could click on a link after the deal has expired. If this happens, we would like to redirect them to the main deals page. My thought was to do this one of two ways:

1. If the entry is "closed" redirect to {segment\_2}. The problem is that expired entries don't automatically change to "closed" status. How would i do this?
2. Use a conditional statement to either show page or redirect based on expiration date.. something like this:

```
{exp:channel:entries
    status="open|featured|homepage|hidden"
    dynamic="no"
    limit="1"
    disable="member_data|trackbacks|categories"}

    {if expiration_date < current_time}
        SHOW DEAL
    {/if}

    {if expiration_date > current_time}
        REDIRECT TO {segment_2}
    {/if}
{/exp:channel:entries}

```

This isn't working either. I did a test with it to just show text based on the condition and both expired pages and live pages showed "SHOW DEAL". Obviously missing something here.

Please let me know if you have any suggestions. Thanks!

# Answer
Well, what happens when you output

```
Expires - {expiration_date}

Current Time - {current_time}

```

Does that output look like two values you can use comparisons with? You could use Low Nice Date to convert times and dates (I think, check the docs), or perhaps have you looked at this addon?

https://devot-ee.com/add-ons/auto-expire

It looks out of date, but might work still. Test it on a dev site first. And also look around devot-ee, there might be a newer version or one by a different author.
> 0 votes

# Answer
Well, I think your conditional is inverted. Shouldn't it be?

```
{if expiration_date < current_time}
   {redirect='{segment_2}'}
{/if}

```

I can't test on an older version of eecms, but maybe the one you're using doesn't save the `expiration_date` as UNIX timestamp. In this case, try:

```
{if "{expiration_date format='%Y%m%d'}" < "{current_time format='%Y%m%d'}"}
   {redirect='{segment_2}'}
{/if}

```
> 0 votes

# Answer
The conditional was correct the whole time. I was missing the show\_expired="yes" in the {exp:channel:entries. What was happening was that entry wasn't pulling at all so the conditional wasn't seeing anything. Once i added the show\_expired it was able to see the expiration date to compare to. Thanks guys!
> 0 votes

---
Tags: expire
---


# Question
Title: Code-driven way to enable PHP parsing on a template
Still a bit new with EE2, but I'm looking to be able to construct a way we can push changes up in environments, without having to sync up database-level stuff. Right now I have several templates that are being changed to include PHP in them. Part of what I want to get right is making sure PHP is enabled in our production environment when we go to push. Is there a way in code to set this flag on a given template? Or is the only solution in the database?

# Answer
The setting on whether a template has PHP parsing turned on lives in the `exp_templates`, under the `allow_php` column (either `y` or `n`) and the `php_parse_location` column (either `i` or `o`). This question really pertains to practices related to versioning, as I assume you would use a VCS tool for pushing code from development to production.

Programatically, you can always modify the database using the Database class, but that isn't what you're looking for. If you are using git, I would recommend using git hooks.

I would use a hook to

1. Dump the `exp_templates` table pre-commit
2. Add that dump file to your commit
3. Repo gets pushed from dev to production here
4. Use a server-side hook to run an update to that table with the dump

It seems like a convoluted way to go about it, but that should essentially push your `exp_templates` table along with your code, but not interrupt your channel data or other tables. This can also have the unfortunate effect of overwriting production changes to templates that were done during development time. Perhaps if you could expand on your teams planned development to production path (agile sprints or something?), and how stable the production deployments are going to be, we can help more.

**Edit** Whether a template gets pulled from file or template, there is **still** a read from the `exp_templates` table in the EE engine to determine PHP parsing. If you want to just have a post-push trigger, you could write a PHP script that looks at both development and production tables, does a comparison of those columns, and then updates the production rows to match the development ones, using a git hook.
> 0 votes

---
Tags: ee2, templates, php
---


title: How to send soap request

text:
# Question
Title: How to send soap request
I need to send a soap requests to an external website but keep on getting “Failed to load resource: Origin xxx is not allowed by Access-Control-Allow-Origin” and “XMLHttpRequest cannot load https://...?wsdl. Origin xxx is not allowed by Access-Control-Allow-Origin.

I have no control over the responding server.

Is there a way to send the request without the browser preflighting the request? Another way of sending soap requests?

I am using EE 2.9.3 and JQuerySoap

```
<script>
$( document ).ready(function() {
var $_POST = <?php echo json_encode($_POST); ?>;
var $entry_date = $_POST["entry_date"];
var $billingFirstName = $_POST["billingFirstName"];
var $billingLastName = $_POST["billingLastName"];
var $eMail = $_POST["eMail"];
var $special = $_POST["special"];
var $howoften = $_POST["howoften"];
var $billingaddress = $_POST["billingaddress"];
var $billingaddress2 = $_POST["billingaddress2"];
var $billingzipcode = $_POST["billingzipcode"];
var $billingcity = $_POST["billingcity"];
var $doorcode = $_POST["doorcode"];
var $instructions = $_POST["instructions"];
var $telephone = $_POST["telephone"];
var $produktnamn = $_POST["produktnamn"];
var $produktpris = $_POST["produktpris"];
var $dibsrefno = $_POST["dibsrefno"];
var $billingdate = $_POST["billingdate"];

var xml =
    ['<soap:Envelope xmlns:soap="http://xxx" xmlns:v2="https://xxx">',
        '<soap:Header/>',
            '<soap:Body>',
                  '<v2:subscribeAndSettle>',
                     '<v2:shopName>xxx</v2:shopName>',
                     '<v2:userName>xxx</v2:userName>',
                     '<v2:password>xxx</v2:password>',
                     '<v2:verifyID>'+$dibsrefno+'</v2:verifyID>',
                     '<v2:data>1:'+$produktnamn+':1:'+$produktpris+'00:</v2:data>',
                     '<v2:ip>xxx</v2:ip>',
                     '<v2:currency>SEK</v2:currency>',
                     '<v2:extra>&entry_date='+$entry_date+'&billingFirstName='+$billingFirstName+'&billingLastName='+$billingLastName+'&eMail='+$eMail+'&special='+$special+'&howoften='+$howoften+'&billingaddress='+$billingaddress+'&billingaddress2='+$billingaddress2+'&billingcity='+$billingcity+'&doorcode='+$doorcode+'&instructions='+$instructions+'&billingdate='+$billingdate+'</v2:extra>',
                  '</v2:subscribeAndSettle>',
               '</soap:Body>',
    '</soap:Envelope>'];
$.soap({
    url: 'https://xxx?wsdl',
    data: xml.join(''),
});

});
</script>

```

# Answer
> 0 votes
I was never able to solve this, instead i moved the javascript into a custom module

---
Tags: ee2, jquery, xml
---


# Question
Title: How to publish content to multiple site channel categories from admin
I had setup the multiple sites using MSM and want to publish content to different sites different categories in a single submit from the admin.

# Answer
I couldn't really find addon already made that will do that. What you'd need to do is craft an one yourself.

This is a bit complex of an addon to make, so I'll try and outline what you'd need to do.

First, create an module with a tab file. Use that Tab file to generate a tab on your publish page (call it something like "MultiPost"). Then, make an accessory that modifies that tab with JavaScript on your publish pages. Use the accessory file to look up your sites, the channels for those sites, and your channel categories. Then, in the accessory, use jQuery to create checkboxes in your MultiPost tab, aka, a list of checkboxes for which sites to post it to, then in that site, which channel (only submit to channels that share the same field group), and which channel categories. Also with that jQuery, hook to the publish form **Submit** button; stop the submission on click (`preventDefault`). Use jQuery to add hidden input fields to the entry form. Those hidden input fields will have the value from your MultiPost tab (what sites you've clicked to post it to, what channels, what categories per channel per site). After you add your hidden inputs, continue with form submission. Then, use an extension hooked to, perhaps, `channel_form_submit_entry_end`, to grab your custom POST data that you inserted into the entry form (`ee()->input->post('my_hidden_field_with_site_ids_to_duplicate_this_channel_entry_to')`). Use that data, and the `channel_form_obj`, and the Channel Entries API to submit new entries to your other sites, modifying the channel id and categories along the way.

See, wasn't that **easy**? I don't recommend actually trying to create an addon of such complexity unless this is your full-time job and your employer is aware of the immensity of developing this addon. What you're asking is technically feasible, but not how you should be going about it. You might be able to use MX Cloner:

http://www.eec.ms/add-ons/mx-cloner/

To just clone entries from one site to another, but I'm not sure if it has the option to change `site_id` or categories in the process.
> 0 votes

# Answer
Why not just publish once and share the same content/entries across your MSM sites? That way you don't need to mass duplicate everything.
> 0 votes

# Answer
Here is my solution. Lets assume we have two sites setup under the EE using the Multisite manager and the shortcodes are

```
1.) default_site   ===>>  Default Site
2.) second_site    ===>>  Second Site

```

Now We had already setup the following category structure under each sites Category group called NEWS

# Category Structure for the default\_site

NEWS \[Category Group\] {Assigned to channel called News}

```
1.) Default Site [Category]
    3.) Latest News
    4.) Top Stories
2.) Second Site [Category]
    5.) Latest News
    6.) Top Stories

```

# Category Structure for the second\_site

NEWS \[Category Group\] {Assigned to channel called News}

```
6.) Default Site [Category]
    8.) Latest News
    9.) Top Stories
7.) Second Site [Category]
    10.) Latest News
    11.) Top Stories

```

# FOR DEFAULT SITE

To fetch Latest news from each site we use the following entry tag

```
{exp:channel:entries channel="news" category="3|8" offset="0" disable="categories|category_fields" track_views="one" dynamic="no" status="open|featured" limit="10" paginate="bottom" site="default_site|second_site"}

```

To fetch Top Stories from each site we use the following entry tag

```
{exp:channel:entries channel="news" category="4|9" offset="0" disable="categories|category_fields" track_views="one" dynamic="no" status="open|featured" limit="10" paginate="bottom" site="default_site|second_site"}

```

# FOR SECOND SITE

To fetch Latest news from each site we use the following entry tag

```
{exp:channel:entries channel="news" category="5|10" offset="0" disable="categories|category_fields" track_views="one" dynamic="no" status="open|featured" limit="10" paginate="bottom" site="default_site|second_site"}

```

To fetch Top Stories from each site we use the following entry tag

```
{exp:channel:entries channel="news" category="6|11" offset="0" disable="categories|category_fields" track_views="one" dynamic="no" status="open|featured" limit="10" paginate="bottom" site="default_site|second_site"}

```

Here everything is based on category ID.
> 0 votes

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


# Question
Title: FreeForm Pro 4.2.0 form fields prepulated with "value"
I'm trying to get the fields that appear on my contact form to be pre-populated using the standard HTML "Value" attribute, but can not figure out how to get the freeform:field declaration to pass it on.

I currently have the following in my form code: {freeform:field:name value="test"}

Here is the form online as of right now: http://sustainablefurnishings.com/contact\_us/

The "value" is not populated in the code and therefore doesn't appear in the field.

How can the "Value" be set for a form field using the FreeForm Pro tools? Am I missing something in their documentation?

# Answer
> 1 votes
The parameter you are looking for is default\_value:

```
{freeform:field:my_field default_value=""}

```

http://www.solspace.com/docs/freeform/form/#freeform\_field\_field\_name

# Answer
> 0 votes
# Using Composer Hidden Fields?

If you found this answer whilst searching for a solution to this problem for hidden fields in Composer, check out Solspace's other answer over here:

**Getting channel TITLE tag value in Freeform Pro Composer hidden input field**

---
Tags: solspace-freeform
---


title: Sorting a Low Search Shortcut

text:
# Question
Title: Sorting a Low Search Shortcut
I am building a property rental site using EE 2.10.1 and Low Search 4.3.1. I am trying to sort the results of the Low Search query by limit, bedrooms and occupancy. I have this working perfectly on a general search results page, as shown in this URL:

http://movingmo.nextmp.net/search/homes/eyJyZXN1bHRfcGFnZSI6Ilwvc2VhcmNoXC9ob21lcyIsInNlYXJjaDphbWVuaXRpZXM6YW1lbml0aWVzX25hbWUiOiJGaXJlcGxhY2UiLCJsaW1pdCI6IjUwMCJ9

But when trying to apply the same sorting to a page that displays a Low Search Shortcut it doesn't work. I've tried changing the query parameter and adding in the shortcut parameter to the tags but can't seem to figure this out. Here's some template code, shortened for brevity but I think it will show where I'm at.

This is the tag on the general search results:

```
{exp:low_search:results
 query="{segment_3}"
 site="foo"
 collection="bar"
}
 <label class="left inline" for="orderby_sort">Sort by:</label>
 <select name="orderby_sort" class="sort" id="orderby_sort" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="bedroomCount|asc"}">Bedrooms - Low to High</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="bedroomCount|desc"}">Bedrooms - High to Low</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="maxGuestCount|asc"}">Sleeps - Low to High</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="maxGuestCount|desc"}">Sleeps - High to Low</option>
 </select>
 <label class="left inline" for="limit">Homes per page:</label>
 <select name="limit" class="limit" id="limit" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="12"}">12</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="24"}">24</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="36"}">36</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="48"}">48</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="500"}">All</option>
 </select>
 ...search results here...
{/exp:low_search:results}

```

And this is the tag on a page that uses a Shortcut, for example: http://movingmo.nextmp.net/luxury-rental-homes/condos-residences

```
{exp:low_search:results
  shortcut="condos-residences"
  site="foo"
  collection="bar"
}
 <label class="left inline" for="orderby_sort">Sort by:</label>
 <select name="orderby_sort" class="sort" id="orderby_sort" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="bedroomCount|asc"}">Bedrooms - Low to High</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="bedroomCount|desc"}">Bedrooms - High to Low</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="maxGuestCount|asc"}">Sleeps - Low to High</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="maxGuestCount|desc"}">Sleeps - High to Low</option>
 </select>
 <label class="left inline" for="limit">Homes per page:</label>
 <select name="limit" class="limit" id="limit" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="12"}">12</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="24"}">24</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="36"}">36</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="48"}">48</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="500"}">All</option>
 </select>
...search results from shortcut here...
{/exp:low_search:results}

```

I thought changing the query parameter to a shortcut parameter would work but no luck. I also tried adding a result\_page parameter but that didn't work either.

Am I missing a parameter on my tag somewhere? Is it not possible to sort this way with a Shortcut?

# Answer
When you amend a shortcut by overwriting or adding other parameters, you end up with a new query. You then have to pass that query on to the Results tag.

So, try adding `query="{segment_3}"` to the second Results tag. If `segment_3` can both contain a shortcut name and an encoded query, you can use `query="{segment_3}" shortcut="{segment_3}"` and the shortcut will be displayed if it is valid, otherwise the encoded query will be displayed.
> 1 votes

---
Tags: low-search
---


# Question
Title: Tagger and Channel Forms — import from simple text field?
I'm using an API to pre-populate EE entry forms, and one of the fields is a Tagger field. How do I take my comma-separated string of plain-text tags and turn the into something the Tagger field will accept?

I know Tagger has an Import feature, but I'd love to able to do this at the entry level, instead of having to go in and process tags manually each time.

If not, is there another tagging add-on that will allow this?

# Answer
Never mind! I figured it out. When creating a new entry, use this field, instead of calling the proper Tagger field:

```
<input name="gallery_location[single_field]" type="text" value="">

```

Then use double pipes to separate your values, and Tagger will accept the submission.

```
<input name="gallery_location[single_field]" type="text" value="New York||Amsterdam">

```
> 0 votes

---
Tags: devdemon-tagger, tagger
---