# Question
Title: Store: need {price} field to be optional?
I'm trying to set up an EE e-commerce site for the following scenario:

1. A product categories list that is 4 levels deep. The product categories will have at least two custom category fields: `amount` and `amount_type`. These fields represent the markup (profit) of a particular product associated with the category. Example values are: {10, 'percentage'} or {5, 'amount'}. NOTE: products will only be assigned the lowest level category.
2. The Channel that has the Store field will have a custom channel field `cost.` This represents the cost of the product to the retailer.
3. Optionally set the `price`.

In the frontend, I want customers to see this:

1. If the `price` field is populated, show that amount.
2. If the `price` field is not populated, then compute the selling price by using `cost` custom Channel field and `amount` and `amount_type` custom Categories fields.

As there is no requirement for the lowest level categories to actually have a value for `amount` and `amount_type`, the frontend logic would need to keep checking the parent category until it finds a category level that does have those fields populated. The root nodes will always be populated.

It appears that `price` is required, though. **So, what might I be able to do in order to support this custom business logic?** Perhaps I set the price to an invalid value, like `-1` and do checks in the frontend based on that somehow?

# Answer
Store 2.x allows for user defined prices so you should be able to enter 0 in the price field then create some template logic when the price is 0 you would then run the math to get the correct price based upon your custom fields.
> 1 votes

---
Tags: expresso-store, add-on
---


# Question
Title: Circumventing the maximum number of segments limit
It says in a support thread that Expression Engine has a maximum number of segments allowed that can't be changed (I can't think of a reason why they would need to do so).

I can't change the directory structure of my resources since it is structured by a ready made template. So I am stuck.

Does someone have a solution circumvent the issue of having too many segments?

Or at least disable Expression Engine from capturing and interpreting that page since the the links that I have that go over the maximum limit point to CSS files which don't need EE interpretation.

# Answer
> 1 votes
If you have structured you htaccess like the htaccess example. ExpressionEngine will not be consulted when accessing folders or files on your server.

These two lines in the htaccess are important

```
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

```

These make sure that if you are accessing a folder or file (like your css files), then do not have ExpressionEngine parse it. This essentially means there is no limit to your segments.

---
Tags: segments
---


# Question
Title: Image uploads, but the modal doesn't update
Using EE 2.8.1 with the default file field.

When uploading an image the modal changes to just have the blank modal with spinner screen (attached). It does actually upload though - but the user has to refresh the entry page to see it.

There are no image transformations on this upload directory, although there was previously and this happens on all directories.

Also, as the screenshot demonstrates no JS errors are occurring within Chrome's Web Inspector.

However Firefox's debug does show this message upon pressing "Upload File"

> The character encoding of a framed document was not declared. The document may appear different if viewed without the document framing it.

Does anybody know of a fix for this?

# Answer
It seems that setting `cp_session_type` to `s` from `c` solved this issue for me.

If I get more time I'll investigate a bit deeper and leave more notes in the comments.
> 0 votes

---
Tags: file-uploads, file-manager, files
---


title: Playa upgrade error in EE 2.9

text:
# Question
Title: Playa upgrade error in EE 2.9
I've just upgraded to EE 2.9 and trying to update Playa to 4.5.

When I go to Fieldtypes -\> Playa I get this error:

> A Database Error Occurred Error Number: 1060
>
> Duplicate column name 'parent\_element\_id'
>
> ALTER TABLE exp\_playa\_relationships ADD parent\_element\_id VARCHAR(255) NULL AFTER parent\_var\_id
>
> Filename: third\_party/playa/ft.playa.php
>
> Line Number: 488

The previous version I had installed was 4.4.5 - I've tried setting it to 4.4.4 in exp\_fieldtypes as well but same error.

# Answer
For some reason sometime the update is applied but EE does not change the version number. I'm not even sure on which side the error happens, but setting the version number to 4.5 in exp\_fieldtypes should solve your problem.
> 12 votes

---
Tags: playa
---


title: Sql query to pull list of channels

text:
# Question
Title: Sql query to pull list of channels
I know this is a simple answer, but I can't remember the exact way to write an SQL query to use in a custom field for displaying a list of channels currently on the site. A Google search on the topic wasn't much help. Thank you!

(I am using Query Field to create a dropdown list of channel names, if that changes anything.)

# Answer
If the site\_id is 1:

```
SELECT channel_id, channel_name
FROM exp_channels
WHERE site_id = 1;

```

Getting the `channel_id` and ht e `channel_name`.
> 1 votes

# Answer
Not exactly a direct answer to your question, but I have created a fieldtype that allows you to select channels. https://github.com/rsanchez/channel\_select

Might be of use to you.
> 0 votes

---
Tags: channel, query, sql
---


# Question
Title: How to stop external site redirect hijacking?
We are recently seeing a number of external sites trying to leverage the core of EE to use our site to force referrals that look like they are coming from our domain. My assumption is they are trying this to juice up their referrals for search engine rankings. What they do is hit our site with URLs like:

http://www.macobserver.com/tmo/?URL=http%3A%2F%2Fexpressionengine.stackexchange.com%2F

This then redirects from our site to that external site. In doing some digging this is something built into the EE Core:

`/system/expressionengine/libraries/Redirect.php`

There is a check that stops the links from auto-redirecting with an interstitial page, but that is only a small bit of protection.

```
if ($force_redirect == TRUE OR ( ! isset($_SERVER['HTTP_REFERER']) OR !     stristr($_SERVER['HTTP_REFERER'], $host)))
{
    // Possibly not from our site, so we give the user the option
    // Of clicking the link or not

$str = "<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n<title>Redirect</title>\n</head>\n<body>".
        "<p>To proceed to the URL you have requested, click the link below:</p>".
        "<p><a href='".$_GET['URL']."'>".$_GET['URL']."</a></p>\n</body>\n</html>";
}

```

Is there a way to better prevent this kind of "referrer-jacking"?

# Answer
> 2 votes
I know it'd be hacking core, but wouldn't throwing a `rel="nofollow"` attribute on the anchor negate the effectiveness of this?

# Answer
> 4 votes
According to the bug reported by Mark Drzycimski, for those who don't have an Ellislab account, the solution is listed as follows:

In /system/expressionengine/libraries/Redirect.php on line 50, change:

`"<p><a href='".$_GET['URL']."'>".$_GET['URL']."</a></p>\n</body>\n</html>";`

to:

`"<p><a href='".$_GET['URL']."' rel='nofollow'>".$_GET['URL']."</a></p>\n</body>\n</html>";`

# Answer
> 0 votes
I can see two alternatives to this:

1. Disable external linking. This would break various things like addon doc links in the control panel.
2. Die rather than provide the external link when referrer != host. This is a much safer solution, but relies on your server providing valid referrer strings. Refreshing a redirected link that times out may also fail.

For **solution #1** below line 39 which starts with:

```
$host =

```

add:

```
if ( ! isset($_SERVER['HTTP_REFERER']) OR ! stristr($_SERVER['HTTP_REFERER'], $host))
{
    die();
}

```

And for **solution #2** below line 43 which starts

```
if ($force_redirect

```

add:

```
die();

```

In either case you could redirect to your homepage instead of just using die.

**Edit:** And as mentioned elsewhere the same idea can be accomplished via htaccess. The only real solution lies in an EE internal whitelist that automatically tracks valid external links. For example every time an addon is added any external URLs are added to the whitelist.

# Answer
> 0 votes
```
<p><a href='".$_GET['URL']."' rel='nofollow'>".$_GET['URL']."</a>

```

Leeds to XSS vulnerability. Change to something like :

```
<a href='".htmlspecialchars($_GET['URL'])."' rel='nofollow'>".htmlspecialchars($_GET['URL'])."</a>

```

---
Tags: redirects, security, core, redirection
---


title: Playa within a Grid field

text:
# Question
Title: Playa within a Grid field
I've just installed Playa 4.5 to try and get around an edge case I'm having with searching and EE's native relationship fields. I basically need to have a single relationship dropdown in a grid field (again, EE native). The problem is there doesn't seem to be an option to add a Playa field into grid. Is this possible, or do I also have to buy Matrix? (It feels slightly unfair if I do!)

Thanks!

# Answer
> 0 votes
As of right now (25 July 2014), you can not have playa in an ExpressionEngine grid field. So order to use playa, you will have to use matrix.

As for your edge case, maybe you could post another question and we could try and help you with the searching issue you are having.

# Answer
> -3 votes
Can you tell us what version of EE you're using? If you're using a version that has native Relationships, you should use those instead of playa.

If you're using one without native Relationships, you should use Matrix instead of Grid.

---
Tags: playa, pixelandtonic, grid
---


# Question
Title: Checking for custom field with conditional inside of an embed template
I've decided to just test an idea for custom meta tags on every page without using Low Variable and try a native approach. The idea is to use an embed template with embed variables to check if a custom field is entered and if not use the global site meta description.

The embed template is:

```
{exp:channel:entries channel="{embed:channel_name}" dynamic="yes" disable="members|categories|pagination"}
    {if embed:meta_tag}
         {{embed:meta_tag}}
            {if no_results}
            blah
            {/if}

    {if:else}
          Nothing entered
    {/if}
    {if embed:meta_tag != ""}
         {{embed:meta_tag}}
            {if no_results}
            blah
            {/if}
    {/if}
    {if embed:meta_tag == ""}
          {gv_meta_desc}
    {/if}
 {/exp:channel:entries}

```

I then pass the embed template into my templates as

```
 {embed="embeds/template_file" channel_name="channel_name" meta_tag="meta_description"}

```

If the meta\_description is entered, content will show. If not nothing will show. I cannot see an error or anything that would cause this to occur.

# Answer
Your code works ok in EE 2.9 but versions below this, this should work:

```
{exp:channel:entries channel="{embed:channel}" dynamic="yes"}
   {if "{{embed:meta_tag}}" }
       {{embed:meta_tag}}
            {if no_results}
            blah
            {/if}
   {if:else}
       Nothing entered
   {/if}
   {if "{{embed:meta_tag}}" != ""}
       {{embed:meta_tag}}
       {if no_results}
               blah
        {/if}
   {/if}
   {if "{{embed:meta_tag}}" == ""}
       {gv_meta_desc}
   {/if}
{/exp:channel:entries}

```

In expressionengine 2.9, they rewrote the conditional parser, so in order to achieve this kind of effect in older versions, you need to double wrap all your embed var tags for conditionals.

Your first conditional was being rendered like:

```
   {if } {!-- blank if! --}
       {{embed:meta_tag}}
            {if no_results}
            blah
            {/if}
   {if:else}
       Nothing entered
   {/if}

```

You were passing in a blank variable, which I think was breaking the template. (See first response in this thread)
> 1 votes

---
Tags: conditionals, low-variables, embeds
---


# Question
Title: Solspace Importer - Merge two fields in one
is it possible to merge two text fields from an XML-Feed into one text field in expressionengine in Solspace's Importer?

Regards

# Answer
> 1 votes
Unfortunately that's not possible. You would need to combine those fields in your XML beforehand, i.e. before importing into your custom text field using Importer.

---
Tags: solspace-importer
---


title: Loop month and year in select options

text:
# Question
Title: Loop month and year in select options
I have found a couple of loop plugins but I cant quite figure out how to get what I'm looking for.

I would like to have a select dropdown in my template that looks like this:

```
October   2014
November  2014
December  2014
January   2015
February  2015

```

How would I accomplish this?

# Answer
You could try combining the DT Plugin with the Loop Plugin.

This is what your code would look like:

```
<select id="expiry1">
  {exp:for_loop start="0" end="12" increment="1" parse="inward"}
    <option value="{exp:dt format='%U' month='{index}'}">
      {exp:dt format='%M %Y' month='{index}'}
    </option>
  {/exp:for_loop}
</select>

```

**To explain how this works:**

The `start=` and `end=` parameters allow us to sequentially loop from a start-end iteration.

We've set the loop to start from `0` which means the first iteration will be`month="0"`. This comes in handy as the DT Plugin (or most plugins for that matter) disregard zero-value parameters and therefore evaluates it as if the `month` parameter were not even provided.

> **Note:** We are also providing the `parse="inward"` parameter to the outer plugin to allow the `{index}` variable to parse before DT Plugin accepts it as a parameter!

Hope this helps!
> 0 votes

# Answer
I created use the plugin stringy for a lot of things and I added this function to it today because I needed the same thing. This could probably be trimmed down but it works. You can pass in the selected date in the selected parameter, I just pass in a specific segment. If not selected parameter is passed in it uses the current year and month as the selected date. You might have to change the date formatting to meet yours needs. This by the way ONLY outputs the option tags, you need to put this inside the tag.

Here is the code.

```
public function month_select()
{
    $sel_date = $this->EE->TMPL->fetch_param('selected');

    if ($sel_date == "") {
        $sel_date = date("Y-m-d");
    }

    $ret = "";
    $date = date('Y-m-d');
    $month = date("n", strtotime($date));
    $year = date('Y');

    for ($cm=0; $cm<12; $cm++) {
        $is_sel = false;
        $sel_str = "";

        $tm = ($month + $cm);
        $ty = $year;

        if ($tm > 12) {
            $tm = $tm - 12;
            $ty = $year + 1;
        }

        $ds = date("F Y", strtotime($ty . "/" . $tm . "/1"));

        if ($ty == date("Y", strtotime($sel_date)) && $tm == date("n", strtotime($sel_date))) {
            $is_sel = true;
            $sel_str = 'selected="selected"';
        }

        $ret .= '<option value="' . $ty . '-' . $tm . '" ' . $sel_str . '>' . $ds . '</option>';
    }

    return $ret;
}

```
> 0 votes

# Answer
Thanks a lot Trevor Orr! I have managed to accomplish what I wanted to do with a plugin called DT (http://viminteractive.com/software/dt\_plugin).

Because I only needed a couple of loop itirations I hardcoded the select options and offsetted the dates like this:

```
<select id="expiry1">
     <option value="{exp:dt format='%U'}">{exp:dt format='%M %Y'}</option>
     <option value="{exp:dt format='%U' month='1'}">{exp:dt format='%M %Y' month='1'}</option>
     <option value="{exp:dt format='%U' month='2'}">{exp:dt format='%M %Y' month='2'}</option>
     <option value="{exp:dt format='%U' month='3'}">{exp:dt format='%M %Y' month='3'}</option>
     <option value="{exp:dt format='%U' month='4'}">{exp:dt format='%M %Y' month='4'}</option>
     <option value="{exp:dt format='%U' month='5'}">{exp:dt format='%M %Y' month='5'}</option>
     <option value="{exp:dt format='%U' month='6'}">{exp:dt format='%M %Y' month='6'}</option>
     <option value="{exp:dt format='%U' month='7'}">{exp:dt format='%M %Y' month='7'}</option>
     <option value="{exp:dt format='%U' month='8'}">{exp:dt format='%M %Y' month='8'}</option>
     <option value="{exp:dt format='%U' month='9'}">{exp:dt format='%M %Y' month='9'}</option>
     <option value="{exp:dt format='%U' month='10'}">{exp:dt format='%M %Y' month='10'}</option>
     <option value="{exp:dt format='%U' month='11'}">{exp:dt format='%M %Y' month='11'}</option>
     <option value="{exp:dt format='%U' month='12'}">{exp:dt format='%M %Y' month='12'}</option>
</select>

```

The first option is always the current month and year and for the following 12 months 1 month is added to the current. It would be nice to be able to make this an actual loop.
> 0 votes

---
Tags: loop
---


title: MSM & Master Config

text:
# Question
Title: MSM & Master Config
I'm trying to set up two sites in EE with MSM & Master Config. But I'm failing. Feels like I'm really close but can't get over the last hurdle.

I've used this suggested method but it's not quite there.

Here are how the domains are set up (simplified):

```
/home/
    /site1
        /html
            /assets
                /third-party
                    /add-ons
                    /themes
                /tpl
            /config
            /system
            /themes
            /admin.php
            /index.php
    /site2
        /html
            /admin.php
            /index.php

```

Site1 is working fine as far as I can tell. No issues in the CP and the home page shows up fine (just has static HTML at the moment).

Site2 is another story:

* I don't yet have templates set up for Site2 so the home page is just showing blank (expected)
* Going to `site2.dev/admin.php` shows the login page but it is unstyled, which tells me it's not finding the themes folder correctly. (Same if I log in.)
* If I'm logged into the CP via site1 and attempt to switch to site2, I get this error: `Fatal error: Call to undefined method Cp::switch_site() in /path/to/home/site1/html/system/expressionengine/controllers/cp/sites.php on line 57` **Update:** This issue was due to having MSM be newer & not compatible with the EE version I had. Upgraded EE and no more error.

I've tried suggestion's from Jason Varga's article on this to no avail (particularly the section from "Not so fast" on, though I've tried the whole thing and that went worse).

And here's what I have in the Dynamic path settings section inside `config.master.php`:

```
$protocol                          = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url                          = $protocol . $_SERVER['HTTP_HOST'];
$base_path                         = FLC_DOCROOT;
$system_folder                     = APPPATH . '../';
$images_folder                     = 'assets/img-ee';
$images_path                       = $base_path . '/' . $images_folder;
$images_url                        = $base_url . '/' . $images_folder;

$env_config['index_page']          = '';
$env_config['site_index']          = '';
$env_config['base_url']            = $base_url . '/';
$env_config['site_url']            = $env_config['base_url'];
$env_config['cp_url']              = $env_config['base_url'] . 'admin.php';
$env_config['theme_folder_path']   = $base_path   . '/themes/';
$env_config['theme_folder_url']    = $base_url    . '/themes/';
$env_config['emoticon_path']       = $images_url  . '/smileys/';
$env_config['emoticon_url']        = $images_url  . '/smileys/';
$env_config['captcha_path']        = $images_path . '/captchas/';
$env_config['captcha_url']         = $images_url  . '/captchas/';
$env_config['avatar_path']         = $images_path . '/avatars/';
$env_config['avatar_url']          = $images_url  . '/avatars/';
$env_config['photo_path']          = $images_path . '/member_photos/';
$env_config['photo_url']           = $images_url  . '/member_photos/';
$env_config['sig_img_path']        = $images_path . '/signature_attachments/';
$env_config['sig_img_url']         = $images_url  . '/signature_attachments/';
$env_config['prv_msg_upload_path'] = $images_path . '/pm_attachments/';
$env_config['third_party_path']    = $base_path . '/assets/third-party/addons/';
$env_config['url_third_themes']    = $base_url . '/assets/third-party/themes/';
$env_config['path_third_themes']   = $base_path . '/assets/third-party/themes/';

```

Lastly, as far as add-ons go, most of third-party ones *seem* to work, but I haven't tested all of them.

So, my hunch is that something needs to change in regard to the 3rd party paths to get them to work properly and to get themes to work properly. Just not sure what. And I've no idea how to get the site switch function working in the CP to seamlessly switch from site1 to site2 and vice versa.

Any thoughts / suggestions?

# Answer
The themes directory is usually the one challenge for the MSM and Master Config combo. There are some options, each with its own unique workaround, so you just have to choose which method seems the least cumbersome/annoying. Here are two options based on a similar directory structure.

---

Directory setup

/config
/system
/codeignitor
/expressionengine
/site1.com
/admin #login to CP
/index.php #This is the only file in this directory
/themes
/site2.com
/admin #login to CP
/index.php #This is the only file in this directory
/themes

**NOTE: I copy the same exact themes folder for each site. This is the annoying piece I choose to live with because I have a weird thing about cross-domain linking. You just have to be careful with EE and add-on updates.**

An alternative is to set a value in your config so the secondary sites know the default site's URL and path, then link to the theme files on that domain. This is what Jason Varga is doing in the "not so fast" section of link you posted. But there's an easier way, in my option. For each environment's config file, add in these four config values for that environment's URL.

config.local.php

```
$env_config['site1_url']        = 'http://www.site1.local';
$env_config['site1_path']       = '/local/path/to/site1.com';
$env_config['theme_folder_url']     = $env_config['site1_url'] . '/themes/';
$env_config['theme_folder_path']    = $env_config['site1_path'] . '/themes/';

```

config.dev.php

```
$env_config['site1_url']        = 'http://www.site1.dev';
$env_config['site1_path']       = '/dev/path/to/site1.com';
$env_config['theme_folder_url']     = $env_config['site1_url'] . '/themes/';
$env_config['theme_folder_path']    = $env_config['site1_path'] . '/themes/';

```

config.prod.php

```
$env_config['site1_url']        = 'http://www.site1.com';
$env_config['site1_path']       = '/prod/path/to/site1.com';
$env_config['theme_folder_url']     = $env_config['site1_url'] . '/themes/';
$env_config['theme_folder_path']    = $env_config['site1_path'] . '/themes/';

```

If you prefer this alternative method, then you only need the /themes directory in your default site.

---

For both /system/expressionengine/config/config.php and database.php you need to this:
`require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.master.php';`

---

/config/config.master.php contains...

```
/**
     * Dynamic path settings
     *
     * Make it easy to run the site in multiple environments and not have to switch up
     * path settings in the database after each migration
     * As inspired by Matt Weinberg: http://eeinsider.com/articles/multi-server-setup-for-ee-2/
     */
    $protocol                          = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
    $base_url                          = $protocol . $_SERVER['HTTP_HOST'];
    $base_path                         = $_SERVER['DOCUMENT_ROOT'];
    $system_folder                     = '../../system';
    $images_folder                     = 'assets/images';
    $images_path                       = $base_path . '/' . $images_folder;
    $images_url                        = $base_url . '/' . $images_folder;

    $env_config['multiple_sites_enabled']   = 'y';
    $env_config['index_page']          = '';
    $env_config['site_index']          = '';
    $env_config['base_url']            = $base_url . '/';
    $env_config['site_url']            = $env_config['base_url'];
    $env_config['cp_url']              = $env_config['base_url'] . 'admin/index.php';
    $env_config['theme_folder_path']   = $base_path   . '/themes/';
    $env_config['theme_folder_url']    = $base_url    . '/themes/';

```

---

For both sites, the /index.php, /admin.php, and /admin/index.php files share these settings, with the `site_name` being the only difference.

```
    $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
    $base_url = $protocol . $_SERVER['HTTP_HOST'] . "";
    $assign_to_config['site_name']  = 'site1'; // MSM only
    $assign_to_config['cp_url'] = $base_url . '/admin/index.php'; // masked CP access only

```

---

Finally, define the `$system_path` in each of those three files for all your sites.

/index.php and /admin.php
`$system_path = '../system';`

/admin/index.php
`$system_path = "../../system/";`
> 1 votes

# Answer
Give this a try: https://github.com/kgrote/msm\_master\_config

I've been using it on a pretty complex MSM site for a while now with no issues.
> 1 votes

---
Tags: multi-site-manager, focus-lab-master-config
---


# Question
Title: How to pre-select option value when option text differs from the value
I have a form with a select drop-down for country codes, and with option text that displays the full country name, like so:

```
<select name="country_code">
  <option value="AUS">Australia</option>
  <option value="CAN">Canada</option>
  <option value="GBR">United Kingdom</option>
</select>

```

After a user has chosen their country and stored the country\_code data into an expressionengine field, how can I pre-select their country code and associate the full country name afterwards when they want to edit their country in the future? For example, something like this:

```
<select name="country_code">
  <option selected value="{country_code}"><!-- full country name here --></option>
  <option value="AUS">Australia</option>
  <option value="CAN">Canada</option>
  <option value="GBR">United Kingdom</option>
</select>

```

# Answer
> 1 votes
Why not save your user the trouble and list all countries? You could use an 3rd party plugin: Reegion-Select, devot-ee.com/add-ons/reegion-select.

# Answer
> 2 votes
I'm assuming you have "AUS" saved in the members profile, you could use this conditional:

```
<select name="country_code">
  <option value="AUS"{if country_code == "AUS"} selected{/if}>Australia</option>
  <option value="CAN"{if country_code == "CAN"} selected{/if}>Canada</option>
  <option value="GBR"{if country_code == "GBR"} selected{/if}>United Kingdom</option>
</select>

```

**Disclaimer:** I'm basing this on your example where you only have a few countries!!

---
Tags: forms
---


# Question
Title: After upgrading to EE 2.9.0 my front-end login page no longer works
Everything else works. And I can login through the back end. But when I submit the login form I get a blank page and am not logged in.

I replaced my login page with the example code on the Expression Engine Member Management page - http://www.ellislab.com/expressionengine/user-guide/add-ons/member/index.html#login-form-tag but got the same result.

Does anyone have any ideas on what might be the cause, or how I can go about identifying it?

I tried uninstalling various member related addons such as User, Twomile Login Redirect and Authenticate, but that hasn't helped.

# Answer
> 1 votes
I had similar issues. It got a bit confusing as session timeouts etc. seem to come in to play, so things I did seemed to work then it stopped working etc. as I experimented with different combinations.

In the end, things I did that solved it:

I changed the front end session type to cookie, and explicitly added the XID hash to all my login forms (actually ALL forms), e.g.

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

Also, and this was important I think, I cleared exp\_sessions of old sessions data (will log you out obviously). It would have been easier to work out the issues if I had done this after each change.

And in my config, I changed back from secure cookies only, set my cookie domain, and made sure the cookie gets expired on browser close (this is with focuslab llc so adapt if you're not using that).

```
+$env_config['cookie_secure']                         = 'n';
+$env_config['cookie_domain']                        = "mydomain.net";
+$env_config['expire_session_on_browser_close']      = 'y';

```

As far as I can tell, these changes are to do with 2.8.1 and secure forms changes, i.e. secure forms are on by default. But it's all a bit unclear and maybe someone more informed can give a better reason as to the whys of it all - but this got it all working again (both front and back ends)

Hope this gets you going!!

---
Tags: members, login
---


# Question
Title: With new Routing capabilities in EE 2.8 - Trying to figure out the best solution
I'll start with an example.

An image with an embedded watermark URL `example.com/1203020202`, in the lower right-hand corner in small text will serve as a redirect to the original URL. So when a user visits `example.com/1203020202`, they will be redirected to the original URL if it still exists i.e. `example.com/something/this-is-the-image-page`. This is so when images are sent via email or shared, found on google images, it serves as a URL shortener and 301 redirects the user to the original source.

EE 2.8 has the new template routing. I'm wondering if it would be better to write an module/extension hook that would do the routing before template parsing. I speculate that this will require more work, but not sure if it's worth it in the end. Does the entry exist, is the status open or closed? etc, etc.

Another option is to use the EE 2.8 routing with a template that would find the entry\_id and perform the redirect if `{segment:id}` is found.

One thing that scares me about the EE2.8 routing is that seems limited by priority, and correct me if I'm wrong, there is no way to set priority with routing. **Edit, as of EE2.9 you can set template routing priorities**

I'm thinking of speed overall, and if it can be done before the template parser begins, it's faster, less code, that would be cool.

Any ideas?

# Answer
> 4 votes
I can think of two ways to do this. One is to use Resource Router. Your config would look something like this:

```
$config['resource_router'] = array(
  ':num' => function($router, $wildcard) {
    $query = ee()->db->select('url_title')
      ->where('entry_id', $wildcard->value)
      ->where('channel_id', 1) // use the right channel id here
      ->get('channel_titles');

    $url_title = $query->row('url_title');

    $query->free_result();

    if ($url_title)
    {
      $router->redirect('your/template/'.$url_title);
    }
    else
    {
      $router->set404();
    }
  },
);

```

The other is to do the same basic logic in an extension using the `core_template_route` hook:

```
function core_template_route($uri_string) {
  $query = ee()->db->select('url_title')
    ->where('entry_id', ee()->uri->segment(1))
    ->where('channel_id', 1) // use the right channel id here
    ->get('channel_titles');

  $url_title = $query->row('url_title');

  $query->free_result();

  if ($url_title)
  {
    ee()->functions->redirect(ee()->functions->create_url('your/template/'.$url_title));
  }
);

```

---
Tags: ee2, module, extension, routing
---


# Question
Title: Matrix display_cell() encoding entities when returning json string
I've come across an issue where I've got a celltype which contains array data stored as a JSON string.

When I json\_encode the array and return it on save\_cell(), display\_cell() then returns the JSON quote wrappers as entities?

What I expect:

```
[{"first_name":"Garret","last_name":"Winder"},{"first_name":"Jeff","last_name":"Claeson"},{"first_name":"Paul","last_name":"Burton"}]

```

What I get:

```
[{"first_name":"Garret","last_name":"Winder"},{"first_name":"Jeff","last_name":"Claeson"},{"first_name":"Paul","last_name":"Burton"}]

```

Is there any way I can disable this in Matrix? Presumably if I set the column formatting to 'none' somehow in the cell settings it'll resolve it - I couldn't see how to do that in the docs?

For now I'm just finding and replacing the " entities before decoding...

Thanks Iain

# Answer
The issue here seems to be that in Matrix 2.3 `form_prep` is called during the display\_cell method:

```
Cell data is now run through form_prep(), just like normal field data

```

If you're outputting the input with `form_textarea` or `form_input` that also calls `form_prep()` leading to the double encoding.
> 1 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: Conditional errors after upgrading to EE 2.9 (just a helpful hand)
The upgrade we did last night from 2.8.1. to 2.9 seemed OK. However we only tested the back-end so far!

While running the front-end we're getting these errors messages on all pages…

> Error
>
> You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
>
> Lexer State: if: is a reserved prefix.

Of course we're focussed on finding incorrect conditional errors and couldn't find any! Checked 50+ templates. Close to giving up we found the issues caused by a missing } in a script in our HTML footer…..

# Answer
Yes the syntax seems more strictly enforced...I've found a number of missing } and / in my code, even an entirely missing {/if}. I just remove big chunks from my template to quickly narrow it down to smaller areas...it's usually not hard from there.

(move to answer as per Robson)
> 1 votes

# Answer
I also found this case:

```
{exp:channel:entries channel="resources" status="open" url_title="{last_segment}" limit="1" disable="member_data|trackbacks|pagination" track_views="one"}
{exp:ifelse parse="inward"}
     {if xxx}

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

```

did not work, but

```
{exp:channel:entries channel="resources" status="open" url_title="{last_segment}" limit="1" disable="member_data|trackbacks|pagination" track_views="one"}
{exp:ifelse parse="inward"}

     {if xxx}

     {/if}

{/exp:ifelse}
{/exp:channel:entries}

```

did. Note the order of the channel entries tag and the closing IfElse tag in relation to the opening tags.
> 0 votes

---
Tags: ee2, ee2-upgrades
---


# Question
Title: Pass segments to variables in exp channel entry
I have the following structure:

A link - a href="/year/1991"\> 1991 /a

And inside the YEAR template is this: {exp:channel:entries channel="channel" limit="10" search:year\_event\_field="=1991"} {title}

If I go to /year, it shows me the entries.

If I go to /year/1991 it doesn't it is showing me a blank page.

Why ?

# Answer
Because if you have a four digits segment, EECMS will try to filter the entries by the year of their creation.

Try to set the `dynamic` parameter to `no`.
> 1 votes

---
Tags: channel-entries, entries, segments, url-title
---


# Question
Title: How do I add an entry to a category progammatically in an add-on?
I have a site that uses ChannelForms for users to add entries to a channel. These entries need to be categorised, but I can't rely on users to pick the right category as this depends on data they enter in other fields in the form, which isn't known until the form is submitted.

How can I set the category programmatically according to known rules using an add-on on the ChannelForm return page in the same way that yo\_status\_tools does for entry statuses?

# Answer
The way ExpressionEngine handle's categories is in the exp\_category\_posts table. In order to assign an entry to a category, simply insert the new entry id into the entry\_id column and the associated category id in the cat\_id table.

Here is an example of my category\_post table
> 1 votes

---
Tags: add-on-development, categories
---


# Question
Title: Is still necessary using the Add-on Ifelse from Mark Croxton with EE2.9?
In the new EE version (2.9), the conditionals evaluate when ready, so the performances are boosted.

Is still necessary using the IfElse Add-on from Mark Croxton, when using EE conditional?

# Answer
It depends.

If you aren't using variables on conditional outside the default order, you can remove ifElse.

For example, ifElse parses early variables like `member_id` and `group_id`.

Take some time to look at the parsing order and see if you need to change it in some way.
> 2 votes

---
Tags: conditionals, ifelse
---


# Question
Title: Help me locate where is XML being generated
my client is using **Expression Engine 1.6.8** and there are some broken XML documents created with page. I have no experience with Expression Engine. The problem is these dinamic XML is being generated - so others pages can use it as source.

**The problem:** I have no idea where this XML is being generated.

This is very broad question but : Where is this XML being generated and how can I fix it? Where to check? What is usual practice?

Thank you,

# Answer
All pages are generated by templates. Take a look at the templates section of control panel.
> 1 votes

---
Tags: xml
---


# Question
Title: After migrating our website to a new server we are getting an error when trying to access Cartthrob
After migrating our website to a new server we are getting an error when trying to access Cartthrob.

Fatal error: Call to undefined method Cp::set\_variable() in /home/smctorg/public\_html/dev.rdrneducation.com/system/expressionengine/third\_party/cartthrob/mcp.cartthrob.php on line 215

# Answer
> 2 votes
If you upgraded EE to 2.8.1, you will need to upgrade CartThrob to 2.6. 2.6 was the first version of CartThrob tested with EE 2.8 See CartThrob changelog

You shouldn't need to uninstall cartthrob for any reason, a straight upgrade will be fine, although your jumping quite a few versions so extensive testing will be required.

---
Tags: cartthrob, php-errors
---


# Question
Title: Expresso Store: remove item in cart with 'x' button
How would I go about removing an item in the cart through the use of a little x button? This would not be in a exp:store:checkout tag.

Rather, the cart would display along side the store itself with a current listing of all items. It would have a 'checkout' button, which then leads to a check out page, but also a little 'x' on the far right of each entry in the cart to allow the user to remove an item with a single click.

Is this feasible in Expresso Store?

Here is the code of my \_cart include.

```
        <div class="cart">
          <div class="cartheader">
            <div class="carticon">
              <img src="{images}/cartIcon.jpg" alt="539b2a50de9f60d2677627c3_cartIcon.jpg">
            </div>
            <p class="carttext">Cart</p>
          </div>
          <div class="cartitemdiv">
          {exp:store:cart}
            {if no_items}
            <div class="w-clearfix cartentry">
             <p>Your cart is empty!</p>
            </div>
            {/if}

            {items}
            {exp:channel:entries channel="store" entry_id="{entry_id}" limit="1" status="open|outlet center"}
            <div class="w-clearfix cartentry">
              <img class="cartitemimage" src="{product_image_thumbnail}" alt="{title}">
              <div class="cartitemtext">{!-- {exp:gwcode_categories entry_id="{entry_id}" excl_cat_id="27|2|38|40|43|37|28|30|29|31|36|34|32|35|33|3" style="linear"}{cat_name}{/exp:gwcode_categories} – --} {product_color}</div>
              <a class="w-inline-block cartitemdelete" href="#">
                <img src="{images}/delete.png" alt="539f0abea2b67b211347a277_delete.png">
              </a>
            </div>
            {/exp:channel:entries}
            {/items}

            <div class="w-clearfix checkoutdiv">
              <div class="checkoutbuttondiv"><a class="button btn btn-success pull-right" href="/checkout/">checkout</a>
              </div>
            </div>
            {/exp:store:cart}
          </div>

```

# Answer
You would need to use the `{exp:store:checkout}` tag pair even if it is not part of your actual checkout process as the `{exp:store:cart}` tag doe not create a form. Once you switch your tags you will need to use the `remove_items` syntax (docs link).

Something along the lines of:

```
{items}
  {title} - <input type="checkbox" name="remove_items[{key}]" value="1" />
{/items}

```

or

```
{items}
  {title} -  <input type="submit" name="remove_items[{key}]" value="X" />
{/items}

```
> 1 votes

---
Tags: expresso-store, shopping-cart
---


# Question
Title: Calling min_order_qty on each product modifier option
I am creating a product info page, where you can select a product modifier (e.g. size, flavor), I have an issue.

First of all, according the Expresso-Store docs:

**min\_order\_qty**

> The minimum order quantity for the product. If the product has more than one SKU, this will be the maximum of all minimum order quantities. If the product does not have any minimum order quantity, this will return 1. Useful for pre-populating the item\_qty field:

Found that it actually returns the minimum of all min order quantities.

Changed the Product.php file on line 132 from:

```
if ($item->min_order_qty < $min_order_qty) {

```

to...

```
if ($item->min_order_qty > $min_order_qty) {

```

That seemed to resolve the issue of not returning the maximum of minimum order quantities.

Lastly, the issue remains that I need to be able to retrieve the individual min\_order\_qty's for each modifier option so that I may, for instance, update the Quantity field in the document dynamically.

Since the fields allow you to map a minimum order quantity to each stock (SKU) variant, I expected to a method to retrieve each of these quantity values.

Attached is an image of an example product modifier options for context:

# Answer
This answer comes from Manuel over at DevDemon Support.

> Thank you for the follow up! And indeed the fix is correct, we already encountered this and it was fixed for Store 2.4.
>
> And for the minimum order qty inside the modifiers loop? Already possible, just not documented.

```
{modifier_options}
    {option_name} - Min Order Qty. {option_min_order_qty}
{/modifier_options}

```

Tested this and it does indeed work without a hitch.
> 1 votes

---
Tags: expresso-store, ee2, ecommerce
---


title: Last edited by tag?

text:
# Question
Title: Last edited by tag?
I have a report area on an EE site that shows specifics about entries in a channel, and was wondering if there was a way to show who edited that entry last? I am using the {edit\_date format="%m-%d-%Y} to get the date/time it was modified, but it would be nice to know which user modified the entry. We have numerous backend admins with various priv's to maintain things.

# Answer
EECMS just saves the IP of who edited an entry, not his or her `member_id`.

You can try the Audit add-ons:

* Audit Pro, which lets you archive logged data, set custom email notifications and search log entries;
* Audit Tags, which lets you output Audit’s logged data in your templates.

The add-on can be found on github as well.
> 2 votes

---
Tags: tags, entry, edit-date
---


# Question
Title: How to clear member accounts with no entries after 6 months
I had asked a similar question a while back: How to delete all member accounts with no channel entries

Need a slightly different twist.

I need to remove member accounts that have authored no channel entries AND were created 6 months ago or older.

I could use some help writing the date part of the query.

Thanks!

# Answer
> 1 votes
This should get you started:

```
SELECT
    member_id,
    username,
    join_date,
    now(),
    (UNIX_TIMESTAMP(now()) - (86400 * 30 * 6))
FROM
    exp_members
WHERE
    join_date < (UNIX_TIMESTAMP(now()) - (86400 * 30 * 6))

```

Returns members who have a join date older than 15552000 seconds (about 6 months).

---
Tags: members, database
---


# Question
Title: Can ExpressionEngine handle nested menus?
I'm creating a web store, and have set up nested categories to make the menu system (example):

```
Home:
  - Categories:
      * Living room
      * Bathroom
Computers:
  - Categories:
      * CPU
      * RAM
  - Ready-made computers:
      * Gamer Starter
      * Gamer Extreme

```

Because of the structure, a simple `ul>li+ul>li`-structure will not suffice. Is it possible to use custom HTML with this structure? This is what I've done so far, but it's messy and not quite working...

```
<ul>
    {exp:channel:categories channel="top_menu" style="linear"}
    {if parent_id == 0}
    <?php $parent_id = '{category_id}'; ?>
    <li>
        <a href="{path='store/category'}">{category_name}</a>
        <div class="big_menu">
            <div class="left">...</div>
            <div class="right">
    {/if}
            <div>
            {if {parent_id} == '<?php echo $parent_id; ?>'}
            <?php $parent_2_id = '{category_id}'; ?>
            <h2>{category_name}</h2>
            {/if}
            {if {parent_id} == '<?php echo $parent_2_id; ?>'}
            <a href="{path='store/category'}">{category_name}</a>
            {/if}
            </div>
            <!-- Will not work because this always happens before the preceding code... -->
            {if parent_id == 0}
            </div>
            </div>
        </div>
    </li>
    {/if}
    {/exp:channel:categories}
</ul>

```

# Answer
> 1 votes
I'm using GWcode Categories, http://devot-ee.com/add-ons/gwcode-categories, to create menu, list from the ExpressionEngine categories. It's working fine, powerful plugin, the doc is very good.

you can use too the category menu http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/#id27 :

{category\_menu} Categories {select\_options} {/category\_menu}

Or using the Query module: http://ellislab.com/expressionengine/user-guide/add-ons/query/

---
Tags: categories
---


title: Timeout error with Freeform

text:
# Question
Title: Timeout error with Freeform
I am new to Freeform and EE; we are using Freeform 3.1.5. I have following questions. Please advise. Thanks!

1. Is this version of Freeform support inline error message?
2. Our inquiry form allows users to upload multiple files. However, when users tried to upload files with large file sizes and timeout (so failed to save and submit the form), no error message is displayed and it will just redirect users to the thank you page that we specified on “return=”. Is there any way to display error message to users when timeout?

**Updates - Here is my template:**

```
{exp:freeform:form
    collection="Field Installation Report"
    notify="OUREMAIL@XXX.COM"
    required="customer_name|install_site|install_date"
    send_user_email="yes"
    template="field_report_template"
    user_email_template="user_field_report_template"
    file_upload="Field Service"
    allowed_file_types="jpg|pdf|zip"
    return="support/success"
}

<fieldset>
    <legend>Field Report</legend>
    <input type="hidden" name="subject" value="Field Report Submitted" />
    <input type="hidden" name="fir_user" id="fir_user" value="{name}" />
    <input type="hidden" name="form_entry_date" id="form_entry_date" value="{current_time format='%Y-%m-%d'}"/>

    <p><label for="customer_name">Customer Name<span class="required">*</span>:</label>
    <input type="text"  id="customer_name" name="customer_name" /></p>

    <!-- more fields.... -->

    <fieldset class="photo">
        <legend>Photos or Documentation</legend>
        <p><input type="file" name="file1"></p>
        <p><input type="file" name="file2" ></p>
        <p><input type="file" name="file3" ></p>
        <p><input type="file" name="file4" ></p>
        <p><input type="file" name="file5" ></p>
        <p><input type="file" name="file6" ></p>
    </fieldset>

    <p><label for="email">Email Confirmation To:</label>
    <input type="email"  id="email" name="email" value="{email}" /></p>
    <p><input class="submit" value="Submit Form" type="submit"></p>
</fieldset>
{/exp:freeform:form}

```

# Answer
> 1 votes
Freeform 3.1.5 is an old version that isn't supported anymore. We strongly recommend upgrading to Freeform 4.x. See the compatibility chart to make sure your version of EE is compatible with Freeform 4.x: http://www.solspace.com/software/compatibility

The following guide is also strongly recommended after upgrading to Freeform 4.x when coming from 3.x: http://www.solspace.com/docs/freeform/upgrade\_3.x-4.x/

> ***Very Important*: Please make a reliable backup of your database and files before upgrading. It's also recommended to run the upgrade on a test/development installation before doing this on a live site**. This way, if something goes wrong, you can revert to your current status.

As for your questions:

1. No. Inline error messages are only supported in Freeform Pro 4.x
2. This is difficult to answer without seeing your template code. Also, in general uploading large files requires PHP to be setup to accept large files and not timeout before. These settings are usually found in your `php.ini` file. Upgrading Freeform is still recommended, however. File upload handling is also different in Freeform 4.x. Once upgraded, you would need to show your template code if the issue persists.

---
Tags: solspace-freeform, solspace, file-uploads
---


# Question
Title: Updating a client's EE installation from 2.3.1 to 2.9
I have a client whose site was basically abandoned by the previous developer. I've managed to get ownership of the license transferred and was in the process of updating EE from 2.3.1 to 2.9.0. I followed the instructions to the letter and then logged into the control panel. The only difference was an alert that index.php had changed. Nothing else. How do I activate the update wizard? Is there something missing in the instructions?

# Answer
> 1 votes
Assuming you mean the instructions in the EE documentation then you need to ensure that the installer directory is within the system directory. Also ensure that the system directory hasn't been renamed.

The most important thing **Back up your database and files before starting**. It is very common for the update process to run into problems when going from a version as old as 2.3.1

You will also find that you may be better off going to 2.8 rather than 2.9. The latest version introduces some changes to the way conditionals work and if your site is complex it might be bit of a job to 'fix' any conditional logic in your templates.

---
Tags: update
---


title: EE slow on submit entry

text:
# Question
Title: EE slow on submit entry
I have recently starting having an issue in which the submit entry has begun to take between 10-20 secs to publish.This has happened over the last few weeks and Im no sure whats going on .Looking at it in firebug the post element seems to wait for the period of time before it completes. I recently upgraded to EE2.8.1 but this problem existed before and still happens now the upgrade is complete.

This seems to happen across all channels no matter what fields exist in them .I setup a test channel with a field set with just a text box but the same issue occurred so it doesn't seem to be a issue with an individual plugin.

Thanks for any help

Brian

# Answer
Just an update on this , it turned out it was related to the the search terms and seach log tables in my database. They had grown to over 300 MB between them and made up about half my database size. This information wasn't important for me so I truncated the tables turned off search logging in the settings. Everything works ok now with my save entries working as normal and my database is now a more manageable size.
> 0 votes

# Answer
I went ahead disabled all my extensions and the delay disappeared. I disabled them one by one and supersearch turned out to be the culprit.

Looks like there is an issue the the supersearch index which is causing the delay.It is with Solspace support at the moment so i will update with their solution
> 1 votes

# Answer
It's the same here.

I opened a Ticket in Solspace and the answer is:

> The slowdown could be caused by Super Search indexing the data during save so that it can be used in searches later.
>
> Also, are you using the "Channel Refresh" cache refreshing option in Super Search (in the CP, in the "Preferences" tab, under "Refresh Rules")? If so, you might want to consider using the "Refresh" option only by setting Super Search to refresh cache only at a set interval (eg. 10 minutes).
> 0 votes

---
Tags: control-panel
---


# Question
Title: Responsive functionality for Calendar, does it exist?
Has anyone integrated calendar into a responsive template?

# Answer
> 1 votes
Yes, just use the cal tag. If you click on view calendar events on this page, that is a Solspace calendar that is responsive. The cal tags allow you to do this easily, it's all just css.

---
Tags: calendar
---


title: Why won't Field Pack List 2.1.1 work?

text:
# Question
Title: Why won't Field Pack List 2.1.1 work?
I am using Field Pack 2.1.1 with EE 2.9.0.

All field types are working except the List field type. Are these compatible? Is there an alternative field type I could substitute with ease?

I have maybe 200 entires using this field type with 5-10 list items each so I am assume it would be painful to migrate away. Any help would be appreciated, Thanks!

# Answer
> 1 votes
Sorry for the lack of clarity, I have figured this out and will detail it in case someone makes the same mistake I made. I have been working with EE to long to make this type of mistake, but figured detailing may help others.

**What this looked like on my end:** The field type appear to install correctly, but when attempting to edit a page using this field type, I could not add or edit any of my list items.

**What I did wrong:** I accidentally uploaded the field type code to both `system/expressionengine/third_party` and `themes/third_party`. Obviously the module's theme code needs to go in the themes folder, but in a rush to update I accidentally made this incorrect upload.

**How I found the problem:** I went to an edit page containing the List field type and did an inspect element. Then noticed 404 errors saying that the field type's css and js couldn't be found. Since these were supposed to be located in the `themes/third_party` folder, checking this folder I found the incorrect folder had been uploaded.

**Solution:** (Which is very obvious at this point) Upload the modules theme folder to the server's `themes/third_party` folder

---
Tags: ee2, error, fieldtype, field-pack, list
---


title: Exp:resso Store - Paypal Pro hosted?

text:
# Question
Title: Exp:resso Store - Paypal Pro hosted?
I am using the fantastic Exp:resso Store. My client has an account with PayPal Pro. Their host hasn't got the option for SSL certs.

I'm just wondering if PayPal Pro can still be used on site? Or if I use the module can I divert it to the hosted version at PayPal?

Sorry for the simple question. Normally I would just try, but I have a meeting with the client and would like to know the answer before then.

Thanks

# Answer
> 2 votes
PayPal Pro is an on-site gateway therefore you must have an SSL certificate setup and installed on your site for the data to be transferred properly and for you to be PCI compliant. You can use the PayPal Express Gateway which is an off-site gateway.

Personally I think it is crazy that the host doesn't offer an SSL option and would recommend that you consider moving to a more modern host.

# Answer
> 0 votes
Paypal seems to have brought up a new way of integrating paypal pro see link: https://developer.paypal.com/webapps/developer/docs/classic/products/paypal-payments-pro/

Is this version supported by expresso store and if not are there any plans for future support? https://developer.paypal.com/webapps/developer/docs/classic/products/ppp-direct-payment/

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


# Question
Title: EE update 2.6 to 2.9 : during update cannot select language
I am trying to update from 2.6. to 2.9 and when asked to select the language the select menu is empty.

# Answer
> 0 votes
Did you copy the languages folders from your old to your new system/expressionengine/language folder?

Edit: to make this a more complete answer- The Expression Engine docs on languages http://ellislab.com/expressionengine/user-guide/general/languages.html

---
Tags: update, language
---


# Question
Title: is there documentation about how to move an EE2 web site?
I am about to change hosting, is there documentation about how to move an EE2 web site from one host to another?

# Answer
> 2 votes
If you do a google search for "expressionengine moving a site" the first link is the ExpressionEngine Documentation for doing so.

---
Tags: ee2
---


title: Render entry_id in URL from jquery

text:
# Question
Title: Render entry_id in URL from jquery
I've made a little script to be able to select entire rows in a table.

```
$(".clickableRow").on("click", function() {
    location.href="{path='leerlijnen/school/{entry_id}/#toevoegen'}";
});

```

However the href doesn't produce a valid URL: ../leerlijnen/school/{entry\_id/#toevoegen'} where I expected: ../leerlijnen/school/3964/#toevoegen.

Any glues?

# Answer
> 1 votes
Try

```
../leerlijnen/school/{entry_id}/#toevoegen

```

You may have to put it between channel tags to get it to parse.

---
Tags: url, jquery, table
---


title: Exp:resso store price based on login

text:
# Question
Title: Exp:resso store price based on login
I have a question about Exp:resso store. I need to develop a webshop where different prices are handeld per group member.

Each group has different pricelevels. For example a product has the following prices:

* Group consumer: 15,-
* Group business: 12,50
* Group retailers: 10,-

So I want to set fixed prices, not a discount percentage! Is this possible?

# Answer
This currently does not exist in Store at the product level. There is a considerable sales/discounts system that allows you to tie it to groups and items, but it is reverse from the way you are thinking.
> 1 votes

# Answer
You could do it outside the scope of expresso-store.

You would have to create three separate products which are identical in every way but price and then use Expressionengine's built in conditionals to display them based upon user group.
> 1 votes

---
Tags: expresso-store
---


title: Random search results

text:
# Question
Title: Random search results
We have an EE 2.7.2 installation with a search feature produces random results. Sometimes, a keyword that definitely exists on the site returns results when entered into the search box, but other times, it will produce a "no results found". Same keyword, same browser, different results.

Sometimes, if I search for the keyword four or five times, a result is eventually displayed. Other times, a keyword produces instant results from the first search. There's no rhyme or reason for the results.

Any ideas?

# Answer
Our resolution to this question was to switch to the Low Search add-on.

(http://gotolow.com/addons/low-search)
> 0 votes

# Answer
Did you check the Channel(s) Preferences CP\>Admin\>Channels (Administrative Preferences) which field is used for search excerpts? And have you checked if the fields are searchable in your custom fields? CP\>Admin\>Channel Fields
> 1 votes

---
Tags: ee2, search
---


title: Strange Error - After Upgrade to EE 2.9

text:
# Question
Title: Strange Error - After Upgrade to EE 2.9
Two days ago I upgraded a local dev site from 2.6x to 2.9. The local site is running via MAMP Pro, running PHP 5.5.10. I am also using the FocusLab master\_config file.

Before upgrading, I ran the server test to make sure things were ok, and they were. The upgrade itself (manual, not using DevDemon updater) went off without errors. I did have a few issues after upgrading, one related to an add-on and another was an error in one of my templates, but I was able to figure them out. Everything seemed to run ok (or so I thought).

The next morning, I was getting an error message try to access the site. "Unable to determine what should be displayed. A default route has not been specified in the routing file."

This happens on the front end or trying to get into the Control Panel. But I can serve up a static file (like robots.txt). I thought it might have something to do with the MAMP Pro install (I had to move the files to another location) so I set up on my Mac Air today. Same exact error. Other local sites still running 2.6x and 2.7x are running ok.

I have also added the following into my config.master file without any luck

$config\['uri\_protocol'\] = 'AUTO';

$config\['enable\_template\_routes'\] = 'n';

(I also tried PATH\_INFO, QUERY\_STRING, REQUEST\_URI, ORIG\_PATH\_INFO for uri\_protocol)

Anyone have any suggestions on things to check or try? Yes, downgrading to 2.7x is an option but I thought this might be something known or easy to fix.

# Answer
Check your config folder for integrity. For that specific error, specifically `/system/expressionengine/config/routes.php` should have `ee/index` specified as the `default_controller`. But if that file is incorrect, that's a sign that the other config files may be incorrect as well. If you see it there, check file permissions to make sure the config files are readable.
> 3 votes

---
Tags: 2.9
---


# Question
Title: Safercracker radio buttons – show chosen on refresh of page
Trying to show selected radio buttons (which assign entry to categories) on Safecracker page – updates entry okay ie assigns to right category but on refresh of Safecracker page all radio buttons are empty?

```
<fieldset>
<h3>Category you belong to</h3>
<p>Please choose ONLY 1</p>

{exp:channel:categories
  category_group="1"
  style="linear"
  channel="live"}
<input type="checkbox" name="category[]" value="{category_id}" />
<span class="sub-label">{category_name}</span>
{/exp:channel:categories}

```

Any pointers appreciated, thanks!

# Answer
I have an idea, but not sure how if it applies to a Safecracker form. Maybe set some POST variables in the refreshed url, and use Mo Variables to GET them. Then you can do some conditionals to check to see which fields need to be marked as selected. But like I said, this might not apply to Safecracker forms.
> 0 votes

# Answer
Thanks for that, this kinda does what I need (although now as a Select Menu)

{category\_menu} Categories {select\_options} {/category\_menu}

from: http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/
> 0 votes

---
Tags: safecracker
---


# Question
Title: Tax handling on Cart Throb price modifiers
I was wondering whether anyone could shed some light on how Cart Throb handles taxes on price modifiers? Are they tax inclusive or exclusive? We're about to launch and just spotted an anomaly in how taxes are handled.

We're charging a global tax rate (UK VAT @ 20%) on all products, and entering product prices ex VAT. Trying to set up a product with 3 options however suggests that taxes are either being ignored or incorrectly calculated. It could also be a combination of incorrect tags on my part :-)

The scenario is this:

* Base price: entered as £8 ex VAT
* Modifiers: entered as £0/£2/£7 - again, ex VAT.

I can use this code

```
{exp:cartthrob:item_options entry_id="{entry_id}"}
<div class="option">
  <label for="packsize">Options:</label>
    <div class="option-input">
      {select id="packsize"}
      <option {selected} value="{option_value}" data-price="{price:plus_tax}">{option_name}</option>
      {/select}
  </div>
</div>
{/exp:cartthrob:item_options}

```

and the `data-price` attribute shows the price uplift with tax included. This suggests the modified prices should be entered ex. VAT. When I add to the basket though, VAT is added to the base price only and not the uplift.

So a price with £8 base + £7 modifier only has tax on the £8 giving a total of £16.60 instead of £18. My cart field is using `{item_price:plus_tax}`.

Has anyone had experience with this?

# Answer
This is a bug in 2.6 that'll be fixed in a later release, thanks for Chris at CartThrob for sorting it out.

In the file third\_party/cartthrob/cartthrob/core/Cartthrob\_item.php on line 566, change:

```
$tax = $plugin->get_tax($this->base_price(), $this);

```

to:

```
$tax = $plugin->get_tax($cost, $this);

```

And your tax calculations will be correct.
> 3 votes

# Answer
Here's the answer I got posted directly into our site based on our help chat with Cart Throb. It's a *one page does it all* example, but well commented.

There's been no changes made to core (CT didn't have FTP access), and this was posted in after we closed the skype call, so I haven't had the chance to talk it through with them. I think the only change as far as I can tell is the option price field being `option_price` and not `price:plus_tax`.

The other difference I can see is that we were trying to output the tax applicable to each line item, whereas this example simply calculates a % amount, based on the rate set in the settings. So perhaps at a line item level, the calculation is incorrect, but at a cart level, it is correct. This seems a little inconsistent but must admit I haven't had an opportunity to test this fully in our environment.

```
{preload_replace:template_group="test"}
{preload_replace:template="tax-test"}
<html>
<head>
<title>Tax Test</title>
</head>
<body>

<h1>Single Page Store</h1>
<p>This single page is an example of how you can use one page to add, update, and delete items, as well as checkout.
    This is the most in depth single page sample

</p>

{!-- ORDER COMPLETE MESSAGES --}
{!-- the submitted_order_info tag outputs information from the last attempted order.
    Even if the customer leaves this page and returns, the information from the customer's
    last attempted purchase will be output.
     --}
{exp:cartthrob:submitted_order_info}
    <div class="store_block">
        {if authorized}
        {!-- This content displays if the purchase was successful--}
            Your transaction is complete!<br />
            Transaction ID: {transaction_id}<br />
            Your total: {cart_total}<br />
            Your order ID: {order_id}
        {!-- This content displays if the purchase is only partly completed--}
        {if:elseif processing}
            Your transaction is being processed!<br />
            Transaction ID: {transaction_id}<br />
            Your total: {cart_total}<br />
            Your order ID: {order_id}
        {if:elseif declined}
        {!-- This content displays if the purchase was declined--}
            Your credit card was declined: {error_message}
        {if:elseif failed}
        {!-- This content displays if the purchase completely fails--}
            Your payment failed: {error_message}
        {/if}
    </div>
{/exp:cartthrob:submitted_order_info}

{!-- ADD A PRODUCT --}
<div class="store_block">
<h2>Add Products</h2>
{!-- outputting products stored in one of the "products" channels.
    Product channels are no different than standard channels. --}
{exp:channel:entries channel="products" limit="10"}
    {!--
         The add_to_cart_form adds 1 or more of a product to the cart

        parameters
        return: the page the customer will be redirected to after adding this item to the cart
        entry_id: the product's entry_id
    --}

    {exp:cartthrob:add_to_cart_form
        entry_id="{entry_id}"
        return="{template_group}/{template}"}
        <p>
            Product name: {title} Price: {pm_base_price}<br />
            Quantity: <input type="text" name="quantity" size="5" value="" />
            <br />
            {exp:cartthrob:item_options entry_id="{entry_id}"}
            {if dynamic}
            <div class="control-group">
                <label class="control-label" for="{option_field}">{option_label}</label>
                <div class="controls">
                {input}
                </div>
            </div>
            {if:else}
               {if options_exist}
               <div class="control-group">
                  <label class="control-label" for="{option_field}">{option_label}</label>
                   <div class="controls">
                   {select class="input-medium"}
                      <option {selected} value="{option_value}">
                      {option_name}{if option_price_numeric != 0} +{option_price}{/if}
                      </option>
                   {/select}
                   </div>
               </div>
               {/if}
            {/if}
            {/exp:cartthrob:item_options}

            <input type="submit" value="Add to Cart">
        </p>
    {/exp:cartthrob:add_to_cart_form}
{/exp:channel:entries}
</div>

{!-- VIEW CART CONTENTS / UPDATE QUANTITIES --}
<div class="store_block">
<h2>Cart Contents</h2>

{!-- cart_items_info outputs information about your current cart, including products in the cart, weight, and prices.
    you can combine this with update_cart_form, to output cart item data, and update cart info
    --}
    {exp:cartthrob:cart_items_info}

        {if no_results}
            <p>There is nothing in your cart</p>
        {/if}
    {!-- outputting content that's only applicable for the first item. --}
    {if first_row}
        {!-- adding an update_cart_form to the first row. --}
        {!-- update_cart_form allows you to edit the information of one or more items in the cart at the same time
            as well as save customer information, and shipping options. --}
        {exp:cartthrob:update_cart_form
            return="{template_group}/{template}"}

        <h3>Customer Info</h3>
        {!-- customer_info outputs customer info that is current stored in session.
            update_cart_form, checkout_form, save_customer_info form and other forms
            can all save customer data.
             --}

        {exp:cartthrob:customer_info}
            First Name: <input type="text" name="first_name" value="{customer_first_name}" /><br />
            Last Name: <input type="text" name="last_name" value="{customer_last_name}" /><br />
            Email Address:  <input type="text" name="email_address" value="{customer_email_address}" /><br />
            State: <input type="text" name="state" value="{customer_state}" /><br />
            Country: <input type="text" name="country_code" value="{customer_country_code}" /><br />
            Zip: <input type="text" name="zip" value="{customer_zip}" /><br />
        {/exp:cartthrob:customer_info}
        <table>
            <thead>
                <tr>
                    <td>Item</td>
                    <td colspan="2">Quantity</td>
                </tr>
            </thead>
            <tbody>
            {/if}
            <tr>
                <td>{title}</td>
                <td>
                    {!-- you can reference products by entry_id and row_id. If you sell configurable
                        items (like t-shirts with multiple sizes) you should use row_id to edit and
                        delete items, otherwise, all items with that entry id
                        are affected, regardless of configuration --}
                    <input type="text" name="quantity[{row_id}]" size="2" value="{quantity}" />
                </td>
                <td>
                    {!-- This deletes one item (row_id) at a time--}
                    <input type="checkbox" name="delete[{row_id}]"> Delete this item
                </td>
            </tr>
            {if last_row}
            {!-- outputting content that's only applicable for the last item. --}
                <tr>
                    <td>
                        {!-- these are just some of the variables available within the cart_items_info tag --}
                        <p>
                            Subtotal: {cart_subtotal}<br />
                            Shipping: {cart_shipping}<br />
                            Tax: {cart_tax}<br />
                            {!--tax is updated based on user's location. To create a default tax price, set a default tax region in the backend --}
                            Shipping Option: {shipping_option}<br />
                            Tax Name: {cart_tax_name}<br />
                            Tax %: {cart_tax_rate}<br />
                            Discount: {cart_discount}<br />
                            <strong>Total: {cart_total}</strong>
                        </p>
                        <p>
                            {!-- total quantity of all items in cart --}
                            Total Items: {exp:cartthrob:total_items_count}<br />
                            {!-- total items in cart --}
                            Total Unique Items: {exp:cartthrob:unique_items_count}
                        </p>
                    </td>
                    <td colspan="2"> </td>
                </tr>
            </tbody>
        </table>
        <input type="submit" value="Update Cart" />
        {/exp:cartthrob:update_cart_form}
    {/if}
{/exp:cartthrob:cart_items_info}
</div>

</body>
</html>

```

It's also worth adding that they guys at Cart Throb are really helpful. The support sessions are paid and booked in advance, but a half-hour session means you can talk through your scenario with another developer who really understands the product.
> 0 votes

---
Tags: cartthrob, tax
---


# Question
Title: 1 include - 2 templates - 2 different results
I have an include / embed file that is being shared across two templates. However one template is displaying a result of the channel:entries tag in the embed whilst the other refuses to display a result.

I have tried updating the channel:entries tag and the second refuses to load content from any channel at all.

Below is the log information from template debugging:

Template 1:

https://www.dropbox.com/s/1g8dw1npd1ysge1/Screenshot%202014-07-29%2017.50.53.png

Template 2:

https://www.dropbox.com/s/29redguruvjy5am/Screenshot%202014-07-29%2017.50.01.png

# Answer
Since you're using the same embed on different templates, I guess their URLs are different from each other. The results of `exp:channel:entries` tags are influenced by the URL.

If you need to bypass this influence, set the `dynamic` parameter to `no`.
> 0 votes

---
Tags: channel-entries, embeds
---


# Question
Title: Freeform Multiselect populated by relationship field
I am using the latest version of Freeform and trying to populate a multi-select with a relationship field of entries. Here is the code, at the moment it is only outputting the first result and not looping properly. Has anyone tried this before and can therefore advise?

```
{related_documents_for_request}
            <select id="{selected_documents:title}" name="{selected_documents:title}" multiple="multiple">
                  {options}
                      <option value="{related_documents_for_request:selected_documents:title}"{selected}>{related_documents_for_request:selected_documents:title}</option>
                  {/options}
             </select>
{/related_documents_for_request}

```

# Answer
> 0 votes
Let's assume you have a Freeform custom field called `my_multi_select_field`. Let's also assume the fieldtype is a *textarea*, since it can contain multiple values, which in turn are saved as newline-separated data if the data comes in as an *array* (as would happen with a multi-select field).

Let's assume you're using the native EE relationship field, and that it's called `related_documents_for_request`. In that case, try this code:

```
<select name="my_multi_select_field" multiple="multiple">
   {related_documents_for_request}
   <option value="{related_documents_for_request:title}">{related_documents_for_request:title}</option>
   {/related_documents_for_request}
</select>

```

If your relationship field comes from a native EE Grid field which in turn contains a native EE Relationship column, then the above code would have to be tweaked, but the main point is that the opening and closing `<select>` element tags should be **outside** of the looping part of the code, and that the `<select>` element's `name=""` should be the name of your Freeform custom field.

---
Tags: solspace-freeform, relationships, grid, multiselect, options
---


# Question
Title: Using multiple search parameters on a Grid field
I am using search tag for express engine channel but it is not working.

for eg. I have created a channel named as 'XYZ' and having following channel fields there :

1) user\_type : text

2) profile : grid a) first\_name : text b) last\_name : text c) user\_name : text d) age : text

Now i want to show user listing for a entry which age is greater than 20 and less than 40. i have used following code :

```
{exp:channel:entries channel="xyz" entry_id=1}
    {profile search:age=">20" search:age="<40"}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
    {/profile}
{/exp:channel:entries}

```

But the code above does not give correct result.

Please help me what is missing/wrong here or give me a solution for the same.

# Answer
> 0 votes
Unfortunately you cannot use more than one search parameter per field.

Less than ideal, but you could do a conditional in addition to your search. It will throw you off if you want to use the `row_count` and `total_rows` variables though.

```
{profile search:age=">20"}
    {if age < 40}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
    {/if}
{/profile}

```

---
Tags: channel-entries, search, grid
---


title: convert EE relationships to Playa

text:
# Question
Title: convert EE relationships to Playa
I guess the opposite of this How to move all Playa relationship to EE relationships

previously developer used the relationships field that the client now wants to search over using Low Search. Obviously relationships just stores the entry id compared to Playa which also stores the entry title.

Is there a reverse method?

# Answer
> 5 votes
Always read the manual Steven!!! http://docs.pixelandtonic.com/playa/using/converting/relationships.html

---
Tags: playa, relationships, field-conversion
---


# Question
Title: Devdemon forms return url without ugly gray EE "thanks" page first
I have this:

```
{exp:forms:form
            form_name="contact"
            return="kontakt/takk"
            attr:class="form default contact"}

            {forms:fields}
                {forms:field}
            {/forms:fields}

            {forms:form_errors} {/forms:form_errors}

            <p class="denote center">Du hører fra oss innen 24 timer. <br><strong>Takk for at du vurderer oss!</strong></p>

        {/exp:forms:form}

```

And while i am returned to "kontakt/takk", that only happens after forms redirects to EEs ugly gray "thank you box". Is there a way to bypass that?

# Answer
> 2 votes
Realized i could go to user messages and add a meta refresh with 0 seconds

# Answer
> 2 votes
I like to use Custom System Messages to avoid the EE default pages.

# Answer
> 1 votes
There is actually an option under "Submission Flow" to change it. You have four different options.

Confirm Message Behavior

1) Before Redirecting

2) On the confirmation page

3) Only Show Message (no redirect)

4) Just Redirect (no confirmation)

You are looking for "Just Redirect"

---
Tags: forms, devdemon
---


# Question
Title: Grouping entries by relationship field (title)
I have one channel named Zone (zones) (All Zone entries are named zone 01, zone 02, etc)

A second channel is named Club Listing (club\_listing) (All club entries are named Dubbo, Eden, etc) Within this channel is a relationship field {zone} that relates to the Zone channel.

So each club (200+) belongs to a certain zone (28).

All i need to do is list all the clubs, but have them grouped by zone;

Zone 01
\- Alstonville
\- Bega

Zone 02
\- Avondale
\- Eden

Zone 03
\- Blacktown
\- Dubbo

Is this possible to do? (Natively or add-on required?)

```
{exp:channel:entries channel="club_listing" dynamic="no" sort="asc" orderby="zone"}
???
<h4>{title}</h4>
{/exp:channel:entries}

```

ANY help is much appreciated!

# Answer
In this case the Club Listing entries would be the parents of the Zone entries. You should be able to loop through the Zones channel and call the parents of each Zone entry within the Club Listing channel. So something like:

```
{exp:channel:entries channel="zones"}
    <h4>{title}</h4>
    {parents field="zone_relationship_field" channel="club_listing"}
        {parents:title}<br>
    {/parents}
{/exp:channel:entries}

```

Here's the tag reference in the docs - http://ellislab.com/expressionengine/user-guide/add-ons/channel/relationships.html#accessing-parents
> 1 votes

---
Tags: channel-entries, relationships, grouping
---


# Question
Title: Embed variable not parsing in channel:entries loop
I'm passing a variable into an embed file. I can output the value of the variable inside the embedded template no problem but when I use it in an channel:entries loop I'm not getting a result. Hard coding a value returns a result. Any thoughts?

```
<p>Member ID {embed:member_id}</p>
<?php $skills = array() ; ?>
{exp:channel:entries
    channel="logbook"
    orderby="date"
    sort="desc"
    dynamic="no"
    author_id="{embed:member_id}"
    disable="categories|category_fields|member_data|pagination"
}
    <?php $skills[] = array('skill' => "{log_skill}{url_title}{/log_skill}", 'badge' => "{log_skill}{skill_badge}{/log_skill}"); ?>
    {/exp:channel:entries}

<script>
    var skills = <?php  echo json_encode($skills); ?>
</script>

```

# Answer
> 1 votes
I have a sneaky suspicion that the previous page you are embeding from is using something like this:

```
{embed="foo/bar" member_id="{member_id}"}

```

{member\_id} is a standard global var and does not get parsed until after your embed. So essentially what that embed code does is this:

```
<p>Member ID {member_id}</p> {!-- {embed:member_id} is replaced with {member_id} tag--}
<?php $skills = array() ; ?>
{exp:channel:entries
    channel="logbook"
    orderby="date"
    sort="desc"
    dynamic="no"
    author_id="{member_id}"
    {!-- so the channel entries is literally looking for "{member_id}" not the
         value of the tag --}
    disable="categories|category_fields|member_data|pagination"
}

```

This would explain why it works for the first statement (it gets parsed later and outputs the correct value) but doesn't work for the channel entries loop.

A possible solution you can have is installing this plugin and modify your embed tag to look something like this:

```
{embed="foo/bar" member_id="{logged_in_member_id}"}

```

This all has to do with ExpressionEngine's tricky parse order.

---
Tags: channel-entries, embeds
---


title: Matrix with Playa within Playa

text:
# Question
Title: Matrix with Playa within Playa
My head is spinning from this. I've got a Matrix field that contains a Playa field. The entries from that Playa field contain another Playa field that we need to get its title value from. I'm not sure how to get that to work.

So the code would go something like this (simplified for demonstration):

```
{exp:channel:entries}
    {matrix_field_name}
        {playa_field_name limit="3"}
            {separate_playa_field}{title}{/separate_playa_field}
        {/playa_field_name}
    {/matrix_field_name}
{/exp:channel:entries}

```

My **actual code** looks something like this:

```
{exp:channel:entries}
    {wine_styles}
        {suggestions limit="3"}
            {vineyard}{title}{/vineyard}
        {/suggestions}
    {/wine_styles}
{/exp:channel:entries}

```

Sticking that in a blank test template I end up with something like this:

```
{playa6YpDIoqY:title}
{playa6YpDIoqY:title}
{playa6YpDIoqY:title}
{/exp:playa:children}

```

Not sure how to get this to work. I've looked at other discussions here but they seem a bit different (I could be wrong).

# Answer
You'll probably need to use a var\_prefix to get everything to work correctly http://docs.pixelandtonic.com/matrix/templating/field.html
> 2 votes

---
Tags: matrix, playa
---


title: Group Grid entries by custom field

text:
# Question
Title: Group Grid entries by custom field
I have a grid field like this:

File - Text field - Relationship field

Where the file is a document, the text field is the title and the relationship field is the argument.

I would like to output the list of files like this:

Argument 1

* File 1
* File 2
* File 3

Argument 2

* File 4
* File 5
* File 6

And so on, therefore grouped by the relationship field.

Now I have something like

```
{grid}

<li><a href="{grid:file}"> {grid:text_field} </a> - {grid:relationship}{grid:relationship:title}{/grid:relationship}</li>

{/grid}

```

That shows me:

* File 1 - Argument 1
* File 2 - Argument 1
* File 3 - Argument 1
* File 4 - Argument 2
* File 5 - Argument 2
* File 6 - Argument 2

How can I output the items by grouping them by argument? It means that the relationship field must shows only one time per type, and create a list for every type.

# Answer
I resolved using Matrix and Playa. I used those because of the Playa parents tag. I could not use the native features of Grid and Relationship because, according to the documentation, “Currently it is not possible to get the parents of a relationship field that is inside of a Grid field”.

The code is:

```
{exp:channel:entries channel="arguments"}
 {title}
  {exp:playa:parents channel="documents" var_prefix="doc"}
   {doc:matrix_field search:relationship="[{entry_id}]"}
    <li><a href="{file}">{text_field}</a></li>
   {/doc:matrix_field}
  {/exp:playa:parents}
{/exp:channel:entries}

```
> 1 votes

# Answer
I'm just thinking here, but if you install Stash and use something like the following. This code is not tested and not sure get\_list can be nested but the theory should be sound :)

```
{exp:channel:entries url_title="{segment_2}"}
{exp:stash:set_list name="entries" parse_tags="yes"} //Grab all your entries
    {grid}
        {stash:title}{grid:text_field}{/stash:title}
        {stash:file}{grid:file}{/stash:file}
        {stash:related}{grid:relationship}{grid:relationship:title}{/grid:relationship}{/stash:related}
    {/grid}
{/exp:stash:set_list}

{exp:stash:set_list name="group_titles" unique="yes" trim="yes"} //Grab just the titles in a seperate list
    {grid}
        {stash:group}{grid:relationship}{grid:relationship:title}{/grid:relationship}{/stash:group}
    {/grid}
{/exp:stash:set}
{/exp:channel:entries}

{exp:stash:parse}
{exp:stash:get_list name="group_titles" prefix="outer"} //Grab the list of titles
    <h1>{outer:group}</h1>
    {exp:stash:get_list name="entries" match="#{outer:group}#" against="related" prefix="inner"} //Grab the entries and match them against the current group
    <li>{inner:title} / {inner:file} / {inner:group}</li>
    {/exp:stash:get_list}
{/exp:stash:get_list}
{/exp:stash:parse}

```
> 1 votes

# Answer
I did a similar thing with matrix field and in a low variables field. Thanks to @stuartmcd69 - I simplified his a bit.

```
{exp:stash:set_list name="groups" parse_tags="yes" unique="yes" }
  {exp:low_variables:parse var="report_downloads" order_by="category"}
    {stash:group}{category}{/stash:group}
  {/exp:low_variables:parse}
{/exp:stash:set_list}

```

then further in the template the output

```
{exp:stash:get_list name="groups" unique="yes" trim="yes"}
  {exp:stash:embed name="downloads" stash:category="{group}"}
{/exp:stash:get_list}

```

and the embed template looks like

```
<h2>{stash:category}</h2>
<ul>
{exp:low_variables:parse var="report_downloads" search:category="={stash:category}"}
  <li>
    <a href="{file}">{title}</a>
  </li>
{/exp:low_variables:parse}
</ul>

```
> 1 votes

# Answer
Stephen T actually had a wonderful answer, maybe you try this:

```
{exp:channel:entries channel="zones"}
    <h4>{title}</h4>
    {parents field="zone_relationship_field" channel="club_listing"}
        {parents:title}<br>
    {/parents}
{/exp:channel:entries}

```

See this link Grouping entries by relationship field (title)
> 0 votes

---
Tags: matrix, playa, relationships, grid
---


title: Matrix fields within Zoo Visitor

text:
# Question
Title: Matrix fields within Zoo Visitor
At the moment I just want to display some data stored in a matrix field in the Zoo Visitor channel, but no data is shown. I am able to update native member data via Zoo Visitor.

My code at the moment (reduced template code):

```
# {billing_info} = Matrix field
# {billing_company_name} = text field within matrix
# {billing_reference} = text field within matrix
# {billing_company_vat} = text field within matrix

{exp:zoo_visitor:update_form
    return='/account/edit/address/success'
    role='form'
    include_jquery='no'
    datepicker='no'
    include_assets='no'
    secure_action='yes'
    secure_return='yes'
    class='form-horizontal'
}
    {billing_info}
    <input type="text" class="form-control" id="billing_company_name" name="billing_info[billing_company_name]" placeholder="Company Name" value="{billing_company_name}">
    <input type="text" class="form-control" id="billing_reference" name="billing_info[billing_reference]" placeholder="Reference" value="{billing_reference}">
    <input type="text" class="form-control" id="billing_company_vat" name="billing_info[billing_company_vat]" placeholder="VAT No." value="{billing_company_vat}">
    {/billing_info}
{/exp:zoo_visitor:update_form}

```

What am I doing wrong? I am logged in on the page.

Tags like the ones below are working fine.

```
{exp:zoo_visitor:details}
    {visitor:member_firstname}
{/exp:zoo_visitor:details}

```

Currently running EE 2.9 + Zoo Visitor 1.3.32 + Matrix 2.6

# Answer
> 0 votes
OK, after hours and hours of aggravation I followed the advice of the Zoo developer on the Devot-ee forums, where we did some more testing, to file a bug report with EE. I first did a bug search and found my error... If only I would have known this before.

---
Tags: matrix, zoo-visitor
---


title: Get Entries older than a certain year

text:
# Question
Title: Get Entries older than a certain year
I am using EE 2.8.1 and was wondering if it is possible to get entries from a certain year and further back in time. For example, this is for an archive page. There are pages for each of the last 5 years and that is all working fine, but for anything beyond 5 years I just want a generic archive page.

In short I can't seem to figure out a channel entries tag to say: Get me every entry from this channel that was entered on or before 2010. So I would get all entries from 2010, 2009, 2008, etc.

My first attempt was with a search field, something like this:

```
{exp:channel:entries channel="press_releases" dynamic="no" search:entry_date="2010-01-01 00:00:00"}

```

But that just returns every entry. I tried using \> signs in the search and still no luck. I'm sure others have had to do this in the past (and I'm surprised I haven't done it before myself), but was drawing a blank and no luck googling.

Thanks!

# Answer
> 2 votes
The start\_on="2010-01-01 00:00" parameter should do the trick...

"You can specify a particular date/time on which to start the entries. Only entries that are on or after this date will be included in the display. This parameter is often used together with the stop\_before= parameter for limiting the entry display to a specific date range."

---
Tags: date
---


# Question
Title: Save custom fields to member profile when creating member from CartThrob checkout
We have a very basic checkout form in which customers are saving their profiles. Using the docs on CartThrob I've got it all working, but only the username/email fields are going through to EE member. Is there a way to pass the other fields over as well? (i.e. first name, last name, phone, etc.)

# Answer
> 1 votes
You need to make sure that you have mapped your member fields by going to CartThrob \> Settings \> Members and map your order fields to your custom member fields or channel fields if you are using Profile:Edit or ZooVisitor.

---
Tags: cartthrob, members
---


# Question
Title: Recurring Event Date on SolSpace Calendar Event Page
EE v2.7.2. Calendar v1.8.5.

I have a calendar using the SolSpace Calendar add-on, with some recurring events. On the individual event pages for these recurring events, the date shows up as the first occurrence of the event and not each individual date, I think because it's only creating one instance of the event page and not targeting the date in the url.

Example: Prime Rib Dinner Nights are Tuesdays at 5:30 PM. The first occurrence on our calendar is January 7th, and all instances of the event on the calendar show that date instead of the actual date.

Clicking on Prime Rib Dinner Night from the July Tuesdays should show the July dates instead of Jan 7th.

Calendar for July: http://sdyc.org/calendar/month/2014/07/ Prime Rib Dinner Night event page: http://sdyc.org/calendar/events/2199/ Not sure how to code that to work properly on the calendar/events template. Thank you.

```
{exp:calendar:events orderby="title" sort="asc" event_id="{segment_3}" date_range_start="2010-01-01" show_months="144"}
   {if no_results}No Results{/if}
   <div class="event_details">

{exp:channel:entries channel="calendar_events" disable="trackbacks|member_data|pagination" limit="1"}
<img class="event_photo" src="{event_image}" alt="" align="right"/>{/exp:channel:entries}

      <h1>{event_title}</h1>

    <p><strong>DATE & TIME:</strong><br/>
  {if event_all_day}
    {event_start_date format="%l, %F %j, %Y"}{if event_multi_day} - <br/>
    {event_end_date format="%l, %F %j, %Y"} {/if}

  {if:else}
    {event_start_date format="%l, %F %j, %Y"}{if event_multi_day} - {event_end_date format="%l, %F %j, %Y"}{/if}<br/>
     {event_start_date format="%g:%i%a"} - {event_end_date format="%g:%i%a"}
  {/if}
    </p>

      <p><strong>LOCATION:</strong><br/> {event_location}</p>
      {if event_speaker != ""}<p><strong>SPEAKER:</strong><br/> {event_speaker}</p>{/if}
      <p><strong>EVENT DETAILS:</strong><br/> {event_summary}</p><br/>

   </div>
{/exp:calendar:events}

```

# Answer
> 0 votes
What we normally suggest people do is build date segments in the link to the detail page (from the calendar month view), and then use the Calendar:Date tag to parse those segments from the URI into your template. Here's what I mean:

For your link in the Calendar month view, check if the event recurs, and then append the date for that occurrence to the link:

```
<a href="
    {path='calendar/events'}/{event_url_title}/
    {if event_recurs}
        {event_start_date format="%Y/%m/%d"}/
    {/if}
">{event_title}</a>

```

In your event detail page, grab the date segments from the URI and parse them into your page with the Calendar:Date template tag:

```
<p>
{if event_recurs}
    {exp:calendar:date
        base_date="{segment_4}-{segment_5}-{segment_6}"
        output_date="today"
    }
        {date format="%l, %F %j"} @ {event_start_date format="%g:%i%a"}
    {/exp:calendar:date}
{if:else}
    {event_start_date format="%l, %F %j @ %g:%i%a"}
{/if}
</p>

```

---
Tags: solspace, date, calendar
---


# Question
Title: Channel form: "The selected author is invalid"
When trying to update the status of an entry through channel form, I get an error that says "The selected author is invalid".

Just do be sure it's not a permissions problem due to lack of permissions for the user group of which the member trying to do the submit the form belongs to, I have set everything to "Yes".

My code looks like this

```
{exp:channel:form
channel="orders"
entry_id="{entry_id}"
return="ordre/vis/{url_title}"
  }
 {status_menu}
    <select name="status" class="status">
        {select_options}
    </select>
{/status_menu}

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

```

Note that with Super Admin it works fine.

What am I doing wrong?

# Answer
> 1 votes
If it is guest posting, make sure you've allowed guests to post in the control panel (aside from user permissions).

http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/

"Allowing guest posts is controlled in the Channel From settings at Admin ‣ Channel Administration ‣ Channel Form."

# Answer
> 0 votes
Check to make sure that the **Include Members in PUBLISH page multi-author list?** option is set to **Yes** for the member group in question. (This setting may also have been overridden per member as well, under **Member Preferences**).

# Answer
> 0 votes
I have absolutely zero clue why, but today it suddenly works. Maybe I tried something in my sleep or something.

# Answer
> 0 votes
This is already working for the OP, but one other possibility for future reference is if the status itself is allowed for the member group. In addition to channel posting permissions, you can also individually control each status' permissions from the Admin \> Channel Administration \> Statuses \> Group Name \> Status Name menu.

Note that when a status is marked 'Can access status' = 'No' for a member group, it means that the member group can not select it themselves although an administrator with proper permissions can still set an entry belonging to that restricted member group to the status. So for example:

* Status name is 'Approved'. It is marked 'Can access status' = 'No' for member group 'Members' but 'Can access status' = 'Yes' for member group 'Administrators'.
* Member group 'Members' is unable to edit an entry and set it to 'Approved'.
* Member group 'Administrators' is able to edit an entry belonging to 'Members' and set the status to 'Approved'.

# Answer
> 0 votes
I just ran into this issue as well. Found this old EE1 forum post but the solution worked in EE2 for me: http://ellislab.com/forums/viewthread/54933/

In `exp_members`, the column `in_authorlist`, set all the users that you need to be able to edit to y.

This can also be done in the CP. Edit a users profile and then under Member Preferences, check the box for `Include user in PUBLISH page multi-author list?`.

---
Tags: channel-form
---


# Question
Title: Error (0) on Cartthrob checkout in Chrome
A number of people get an EE error screen when submitting a Cartthrob checkout in Chrome if they don't use correct credit card details:

When I test it myself I get a proper transaction declined error but other users are seeing this.

I'm on EE 2.8.1, Cartthrob 2.6.

# Answer
We discovered that this was triggered by using test@test.com as the email address in the checkout form... completely bizarre. But there you go.
> 0 votes

# Answer
CT2.6 requires EE 2.8.1+

From their site: NOTE ExpressionEngine 2.8 + is REQUIRED to run CartThrob 2.6+ Lesser versions may be able to run CartThrob 2.6, but they are not supported.

You should probably add more details about gateway etc. to get a more on point answer.
> 0 votes

---
Tags: cartthrob
---