title: 500 Server Error - FastHosts & Windows

text:
# Question
Title: 500 Server Error - FastHosts & Windows
We've just pushed a website on to a clients server... Sadly, he's chosen his own hosting and gone with Fasthosts, and Windows!?

After activating PHP and MySQL on the server, we've hit two problems:

* When it's in the root folder, it gives us a **"500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed."** error. No matter if we go to the front end or ExpressionEngine admin itself
* When it's in a sub-folder, we get a different error - **"The service is unavailable."**

Would you say this is a hosting issue, or some settings we need to tweak?

We've ran the Server Wizard and everything is marked as yes.

Is there anything we coudl check to see whats going on? It's a shared host, so there is no logs on the server, or CP that I can see of!

# Answer
That sounds like it could be something to do with your htaccess file. Try removing bits from it and see if the site begins to (sort of) work. At least that will tell you where to look.
> 1 votes

# Answer
First of all try to create test file, like test\_info\_.php

```
<?php
phpinfo();
?>

```

if you will get info, try to upload and run some EE compatibility tests. Possible some libraries is not available on this hosting.
> 1 votes

---
Tags: hosting, error-500
---


# Question
Title: How make logged in members auto logout when visiting a certain URL
Maybe strange question, I put it in the setting of this case. I have build a shoppingsite (Carttrob, Profile:edit) where members are logged in after registration. I also use Freemember to bypass EE messages for the normal login c.q. logout procedure.

Now the owner wants for certain groups a registration without logging in, because he wants to approve them first. Profile:edit echoes the settings in Membermodule, which is allright, so now I must make an exception here. I could not find an override tag.

My thought is to send the member\* to a redirect page where they, without knowing it, become logged out. \*after completion of the form they are at that point logged\_in\*

I could of course make a button (with some text)to activate the logout procedure, but what if the user does not use that button, and goes back to the site?

My question, how would I code that page? In order to automate the logout procedure?

# Answer
LogMeIn add-on has not only option to login user, but also logout. Just add next tag in your template

```
{exp:logmein:logout}

```
> 3 votes

---
Tags: freemember, profile-edit
---


# Question
Title: What does a slow "Parsing Segment, Embed, and Global Vars Conditionals" log entry mean?
I'm working on getting EE installed on Google Appengine's new PHP runtime.

Things are slow, and I'm trying to identify why that might be. I've disabled most add-ons, and created an EE tag-less template. The url is a straightforward template-group/template format.

It should be really fast, but I'm seeing a very slow stage I've never seen slow before:

```
(0.030650/1.42MB) - Parse Current Time Variables
(0.030660/1.42MB) - Parsing Segment, Embed, and Global Vars Conditionals
(0.339330/1.43MB) - - Beginning Tag Processing -

```

What exactly happens during that Parsing Segment... stage?

# Answer
Yes, simple conditionals are parsed in that stage. But also, module and plugin files are "scanned". The first and third party directories are read for the presence of module and plugin files and stored for reference. If you have a lot of add-ons in the 3rd party folder (having them installed is irrelevant here), it might take longer, especially if the server is bad at disk IOs.
> 3 votes

---
Tags: performance, debugging
---


title: Installing the "Perfect" module

text:
# Question
Title: Installing the "Perfect" module
I am trying to try and install this

http://devot-ee.com/add-ons/perfect.

does not seem to have the same structure of other modules I have installed. How do I do this?

Thanks.

# Answer
Just put the `perfect` folder inside `/system/expressionengine/third_party`.

(Also: the add-on is developer-supported via devot:ee's forums \- the add-on's developer is far more likely to help you there.)
> 2 votes

---
Tags: module, plugin
---


# Question
Title: Discussion Forum - Are template tags available for it?
Based on the documentation, `{exp:forum}` is available to show the forum in the templates.

But the problem here is that I want the forums to conform to the look and feel of my site.

Are there tags available for this module where we can get more control on the output(like a tag for the header, a tag for the list of boards, etc)?

# Answer
> 2 votes
No, there are not. To style the forum you have to edit the theme files directly.

EllisLab's reommendation per the documentation:

> If you plan to make changes to your theme, we recommend that you make a copy of the themes/forum\_themes/default/ directory, name it something else, and make your changes to that one.

Instead of doing that, I suggest taking a look at **Scaffold forum theme** because it will almost certainly serve as a better starting point for your customization.

---
Tags: forum, discussion
---


title: Disable secure forms form parameter?

text:
# Question
Title: Disable secure forms form parameter?
I have a multi-page freeform pro form which breaks every time the user uses the back button to go back to a previous part (the dreaded "action is invalid error").

I can only get it to work properly by disabling secure forms globally in the control panel - is there no way to disable it just for this one form through a parameter? Using FFP v 4.1.3 on EE 2.7.3

# Answer
> 5 votes
Unfortunately there is not - when Secure Forms is enabled, EE requires every `POST` to contain a valid `XID`. More and more I'm just disabling Secure Forms on any site which takes user submissions because it brings so many headaches.

---
Tags: solspace-freeform
---


# Question
Title: Is there a "Select a Category OR Entry" field type? If there isn't, is there a way to toggle fields?
Basically I want to have entries with field types that provide links to either a category or an entry. I'm guessing such a fieldtype doesn't exist, so... I can use WB Category Select for selecting the category and whatever native or Playa for selecting an entry, but is there any way to toggle between them?

Like a radio fieldtype or something that will show/hide a set of fields?

E.g.

**Choose a type of link and link itself \[#n...\]**

* Category (clicking this reveals WB Category Select, hides the other)
* Entry (clicking this reveals single Entry selection, hides the other)

The above in repetition. Matrix/Grid isn't necessary, can manually make a bunch of repetitive fieldtypes.

Probably doesn't exist either, so any recommendation for an existing radio/switch/pill type and binding some javascript to it for the toggle functionality?

edit:

Props to Max & Tyler who recommended the Entry Type add-on. That was *exactly* what I needed. Have implemented it already, it's perfect.

# Answer
*possible I misunderstand the question.*

You can try Entry Type \- dropdown fieldtype that shows/hides other fields on the publish page.
> 4 votes

# Answer
Suggestion: use a Matrix or Grid field with two columns: one contains a Relationship field (to link to an entry), the other contains WB Category Select, and instruct users to fill out only one or the other for each row.

You can enforce this one-or-the-other setup in your template using a conditional (in case someone selects both):

```
{matrix_field}
    {if relationship}
        {relationship:title}
    {if:else}
        {category}
    {/if}
{/matrix_field}

```
> 1 votes

# Answer
Rob Sanchez developed a really great add-on called "Entry Type" (http://devot-ee.com/add-ons/entry-type). Make a note of this one for future projects ;)

You can configure an Entry Type field in the Channel Fields for the relevant channel and show/hide fields based on the value of the Entry Type field's selection. This way, based on the value of the Entry Type field and the settings that you control, you can toggle the visibility of the fields.
> 1 votes

---
Tags: control-panel
---


# Question
Title: no_results not working when moved to snippet
I have moved embed code to be a snippet. After that move no\_results stopped to work (part of the code below)

```
{exp:channel:entries channel="products" category="{segment_2_category_id}" orderby="title" sort="asc" limit="8" paginate="bottom" dynamic="no"}

            {if no_results}
                    <div class=""><p>No entries yet.</p></div>
                {/if}

{/exp:channel:entries}

```

Any clue why it has stopped?

# Answer
Well, it is issue related to switchee (thanks Robson Sobral for pointing me to that).

The {if no\_results} behaviour is ‘owned’ by the outer wrapping tag not the inner tag. This is an EE bug/feature and not unique to Switchee.

Because of this, Switchee has it’s own no\_results handling which will work for each nested switchee layer:

```
{if switchee_no_results}
...
{/if}

```

From http://devot-ee.com/add-ons/support/switchee/viewthread/2925
> 1 votes

---
Tags: switchee, snippets, no-results
---


# Question
Title: Solspace user - percent of profile complete
I want to calculate the % of the profile a user has complete is this possible?

Maybe even define the fields.

# Answer
Although it's geared towards doing the same but with *channel* fields, the Perfect module could get you started down this path. (It will need to be modified, or you'll need to use a module such as Profile:Edit or Zoo Visitor to connect your member with channel entries).
> 1 votes

---
Tags: solspace-user
---


# Question
Title: Parent Relationship and Channel Category Archive
I am still not 100% familiar with the newer relationships method added in 2.6 and I am wondering if I can get the **Channel Category Archive Tag** {exp:channel:category\_archive} working with a parent relationship. It's for the table of contents of a monthly magazine, and I want the category heading and the entries listed below. The parent being the issue number.

Something like:

**Category**

* Article 1
* Article 2

**Category**

* Article 3
* Article 4

I've been playing with various combinations and no luck:

```
{exp:channel:entries channel="print_editions" disable="pagination" limit="1"}

  {exp:channel:category_archive channel="articles" style="linear" show_empty="no" status="not closed"}
    {parents}
      <h2>{parents:categories}{category_name}{/parents:categories}</h2>
       <ul>
        {parents:entry_titles}
         <li>{parents:title}<li>
        {/parents:entry_titles}
       </ul>
    {/parents}
  {/exp:channel:category_archive}
{/exp:channel:entries}

```

# Answer
I feel your pain with EE relationships. I wrote up a good bit on the method we use here.

It was for product-buyers relationship paths, but is the same concept and I do certainly feel like you can get done what you need to here.

It can be done without the :search param in channel entries, I think under EE 2.6.... But it requires some well thought out plugin design.

Anyway, i'll leave this here and I do hope that it helps you.

https://expressionengine.stackexchange.com/a/18229/1872
> 1 votes

# Answer
I don't know that I completely follow what you are after, but it looks like a nasty little ditty.

Without knowing how everything is set up, you might be able to try using embeds to toss the data around like you need it. I haven't tested any of this, but it looks like it would do what you need.

In your main template:

```
{exp:channel:entries
    channel="print_editions"
    disable="pagination"
    limit="1"
}
    {parents}
        <h2>{parents:categories}{category_name}{/parents:categories}</h2>
        <ul>
            {embed="template_group/category-archive-data-template"
                entryID="{entry_id}"
                entryChannel="{channel}"
                archiveChannel="articles"
            }
        </ul>
    {/parents}

{/exp:channel:entries}

```

Then the 'category-archive-data-template' could have:

```
{exp:channel:category_archive
    channel="{embed:archiveChannel}"
    style="linear"
    show_empty="no"
    status="not closed"
}
    {embed="template_group/back-to-parent-relationship-data"
        categoryID="{categories}{category_id}{/categories}"
        entryChannel="{embed:entryChannel}"
        entryID="{embed:entryID}"
    }
{/exp:channel:category_archive}

```

Then in the 'back-to-parent-relationship-data' you could do the following:

```
{exp:channel:entries
    channel="{embed:entryChannel}"
    entry_id="{embed:entryID}"
    category="{embed:categoryID}"
    disable="pagination"
}
    {parents}
        {parents:entry_titles}
            <li>{parents:title}<li>
        {/parents:entry_titles}
    {/parents}
{/exp:channel:entries}

```
> 0 votes

---
Tags: relationships, categories
---


# Question
Title: On back-end, trying to use Assets loads my homepage on the Assets box!
I have an Assets field on my site. When I click to upload files, the assets box opens as it should, but displays my homepage. Any ideas?

# Answer
Issue solved. The path in "URL of Upload Directory" under File Upload Preference was set as an absolute path for some reason. I changed it to an relative path and it now works.
> 0 votes

# Answer
Update: based on your comment that you've got a multiple sites installed on the same server:

Make sure the correct system dir is being specified in your `index.php` and `admin.php` files, and that you've got valid values for `$config['base_url']`, `$config['site_url']`, and `$config['cp_url']`.

====

An over-ambitious .htaccess re-write rule is commandeering the `?ACT=` request, and redirecting the URL to the homepage, perhaps?

Should be easy to test; comment out and/or remove the .htaccess rules, if possible, and see what happens.
> 1 votes

# Answer
Do you have an index.htm page in your site root? That can cause a similar issue for Assets.

Try adding this config line to your config.php to tell Assets the path to your site index:

$config\['assets\_site\_url'\] = "/index.php";
> 1 votes

---
Tags: assets
---


# Question
Title: ExpressionEngine - Send custom field in New Member Registration Email?
I need to send custom field data to the admin when a user registers. In this example I'm trying to send the ZIPCODE along with other standard fields. I'm using freemember to collect the custom field data.

This is my Admin Notification of New Member Registration Template:

```
    New member registration site: {site_name}

    Name: {name}
    User Name: {username}
    Email: {email}

    zipcode: {zipcode}

    Your control panel URL: {control_panel_url}

```

Any Help is greatly appreciated. I do have Solspace User, but that hasn't been any help.

# Answer
You can do this easily with Notify Control. No needs in any php coding. Just email template with regular expressionengine code.
> 2 votes

# Answer
I was able to get this to work using Postmaster. Thanks to Justin over there for pointing me in the right direction.

I created a new php file in the hooks dir of postmaster:

E.g.

Member\_member\_register.php

```
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Member_member_register_postmaster_hook extends Base_hook {

    protected $title = 'Member member register';

    public function __construct($params = array())
    {
        parent::__construct(array());
    }

    public function trigger($data, $member_id)
    {

        $member = $this->channel_data->get_member($member_id)->row_array();

        $member['email'] = $_POST['email'];
        $member['street_address'] = $_POST['street_address'];
        $member['city'] = $_POST['city'];
        $member['state'] = $_POST['state'];
        $member['zipcode'] = $_POST['zipcode'];

        return $this->send($parse_vars, $member);
    }
}

```

Then in my postmaster template, I accessed the data like such:

```
Name: {hook:screen_name}
Email: {hook:email}
Address: {hook:street_address}
{hook:city}, {hook:state} {hook:zipcode}

```

The downside is that you have to hard code the values. If you were to add more fields, you would have to change the hook file. I'm sure with some tweaking you could make this dynamic.
> 1 votes

# Answer
I haven't run into this specific problem before, but a quick google turned up this thread and this earlier thread, which seem to imply that you can't use custom fields in the member registration emails.

> I am afraid there is no built-in way to use other variables in these mails. Perhaps Freeform can handle that? Otherwise it’d have to be a Feature Request.

I wouldn't recommend hacking core files, so your best bet is probably to check out Postmaster or another email plugin to see if it can do this for you.
> 0 votes

---
Tags: custom-fields, freemember, custom
---


# Question
Title: How to outsmart ExpressionEngine Parse Order?
I need to get this work — how can I code this to get the parse-order I need?

`{exp:channel:entries channel='{exp:plugin entry_id="{segment_3}"}' …`

As you can see in the code above: I read out the 3rd segment of the url, paste it in a attr of a plugin and use its output as a value of the channel-attr of exp:channel:entries.

Right now it does not work, the plugin with the segment-readout does work outside of the exp:channel:entries-Tag, therefore I *think* it is a parse order issue.

# Answer
> 3 votes
put exp:channel:entries inside **embeded** template

```
{embed="site/channel" my_plugin_ids="{exp:plugin entry_id="{segment_3}"}

```

*site/channel*

```
{exp:channel:entries channel='{embed:my_plugin_ids}' …

```

-or-

put exp:channel:entries inside your plugin tag's

```
{exp:plugin entry_id="{segment_3}" parse="inward"}
    {exp:channel:entries channel='{my_plugin_ids}' …

{/exp:plugin}

```

---
Tags: plugin, parse-order
---


title: Adding a custom class to ol or ul lists

text:
# Question
Title: Adding a custom class to ol or ul lists
I'm attempting to add some sort of functionality to WYGWAM that will add a custom class to a ol or ul lists. So for example:

```
<ol class="custom">
....
....
</ol>

```

I've tried editing a custom styleSet to something like:

```
{ name: 'Alert' , element: 'ol',attributes: { 'class': 'custom' }},

```

but this doesn't work. It could be a Style dropdown or a custom button in the toolbar. Any help would be great!

# Answer
> 2 votes
Did you follow the instructions on creating a custom style set here http://docs.pixelandtonic.com/wygwam/using/style\_set.html ?

Double check that you followed those instructions. It should work just fine.

Note: If this is the only custom style in the set, or it the last in the list, then you will not need the trailing comma. If you followed the instructions above and still had a problem then that could be your issue.

Also, Chrome (and maybe other browsers) is really aggressive about caching the custom style JS file so you may need to do a hard refresh or bust the cache to load your updated style set. I usually do this by updating the reference to the styleset with a version query string `my_styles:/themes/third_party/wygwam_assets/my_styles.js?v1.2`

---
Tags: wygwam
---


# Question
Title: Using exp:query with WHERE = {segment_2} is it safe?
I'm querying the database directly using the exp:query tag and filtering results on the value of a segment, is this safe?

How can I make it safe?

# Answer
> 10 votes
No, it is not. Using segment variables (which is user input, effectively) in a query with the Query module is generally regarded as unsafe.

You should use the **Active Record** plugin instead.

---
Tags: query-module
---


# Question
Title: Can I migrate/convert a text field containing an <img> into a file field?
I have a text field that's been to featured an image since an earlier EE1 install and I would like to convert it to a File field type, so as to better utilize the image URL throughout different templates.

Can I simply change the type from Text Input to File? I'm doubtful, since there is so much other text in the input aside from the image URL. (ie: `<img src="{filedir_4}file.jpg" alt="" height="300" width="300" />`)

I came across this post with the same question but do not fully understand the solution provided. (I am also too new to comment there.) It says that I can add the following PHP to a template and it will do the migration itself:

```
<?php

$old_field = 'field_id_XX';
$new_field = 'field_id_XX';

$images = ee()->db->query("
    SELECT entry_id, $old_field FROM exp_channel_data WHERE $old_field != ''
");
foreach($images->result_array() as $image)
{
    preg_match('/src="([^"]*)"/i', $image[$old_field], $match);
    if(!empty($match))
    {
        $data = array(
            $new_field => $match[1]
        );
        ee()->db->query(
            ee()->db->update_string('exp_channel_data', $data, 'entry_id = '.$image['entry_id'])
        );
    }
}

?>

```

I've added the PHP to the related template (which allows PHP), replaced the field\_id\_XXs with the proper IDs, then loaded a few pages—but no migration is taking place.

Any suggestions?

# Answer
You need to prefix those IDs with `field_id_`, e.g.,

```
$old_field = 'field_id_51';
$new_field = 'field_id_217';

```

That should get the migration working.

Note that you'll only need to load that code once in a single PHP-enabled template, and it should migrate all entries which have an image in the specified field (you mentioned "loading a few pages").
> 1 votes

---
Tags: fieldtype, fields, file-field
---


# Question
Title: What are the benefits of MailChimp over EEs native Mailing Lists?
Why should I use a AddOn to let Members opt-in a Mailing-List managed by MailChimp, when there is a native EE-Mailing-List-Module? What are the benefits of using MailChimp instead of EEs own/native/local Mailing-List-Module?

# Answer
MailChimp's Email Delivery feature page is essentially a list of all the things MailChimp does that EE's mailing list (which is basically a dumb interface to your server's sendmail function) does not.

In short: do not rely on EE's Mailing List feature.
> 6 votes

# Answer
It should be noted that you can very easily hook up EE's email sending methods to a Transactional Email Service such as Mandrill (http://mandrill.com/) this is actually what Mailchimp is using, Mailgun, Postmark and others.

This means that all email sent by your EE installation goes through that service and can be monitored for delivery success/failure etc.

You can use Mandrill for free up to a point so it's worth giving it a go. Just sign up and enter the SMTP connection info into EE's email setup.

I wrote up a little guide to set up EE to use Mandrill a while ago which might be helpful http://www.foamcow.com/general/configure-expressionengine-to-use-mandrill-transactional-email-services/
> 2 votes

# Answer
MailChimp give you a lot of option and stats on your mail!

You can see the % of people that open it and track them with your google analytic.

You can easily customize the design of the email your sending to get your members attention!

If you use EE's mailing list feature you have more chance of getting your Server IP banned if you get report for mail spamming.. That not nice!
> 1 votes

---
Tags: mailinglist, mailchimp
---


# Question
Title: Filter channel entries by category with nested condition
I am using EE 2.7.2. How can we filter channel entries like below:

```
{exp:channel:entries category="1&2&3&(5|6)"}

```

Is it possible to use '&' and '|' together?

# Answer
> 3 votes
No, unforchently you can't use '&' and '|' together. In category parameter you can use or '&' logic or '|' logic.

*possible solution:*

```
{exp:query sql="SELECT group_concat(entry_id separator ', ') as result_ids FROM
exp_category_posts WHERE entry_id IN
(SELECT entry_id FROM exp_category_posts WHERE cat_id = 1 AND cat_id = 2 AND cat_id = 3)
AND (cat_id = 5 OR cat_id = 6)" parse="inward"}
  {exp:channel:entries entry_id="{result_ids}"}
    ...
  {/exp:channel:entries}
{/exp:query}

```

Cheers!

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


# Question
Title: htaccess file for static CE Cache also redirect www
I am currently using the htaccess rules that CE Cache recommends when setting up a static cache:

```
#------------------- remove trailing slash -------------------
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/$ /$1 [R=301,L,QSA]

#------------------- index.php -------------------
#strip index.php from the URL if that is all that is given
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://%{HTTP_HOST}/ [R=301,NS,L,QSA]
#strip index.php/* from the URL
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php/ [NC]
RewriteRule ^index\.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]

#------------------- CE Cache Static Driver -------------------
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond %{DOCUMENT_ROOT}/static/ce_cache/8203ba/static%{REQUEST_URI}/index\.html -f
RewriteRule (.*) /_static_cache_handler.php?%{REQUEST_URI}/index\.html [L,QSA]

#------------------- EE -------------------
#rewrite all non-image/js/css urls back to index.php if they are not files or directories
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

```

However, I'd like to add in a redirect so if somebody visits at www.mydomain it goes to mydomain. I've tried a few things that I think should work with no luck. Any ideas?

Thanks.

# Answer
> 1 votes
just add next lines at the beginning of .htaccess right after RewriteBase /

```
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

```

---
Tags: ce-cache
---


# Question
Title: Matrix outputs parts of it's tags on the frontend
After moving to a different server, i'm seeing strange output from Matrix. The output contains some of the ee tags and some of the html from within.

Here is the matrix tag pair:

```
{service_group_staff_quotes}
  <blockquote class="testimonial">
    {if photo}<img class="testimonial__media" src="{photo}" alt="{staff_credit}">{/if}
    <p class="testimonial__quote">“{staff_quote}”</p>
    <p class="testimonial__title">— {staff_credit}</p>
  </blockquote>
{/service_group_staff_quotes}

```

This is a screengrab of the output:

The '{s' at the beginning and the '/p\>' at the end of the first para, then the '{sta' at the beginning of the second para are the problem. Anyone seen this before or got any ideas? I've tried running the EE server wizard on the new server which reports everything is fine and i've tried re-uploading the system folder incase anything got lost over FTP. Any help appreciated :)

EE 2.5.5, Matrix 2.5.10

# Answer
The only time I've seen this behavior is when the text in the field contains foreign characters, like if its been pasted from Word but have seen it from other PC based apps with no rhyme nor reason.

Try deleting everything in the field and type it a new - don't copy paste.

PS. Just noticed the output - this may not help :(
> 2 votes

---
Tags: matrix
---


# Question
Title: Freeform option to hide forms from Member Group?
As the title suggests, is it possible to hide certain forms from a member group when they are logged in. I am using 5 forms on a site but I only want to allow a member group access to the one form.

UPDATE: This is in the CMS, so Backend.

Many thanks in advance. Clinton

# Answer
If you're referring to the front end you can use simple conditionals like this:

```
{if member_group == '3'}show freeform {/if}

```

Examples can be found here: http://ellislab.com/expressionengine/user-guide/templates/globals/conditionals.html#logical-operators

In that case: Yeah, no would be the answer for that one. You can hide the module from member groups but not individual forms
> 0 votes

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


# Question
Title: Blank index.php and admin.php on AWS elastic load balancer
This latest ee launch is going on xyz.com. I've been told:

> This DNS entry points at an AWS elastic load balancer with two linux instances behind it.

I'm not a server person. I don't know how it's set up. Phpinfo seems to have everything I need.

Both my home page (index.php) and admin.php are blank. Yes, I've set $debug = 1. Still blank.

I literally have no idea what to try next. I don't know if it's the files, the server, a path setting or ee itself.

Can someone please suggest something?

Thanks, Amanda

Here's something... if the servers are set up as xx.xx.x.254 (Web1), xx.xx.x.214 (Web2) and xx.xx.x.25 (DB1), phpinfo should still show a mysql section, no?

# Answer
Never mind. Server guy didn't install (or had wrong version of) mysql package.
> 0 votes

---
Tags: blank-screen, aws, php.ini
---


# Question
Title: Is the date_range_start parameter based on the entry date?
I assumed the tag would be based on the start date of an event, however I have this code

`{exp:calendar:events orderby="event_start_date" author_id="{member_id}"}`

which shows all entries. When I add the date\_range\_start parameter

`{exp:calendar:events orderby="event_start_date" author_id="{member_id}" date_range_start="today"}`

no entries appear, even though there are two events with start dates in May, 2014.

# Answer
> 0 votes
Looks like you're looking to order events in chronological order. In that case, you must use **`{exp:calendar:cal}`** and not `{exp:calendar:events}`. {exp:calendar:cal} is the only tag that will order events in chronological order (and take overlapping events/occurrences, etc into consideration), as well as calculate which events/occurrences fit inside the time frame set up in the `date_range_start=""` and `date_range_end=""` parameters.

★ The following is a must read for further details on deciding which tag to use for your purpose: http://www.solspace.com/docs/calendar/getting\_started/

Also, in your example {exp:calendar:events} simply reads date\_range\_start="" and compares it to the date data set up in the event entry form (not the EE entry\_date). Further, using date\_range\_start="today" but not specifying date\_range\_end="" means date\_range\_end will default to "today". You would need something like `date_range_end="+6 months"`

---
Tags: solspace-calendar
---


# Question
Title: Using Matrix with Playa Fields and Stash set_list
I'm using {exp:stash:set\_list} along with a few Matrix fields, but when I use {exp:stash:get\_list} in my view template to retrieve the values nothing is returned. Here's barebones example of what I'm using.

**Model template:**

```
{stash:embed:layouts:template}

{exp:stash:set_list
  name="people_entry:{segment_2}"
  parse_tags="yes"
  parse_depth="2"
}

  {exp:channel:entries
    channel="people"
    disable="categories|category_fields|member_data|pagination"
    limit="1"
    status="open"
  }

        {stash:people_title}{title}{/stash:people_title}

        {exp:stash:set_list:nested
          name="name_{entry_id}"
          parse_tags="yes"
        }
          {matrix_field_1}
            {stash:people_name}
                {playa_field}
                    {name}
                {/playa_field}
            {/stash:people_name}
          {/matrix_field_1}
        {/exp:stash:set_list:nested}

        {exp:stash:set_list:nested
          name="position_{entry_id}"
          parse_tags="yes"
        }
          {matrix_field_2}
            {stash:people_position}
                {playa_field}
                    {position}
                {/playa_field}
            {/stash:people_position}
          {/matrix_field_2}
        {/exp:stash:set_list:nested}

{/exp:stash:set_list}

```

**View template:**

```
{exp:stash:get_list
    name="people_entry:{segment_2}"
}

    {people_title}

    {exp:stash:get_list:nested
        name="name_{entry_id}"
    }
        {people_name}
    {/exp:stash:get_list:nested}

    {exp:stash:get_list:nested
        name="position_{entry_id}"
    }
        {people_position}
    {/exp:stash:get_list:nested}

{/exp:stash:get_list}

```

Any thoughts on what I'm doing wrong?

Using EE 2.7.3 with Stash 2.4.8 and Matrix 2.5.10.

# Answer
> 1 votes
The inner nested list needs to be assigned a context that identifies it as belonging to a specific row in the outer list - in this case `{entry_id}` would be a good choice since it is a unique value. Note that I have assumed your playa field is returning a single result - if not you would need another nested list to capture each playa entry and associate it with the parent matrix row\_id.

```
  {exp:stash:set_list
    name="people_entry"
    context="{segment_2}"
    parse_tags="yes"
    parse_depth="2"
  }
    {exp:channel:entries
      channel="people"
      disable="categories|category_fields|member_data|pagination"
      limit="1"
      status="open"
    }
        {stash:people_title}{title}{/stash:people_title}

        {!-- unique reference to child list  --}
        {stash:entry_id}{entry_id}{/stash:entry_id}

        {!-- nested list --}
        {exp:stash:set_list:nested
          name="names"
          context="{entry_id}"
          parse_tags="yes"
          parse_depth="2"
        }
          {matrix_field_1}

            {stash:name}
              {playa_field limit="1"}
                  {name}
              {/playa_field}
            {/stash:name}

          {/matrix_field_1}
        {/exp:stash:set_list:nested}

    {/exp:channel:entries}

  {/exp:stash:set_list}

```

When you get the list the entry id of the outer get\_list row is passed to the nested get\_list so that the list associated with that particular row is retrieved:

```
  {exp:stash:get_list name="people_entry" context="{segment_2}"}

      {people_title}

      {exp:stash:get_list:nested name="names" context="{entry_id}" prefix="nested"}

          {nested:name}

      {/exp:stash:get_list:nested}

  {/exp:stash:get_list}

```

# Answer
> 1 votes
I think you need to capture the entryid as a stash var so you can call it instead of entry\_I'd because entry\_id doesn't exist when calling the get\_list.

```
{stash:embed:layouts:template}

{exp:stash:set_list
name="people_entry:{segment_2}"
parse_tags="yes"
parse_depth="2"
}

{exp:channel:entries
channel="people"
disable="categories|category_fields|member_data|pagination"
limit="1"
status="open"
}

    {stash:people_title}{title}{/stash:people_title}
    //Capture entryID
    {stash:entryid}{entry_id}{/stash:entryid}
    {exp:stash:set_list:nested
      name="name_{entry_id}"
      parse_tags="yes"
    }
      {matrix_field_1}
        {stash:people_name}{name}{/stash:people_name}
      {/matrix_field_1}
    {/exp:stash:set_list:nested}

    {exp:stash:set_list:nested
      name="position_{entry_id}"
      parse_tags="yes"
    }
      {matrix_field_2}
        {stash:people_position}{position}{/stash:people_position}
      {/matrix_field_2}
    {/exp:stash:set_list:nested}

{/exp:stash:set_list}

{exp:stash:get_list
name="people_entry:{segment_2}"
}

{people_title}

{exp:stash:get_list:nested
    name="name_{entryid}" //Unsure of syntax here, could try…
    name="name_{stash:entryid}"
}
    {people_name}
{/exp:stash:get_list:nested}

{exp:stash:get_list:nested
    name="position_{stash:entryid}"} //stashed entryid var
    {people_position}
{/exp:stash:get_list:nested}

{/exp:stash:get_list}

```

---
Tags: matrix, playa, stash
---


title: Create filters with exp-resso shop

text:
# Question
Title: Create filters with exp-resso shop
I want to use exp-resso for building a webshop. At the front-end I want to offer customers filters. The filters should be for color, size, price etc. Does exp-resso have something build in for that or do you need to build it all by your own?

# Answer
Try Reefine: http://devot-ee.com/add-ons/reefine. It allows you to filter by almost anything and supports the Store custom field.
> 4 votes

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


title: Working with CartThrob Packages

text:
# Question
Title: Working with CartThrob Packages
I have a number of questions regarding CT packages, posting here at the request of the CT twitter.

1. If package price is drawing from the total price from the products, is there a tag to output that total price on the template pre-cart?
2. Does CT Price By Member Group work with that 'additive price' feature?
3. Can price adjustments / discounts be applied using the additive price?
4. What happens if a product in a package has 0 inventory? Can the package still be purchased? Is there a tag that allows me to reflect this on the template?

# Answer
> 1 votes
I'm using these names in the following examples.

* {packages\_packages} is the short name of the packages channel's CartThrob Package field.
* {packages\_price} is the short name of the package's CartThrob Price - Simple field

I only tested in CT 2.5. I can't guarantee all of this applies to earlier versions

1. This will display the set price if one is set in the packages entry, or will display the calculated price based on the included products.

```
{if packages_price}{packages_price}{if:else}{packages_packages:price}{/if}

```
2. I just tested this and can confirm that it works.
3. No. If you're applying a discount based on the entry\_id of a product, that discount won't apply to packages containing that product. You would need to include the packages entry\_id as part of the coupon's Product entry\_id field.

Also keep in mind that you can't show discounted prices of products until they are in the cart.
4. If a package has a product that is out of stock you will receive the "is currently out of stock" error message. If you want to show the current inventory of products in your package you can use this tag:

```
{packages_packages}
    {sub:title} inventory = {sub:inventory}
{/packages_packages}

```

---
Tags: cartthrob, packages
---


# Question
Title: Primary Category doesn't display inside Super Search results
Inside `{exp:super_search:results}` I cannot get a Primary Category to display. Normally I would use `{exp:primary_category}{primary_category_name}{/exp:primary_category}` inside `{exp:channel:entries}`. That works fine but the same thing side Super Search results doesn't work.

Is there something special I have to do to display Primary Category? Strange that it wouldn't work in Super Search since they are both Solspace add-ons!

# Answer
Adding `entry_id="{entry_id}"` to `{exp:primary_category}` fixed it. This is not required in channel:entries but is required in Super Search results.
> 3 votes

---
Tags: solspace, supersearch, primary-category
---


title: CT->Adding products to cart via ajax

text:
# Question
Title: CT->Adding products to cart via ajax
These would be considered pre-sales questions:

1. Can I add products to my cart via ajax in CartThrob?
2. Can I add a custom field where I can store some JSON for each product in my cart?
3. If I add the custom field, is it accessible at all stages of checkout, from cart item to the Thank You page and Order Confirmation Email?
4. How customizable is the Discount engine? I need to have discounts by SKU.
5. Can we have one product and modify it's attributes, like price, SKU, etc before it is inserted into the cart and have it retain that info through out the process?

# Answer
> 4 votes
1. Yes. If you do not have EE's secure forms turned on, it's simple.

If you have EE's secure forms turned on, you will need to pass a fresh XID hash each time you add a product. Our example store code (does not include ajax add to cart) includes ajax customer info updates, and has an example of refreshing the XID. That same method can be applied to adding items to the cart.
2. Yes. You can either store it as an item\_option. or you could create a "custom\_data" field which is not specific to a certain product. It might be better to use custom\_data\[product\_123\] so that the JSON doesn't get output by our item\_options tag.
3. Yes. If its' an item\_option it'll be stored with the item in the order. If it's custom\_data, you'd need to have a dedicated field in the order channel.
4. It uses plugins. If one of the existing plugins doesn't work, and you know PHP, you can create your own. The existing plugins all have the ability to apply to specific entry ids. If it needs to apply to a different product field, then a custom plugin would be in order.
5. Yes. You can specify many things as parameters in the add\_to\_cart\_form. Price, shipping, item\_options, etc.

---
Tags: cartthrob
---


title: Multi-file upload into grid

text:
# Question
Title: Multi-file upload into grid
I've seen hints that the native Grid Fieldtype allows multi-file uploads but I can't find that feature.

http://devot-ee.com/add-ons/jf-multi-file-field says "the new ‘Grid’ field does everything this add-on does" and one of the comments on http://ellislab.com/blog/entry/introducing-grid-new-in-expressionengine-2.7 seems to indicate the same.

but I must be missing something. can someone explain how I can upload multiple images into the grid?

# Answer
You can not natively upload all the files at once with grid. But you can individually select them for each cell in the grid
> 2 votes

# Answer
This doesn't apply to Grid, so I'm just leaving this here as it's the most relevant q/a I found to bring it up. I wanted to be able to select multiple files in a single cell. Since the only obvious multi upload was P&T's Matrix Multi Upload (it uploads whatever files you pick, then generates a row in Matrix for each file, as opposed to a new File fieldtype that allows multiple file selection) basically I'll upload all the files in advance (dummy field, or dummy entry, or same entry then refresh, whatever) and use a MX Select Plus($) field that yields a dropdown based on your own sql query (for me it was a list of specific filetypes).

Haven't used in templating yet but as far as control panel GUI goes that's the combination I've got going.
> 0 votes

---
Tags: file-uploads, grid
---


# Question
Title: New at Cartthrob and trying to Hardcode some option
I read a lot the old forums of Cartthrob and here... Didn't find something to help me understand exactly how Hardcoded option work...

I'm trying to create what you can see in the capture screen that I just post.. All my html is done.

```
<div id="piping_color0" class="color_swatch" style="background:#FFFFFF; border:1px solid #ccc;"  onclick="javascript:ApplyBindingColor(169); setBorder(0,23,'binding'); makerequest();"><img src="images/colorblk.png" alt="White" title="White"></div>

```

But I can't figure out how to create the script for the hardcoded option... I you can juste tell me some idea ou link me some post or article that you know that can help me i will very apperciate :)

Thx Guys!

EDIT: Here some new developpement from my part!

I menage to use Matrix to create all the Entry; option\_value, option\_name color\_code and Price. Now my problem is when i'm putting the code together i have a error when I reload my page.

Parse error: syntax error, unexpected 'endif' (T\_ENDIF) in /home/hakounan/public\_html/clients/ogilvy/system/expressionengine/libraries/Functions.php(680) : eval()'d code on line 1585

```
{exp:cartthrob:item_options entry_id="{entry_id}" row_id="{row_id}"}
    {options}
    {if selected}
    {option_label}: {option_name}<br />

        {exp:channel:entries channel="products" dynamic="no"}
            {binding}
                <div id="{option_value}" class="color_swatch" style="background:#{color_code}; border:1px solid #ccc;"  onclick="javascript:ApplyBodyColor(187); setBorder(0,7,'body'); makerequest();"><img src="{site_url}assets/images/colorblk.png" alt="{option_value}" title="{option_name}"></div>
            {/binding}
        {/exp:channel:entries}
    {/if}
    {/options}
{/exp:cartthrob:item_options}

```

# Answer
If I'm understanding correctly, you're trying to set up those color swatches to be a clickable way to set an item option.

I'm assuming that your Matrix field is named "binding". Here is some code that will hopefully help you out. It uses a simple jquery click event to set the value of a text field that will be submitted when you add the product to your cart.

```
<html>
<head>
{!-- using the jquery module script tag here, but you can link to any jquery library --}
{exp:jquery:script_tag}
</head>
<body>
{exp:channel:entries channel="products" dynamic="no"}
    {exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}
        {title}<br />
        {binding}
           <div id="{option_value}" class="color_swatch" style="background:#{color_code}; border:1px solid #ccc; width:50px; height:25px; display:block; float:left; margin: 10px;"></div>
        {/binding}
        <div style="clear:both;"></div>

        {!-- this is the input that will add the item option called "color" to your item in your order channel --}
        {!-- you can change this to type="hidden" if you don't want it shown --}
        <input type="text" name="item_options[color]" id="selected_color" /><br />

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

 <script type="text/javascript">
 jQuery(document).ready(function($){
      $(".color_swatch").click(function(){
           $("#selected_color").val($(this).attr('id'));
      });
 });
 </script>
 </body>
 </html>

```
> 2 votes

---
Tags: ee2, cartthrob, ecommerce, shopping-cart
---


# Question
Title: Cartthrob Stripe Gateway Blank Screen after checkout
I have a weird issue with Stripe and Cartthrob.

Version Info. EE- 2.5.5 Cartthrob - 2.4

When submitting the checkout form using the stripe gateway. In firefox and safari (some customers have reported chrome as well but it works on my machine) the order gets processed correctly and payment shows up at stripe but the return parameter never runs.

To clarify whats happening the group/template from which the checkout is happening is store/checkout. Once the checkout is complete the return is supposed to take you to store/thanks.

Instead the the site stays (or reloads not sure) store/checkout but the page is blank.

Customers obviously think there is an error and click the back button. The cart is not cleared and we have instances where customers have submitted the same order and got a token reference error.

Once again the payment is reaching stripe its just how the order confirmation return is not working that is causing the problems.

I am aware that stripe uses it's own javascript that it embeds into the page.

I have removed all my external javascript from the page. I also made sure the checkout form does not have a custom id and that the required fields do not have a name value associated with them as per the payment documentation inside the plugin.

My console is showing no javascript errors and all the stripe js files are linking correctly from the source code from what I see.

Please help guys I haven't seen the issue anywhere else and I'm out of ideas.

Thanks for the great plugin.

Ben

# Answer
> -1 votes
This was caused by a conflict between Cart Throb and the Zenbu plugin. Zenbu was not a "have to have" on the site so after its removal its back to working correctly.

---
Tags: cartthrob, error, checkout, stripe, blank-screen
---


# Question
Title: Is it possible to have channel specific Rating fields?
I am looking into using Solspace Rating for a web project I am working on and I will need to have different Rating fields for different channels. Is this possible? Or do I need to work out a way of hiding some fields for some channels?

# Answer
> 2 votes
You could display or not display the fields using a conditional based on the channel\_id.

# Answer
> 0 votes
Another option is to use the same fields for each channel, but simply change the labels on the front end. We had a similar situation where each channel needed different fields but they all had the same number of fields. So we created 4 generic rating fields and then used a combination of channel short names and matching global variables to show the correct field labels for each channel.

---
Tags: solspace-rating
---


# Question
Title: Changing status of Payment by Check orders does not properly trigger events
We need to be able to accommodate payments by checks for our commercial customers, and have found that changing the status of orders placed through the Pay by Check gateway does not trigger normal events, such as updating inventory counts or logging items in the Purchased Items channel (both of which, by the way, work for normal credit card processing through Stripe).

Currently, on the Orders settings pane, both the Order Status and Purchased Items Channel sections are configured to use the same statuses for **Payment authorized/complete** (Paid) and **Payment being processed** (Awaiting Payment).

Also, on the Payments settings pane, the Pay By Check gateway **When order is taken, set processing status to** option is set to "Processing".

So, for example, once an order is placed on the front-end of the site, the order appears in the Orders channel with the status of Awaiting Payment. If I update the status to Paid, the order does trigger any of the actions that it should as a completed order. I've tried updating the status directly in the Orders channel as well as in the Ecommerce Orders Manager. Neither work. Also, I've tried using the `force_processing="yes"` parameter on the checkout form.

Any thoughts?

# Answer
Changing the status in EE's backend will not run any of those actions. At present there is no method to do what you request through changing EE's statuses.

The status itself is currently incidental to the payment collection system. The statuses are changed by outside actions, but changing the statuses manually won't reciprocally initiate those actions.

An extension or modification could be built to "complete" the transaction based on the status change, but at present we don't have anything in place to handle this.
> 1 votes

---
Tags: cartthrob, status, payment-gateway
---


title: Gateway Fields are not being displayed

text:
# Question
Title: Gateway Fields are not being displayed
I am trying to use a template that I have custom Gateway fields in and I am using the following code

```
{exp:cartthrob:checkout_form return=""}
{gateway_fields}
<button class="checkout">Check Out</button>
{/exp:cartthrob:checkout_form}

```

But when the page renders there is just the EE embed tag instead of the fields.

I am using Stash variables to embed this form in the main page wrapper. I think it has something to do with the parsing order but I am not able to figure it out. Any help would be great.

Thanks

# Answer
Instead of using gateway fields, try using the embed itself. This may help get around parse order issues.

You could alternately try using: http://cartthrob.com/docs/tags\_detail/selected\_gateway\_fields/

{exp:cartthrob:selected\_gateway\_fields gateway="authorize\_net"}

This might get around the parse order issues as well. I don't have stash set up, so I can't test unfortunately, so I'm just making guesses at the moment.
> 1 votes

---
Tags: cartthrob, stash
---


# Question
Title: Changing default Cartthrob language files
What is the best way to alter some of the default user feedback messages stored in the language files? I can obviously edit directly the language file in question but that would get overwritten on every upgrade.

# Answer
> 1 votes
You can move cartthrob lang files into

system \> expressionengine \> language \> english (or other language folder)

If you upload again, the CT lang files WILL override those found in the EE language folder, but at least will not overwrite them.

---
Tags: cartthrob
---


# Question
Title: How to show the contents of one folder in Assets?
I'm totally confused about Assets. I'm just trying to show the contents of a folder in a template. Here's my folder structure (dashes indicate subfolders):

```
Docs
-staff
--board
-public
Images
Logos

```

How would I display the contents of, say, the "public" folder? For some reason I'm not getting it.

Thanks for any help.

# Answer
> 2 votes
You're after the exp:assets:files template tag:

```
{exp:assets:files folder="{filedir_1}public"}
            <li>File name: {filename}</li>
{/exp:assets:files}

```

Change {filedir\_1} to whatever is appropriate for your Assets field.

To find what your filedir id is, go to **Content → Files → File Upload Preferences** and hover your mouse cursor over the appropriate "**Edit**" icon for the directory.

Within your browsers status bar, you will see "id=X". Use this number within {filedir\_X}, for example in my screenshot mine is {filedir\_1}.

**Note:** It's not clear in your answer, but if your "Server Path to Upload Directory" is set to something like /home/me/www/assets/docs" and you've created the "public" directory within Assets. Then your correct folder path to 'public' is: `folder="{filedir_1}public"`

---
Tags: assets
---


# Question
Title: Not able to update channel entries related to store, other issues
I’ve recently updated a site from 2.5.2 to 2.7.3. I've also updated Store from 1.6.1 to 1.6.5. I’m experiencing issues in certain sections of the back-end, namely editing channel entries and working with the Template Manager.

For one channel, when I click Submit I receive the following error:

```
Error Number: 1030

Got error 139 from storage engine

Filename: libraries/api/Api_channel_entries.php

Line Number: 1665

```

For another channel, I receive an empty click when trying to Submit or Save Revisions. Nothing is firing in console.

A third issue is, the template manager is empty. Screenshot:

Is anyone familiar with these issues? I’ve run out of ideas.

# Answer
> 3 votes
The error message "Got error 139 from storage engine" is being thrown by MySQL. I bet your tables are using a mixture of InnoDB and MyISAM storage engine.

Check your database and confirm it's using MyISAM. If it's using InnoDB, this question may help with converting it to MyISAM using phpMyAdmin.

---
Tags: expresso-store
---


title: Does CartThrob allow multiple carts?

text:
# Question
Title: Does CartThrob allow multiple carts?
Does CartThrob allow multiple carts? Is it possible to have 2 unique carts? 1 is a standard cart. 1 is a **custom gift box** cart — customers will fill up this cart with products that they are sending as a **custom gift boxes** to someone. We don't want to use 1 cart because then we have to deal with multiple shipping addresses and we want these **custom gift box orders** to be made up of individual product SKUs from our product catalog. LemonStand uses cart\_name for cart assignment.

# Answer
No it does not allow multiple carts.

Great feature request though.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Cartthrob multi-add-to-cart not reducing inventory on
I have set up CT to use a Matrix for pricing on products. Everything is adding to cart and checkout is OK. I have allow\_user\_price on as it is a multi-lingual site and I need to show different prices.

No matter what I tweak, I can't get the inventory to reduce once a sale as gone through.

In my Matrix field I have the following:

* option\_value
* inventory
* uk\_price
* eu\_price
* us\_price

I have also mapped inventory in to the name of he matrix field in products (pricing).

The multi\_add\_to\_cart is wrapped round a bunch of products. When a customer clicks on more details, Jquery fetches the options - An EE template that loops through options.

Here is a highlight of the options:

```
{exp:cartthrob:item_options entry_id="{segment_6}" field="pricing"}
{options}
<input type="hidden" name="entry_id[{segment_6}{count}]" value="{segment_6}"/>
<input type="hidden" name="item_options[{segment_6}{count}][option_value]" value="{option_value}"/>
<input type="hidden" name="item_options[{segment_6}{count}][size]" value="{size}"/>
<input type="hidden" name="item_options[{segment_6}{count}][pack]" value="{pack}"/>
<input type="text" id="cart-qty" name="quantity[{segment_6}{count}]" value="">

<button type="submit"  class="add_to_cart_submit btn btn-danger btn-small" >{phrase:add_to_cart}</button>
{/options}
{/exp:cartthrob:item_options}

```

I have omitted the price field and other styling for clarity.

Can anyone see if I am missing anything obvious?

# Answer
> 1 votes
It needs to reference the name of the field. option\_value isn't the name of the field (I'd guess). So if your matrix field was called YOUR\_FIELD\_NAME\_HERE, you'd add that as the option name. See example below.

```
<input type="hidden" name="item_options[{segment_6}{count}][YOUR_FIELD_NAME_HERE]" value="{option_value}"/>

```

---
Tags: matrix, cartthrob
---


# Question
Title: Cartthrob: How do I set the VAT for not logged in visitors?
I have big problems how to figure out the taxt (VAT) system, I do not understand anything. The settings are very confusing.

How do I set a basic tax for non-logged in visitors? And why must I set my global rates on New York? This shop shall work in the Netherlands, there is no option for other countries than in the US.

Thanks a lot for replying.

# Answer
> 1 votes
1. Make sure you've uploaded the CartThrob themes folder to

your\_site\_root \> themes \> third\_party \> cartthrob

To make sure that the settings javascript is available (the settings don't work correctly if it's not uploaded)

1. cartthrob settings \> global \> default location

set your default country to the Netherlands (or other country as needed). This way CT will assume that anyone visiting is starting from the Netherlands, even if they are not logged in, and there is no default location data to work with.

1. Go to cartthrob settings \> taxes \> tax by location - percentage (i'm assuming this will work for VAT. CT doesn't include a VAT specific tax plugin, but typically it's about 20% so this will probably work fine). It should allow you to select most any country if used with its default locales data. Set a name, % and the country. Add an additional rate beneath that to set a global rate for all other locations (if different)

---
Tags: cartthrob
---


# Question
Title: Parse error: syntax error, unexpected 'II' (T_STRING)
I recently updated to EE 2.7.3 and noticed that I am getting the following error at the top of all my pages:

> Parse error: syntax error, unexpected 'II' (T\_STRING) in /var/www/vhosts/mysite.com/eesystem/expressionengine/libraries/Template.php(3276) : eval()'d code on line 1

Line of said template reads:

```
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

```

Any clues what is causing this and how to resolve it?

Thanks.

# Answer
> 2 votes
Actually, that error message points to **line 1 of eval()'d code**, which is executed on line #3276 of Template.php:

```
eval("\$result = (".$cond.");");

```

This is part of parsing conditionals. So it looks like there's a problem with one of your conditionals. And since you say the error occurs on each page, the conditional most likely is present in a header/footer snippet/embed in your templates.

Check your templates and snippets for a conditional that uses `||` and verify its validity.

---
Tags: templates, error, php-errors
---


# Question
Title: MX Notify - Freemember - Custom Profile_data
I've got this bit of code where I'm trying to get member custom field information. when I use member\_id="41" nothing is rendered. Anyone know why?

```
{exp:member:custom_profile_data member_id="41"}
<p>{given_name} {family_name}
  {if company_name != ""}<br />{company_name}{/if}</p>
<hr />
<div class="row">
  <div class="col-md-6">
    <h4>{bbr-mls-common-location}</h4>
    {exp:channel:entries channel="event_locales" search:city_name="{locale_name}" limit="1"}

      <p>{venue_address}<br /><a href="{venue_website}" target="_blank">{venue_website}</a></p>
    {/exp:channel:entries}
  </div>
  <div class="col-md-6">
    <h4>{bbr-mls-common-session}</h4>
    {exp:channel:entries channel="locale_slots" entry_id="{locale_slot}" limit="1"}
    <p>
      {if language_code == "en"}
        {start_date_time format="%F %j"}
      {if:else}
        {start_date_time format="%j"} au {end_date_time format="%j"}
        {if '{start_date_time format="%F"}' == "September"} septembre {/if}
        {if '{start_date_time format="%F"}' == "October"} octobre {/if}
        {if '{start_date_time format="%F"}' == "November"} novembre {/if}
        {if '{start_date_time format="%F"}' == "December"} decembre {/if}
      {/if}
      <br />
      {start_date_time format="%g:%i%a"} - {end_date_time format="%g:%i%a"}
    </p>
    {/exp:channel:entries}
  </div>
</div>
{/exp:member:custom_profile_data}

```

# Answer
> 2 votes
It is happens because Freemember save custom fields data *after* member\_register hook is executed. So at the moment when NC parsed template is no custom field data in DB. As temporary solution possible to use plugin which will take this data from \_POST (like GET\_POST\_Var plugin).

New versions of NC which I'll release this week, have FreeMembers triggers.

---
Tags: member-management
---


# Question
Title: Access a Relationship field inside a Playa field
I have a Playa field that contains related People to display on a page. In each Person entry there is a standard EE Relationship field (pre EE2.6) to assign the Office Location.

What I need to do is show the telephone number from the Office Location, but can't figure out the best way to do it.

Here is my code;

```
{exp:playa:children field="page_people"}
    {exp:stash:append_list name="page_people" parse_tags="yes"}
        {stash:person_title}{title}{/stash:person_title}
        {!--This is the relationship field for Telephone--}
        {stash:person_telephone}{related_entries id='person_office'}{location_telephone}{/related_entries}{/stash:person_telephone}
    {/exp:stash:append_list}
{/exp:playa:children}

```

When the page renders, it just displays as {REL\[person\_office\]6g2JK3WuREL}.

If anyone can offer a suggestion, I would be grateful.

Thanks.

# Answer
> -1 votes
The `{related_entries}` tag was used in EE1, but is no longer used in EE2.

Instead, to call in data from a native EE2 relationship field, you need to use a looping tag pair. For example:

```
{your_relationship_field}
    {your_relationship_field:title}
    {your_relationship_field:a_custom_field}
{/your_relationship_field}

```

If your relationship field only accepts one single entry, you can also just use a single tag without the loop, like so:

```
{your_relationship_field:a_custom_field}

```

You can find more detailed examples in the EE documentation documentation.

So, your code `{related_entries id='person_office'}{location_telephone}{/related_entries}` should be:

```
{person_office:location_telephone}

```

---
Tags: playa, stash, relationships
---


title: Blocks in ExpressionEngine

text:
# Question
Title: Blocks in ExpressionEngine
I am a Drupal developer doing my fist ExpressionEngine project.

Drupal uses a model of content 'blocks' that can be placed in regions on pages based on certain rules.

I understand the use of channels but can I tailor this to ExpressionEngine? Do I just create multiple channels and how can I make these blocks more flexible so I can choose which pages they appear on.

# Answer
> 4 votes
Welcome to ExpressionEngine! The first thing to understand is that EE has no concept of "regions" - it completely separates your content from your templates. The only content which appears at any given URL (which essentially is the same as your templates - templates in EE are like routes or controllers) is what you explicitly define inside your templates.

So, having said that, there are a few ways you could accomplish what you're after.

### Use a channel

You could setup a channel, and you could even call it "Blocks". You could then give it as many fields as you like - content, maybe an image, whatever might be useful for you for each "block".

Then, in your EE template - presumably inside of a snippet or an embedded template, which you'd be using throughout other templates - you'd write some conditional code:

```
{if segment_1 == 'about-us'}
    {exp:channel:entries channel="block" entry_id="32" disable="member_data|pagination|categories"}
        <div class="block about-us-block">
            <h3>{title}</h3>
            {block_content}
        </div>
    {/exp:channel:entries}
{/if}

```

(This assumes that the `entry_id` of the "About Us" block was `32`.)

The problem with this approach is that if you have a number of blocks on your page (in a sidebar or whatever), this is very resource intensive (running a `channel:entries` tag several times).

### Global Variables

This approach also lets you manage your "block" content inside of the control panel, but depending on how you approach it, gives you less flexibility. Global variables are always loaded, so you can use them anywhere in your templates with no performance hit.

If you use EE's global variables, you are limited somewhat, as each is just an empty text area where you dump text and/or HTML. But if you upgrade to something like Low Variables, you can create variables much like you create custom channel fields, and get much more sophisticated.

So if you dumped the entire HTML contents of your block inside of a global variable called `gv_about_us_block`, you could do:

```
{if segment_1 == 'about-us'}
    {gv_about_us_block}
{/if}

```

Or if you broke your block up into parts (say, inside of a Low Variables group):

```
{if segment_1 == 'about-us'}
    <div class="block about-us-block">
        <h3>{lv_about_us_block_title}</h3>
        {lv_about_us_block_content}
    </div>
{/if}

```

### Snippets

Snippets are a more advanced form of global variables, in that they can contain EE module/plugin tags as well. They are also managed inside the control panel (though many use add-ons such as Snippet Sync to store them in the filesystem instead). You could actually replicate *or* combine the above two approaches with snippets if you wanted - use a channel entry and put all that code in a snippet (which you then call inside your template conditional), or just dump your entire "block" content into a snippet and use it exactly as you would the first example above under Global Variables.

### Add-ons

There is an add-on called Widgets, which I have no experience with, and which appears not to have had too much development activity as of late, but may well work for you and get the job done. Its concept is similar to WordPress' widgets (but of course, since EE is a blank slate with no predefined regions of any sort, the widgets need to be added to your templates manually).

Hope that gives you some ideas on how to approach this!

---
Tags: module, content
---


title: search result related

text:
# Question
Title: search result related
I want to display up to 200 words of the related results just in the next line to title But i am not getting the text that {excerpt} should Display

My code is written below

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

<table border="0" cellpadding="6" cellspacing="1" width="100%">

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

    <tr class="{switch}">
   {if page_meta_title != ""} <td width="30%" valign="top"><b><a href="{if page_meta_resource}{page_meta_resource}{if:elseif page_meta_override_url}{page_meta_override_url}{if:else}/{title_permalink}{/if}">{title}</a></b></td>{/if}
</tr>
<tr><td style="color:red!important">{excerpt}</td></tr>
    {if count == total_results}
        </table>
    {/if}

    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}

{/exp:search:search_results}

</table>

```

# Answer
The `{excerpt}` variable, which is defined in the Channel Preferences, consists of the first 50 words from the field specified (see docs). If you need more than that, you're probably better off using the regular custom field notation and using something like Hacksaw or TruncHTML to limit that field to 200 words.

To make sure the `{excerpt}` is defined correctly:

* Go to CP \> Admin \> Channel administration \> Channels;
* Go to Edit Preferences for a channel;
* Under Administrative Preferences, make sure *Which field should be used for search excerpt?* points to the correct field (only fields that have been set as “searchable” will be included);
* Repeat for each relevant channel.
> 2 votes

# Answer
As Low has already said, you need to set the field as searchable.

To do that, go to the Channel Field that you want to use as the excerpt and set ***Is field searchable?*** to ***Yes***.

Then go back to the Channel preferences and you should now be able to select that field in the ***Which field should be used for search excerpt?*** dropdown.
> 0 votes

---
Tags: search
---


# Question
Title: Ban Keywords FreeForm Pro + AJAX Submit not working
I have a couple of 'ban keywords' set to try and minimise spam in a FreeForm Pro form. The form is inline validated and submitted via ajax/jquery. In the js code, I'm checking for data.seccess = true. However, even if I put some banned keywords in the form, I still get success=true and the form submits.. What can I do to make the form not submit when banned keywords are used?

# Answer
I have had contact with Solspace about this and after testing the form without AJAX the page through an error complaining about the an invalid regex match. In my banned keyword list there was an html "a" closing tag that was causing the error. So, you can only use normal words in the ban keyword field; no special characters.
> 0 votes

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


# Question
Title: Stash Destroys variable regardless of conditional
I have the following at the top of one of my pages:

```
{if "{fn_zone}"!=""}
    {redirect="/store"}
{if:else}

{exp:stash:destroy name="delivery_day"}

.... More stuff ....

{/if}

```

However, what I'm finding is that regardless of the conditional the stash variable is *always* being destroyed.

I've even tried changing it to the following:

```
{if "{fn_zone}"!=""}
    {redirect="/store"}
{/if}
{if "{fn_zone}"==""}
    {exp:stash:destroy name="delivery_day"}
{/if}

```

Yet its still doing the same.

Can anyone advice how to deal with this?

# Answer
> 3 votes
The quotes around {fn\_zone} mean it's an advanced conditional which may be the problem.

Can you do:

```
{if fn_zone == ""}
...
{/if}

```

Or you may have to use the if:else plugin:

```
{exp:ifelse parse="inward"}
    {if "{fn_zone}"!=""}
        {redirect="/store"}
    {if:else}

        {exp:stash:destroy name="delivery_day"}

    {/if}
{/exp:ifelse}

```

# Answer
> 2 votes
Yes, that is because the conditional is an advanced one, and will be parsed after plugin tags (ie Stash) (ref LOW's parse order PDF).

If the conditional was a simple one, this could work, but that depends on what {fn\_zone} is. Only segment, embed, global variables are parsed as simple, and you have to write the left hand part of the conditional witout curly braces and string identifiers. If {fn\_zone} is a global variable, something like this could do the trick:

```
{if fn_zone!=""}
    {redirect="/store"}
{/if}
{if fn_zone==""}
    {exp:stash:destroy name="delivery_day"}
{/if}

```

But, my goto solution in these cases is to use Croxtons Switchee or IfElse plugins, and have parse="inward" enabled. With switchee it would be something like this:

```
{exp:switchee variable="{fn_zone}" parse="inward"}
    {case value=""}
        {exp:stash:destroy name="delivery_day"}
    {/case}
    {case default="yes"}
        {redirect="/store"}
    {/case}
{/exp:switchee}

```

Hope that helps.

---
Tags: stash, conditionals, parse-order
---


# Question
Title: Replace File using Assets with S3 + Cloudfront
I'm attempting to replace an existing JPG image on S3 that's managed by Assets, but it appears the new file doesn't replace the existing one on S3.

My first thought was that it was an issue with browser caching, but I have it disabled, and, when viewing the file's URL in a different browser, I still see the old image, so, I'm confident the new file isn't ever making it to S3.

I do not see any errors in the EE control panel; everything else is working without any problems (upload, delete, move, etc.).

Steps to Reproduce:

* Upload a file to S3 in the EE CP using Assets
* Upload another file with the same name to to same folder
* Select "replace the existing file" at the prompt
* Right click the thumbnail/file, view file; file on S3 hasn't been updated.

This install is on EE 2.7.2 with Assets 2.2.2. Will not be able to provide credentials for troubleshooting, as it's behind a VPN on infrastructure I cannot modify; hopefully you can reproduce in your test environment.

# Answer
> 1 votes
We've been working like maniacs to hit a deadline on this project, and hadn't had time to deploy the updated version of Assets that P&T's support quickly provided; although I did notice yesterday that the file I was testing this issue with had updated... apparently it just took a few days.

I strongly suspect this was a problem for us because we're using Cloudfront to serve these files, not plain vanilla S3.

There are several posts in the regular Stack Exchange site that address this issue; in order for Assets to handle this automatically, it looks like a special API call would need to be performed. Don't know if that's possible or not, but, at least there's a theoretical solution.

Barring that feature support:

* advise content creators to upload files with a version number in the filename instead of replacing them directly
* wait a few days for the new version to propigate on its own
* issue a cloudfront update manually via an API call or the AWS control panel

# Answer
> 2 votes
When updating files connected to a CloudFront distribution you can speed up the required waiting period by invalidating the modified files. In many cases this reduces the waiting period to update CloudFront edge locations from days to under an hour.

Details here: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

---
Tags: assets, s3, cloudfront
---


# Question
Title: Pixel and Tonic Assets add-on -- Workarounds for Assets File Chooser Not Allowing a Directory to be Selected?
See subject. Wondering if anyone has needed the ability to select an Assets directory (e.g. on Rackspace) for a channel field?

Some ideas:

Method (1) (ugly): use the supplied Assets file chooser for a channel field, choose a file, and other code that uses this just ignores the filename. This is confusing for an EECP user creating/editing such a channel entry. The "display settings" for such a field does not let one hide the "Name" column either, which seems to be hard-coded in assets in quite a few places and not easily changeable. Hiding that field just makes it a little less confusing for an EECP user. A further strike against this is it also requires a file exist in any directory to be chosen.

Method (2): Write a channel field add-on, can likely be as easy as getting the directories from an Assets source (which are in the EE DB, since Assets indexes things) and presenting a drop-down list of directories for a given Assets source. This is likely
best, except for (4).

Method (3): Text field, and can validate is an actual path. Dead simple, but is a pain because would require the EECP user type in and already know the path name ahead of
time.

Method (4): (Hi P&T!) Is such a feature planned in Assets? Would be nice.

# Answer
Your second suggestion (a custom fieldtype which lists all directories and subdirectories indexed by Assets) is the best option absolutely.

Send feature requests to support@pixelandtonic.com.
> 1 votes

---
Tags: ee2, channel-entries, assets, pixelandtonic, feature-request
---


# Question
Title: Simple redirect with Redirectee doesn't work
In my Templates Global Preferences I've set the 404 page to go to pages/404.html template. In that template is a redirect to the 404 page:

```
{exp:redirectee:redirect status="404" url="/404/"}

```

It doesn't work, instead it shows a blank page, as if that tag wasn't in the template.

I have used the redirectee redirect on another template on the same site, and it works!

What am I doing wrong?

# Answer
> 2 votes
The problem is that the redirectee plugin use the native PHP header function which not support the 404 code. In fact it is a little bit strange to send a 404 with the header. Therefor you have to use a 302 code, the 404 page will send a 404 code on his page.

As for redirecting with the 404 code, you have the think of this QA:

* User: Hey, do you have anything for me at this URI webserver?
* Webserver: Yes, I do, it's a 'PHP' page. It'll tell you what the
response code is
* PHP: Hey, OMG 404!!!!!!!
* Webserver: Well crap, the 404 page people have already gone home, so I'll just send along
whatever PHP gave me

I just uploaded a new version of the Redirectee with a check on this problem.

---
Tags: redirects, 404, redirection
---


# Question
Title: EE 2.73 Channel Forms and Grid - no documentation
I'm trying to figure out how to add an editable grid field to my channel form - there is very sparse (i.e. none) documentation for this at the moment.

Basically I just need a logged in user to edit the existing grid field and also to add new rows. However, I don't want all fields to be display, so I need to use a custom\_fields type of loop rather than just {field:grid\_field\_name}.

Even using {field:grid\_field} in the form doesn't seem to work very well - I get the 'Add Row' button, but clicking it does nothing at all.

Anyone got this working yet?

# Answer
> 1 votes
@Derek is correct. Simply use the `{field:grid_name}` within the `{exp:channel:form}` tag pair. Make sure you also include the channel form css: `<link href="{path=css/_ee_channel_form_css}" type="text/css" rel="stylesheet" media="screen">`

Lastly, if you're loading jQuery already you could run into some issues as the channel:form will load jQuery as well and you may receive errors and general oddities. You may want to add the `include_jquery="no"` parameter in the form tag.

You may also need to move jQuery to the head of your document if you do the above. I was getting errors as the fields were attempting to access jQuery before it was loaded.

# Answer
> 1 votes
As it stands, `{field:grid_name}` is (as far as I know) the only supported way to use a Grid field in a Channel Form. I do see that the docs make note of Grid fields under the `{custom_fields}` section, but they then show simply using `{display_field}` when you encounter a Grid field within the Custom Fields loop.

The markup and interaction is pretty complex, so I guess they figure it's too difficult to support.

If `{field:grid_name}` is not functioning as expected, make sure you haven't set `include_assets="no"`, and that you've loaded the Channel Form CSS styles as well.

---
Tags: channel-form, grid
---


title: Solspace Calendar filter by day

text:
# Question
Title: Solspace Calendar filter by day
Maybe I'm just completely missing something, but I've looked through the docs a few times and haven't been able to find an answer. I'm working on building a way for people to go through events and filter them by day and time. Is there a way in Calendar to filter events by day? I haven't been able to find anything about it.

For example, I'd really like to be able to simply put something along the lines of:

`{exp:calendar:cal day="thur"}`

to only display events that occur on Thursdays. But so far, I haven't been able to find anything along those lines and I'd rather stay away from doing a somewhat complicated if statement. Especially with the number of filters I'm creating. I'm also using some query strings to filter, but I assume that wouldn't be an issue if I can just figure out how to filter events by day.

# Answer
There isn't a simple parameter for this. You must provide a time window for `{exp:calendar:cal}`, then filter for your day using a conditional. Here's a simple example for getting all events on Thursday for the current month:

```
{exp:calendar:cal
   date_range_start="year-month-01"
   date_range_end="year-month-last"
   pad_short_weeks="n"}
   {events}
      {if '{event_start_date format="%l"}' == "Thursday"}
         // Your event data
      {/if}
   {/events}
{/exp:calendar:cal}

```

Of course, in a different scenario, if you have a specific date and want to "zoom in" on that date (eg. Jan 30th, which was a Thursday), you can also set `date_range_start=""` and `date_range_end=""` on the same date to display only events on that day:

```
{exp:calendar:cal
   date_range_start="2014-01-30"
   date_range_end="2014-01-30"
   pad_short_weeks="n"}
   {events}
      // Your event data
   {/events}
{/exp:calendar:cal}

```

You can use also URI segments to determine what is used in the `date_range_start=""` and `date_range_end=""` parameters.

The `pad_short_weeks="n"` parameter is also important to avoid including all days from a full week row.
> 0 votes

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


# Question
Title: User / On the fly price for CartThrob recurring Subscriptions price
I'm trying to set a custom price for a recurring subscription in CartThrob. I've currently got the following code:

```
{exp:cartthrob:add_to_cart_form
    return="/become-member/checkout"
    subscription="yes"
    subscription_allow_modification="yes"
    shipping_exempt="yes"
    tax_exempt="yes"
    allow_user_price="yes"
    plan_id="{id}"
    subscription_interval_units="{interval_units}"
    subscription_interval_length="{interval_length}"
    subscription_price="{price}"
  }
    <input type="hidden" name="price" value="70.00" />
    <input type="hidden" name="subscription_price" value="70.00" />

   ....
  {/exp:cartthrob:add_to_cart_form}

```

That works fine, it'll set the price of $70.00 as dictated by 'subscription\_price'.

My problem is that users are able to add a concession card code to the product in the add to cart form and that will reduce the price to $66.50 (using javascript). Upon checkout this price is saved in the CartThrob order in the CP but the recurring subscription price is still the full $70.00 amount.

Is there a way to set the recurring price to the concession price if it's set in the checkout form or do I need to look into other options?

Thanks in advance!

# Answer
> 1 votes
Judging by your use of {id}, {interval\_units}, and {interval\_length} I'm assuming you have all that wrapped in a `{exp:cartthrob:plans}` tag pair and that you're trying to adjust the price of an existing plan. Here's how you would do that.

```
{exp:cartthrob:plans}
    {!-- specify the subscription plan id to add the item to the cart --}
    {exp:cartthrob:add_to_cart_form
         return="become_member/checkout"
         subscription_plan_id="{id}"
         form_class="form-horizontal"
         allow_user_price="yes"
         shipping_exempt="yes"
         tax_exempt="yes"
    }
    <input type="hidden" name="price" value="{price}" /><br />
    ...
    <input type="submit" value="Add plan" />

    {/exp:cartthrob:add_to_cart_form}
{/exp:cartthrob:plans}

```

All of the other subscription settings (units, length, etc.) will be handled by your plan settings in the subscriptions module.

When you update your price field with javascript and submit that add to cart form, it will apply to your subscription plan price.

---
Tags: cartthrob, subscriptions
---


# Question
Title: Exp:resso Store 2.x doesn't force/retain Last Name from single billing_name field for Authorize.net AIM
Not sure if this was addressed before but when I was using Store 1.6 with Authorize.net if a person failed to put a last name they would get an error.

After upgrading to Store 2.x it was necessary to split the `billing_name` form field into separate First and Last name fields.

I don't recall if this was because the last name was simply no longer required somehow (so no error with just one word submitted) or it if was somehow slipping through, but it just made more sense to use First/Last names separately now that they're split in the Order itself.

At the time this was a pretty big problem for us as we really needed the customers' last names. Several people were able to purchase with providing only a first name. I am not sure if this problem exists for other gateways and the transition from 1.6.x to 2.x.

edit for clarity:

In Store 1.6.x w/ Authorize.net:

* One billing name field, last name is required with only `require="billing_name"`, user gets an error if submitting checkout form without a second name ( `{error:payment_method}` would read `The Last Name field is required.` which to me suggests it's from the gateway.)

In Store 2.x w/ Authorize.net:

* One billing name field, order goes through with only one name despite being same form with `require="billing_name..."`. Last name is no longer required.

We didn't change anything on our merchant account. What went wrong? Was Store 1.6.x's error really from Authorize.net? If so, why doesn't it appear in Store 2.x? If not, why did it disappear in Store 2.x without any notice in the docs?

# Answer
> 1 votes
That's an interesting observation. It certainly wasn't an intentional change, but it seems like one for the better in your situation.

In Store 1.6, the check for a last name was coming from this line in CI-Merchant:

https://github.com/expressodev/ci-merchant/blob/master/libraries/merchant/merchant\_authorize\_net.php#L71

So the last name check was made by Store/CI-Merchant. This was probably due to the field being listed as required in the Authorize.net API documentation.

Store 2 uses Omnipay instead of CI-Merchant, so the payment gateways were rewritten from scratch. In the Omnipay Authorize.Net driver, there is only a check for a single name, not separate first name/last name (even though they are still separate fields in the gateway).

https://github.com/omnipay/authorizenet/blob/master/src/Omnipay/AuthorizeNet/Message/AIMAuthorizeRequest.php#L15

Since you have had orders go through successfully, it would appear that Authorize.Net does not have a problem creating payments with only a single name, and since the last name check was removed in Store 2/Omnipay, it's now working as expected.

---
Tags: expresso-store
---


# Question
Title: Subscribing Expresso Store customers to Mailchimp with SL MailChimp Subscribe
We've installed both Store and Mailchimp subscribe however seem to have run into a few issues:

* If a user registers via the default register screen, the form works and they get subscribed to mailchimp if they select Yes to subscribe, yay!
* If a user registers via our store checkout form their choice is saved in their expressionengine profile, however it won't add them to the mailchimp list, booo!

We've basically setup a custom field with the options yes and no, if they select yes it should subscribe them to the mailing list.

We've then mapped this custom field to a store custom field (order\_custom2) and used the following code in the checkout form:

```
  <div class="control-group {if error:order_custom2}error{/if}">
    <label class="control-label" for="order_custom2">Newsletter</label>
    <div class="controls">
      <select name="order_custom2" id="order_custom2" >
        <option value="Yes">Subscribe</option>
        <option value="No">Don't Subscribe</option>
      </select>
      {error:order_custom2}
    </div>
  </div>

```

We're struggling to see why this isn't working and any ideas would be much appreciated!

# Answer
We are using Mailchimp Subscribe on exp-resso.com, and in the basic case of subscribing new users to a mailing list it works fine.

The problem I assume is coming from your mapped member field, which isn't updated with the order value at the time Mailchimp Subscribe is looking for it.

Store creates orders in this order:

1. Process payment
2. If `register_member` was set, create a new user and assign to the order
3. If user is assigned to order, update mapped member fields
4. Save order

Now, without looking at the code I assume Mailchimp Subscribe is using a hook which gets called as part of (2). So at the time the user is created, none of their custom member fields are set (only username, email, password etc). This means that any extensions which depend on the standard member registration hooks won't be able to see the custom member fields.

There isn't really an easy workaround for this. The only suggestion I can make is to edit the extension so that it has explicit support for registering users created during the checkout. To do this, you would need to use the `store_order_complete_end` hook in Store, which is called after the order is saved (and all mapped member fields will be updated at that point).
> 1 votes

---
Tags: expresso-store, members, forms, mailchimp
---


# Question
Title: Expresso Store 1.6.5 with UPS Shipping: The maximum per package weight
I'm sure this has been covered and I've seen the updates in 2.0 that have fixed this issue but, is there a work around for Version: 1.6.5 pertaining to "The maximum per package weight for the selected service from the selected country is 150.00 pounds." error. I want to break these up into multiple packages.

I'm assuming its in here:

```
<Package>
                    <PackagingType>
                        <Code>'.$this->settings['packaging'].'</Code>
                    </PackagingType>
                    <Dimensions>
                        <UnitOfMeasurement><Code>'.$dimension_units.'</Code></UnitOfMeasurement>
                        <Length>'.sprintf("%.1f", $order_length).'</Length>
                        <Height>'.sprintf("%.1f", $order_height).'</Height>
                        <Width>'.sprintf("%.1f", $order_width).'</Width>
                    </Dimensions>
                    <PackageWeight>
                        <UnitOfMeasurement><Code>'.$weight_units.'</Code></UnitOfMeasurement>
                        <Weight>'.sprintf("%.1f", $order_weight).'</Weight>
                    </PackageWeight>
                    '.$insure_order.'
                </Package>

```

# Answer
> 1 votes
This feature (automatically splitting packages into multiple orders) was first added in Store 1.6.1, as can be seen in the release notes:

> Updated the UPS shipping plugin to split large orders into multiple packages

The code you have pasted above seems to be from Store 1.6.0 or earlier.

Therefore, if you are using 1.6.5 as you mentioned, you should not be seeing this problem (or even that code). I suggest you delete your entire third\_party/store folder on the server and re-upload a clean version of 1.6.5 to ensure you are actually running the latest version.

---
Tags: expresso-store, ups-shipping
---


title: Using Low Events with Seg2Cat?

text:
# Question
Title: Using Low Events with Seg2Cat?
Trying to build a simple event filtering system with categories (Seg2Cat) and dates. This is my current approach (which does not work):

```
{exp:low_events:entries channel="events_submitted|events_internal" category="{last_segment_category_id}" date="{last_segment}" dynamic="no" parse="inward"}

```

I did manually place a date in the parameter which also did not work.

```
{exp:low_events:entries channel="events_submitted|events_internal" category="{last_segment_category_id}" date="2014-06" dynamic="no" parse="inward"}

```

Ideally, I'd like to be able to achieve these results with just the one tag:

Is it possible for them to play together? Or should I rethink the approach? Perhaps use Low Search?

# Answer
> 2 votes
For the first URL, you won't get a valid category ID, as `{last_segment_category_id}` points to the last segment: the date. You'd need to get creative with simple conditionals and preload replace vars. Something like this:

```
{if segment_4 != ''}
  {preload_replace:pre_category="{segment_3_category_id}"}
{/if}

{preload_replace:pre_category="{last_segment_category_id}"}

{exp:low_events:entries
  category="{pre_category}"
  date="{last_segment}"
  ...
}

```

Note that this approach only works when using simple conditionals for the preload replace vars.

---
Tags: segments, low-seg2cat, low-events
---


# Question
Title: How do I resolve this scope issue with Stash?
I'm just playing around with implementing Stash on a site, following the Template Partials Using Stash article, but now I seem to be having a scope/execution order issue.

## Layout

```
<html>
 <head>...</head>
 <body>
  <div id="container">
   <div id="sidebar">
    {exp:member:custom_profile_data}
      {exp:stash:member_field_1}Foo{/exp:stash:member_field_1}
      {exp:stash:member_field_2}Bar{/exp:stash:member_field_2}
    {/exp:member:custom_profile_data}
   </div>
   <div id="content">
     {exp:stash:content}
   </div>
  </div>
 </body>
</html>

```

## Content Partial

```
{embed="layouts/content"}
{exp:stash:content}
<div>
 <h1>{exp:stash:member_field_1}</h1>
 <h1>{exp:stash:member_field_2}</h1>
 ...
</div>
{/exp:stash:content}

```

I have some custom member fields that I need in a few places throughout my content sections, so I'm trying to retrieve them in the layout and assign them to variables, in the hopes that I could save my content from being littered with {exp:member\] tags, but the variables don't seem to be available in my content partials.

I believe that it's not working because my Stash variables are being parsed before the values are assigned, and from what I believe I understand about the order of how EE is parsing the views, it goes something like this:

1. Partial is retrieved
2. Content is assigned to {exp:stash:content}
3. Layout embed is retrieved
4. Layout is parsed and {exp:stash:content} value injected.

Am I missing a feature/use-case of Stash, or am I simply using the wrong tool for this particular job?

**Update:** After racking my brain for days, and then writing this question, I tried saving the variable definitions in a snippet, which is called from my layout and it seems to work. I'd still be interested to know if there is a Stash implementation of this type of case, though.

# Answer
> 2 votes
You should try separating the data-fetching from the markup-assembly - this way you'll be able to cleanly fetch all your member variables and store them into Stash vars for use later (either in the same template or an embedded one). Here's a tutorial I wrote describing how to do this: http://www.jamessmith.co.uk/articles/expressionengine-stash-tutorial-level-2

---
Tags: stash, variable, template-partials
---


# Question
Title: "Undefined property: EE::$session" in ee.php after upgrade
After updating from v2.5.5 to v2.7.3, I get the following error:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: EE::$session

Filename: controllers/ee.php

Line Number: 41

Fatal error: Call to a member function userdata() on a non-object in /......../admin/expressionengine/controllers/ee.php on line 41

```

I feel like I have done this upgrade loads of times and I cannot work out where I'm going wrong here. I have overwritten all files as usual. The CP works fine.

Any ideas?!

D

# Answer
> 1 votes
For some reason, `expressionengine/controllers/ee.php` hadn't been replaced during the update, so instead of:

`class EE extends EE_Controller {`

it was

`class EE extends CI_Controller {`

# Answer
> 1 votes
Have you tried clearing the cache (Tools \> Data \> Clear Caching)?

If that doesn't help - what add-ons are you using? If you try disabling them one by one, does that fix it?

---
Tags: upgrade, ee2-upgrades, sessions
---


# Question
Title: ACK! Can't edit fields - getting WYGWAM error after EE & WYGWAM upgrade
EE v2.7.3 - Build Date: 20131210 / Wygwam - 3.2.2

when I go to:

CP Home -\> Add-ons -\> Fieldtypes

*OR*

CP Home -\> Administration -\> Channel Fields -\> (any field group even if there is no wygwam field in the group)

ERROR I get:

> A PHP Error was encountered Severity: Notice Message: Use of undefined constant FT\_PATH - assumed 'FT\_PATH' Filename: wygwam/ft.wygwam.ee1.php Line Number: 7 A PHP Error was encountered Severity: Warning Message: require\_once(FT\_PATHwygwam/config.php) \[function.require-once\]: failed to open stream: No such file or directory
>
> Fatal error: require\_once() \[function.require\]: Failed opening required 'FT\_PATHwygwam/config.php' (include\_path='.:/usr/lib/php:/usr/local/lib/php') in third\_party/wygwam/ft.wygwam.ee1.php on line 7

I can get to CP Home -\> Modules -\> Wygwam -\> Editor Configurations - and I resaved all my wygwam fields as per this post: WYGWAM PHP errors in CP after upgrade

THAT post mentions a post to look at on https://getsatisfaction.com/pixelandtonic but that info is "retired" :-/

> Sorry, the community that you’re looking for has been retired and is no longer available. If you need help, please contact the company you're looking for directly.

# Answer
> 1 votes
It looks like you uploaded the EE1 version of Wygwam. Not sure how that’s possible since Wygwam hasn’t shipped with EE1 files in a long time. Try re-downloading Wygwam from http://devot-ee.com and uploading the system/expressionengine/third\_party/wgywam/ and themes/third\_party/wygwam/ folders again.

---
Tags: wygwam
---


# Question
Title: EE 1.6.7 entries order within a category
I'm using this code:

```
{exp:weblog:categories weblog="games" style="none" show_empty="no"}
{exp:weblog:entries site="games_site" weblog="games" category="{category_id}" style="linear" disable="member_data|pagination|trackbacks" }
{title}
{/exp:weblog:entries}
{/exp:weblog:categories}

```

to display all the entries for all categories assigned to a specific weblog. This works ok, but I would like to maintain the order given to the entry inside each category. Is there a specific orderby parameter to use?

# Answer
After further investigations I understand that the items order is managed by a 3rd party plugin. Unfortunately I can't tell which plugin it is but apparently it adds an "order by" custom field type which contains the information about the order within the category. I wasn't aware of this particular plugin since I didn't create the EE site in the first place. Thanks anyway for the support.
> 0 votes

---
Tags: categories, orderby
---


title: Google maps for Expression Engine issue

text:
# Question
Title: Google maps for Expression Engine issue
I have a channel set up that has acc\_longitude and acc\_latitude, these fields have the correct coordinates for the destination applied. I am using this code below to try and display a map with the a marker of the destination. Below you can see my code for my attempt at this, I am just receiving a white box with no map in it. Any ideas? js script running below looks like this (being pulled in by the add-on).

{exp:gmap:init id="map" class="gmap" latitude="{acc\_latitude}" longitude="{acc\_longitude}" style="width:100%;height:200px;"}

# Answer
Issue was that the jquery.min.js file was in the footer, it was preventing the map from being rendered
> 1 votes

---
Tags: ee2, channel-entries, google-maps-for-ee, google-maps, low
---