title: Expresso Store: Subscription like cart

text:
# Question
Title: Expresso Store: Subscription like cart
Is there a way to mimic the add item to cart so a product(subscription) is added to cart during a registration process? In short I wanted to automatically add item in the cart using Expresso Store, that is if it's possible.

# Answer
> 2 votes
It is possible to add a product to the cart by simply visiting a page so upon successful registration you could redirect them to a success page which then adds the subscription item to their cart in the background.

It can be achieved by using AJAX to POST directly to Store's action URL. You simply add the add the product tag to the page as normal and then using JavaScript to make the submission automatically. Along these lines:

```
$("#productform").submit()

```

Where `#productform` is the ID of your form.

This can either be hidden or visible.

# Answer
> 1 votes
You could also use the Product Form Tag so that you can add multiple items to the cart with a single Add to Cart form and submit button. You would need to have something along the lines of:

```
{exp:store:product entry_id="{subscription_entry_id}"}
<input type="hidden" value="1" name="item_qty" />
{/exp:store:product}

```

---
Tags: expresso-store
---


# Question
Title: Channel entries tag sort by P&T Field Pack Dropdown values
I've got a P&T field for US states set up with values and labels like this:

```
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
etc...

```

I need to group entries by state, and the groups should be ordered by state name alphabetically.

CHANNEL ENTRIES TAG:

```
{exp:channel:entries
        channel="resource_links"
        show_future_entries="yes"
        show_expired="yes"
        status="not closed"
        order_by="resource_link_state"
        sort="asc"
        limit="9999"
        dynamic="no"
    }

```

I'm using some inline PHP to handle the grouping and that seems to be working fine. The problem is that the states are not coming back in ascending alpha order as I've tried to specify in my channel entries tag.

I'm getting: CA, CO, NM, NJ, OH, TX, LA, IL, FL, NY, NM, NY, AL, AK, AZ, AR, CT, DE, etc.

http://poms.mach1media.com/resource/links-by-state/

Anybody else run into this problem and found a solution?

# Answer
You should put the P&T drop down field's option as:

```
Alabama
Alaska
Arizona
Arkansas
California
Colorado

```
> -1 votes

---
Tags: channel-entries, pixelandtonic, field-pack, sort, pt-dropdown
---


title: How to encrypt/decrypt?

text:
# Question
Title: How to encrypt/decrypt?
I'm displaying a list of Channel entries in a "search results" page. Each item has a link to a "details" page. Right now, my URLs look like this:

```
domain.com/products/1/
domain.com/products/2/
domain.com/products/3/

```

I'd like to encrypt the entry ids when I generate the links in the search results page. In the details page, I'd like to decrypt that when I pass it as a param to `{exp:channel:entries}`. Is there a way to do this natively in EE? Or is there an addon that'll do this for me? Or should I enable PHP in the templates to make this happen? (other members will not have access to EE's CP, only the admin).

# Answer
I would suggest you just to use pages module for Products channel and enter the random string into Page URI of Pages.

But it wouldn't be good approach to generate and enter a URI (like /products/xA39sZ7s) containing random string into Page URI each time while editing or publishing an entry. To overcome it, just develop a small extension which will do update Page URI while editing or publishing the entry.

Now your site product urls will be like domain.com/products/xA39sZ7s/.

Hope, it would help you.
> 2 votes

# Answer
Maybe Encode/Decode Plugin might help? I haven't used it myself, so your mileage may vary.

From the Docs:

This plug-in is designed to help you encode and decode a string of text. Typical use would be to encode a string so it can be safely passed from one page to another in the URL. Includes support for json, base64, htmlspecialchars, htmlentities, uuencode and rawurlencode.

BASIC USAGE:

`{exp:encode_decode style="url" direction="encode"}This is @/ test string{/exp:encode_decode}`
> 0 votes

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


# Question
Title: Choose a specific low variable based on playa via stub?
Ok I have brands for products stored as a Playa so I can do various things with them...obviously simple things like:

`{cf_paper_brand}
 {title}
{/cf_paper_brand}`

However, later I want to include a list of articles based on that product's brand. I am storing these related articles in low variables(of playas) -

`lv_brand1_articles, lv_brand2_articles`

etc.

Thus my basic issue is I want to retrieve/choose the appropriate low variable based on the playa brand field.

This seems like it should be easy, and certainly I can do it with a bunch of conditionals I guess. But I am thinking there must be a more elegant solution...basically, I just need to get the brand title once and then use this in a few spots as a 'stub' when retrieving the low variable

In pseudo code:

```

if cf_product_brand == "brand1" then
    {exp:low_variables:parse var="{lv_brand1_articles}" var_prefix="brand_articles"}
        {brand_articles:title}
    {/exp:low_variables:parse}
else if cf_product_brand == "brand1"
    {exp:low_variables:parse var="{lv_brand2_articles}" var_prefix="brand_articles"}
        {brand_articles:title}
    {/exp:low_variables:parse}
else if....

```

etc... but for a LOT of brands, and I have related articles, links, and files. So I will end up with a block of 30+ conditionals - which sucks. Basically, I want to keep this mess of conditionals out of my template or at least in one spot in the template.

SO - If could set a stub of the brand title somehow, then retrieve {lv\_{stub}\_articles} - that would work....but I can't seem to do this. I have tried with stash but I am new to all the parse order issues and getting confused. I am thinking maybe I need to use a low variable with a pre\_parse thing but can't quite seem to get it ...

Any help much appreciated!! I am relatively new to EE and Stack Exchange etc. Hope I have asked correctly!

(And note - the brand is not available in the segment\_x variables as it's not in the URL. I could in theory put it there, but I'd really prefer not to)

# Answer
Ok for future reference, this is how I did it:

```

                {exp:playa:children field='cf_paper_brand' var_prefix="brand"}
                    {exp:low_variables:parse var="lv_links_{brand:url_title}" var_prefix="brand_links"}
                             ****** B- {brand_links:link_text}{brand_links:link_description}
                    {/exp:low_variables:parse}
                {/exp:playa:children}

```

Predictably, this seems obvious now.
> 0 votes

---
Tags: playa, low-variables
---


# Question
Title: Get matrix row/cell data in entry_submission_end hook?
Anyone know the proper way to get data stored in a matrix row from the entry\_submission\_end hook for use in an addon?

# Answer
> 1 votes
One solution I've come up with is to pull the rows directly out of the database. This works but seems like there should be an api or hook to do this still in the event the Matrix code gets refactored. I can also see that it's an unnecessary database query since you are saving the data then re-accessing it.

Below is an example with some hardcoded Matrix col\_id and field\_id values.

```
public function entry_submission_end($entry_id, $meta, $data)
{
    $query = ee()->db->from('matrix_data')
        ->select('col_id_362 status, col_id_363 email')
        ->where('field_id', 911)
        ->where('entry_id', $entry_id);

    $result = $query->get()->result();

    foreach ($result as $row)
    {
        error_log($row->status);
    }
}

```

# Answer
> 0 votes
I guess your starting point should be print\_r the array of submitted data, there you can see what field\_ids are submitted for Matrix. After that you can get specific field something like this $obj\[...\]\[...\]. I would also like to know if there is more "nicer" way of doing this.

**edit: I added my version of code based on yours**

```
public function entry_submission_end($entry_id, $meta, $data)
{
    //Just for test to see the field_id, you can check this in DB also
    // image 1
    print_r($data); //this will output array of submitted data

    //now that we know our matrix field, lets get it unserialized
    $matrix_field = unserialize(base64_decode($data["revision_post"]["field_id_3"]));

    //lets print to see what we will get
    print_r($matrix_field); //this will give result image 2

    // $matrix_field now contains our matrix array, so you can use it...
}

```

image 1: http://cl.ly/image/381i0k0v3C18

image 2: http://cl.ly/image/0V2A3F0x2Z3o

If you need to manipulate matrix data, don't forget to use `base64_encode(serialize($your_new_matrix_data));` to get it back to initial format.

I'm really new to all this, so maybe some add-on developer could provide better solution, but I think there is no need you to make another query to get data that are already there.

let me know if it helps

---
Tags: add-on, matrix, add-on-development, extension
---


# Question
Title: Templates in default group not displaying unless group name is in the URL
I have a set of templates in my default template group called "home".
These templates are "about", "contact-us", "membership" and of course "index".

Only the "index" template will display without the name of the group in the url.
PASS: example.com/
PASS: example.com/home/about
FAIL: (404) example.com/about
PASS: example.com/membership
FAIL: (404) example.com/home/membership

I have tested this with and without an "index.php" .htaccess re-write. No luck.

(Details: Brand new EE 2.6.1 install on stable cPanel server.)

I've never seen this happen before.
Thanks.

# Answer
This is as a result of the Strict URLs feature being enabled by default in EE2.6+ (previously it was opt-in, now it's opt-out).

If you want the old behaviour back you can change it in Global Template Preferences
> 5 votes

---
Tags: ee2, templates, url
---


title: LDAP Authenication on admin users?

text:
# Question
Title: LDAP Authenication on admin users?
I am new to Expression Engine, I am looking for a plugin or extension that will allow me to authenticate admin users against Active directory. Can someone point me in the right direction?

Thanks

# Answer
> 1 votes
Devot-ee + Google = your friend:

LDAP Authentication by Design by Front on Devot-ee (free)

As an aside, generally if you're looking for an add-on you are best off starting by searching Devot-ee first, as it basically has everything the community has released.

---
Tags: authentication
---


title: Multiple Hooks, One Extension

text:
# Question
Title: Multiple Hooks, One Extension
In the documentation the code to add enable extension hooks is like this

```
$data = array(
    'class'     => __CLASS__,
    'method'    => 'truncate_this',
    'hook'      => 'typography_parse_type_end',
    'settings'  => serialize($this->settings),
    'priority'  => 10,
    'version'   => $this->version,
    'enabled'   => 'y'
);

ee()->db->insert('extensions', $data);

```

So to add multiple hooks to one extension, then should I just simply repeat that code as many times as I wish??

```
$data1 = array(
  ...
);

ee()->db->insert('extensions', $data1);

$data2 = array(
  ...
);

ee()->db->insert('extensions', $data2);

```

# Answer
> 10 votes
Yes. For example....

```
    $hooks = array(
        "template_fetch_template" => "template_fetch_template",
        "typography_parse_type_end" => "typography_parse_type_end"
    );

    foreach ($hooks as $hook => $method) {
        $data = array(
            'class' => __CLASS__,
            'method' => $method,
            'hook' => $hook,
            'settings' => "",
            'priority' => 10,
            'version' => $this->version,
            'enabled' => 'y'
        );
        $this->EE->db->insert($this->EE->db->dbprefix . 'extensions', $data);
    }//###   End of foreach   ###

```

---
Tags: extension, hook
---


# Question
Title: Messaging Addon: You are not authorized to perform this action
I am trying to send a private message using http://www.intoeetive.com/docs/messaging.html:

```
{exp:messaging:pm_compose
    class="form-horizontal"
    return="SAME_PAGE"
    save_sent="yes"
    skip_success_message="yes"
}
    <fieldset>
        <input type="hidden" name="recipients" value='{exp:channel:entries channel="profiles" entry_id="{segment_2}"}{screen_name}{/exp:channel:entries}'/>
        <input type="hidden" name="subject" value=""/>
        <textarea class="span12" rows="5" name="message" id="message"></textarea>
        <button type="submit" class="btn">Send Message</button>
    </fieldset>
{/exp:messaging:pm_compose}

```

When I go to the page that contains the above code, I get the following error:

```
You are not authorized to perform this action

```

I'm using Safecracker Registration -- and that's why I have to get the `{screen_name}` that way (it gets it correctly). Any idea what's going on?

# Answer
The user was not in a member group that could send private messages. Problem solved.
> 0 votes

---
Tags: add-on, addons
---


# Question
Title: Why Does Pagination Appear Outside HTML Tag Wrapper?
This has bugged me for a while and I'd really like to know what the heck is going on. Here's my template:

```
<header>
    {!-- Pre-Pagination Header Content --}

{exp:channel:entries
    channel='mychannel'
    limit='10'
    disable='member_data'
    paginate='both'
}
    {if count == 1}
        {paginate}
            {pagination_links}
                <ul class="pagination">
                    {previous_page}
                        <li class="prev"><a href="{pagination_url}">«</a></li>
                    {/previous_page}
                    <span class="numbers">
                        {page}
                            <li{if current_page} class="here"{/if}>{if current_page == ''}<a href="{pagination_url}">{/if}{pagination_page_number}{if current_page == ''}</a>{/if}</li>
                        {/page}
                    </span><!--/.numbers-->
                    {next_page}
                        <li class="next"><a href="{pagination_url}">»</a></li>
                    {/next_page}
                </ul><!--/.pagination-->
            {/pagination_links}
        {/paginate}
    </header>

    <div class="listing">
    {/if}

    {!-- Listing Item Content --}

    {if count == total_results}
        </div><!--/.listing-->

        <footer>
            {paginate}
                {pagination_links}
                    <ul class="pagination">
                        {previous_page}
                            <li class="prev"><a href="{pagination_url}">«</a></li>
                        {/previous_page}
                        <span class="numbers">
                            {page}
                                <li{if current_page} class="here"{/if}>{if current_page == ''}<a href="{pagination_url}">{/if}{pagination_page_number}{if current_page == ''}</a>{/if}</li>
                            {/page}
                        </span><!--/.numbers-->
                        {next_page}
                            <li class="next"><a href="{pagination_url}">»</a></li>
                        {/next_page}
                    </ul><!--/.pagination-->
                {/pagination_links}
            {/paginate}
        </footer>
    {/if}
{/exp:channel:entries}

```

The pagination inside the header displays fine, but in the footer, the pagination `<ul>` displays *after* the `<footer>` tag it's wrapped in.

Why? Why does ExpressionEngine do that? Does it have to do with the `paginate` parameter? Is there a way to fix it besides buying AB Pagination?

# Answer
The pagination will display at the top, bottom or top and bottom of the channel entries tag (depending on what you set in the `paginate=""` parameter). It doesn't matter where you place `{paginate}` it in the template code itself.

Either use a pagination addon (like AB Pagination) or use Stash.

Mark Croxton has an example of how he moves his pagination to where he wants using Stash.
https://gist.github.com/croxton/1206694
> 4 votes

# Answer
I'm guessing this is more to do with a problem with your HTML (such as a tag that hasn't been closed or has been incorrectly nested) or, more likely, your CSS and quite possibly related to floated or absolutely position elements.
> -1 votes

---
Tags: pagination
---


title: Proper way to build URLs?

text:
# Question
Title: Proper way to build URLs?
I'm struggling to understand what is the "proper" way to build URLs in EE. I think I want my URLs to be built in such a way that it can take advantage of EE's `dyanamic="yes"`, etc. Right now, I can build URLs and use certain segments to display the content I want, but I'm not sure if I am doing it correctly.

Say I am building a simple forum. I have a Channel `forum_topics` which has Categories. I want to do the following:

1. Display a page with a list of categories. Each category will link to a list of Channel entries with that category. **Also, ideally, I'd like to list the last 10 entries for each category on this page. Is this possible?**
2. Display a list of Channel entries for a given category. Each channel entry will link to that entry's single entry page.
3. Display the single entry page.

I can do it, but I'm just not sure if I am doing it the "EE way." Here are the snippets of how I'm doing it:

```
1. FIRST template: loop through categories, create list of links to SECOND template

    {exp:channel:categories
        category_group="1"
        status="open"
        style="linear"
    }
        <a href="/forums/{category_id}/">{category_name}</a>
    {/exp:channel:categories}

2. SECOND template: use segment_2 in {exp:channel:entries}, set {entry_id} as 3rd segment

    {exp:channel:entries
        category="{segment_2}"
        channel="forum_topics"
    }

        <a href="{url_title_path='/forums/topics/{entry_id}/'}">{title}</a>
    {/exp:channel:entries}

3. THIRD template: use segment_3

    {exp:channel:entries
        channel="forum_topics"
        entry_id="{segment_3}"
    }

        <h1>{title}</h1>
    {/exp:channel:entries}

```

Any suggestions?

# Answer
> 4 votes
I wouldn't say that there is a right or wrong way to go about this (as long as you keep an eye on performance bottlenecks in the template debugger, which you should be doing all the time anyway)... Whilst EE does have some built-in ways of interpreting your URLs (http://www.jamessmith.co.uk/articles/expressionengine\_url\_schematic) there's no reason you have to use those ways, and if your templates are working the way you want and they're efficient then there's no need to change.

With that said...

For listing entries by category you can use the Category Archive tag. It's one of the worst tags available in EE as it's both lacking in power/features and is quite inefficient... but there you go.

Here's "the EE way" of setting this up...

For your first template, the category links would link to standard category pages - by which I mean URLs that contain either the category trigger word (as defined in your settings), or a category identifier, that looks for example like "C5". You can do this automatically using the {path...} variable. This allows your second template to automatically filter your channel entries so you won't need to specify `category="{segment_2}"`.

For your second template's links you could simply use `{entry_id_path=forums/topics}` or `{url_title_path=forums/topics}` \- I'd recommend the latter for better SEO. No need to have both the entry id and the url title in there unless you're pulling content from more than one channel (url titles ARE allowed to be duplicated for entries in different channels).

For your third template you then don't need `entry_id="{segment_3}"` (or `url_title="{segment_3}"`) as this will be automatically assumed in the absence of `dynamic="no"`.

---
Tags: channel-entries, templates
---


title: EE 2.6.1 updater stuck on Survey Screen

text:
# Question
Title: EE 2.6.1 updater stuck on Survey Screen
I'm trying to upgrade from EE 2.5.5 to 2.6.1, but I can't get through the updater. I get to the opt-in survey page and click submit, and I get the next screen that says it's updating to 2.6.0, but then it just goes back to the survey page.

# Answer
> 1 votes
I believe a lot of people have had better luck doing the 2.6.x update by renaming their 3rd party addon folder to something else during the upgrade then changing it back after. I don't know what addon is causing the issue, but I have theories. Do you run Matrix?

# Answer
> 0 votes
Thanks for the tip!

I encountered a similar problem while updating from EE 2.5.5 to EE 2.6.1, and changing the name of the third\_party add-ons folder did indeed enable me to complete the update, but unfortunately I did not get to complete the survey. Pity!

---
Tags: upgrade, ee2-upgrades, updating
---


title: Assets File Manager not showing images

text:
# Question
Title: Assets File Manager not showing images
I have the latest Assets on EE 2.5.5 and I'm not seeing the files in the File Manager. I have one upload destination called Uploads and in that, a number of subdirectories and files. When I update the index, it takes some time so it **looks** like it's found files, but the File Manager shows neither directories nor images.

All file permissions are fine and it appears to upload OK, I just can't browse and select anything. Any suggestions?

# Answer
> 1 votes
was having the exact same problem with ee2.6.1 and assets2.1.3.

After some deeper digging i found out assets created a new entry in the exp\_assets\_folders table where it remapped my parent directory to a new entry while deleting the orignal entry. Because of this all the other entrys where referring to the wrong parent\_id.

Manually corrected this problem and that seemed to fix the problem.

With kind regard, Bas van Ginkel

---
Tags: assets
---


title: URL Structure Shifts

text:
# Question
Title: URL Structure Shifts
I have a site that is using the simplest of URL layouts and was just asked if they could change.

Currently, they are as follows:

www.domain.com/details/item
www.domain.com/dates/item
www.domain.com/topics/item

Where 'item' is a separate entry that is linked via playa field. So all links are simply

www.domain.com/template\_group/index

and 'item' is {last\_segment} which triggers the entry {url\_title}

Now they would like to shift this to

www.domain.com/item/details
www.domain.com/item/dates
www.domain.com/item/topics

Is there something simple I am missing? I feel that each time I look at it, I start to over complicate it.

# Answer
> 0 votes
So, this is dirty, but seems to be working locally anyway. There may be much tidier solutions but they escape me.

In your home template, try using something like:

```
{if segment_2}
    {embed="{segment_2}" target="{segment_1}" /}
{/if}

```

This assumes you have a template group with the template set in segment 2 (i.e. details, dates, etc.). It may be prudent to add some additional logic to ensure the request is valid.

Then, again assuming you only want one entry on the details page, you can use:

```
{if embed:target}
    {exp:channel:entries channel="items" limit="1" url_title="{embed:target}"}
        Some code...
    {/exp:channel:entries}
{/if}

```

Theory being that all requests to non-existent stuff gets forwarded to the home template (so the old paths of /details/item *should* still work). Then the home template picks them up and embeds the template you actually want.

# Answer
> 0 votes
Whilst it's possible to achieve what you're looking for via any number of techniques (htaccess, pages module, convoluted embeds), I wouldn't recommend doing this at all. You'll end up fighting against EE the whole way, and if the site grows in complexity you'll have a maintenance nightmare on your hands. At a minimum, you'll need to specify a template in segment 1 and an entry in segment 2, so /items/item/dates

---
Tags: ee2, playa, url, relationships, url-title
---


# Question
Title: How do I use uploaded images from primary MSM site on other site?
I have a primary domain on a server then a secondary domain also on the same server. Using MSM, I setup the secondary site and things seem to be running smoothly except one thing.

The second site primarily mirrors the first site's content but with a different look/feel. I'm using channel entries from the primary site on the secondary site in some cases but have some issues with image assets.

I've found that in some cases I can use the site1.com's assets by just using the absolute url. But, if the image was uploaded within a field, there isn't the ability to just put "http://site1.com..." in front of the image.

Is there any sort of automatic way to have my image url's on site2.com point towards the folder on site1.com?

If it helps, I'm using Media Temple (gs) for hosting.

# Answer
> 1 votes
We have done this using symlinks on the server filesystem.

If you'd like to post some details about the server path to the site root on for both sites along with some paths for images I can give a more detailed solution.

---
Tags: multi-site-manager
---


# Question
Title: Using low search to pull up child categories
I'm setting up a search using nested categories. So in category\_grouy 5 I have 5 parent categories and a handful of nested child categories. Using the below returns all categories but parent searches return no results.

```
<select name="category[]" multiple="multiple">
    {exp:channel:categories channel="attraction" style="linear" category_group="5"}
        <option value="{category_id}"{if category_id IN ({low_search_category})} selected="selected"{/if}>
            {category_name}
        </option>
    {/exp:channel:categories}
</select>

```

Using this next section gives me the display I want but still the same problem. It's not returning any of the children.

```
<select name="category[]" multiple="multiple">
    {exp:channel:categories channel="attraction" parent_only="yes" style="linear" category_group="5"}
        <option value="{category_id}"{if category_id IN ({low_search_category})} selected="selected"{/if}>
            {category_name}
        </option>
    {/exp:channel:categories}
</select>

```

My question: I can display parent categories, so how do I get Low Search to return sub categories when the parent is searched?

# Answer
Can you go to CP -\> Admin -\> Channel Administration -\> Global Preferences.

See hear if "Auto-Assign Category Parents" is selected as "Yes".

I hope, it would work.
> 1 votes

---
Tags: categories, low-search
---


# Question
Title: If conditional to test if an entry does not have a relationship
I have a relationship field, and I want to display entries only if they are NOT populated with the relationship.

```
{exp:channel:entries channel="message" orderby="date" sort="asc" {gv_param_disable_default}}
        <ul>

            <li>
            {series_association}
            here's what doesn't seem to be working --> {if series_association:title == no_results}
            <h3><u>{title}</u> - <i><h5 class="inline-header">{message_date format='%F %j, %Y'}</h5></i></h3>
            <p>{if message_speaker}<i>Speaker:</i> {message_speaker}{/if}
            <p>{if message_scripture}<i>Scripture Reference:</i> {message_scripture}{/if}
            <p>{message_summary}</p>
            <audio src="{message_audio}" preload="none" />
            {/if}
            {/series_association}
            </li>

        </ul>

    {/exp:channel:entries}

```

How would I code this to make it show only entries without a relationship?

# Answer
> 1 votes
You can use no\_results but like:

```
{if series_association:no_results}
    --- your content ---
{/if}

```

---
Tags: relationships
---


# Question
Title: Two registration forms with two different member groups
Is it possible, maybe with Freemember or another free module, to choose the member group a member is assigned during registration?

I need two forms, each one assigning a different member group .

Can I do this without an add-on like Zoo Visitor or User by solspace?

Thanks in advance for your help.

# Answer
FreeMember 2.1.1 (released today) implements this feature. You can specify the group ID in the register tag:

```
{exp:freemember:register group_id="5"}

```

You can also whitelist group IDs in the register tag parameter, then submit the group\_id as a form parameter:

```
{exp:freemember:register group_id="5|6"}

    <select name="group_id">
        <option value="5">Author</option>
        <option value="6">Editor</option>
    </select>

{/exp:freemember:register}

```
> 3 votes

# Answer
Okay, so I just realized you were using Zoo Visitor. As @Derek Hogue, User by Solspace will handle this for you, or as I mentioned, hidden input fields on custom, but separate forms will work.

But Zoo Visitor allows for selection of user groups. I believe it also takes care of people trying to add themselves to SuperAdmin but you should also be able to strengthen the backend protocols so that only SuperAdmins can modify the SuperAdmin group. See this code from Zoo Visitor

```
{exp:zoo_visitor:registration_form error_handling="inline" return='account/register/success' allowed_groups="5|6"}

                Select member group:
                <select name="group_id">
                        <option value="5">Group with id 5</option>
                        <option value="6">Group with id 6</option>
                </select>

                Email*: <input id="email" name="email" type="text" value="" />
                {error:email}

                Password*: <input id="password" name="password" type="password" value="" />
                {error:password}

                Confirm password*: <input id="password_confirm" name="password_confirm" type="password" value="" />

                Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
                {error:member_firstname}

                Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
                {error:member_lastname}

                <input class="form-submit" type="submit" value="Register" />

{/exp:zoo_visitor:registration_form}

```

It's the Select member group section, you are interested in:

```
<select name="group_id">
    <option value="5">Group with id 5</option>
    <option value="6">Group with id 6</option>
</select>

```

**Here's an example with a hidden member group**

```
{exp:zoo_visitor:registration_form error_handling="inline" return='account/register/success' allowed_groups="5"}

        <input type="hidden" name="group_id" value="5">

        Email*: <input id="email" name="email" type="text" value="" />
        {error:email}

        Password*: <input id="password" name="password" type="password" value="" />
        {error:password}

        Confirm password*: <input id="password_confirm" name="password_confirm" type="password" value="" />

        Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
        {error:member_firstname}

        Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
        {error:member_lastname}

        <input class="form-submit" type="submit" value="Register" />

{/exp:zoo_visitor:registration_form}

```

Please take note that, I also limited what group\_id could be used in the form. I believe Zoo Visitor uses this as a security check, incase the registrant tries to manually supply a different member group, like group\_id="1" which would make them a super\_admin.

When duplicating the form, you would need to change both the allowed group and the hidden field value.
> 2 votes

# Answer
You can set the `default_member_group` in your **config.php** file:

```
$config['default_member_group'] = 6;

```

But this will apply to all new member registrations, not just those from a particular form.

FreeMember does not allow you to choose the member group new members are assigned to.

Alternately, you could look at the User module, which does allow you to specify the member group during registration.
> 1 votes

# Answer
Amasing extension that finally offers custom member groups during registration !!! **Member Group Assigner 2.1**
> -1 votes

---
Tags: members, safecracker, zoo-visitor, freemember
---


# Question
Title: Is there a way to add dropbox chooser or google drive picker into the publish page?
I've been using expression engine for 5 years now, but I am new to this forum, so hi everyone!

I was wondering if there is a way to use the dropbox chooser and/or google drive features inside the publish page of expression engine.

Had looked into devot-ee, but so far theres nothing for google, and for dropbox there is an addon but only to display dropbox files.

This will be really useful. I am needing this functionality currently for a site I am building.

Please let me know, if someone have a hint or have heard of something in this regard.

Thanks for your time

Regards

-Manuel

# Answer
> 2 votes
I've put together dropbox\_chooser which is a fieldtype. At the moment, it opens the Dropbox Chooser and allows you to pick a single file (whilst multiselect can work, I'm not sure how to output multiple links individually in a template).

You will need an App Key from Dropbox.

I'm no developer, but I needed this functionality.

---
Tags: add-on, fieldtype
---


title: SQL query syntax incorrect?

text:
# Question
Title: SQL query syntax incorrect?
This doesn't give me an error, but it also doesn't display any results. I'm trying to display only the entries that don't have a relationship. My relationship field is field\_id\_57, and I only want to display entries from channel\_id\_30. Am I doing something wrong?

```
{exp:query sql="SELECT * FROM exp_channel_data WHERE field_id_57 IS NULL && channel_id = '30'"}

content should display here

{/exp:query{

```

# Answer
Since channel entry titles & data are stored in different tables, you will need to `inner join` the two tables together to get the **Title** of the entry. Something like this:

```
SELECT ecd.entry_id,
ect.entry_id,
ect.title
FROM exp_channel_data AS ecd
INNER JOIN exp_channel_titles AS ect
ON ecd.entry_id = ect.entry_id
WHERE ecd.field_id_57 IS NULL
AND ecd.channel_id = '30'

```
> 1 votes

---
Tags: query, sql
---


# Question
Title: Exp:resso Store - Prevent updating mapped member fields from checkout
Is it possible to prevent Store from updating mapped fields during checkout unless an option to update is selected? Specifically billing and shipping addresses?

I'm using exp:user to allow a user to save a default billing and shipping address in their account. These are mapped to Store's order fields and everything works hunky-dory, except default behavior for Store is to update these details if they're changed during checkout (as detailed as a "remember my details" feature here: https://exp-resso.com/docs/store/settings\_order\_fields.html).

I would only like to update the mapped fields if an option in the checkout is checked. Something along the lines of an "update my default billing/shipping address" option.

Many thanks for any help.

# Answer
There is nothing built into Store that would allow you to selectively choose when to update the mapped member fields based upon a conditional or checkbox functionality. You could create a little extension to enable that kind of functionality (available extension hooks).

Alternatively and I have not tested something like this with Store you could use Profile:Edit which allows users to create multiple address profiles. Then in your templates you would have to manually create the store checkout fields so that you had

```
<input type="text" name="billing_address1" value="{profile_edit_field_for_billing_address1}" />

```

If you were going to use this approach you would probably not want to have the member fields mapped.
> 1 votes

---
Tags: expresso-store
---


title: Facebook Connect vs Zoo Visitor

text:
# Question
Title: Facebook Connect vs Zoo Visitor
I was wondering if someone has successfully implemented both Facebook Connect and Zoo Visitor on a single site. Are there any issues I should be aware of? Does creating an account through Facebook also trigger the creation of a Zoo Visitor member-channel entry? Client has requested a quote on this functionality and I don't want to promise something that's dead in the water before I've even started.

Thanks,

Steven

# Answer
> 2 votes
Steven, I would recommend using Yuri’s addon, Social Login PRO, if only for the fact that he and the EE Zoo team have worked to make them work well together. To that extent though, the documentation on ensuring a sync is a little sparse for my tastes. I do see this link: Integration with Zoo Visitor that shows a bit about how to ensure the syncing isn’t a one-time deal, but as for making it happen with FBC, I’m not sure it’ll happen yet.

# Answer
> 3 votes
I've done it on a site I worked on a while back. My memory isn't fresh, since it's been handed off to the client and my hands are completely off it, but I can tell you that it does work — it's just a bit tricky.

As powerful and awesome as Zoo Visitor is, you have to remember that you are basically duplicating data from EE's native member database into its own channel, and therefore when a user is created via alternate means (like Facebook Connect), you have to then ensure that the user also gets a new entry in the Zoo Visitor channel.

It sounds simple now, but you just have to invoke Zoo Visitor's sync tag:

```
{exp:zoo_visitor:sync}

```

…which frustratingly isn't mentioned in the official docs. I found out about it here:

http://devot-ee.com/add-ons/support/zoo-visitor/viewthread/2395

---
Tags: zoo-visitor, solspace, facebook
---


# Question
Title: Is it possible for the hook handler of safecracker_submit_entry_start to cancel form submission?
I have a hook handler for safecracker\_submit\_entry\_start that gets some value from a form field and processes it.

I want to validate the output of that process.

* If the output is good, then continue form submission
* If the output is not valid or bad, I want to cancel form submission and if possible, return some sort of error code or message

Is it possible for the hook handler of safecracker\_submit\_entry\_start to cancel form submission?

# Answer
As you are checking the Safecracker form submitted data and would like to show error and cancel submission on incorrect data.

Here is the code example which you have to write same like into the hooked function:

```
function function_name($obj)
{
$custom_error = 'XYZ'; // need to check the data if that error exist
if($custom_error)
{
array_push($obj->errors, $custom_error);
}
}

```

Now that error message will be shown also. If you are using error\_handling="inline" parameter then this error message will be shown within:

```
{global_errors}{error}{/global_errors}

```

In the same way, you can output the custom error message for any field with following example code:

```
function function_name($obj)
{
$custom_error = 'XYZ'; // need to check the data if that error exist
if($custom_error)
{
$obj->field_errors['field_name'] = $custom_error;
}
}

```

This error message can be outputted within safecracker for with the tag:

```
{error:my_field_name}

```

I hope, it would help you.
> 1 votes

---
Tags: safecracker, forms, hook
---


# Question
Title: can you set permissions with HooKan Permissions Manager
can you set permissions with HooKan Permissions Manager, or does it just display them? I see this plugin is for setting permissions and I didn't know if I needed to get both, http://devot-ee.com/add-ons/entry-permissions

# Answer
You can set permissions with HooKan. The HooKan CP will display permission statuses as you set/unset them. The interface is ajax, so you see status as you make changes.
> 2 votes

---
Tags: permissions
---


# Question
Title: Spaces being inserted into paragraph text when using Wygwam
I'm using Wygwam and it is inserting extra space into paragraphs which is making text display with an extra line top and bottom. If I click to Source view in the ee control panel, I can manually remove this and submit, then the text displays correctly. Any help would be appreciated. I'm on EE v2.6.1 and Wygwam 2.7.1. Cheers

# Answer
Thanks for getting back to me. I'm sorry to have wasted your time. It was due to a rogue css style. Which has resolved the issue.

Thanks again.
> 1 votes

# Answer
Can you replicate the behavior on http://ckeditor.com/demo? If so, then it's CKEditor behavior and there isn't much we can do to affect it.
> 0 votes

---
Tags: wygwam, plugin
---


# Question
Title: Create a link to add Matrix stored event to iCal using Easy iCal
Sorry if this is obvious but we have an entry which contains multiple venues and dates for a specific event.

I want the user to be able to add a specific venue and date to iCal by simply clicking on a link.

The Easy iCal docs are a bit light so can someone explain the best way to do this.

PS. Using Stash if that makes it easier!

# Answer
> 1 votes
I'm not even sure whether the ical format supports multiple venues, but I'm pretty sure the easy\_icalendar plugin doesn't. It was only designed for our specific requirements (a long time ago), so feel free to bend it to your needs.

To create multiple dates, you would simply create multiple events using a loop inside the calendar tag, as per the example:

```
{exp:easy_ical:calendar timezone="Pacific/Auckland" name="My Simple Event Calendar"}
    {exp:channel:entries channel="events" show_future_entries="yes" show_expired="yes" limit="20"}
        {exp:easy_ical:event uid="{entry_id}" start_time="{entry_date}" end_time="{expiration_date}" location="{event_location}" summary="{title}"}
            {event_description}
        {/exp:easy_ical:event}
    {/exp:channel:entries}
{/exp:easy_ical:calendar}

```

---
Tags: expresso, ical
---


# Question
Title: Searching channel entries using playa field
Im trying to send off the following channel entries request.

```
{exp:channel:entries channel="products" orderby="title" sort="asc" search:crops="{segment_3}"}
{/exp:channel:entries}

```

The crops field is a Playa field. If i use `{crops}` tag in my template, i get entry\_id(s), rather than the `url_title` or `title`.

Shouldn't `search:crops` try to match both `entry_id` and `url_title`?

If not, is there a way of getting `{entry_id}` from `{url_title}` if I know it is equal to `{segment_3}`, so that i call:

```
{exp:channel:entries channel="products" orderby="title" sort="asc" search:crops="{segment_3_entry_id}"}
{/exp:channel:entries}

```

Is there anything else I should be doing? Any help would be greatly appreciated!!

# Answer
Haven't test it but I assume if you use url\_title="{segment\_3}" it would be the same as entry\_id and search this specific entry+

otherwise you are searching all entry's in your channel

http://ellislab.com/expressionengine/user-guide/templates/globals/url\_segments.html
> 0 votes

---
Tags: channel-entries, playa, search, url-title, entryid
---


title: Custom fields in channel information?

text:
# Question
Title: Custom fields in channel information?
I have some channels on a site, with some of the channels making up the main navigation for the site.

Each top level navigation item needs an image, a short description, and a different title than the channel name.

Been looking for a plugin to add custom data to the channel itself, but I keep coming up short.

I might be missing an obvious way to do this, or maybe I just can't find the right module.

# Answer
> 2 votes
I could be wrong but i don't think there is such option in EE The only thing you could do is go to Admin \> Channel Administration \> Channels \> Edit Preference There you could change Full channel name and add a description but there isn't an option for image.

Perhaps low variable could be a solution in order to create a navigation + sub-navigation with different images, description and title?

Here is a list of how you could use Low Variables in different ways http://www.blue-dreamer.co.uk/blog/entry/creative-uses-for-low-variables

# Answer
> 0 votes
Create a channel with entries (maybe a matrix) that correspond to the channels...pull you nav from that?

---
Tags: channel
---


# Question
Title: Only show if there are related entries (EE 2.6)
I have a list of related entries on a single entry page. I only want to show surrounding code if there are related entries. I know related entries has been changed recently so I'm stuck.

I would expect the following conditional to work but it doesn't.

```
{if cf_article_related}
    <aside>
      <h2>Further Reading</h2>
      <ul>
        {cf_article_related}<li><a href="{cf_article_related:url_title}"> {cf_article_related:title}</a></li>
{/cf_article_related}
      </ul>
    </aside>
{/if}

```

I'm sure it'll be something obvious but I would love to know how to do this!

Cheers, Mike

# Answer
The documentation is confusing on the EL site. If you prefix the single tags variables `count` & `total_results` with the custom field name, you will have access to control your markup with conditionals. This should work:

```
{cf_article_related}
    {if cf_article_related:count == 1}
        <aside>
        <h2>Further Reading</h2>
        <ul>
    {/if}

    <li><a href="{cf_article_related:url_title}"> {cf_article_related:title}</a></li>

    {if cf_article_related:count == cf_article_related:total_results}
        </ul>
        </aside>
    {/if}

    {if cf_article_related:no_results}NOTHING FOUND{/if}
{/cf_article_related}

```
> 5 votes

---
Tags: conditionals, relationships
---


# Question
Title: {site_url} returns value without 'http://' string
In the control panel under

Admin \> General Configuration

I have set the value of the field 'URL to the root directory of your site' to be the URL of my site with the leading http://

eg: http://mysite.com

When I use the tag in templates it just returns

mysite.com (without the leading http://)

This is causing issues throughout my templates - is this expected behaviour?

# Answer
Check the config folder, you may need to set it in there with the leading HTTP too.
> 1 votes

---
Tags: templates, tags
---


title: Using matrix for FAQ's

text:
# Question
Title: Using matrix for FAQ's
Using EE to display FAQ's on my site. Each FAQ will have a link to an individual page for SEO reasons. I have two options:

1: Using EE's native channel entries and adding FAQ's individually/importing them as a batch with DataGrab.

2: Using a matrix field and having them all stored in one channel entry.

To get the faq's to display as separate urls I will use the additional matrix\_url\_title field type: https://github.com/pixelandtonic/matrix\_url\_title.

Now to me the standard entries way seems more efficient. However, can someone tell me which one is the best way in terms of Database queries etc.

Thanks, Ian

# Answer
I'm not sure about the differences DB queries-wise, but in terms of user experience, you may find entries the way to go. For example, as the number of FAQs increases, it may be useful to group them by categories, for example - natively pretty simple to do as entries. Not to mention the admin's entry workflow would be the same as it would be everywhere else. The advantage Matrix offers, potentially, is actively determining order. To do that with entries natively can be a bit of a pain (though Low Reorder makes that pretty simple).
> 2 votes

# Answer
I also like the idea of using entries instead of matrix fields - both for ease of maintenance, and so that - unless you're already using Matrix somehow else on this same site - to minimize the number of plugins/extensions being used.

It's possible to create a channel for the FAQ entries, and add a field to that channel that lets you specify the entry-order / question-order.
> 1 votes

# Answer
In the last couple of sites that I built that had FAQs, they were less than 20 questions per faq. I didn't set up a channel, but instead used a Low Variable that used the matrix field type. Super easy to use, easy to re-order and the clients are very happy with it.

If categories were required then I would take one of two options, create a whole new matrix per category or add a new column with a dropdown/p&T pill and have the category chosen on a per row basis. In this case in the matrix code you'd use matrix search {my\_matrix\_field search:age="\>=16"}
> 0 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: Events Addon? Need something like Meetup.com
I need to sell "events" to registered members of my EE site. Requirements are as follows:

1. Admin shall be able to create an event. An event is defined as having a start date/time, maybe an end date/time, a venue for the event, and a description.
2. Admin shall be able to set "pricing rules" for the event, primarily based around member details. For example, it's $0 for women, $10 for men, etc.
3. Admin shall be able to set quotas for the the event, primarily based around member details. For example, allow 10 men and 10 women to register for the event. Or allow 20 members to register, regardless of gender. Etc.
4. Allow members to register for the event. If the event requires payment, then process the member's payment.

Is there a native EE addon for this? If not, is there some 3rd party addon I can look at?

# Answer
You could conceivably build a solution using Cartthrob and Profile:Edit in conjunction - as your events could be simple channel entries. It would seem your "customers" would need to register for the site, with some sort of required "gender" field, which could then control which events would be visible, and to whom, or available for purchase. You could probably use price modifiers per event based on the cost per gender.

But it could potentially require some custom work for the products - i.e. for the quotas - you might need a custom extension for inventory - and how would you even begin to enforce the gender aspect?
> 2 votes

# Answer
Unfortunately this is not possible out of the box with ExpressionEngine. The only 3rd party events add-on that I was able to find is Low Events, which doesn't appear to do everything you need/want it to do.

The most complex part is likely to be the "pricing rules" and "quotas". It seems to me that you're likely to need a custom addon for that.
> 0 votes

---
Tags: add-on, members, addons
---


# Question
Title: Make channel entry show up regardless of URL
I have two channels: Blog and Offers; and I have a blog detail template. The blog detail template should display one of several entries depending on the URL. But the template should also display an entry from the Offers channel that is always the same.

Currently, the way it's working is, if I access the template without specifying the article name in the URL, I can see my channel entry (the thing at the bottom that says "Gearing up for a site redesign?"). But if the URL specifies a particular Blog entry (as in the link in the first paragraph), the channel entry won't show up. The opening code for the code for the channel entry looks like this: `{exp:channel:entries channel="offers" orderby="date" sort="desc" limit="1"}`

Note: this is now solved. I added dynamic="no" to the tag.

# Answer
> 0 votes
I have added a snippet to SublimeText to create a channel entries tag with defaults for both the disable="all the normal things" and dynamic=no. Actyally I store my disables in an early parsed low variable so that is a new one comes along I can add it in one place and it will propagate to all my templates...

Very handy - stops me tripping up on the dynamic thing time and time again!

Might be handy for you.

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


title: Database error from Safecracker

text:
# Question
Title: Database error from Safecracker
I have a page that allows registered users to post a entry on my site.

Since upgrading to the latest version of EE, I'm getting the following error, instead of the page loading:

```
Error Number: 1054

```

Unknown column 'date' in 'order clause'

SELECT DISTINCT `exp_channel_titles`.`entry_id`, `exp_channel_titles`.`title` FROM (`exp_channel_titles`) WHERE `exp_channel_titles`.`channel_id` IN ('5') AND `exp_channel_titles`.`entry_date` \< 1369859305 AND (exp\_channel\_titles.expiration\_date = 0 OR exp\_channel\_titles.expiration\_date \> 1369859305) ORDER BY `date` desc

Filename: modules/safecracker/libraries/safecracker\_lib.php

Line Number: 2736

# Answer
I was able to solve this problem myself using the following bug report on the EE site:

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

Although the bug has been fixed in more-recent versions of EE -- you can see the patches in the source files -- it still may be necessary to open and save any relationship fields in your channels.

Just go to Administration / Channel Fields, and check set set of fields for any relationship fields. Open them, don't change anything, and then update them. That solved the problem for me.
> 0 votes

---
Tags: safecracker, database
---


title: Only show if there are sibling entries

text:
# Question
Title: Only show if there are sibling entries
I am showing entries from the same category on a single entry page.

```
<aside>
        <h2>Categories</h2>
        <ul>

    {exp:channel:entries
      channel="articles"
      disable="member_data|pagination|trackbacks"
      require_entry="yes"
      dynamic="off"
      related_categories_mode="on"
    }

    <li><a href="/articles/detail/{url_title}">{title}</a></li>

    {/exp:channel:entries}

        </ul>
    </aside>

```

All good but I only want the container to show if there are those entries. Any ideas?

Thanks!

# Answer
> 2 votes
You could move the wrapping html into the channel entries loop, like so:

```
{exp:channel:entries
  channel="articles"
  disable="member_data|pagination|trackbacks"
  require_entry="yes"
  dynamic="off"
  related_categories_mode="on"
}

{if count == 1}
  <aside>
    <h2>Categories</h2>
    <ul>
{/if}

<li><a href="/articles/detail/{url_title}">{title}</a></li>

{if count == total_results}
    </ul>
  </aside>
{/if}
{/exp:channel:entries}

```

If there are no results, nothing will get displayed. If you want to trigger something to happen, just use the no\_results trigger:

```
{if no_results}{embed="inc/random_entries"}{/if}

```

Iain

---
Tags: categories
---


# Question
Title: Using Low Search with a custom date range
I'm trying to add 2 text fields in Low Search for users to select a beginning and end date for an event search. I'm basing my events off of entry\_date instead of a custom field (though I could run a custom field if it's easier).

```
    <label for="start_on">From</label>
    <input type="text" class="datepicker" placeholder="From" name="start_on">

    <label for="stop_before">To</label>
    <input type="text" class="datepicker" placeholder="To" name="stop_before">

```

When I enter my dates (currenty being returned in YYYY-MM-DD format, search results return nothing. I'm feeling a bit lost on how to get low search to read my start\_on and stop\_before limits.

# Answer
> 0 votes
Both the `start_on` and `stop_before` parameters need this format: `YYYY-MM-DD HH:MM`, as per the native docs. If you make sure the fields are in that format before the form is submitted, it should work.

---
Tags: low-search
---


# Question
Title: Show a list of child categories plus it's entries
I need to show a list of child categories plus it's entries. I had done this great using a child categories extension but now I need the ability to use Low Reorder. I have tried numerous ways get them to work together with no luck so I think I need another method. I haven't posted my current code because I'm sure it will need completely re-writing. Happy to post if needed but this is the structure I'm hoping for.

```
<dl class="cat-list">

<!-- child category loop -->

<dt><span>{child_category_name}</span></dt>
<dd>
    <p>{child_category_description}</p>
<ul>

  <!-- entries loop -->

  <li><a href="/articles/detail/{url_title}">{title}</a></li>

  <!-- /entries loop -->

</ul>
</dd>

<!-- /child category loop -->

</dl>

```

Any help would be greatly appreciated.

# Answer
Your example code looks a lot like the example I used in this article. It doesn't necessarily take child categories only into account, but the principle is the same.

You could use the same solution I mention in the blog post, but use the Query tag (or a 3rd party add-on) to only get child categories and use Low Reorder to get the entries in the right order. However, you'd need a certain setup: one big Low Reorder set containing all entries from all categories, ordered the way you want. Then you could filter that list by category. That implies that an entry could only belong to 1 category.

If entries belong to multiple categories, the nested approach might be the only way. Just keep a close eye on the number of queries generated. As for the LR setup, a single set with 'show entries per single category' option will allow you to create ordered lists per category. Nesting that inside the Query tag (or 3rd party add-on) will let you use a {category\_id} as a parameter to get to the right list.

So sorry, no easy answer for this one. It's always been a bit of a pain to generate entries per category in one go.
> 1 votes

---
Tags: low-reorder, child-categories
---


# Question
Title: CartThrob Price Modifier - Hide form if no options available
I have a channel to create an event. I also have a CartThrob Price Modifier field to add tickets if they are available.

On the single entry page, I only wish to show the exp:cartthrob:multi\_add\_to\_cart\_form if the single entry has available tickets.

I'm using the following code;

```
{if event_tickets:total_results}
<div id="event_tickets" class="box toptagorange buybox">
    <h2>Buy Tickets</h2>
        {exp:cartthrob:multi_add_to_cart_form
            return="shop/basket"
        }
        <fieldset>
            <table>
                <tbody>
                    <tr>
                        <th class="ticket">Ticket</th>
                        <th>Qty</th>
                    </tr>
                    {event_tickets}
                    <tr>
                        <td>{option_name} <span class="price">{exp:cartthrob:view_formatted_number number="{price:plus_tax}" prefix="£" decimals="2"}</span></td>
                        <td><input type="text" name="quantity[{row_id}]" value="" class="tiny" /></td>
                        <input type="hidden" name="item_options[{row_id}][event_tickets]" value="{option_value}" />
                        <input type="hidden" name="entry_id[{row_id}]" value="{entry_id}" />
                    </tr>
                    {/event_tickets}
                </tbody>
            </table>
        </fieldset>
        <input type="submit" value="Buy Tickets">
    {/exp:cartthrob:multi_add_to_cart_form}
</div>
{/if}

```

This works fine for an event that has tickets. However, if an event doesn't have any tickets then the page just goes to a 404. I was wondering if someone might be able to help figure this out?

Thanks, Neil

# Answer
Solution using Matrix field type instead:

```
{if event_tickets}
<div id="event_tickets" class="box toptagorange buybox">
<h2>Buy Tickets</h2>
{exp:cartthrob:multi_add_to_cart_form
return="shop/basket"
}
<fieldset>
<table>
<tbody>
<tr>
<th class="ticket">Ticket</th>
<th>Qty</th>
</tr>
{event_tickets}
<tr>
<td>{if option_name}{option_name}{if:else}{option_value}{/if} <span class="price">{price_plus_tax_numeric}</span></td>
<td><input type="text" name="quantity[{row_id}]" value="" class="tiny" /></td>
<input type="hidden" name="item_options[{row_id}][event_tickets]" value="{option_value}" />
<input type="hidden" name="entry_id[{row_id}]" value="{entry_id}" />
</tr>
{/event_tickets}
</tbody>
</table>
</fieldset>
{if '{event_tickets:sum col="inventory"}' == 0}
<p>Out Of Stock</p>
{if:else}
<input type="submit" value="Buy Tickets">
{/if}
{/exp:cartthrob:multi_add_to_cart_form}
</div>
{/if}

```
> 1 votes

---
Tags: cartthrob, ecommerce, redirects
---


# Question
Title: Ajax Login Validation using native EE function
I'm rather new to EE, and I'm having a hard time finding some stuff in it. I started working on a legacy site that is pure EE template and for every validation it goes to a new page. I'm wanting to use jQuery/Ajax/EE for validation, but I can't find the function that would validate the data on submission. I also want to know what is EE using to hash the passwords so I can correctly hash before I send to the server. If anyone can provide a link or an answer I would be very grateful.

# Answer
> 1 votes
If I understand you correctly then you don't really need to know what function EE is using but simply submit your login form via Ajax to the URL it would normally submit to.

You might also want to look at these add-ons. Some of them cost a few dollars but they will probably cost less than the time you will spend on trying to create the same functionality.

http://devot-ee.com/search/results?keywords=ajax+login&addon\_version\_support=ee2

---
Tags: ee2, ajax, validation
---


title: Using playa to get entries

text:
# Question
Title: Using playa to get entries
one called "crops" one is named "products".

Crops linked to products, through a playa field for the products channel.

At the moment my tag produces a list of crops but many are repeated.

When populating a crops menu, I want to query those crops who are linked to a product. This way, crops for which we dont have products assigned aren't listed. I want a unique entry for each crop that has 1 or more products associated to it.

Any ideas?

*Update*

Here is the code I left out last time...

```
{if segment_2=="crops"}
<div class="box plants">
    <h2>Φυτά</h2>
<select>
    <option {if segment_2==""}selected="selected"{/if} value="/index.php/products/">όλa</option>
        {exp:channel:entries channel="products" orderby="title" sort="asc" dynamic="no"}
            {exp:playa:children channel="crops"}
                {if count>0}
                    <option {if segment_3==url_title}selected="selected" {/if} value="/index.php/products/crops/{url_title}">{title}</option>
                {/if}
            {/exp:playa:children}
        {/exp:channel:entries}
</select>
</div>
{/if}

```

The playa relationship is a field in products channel that links to entries (fieldname={crops})in the crops channel. Not sure whether this is revers relationship or not.

# Answer
I had exactly this problems, and I used Nested Entries instead. Maybe this can help you too.

```
{exp:channel:entries channel="country"}
    {title}
    {exp:nested:prep_vars var_prefix="nested_"}
        {exp:nested:entries channel="office" dynamic="off" search:cf_office_country="{title}"}
            Office: {nested_title}
        {/exp:nested:entries}
    {/exp:nested:prep_vars}
{/exp:channel:entries}

```
> 1 votes

---
Tags: playa, relationships, entry
---


title: Dropdate Array Error

text:
# Question
Title: Dropdate Array Error
Using Dropdate 2.2.0 and EE 2.5.1

Outputting the field gives me this:

```
A PHP Error was encountered

Severity: 4096

Message: Argument 2 passed to Dropdate_ft::replace_tag() must be of the type array, boolean given, called in     /Users/Chad/Repositories/hhc/site/system/expressionengine/libraries/channel_entries_parser/components/Custom_field    .php on line 125 and defined

Filename: dropdate/ft.dropdate.php

Line Number: 338

A PHP Error was encountered

Severity: Warning

Message: array_merge(): Argument #2 is not an array

Filename: dropdate/ft.dropdate.php

Line Number: 357

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at     /Users/Chad/Repositories/hhc/site/system/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 412

```

Can someone direct me to a fix for this? I couldn't see anything obvious in the code. Line 338 is

```
public function replace_tag($field_data = '', Array $params = array(), $tagdata = '')

```

and the param in question is Array $params = array()

# Answer
> 1 votes
That add-on is now discontinued, I'm using v3 successfully though - you can find it in the GitHub account under the Develop branch.

There's a mention of array\_merge in the errors (on my version of DropDate it's line 482 in \_build\_settings method), this tries to intersect array keys regarding settings. Try going to the settings for the fieldtype in EE backend to see if that updates anything, I get this message when I go there:

> We lured you here under false pretences.
>
> There are no global settings, but ExpressionEngine won’t update a fieldtype unless you visit its global settings page. Obviously.
>
> Just click the “Submit” button, and get back to your nice life where you don’t have to deal with this nonsense for a living.

...So clearly it's done something...!

Otherwise, (on my version) display\_var\_tag calls replace\_tag, so you could add a check on that:

```
public function display_var_tag($var_data, Array $params, $tagdata)
{
    if (!is_array($params)) {
        return $this->replace_tag($var_data);
    } else
        return $this->replace_tag($var_data, $params);
    }
}

```

---
Tags: fieldtype, date, dropdate
---


# Question
Title: $system_path for EE setup in subdirectory
I need to move an EE install into a subdirectory. The site currently has the system folder above web root and uses focus lab's dynamic config setup.

My desired setup would this:

```
--system
--config
--public_html
   |
   |-my_subdirectory
      |
      | -assets
      | -index.php
      | -admin.php
         etc.

```

However I could not get the index.php working as yet. Anyone having an idea what the correct value for the $system\_path variable located in the index.php would be?

Many Thanks

# Answer
> 3 votes
The solution involved the following steps:

1. set the $system\_path in the index.php and admin.php to $system\_path = '../../system';
2. change a couple of lines in the config.master.php:

on line 93 add your directory name to the $base\_url variable like so:

$base\_url = $protocol . $\_SERVER\['HTTP\_HOST'\].'/my\_subdirectory';

on line 94 add your directory name to the $base\_path variable like so:

$base\_path = $\_SERVER\['DOCUMENT\_ROOT'\].'/my\_subdirectory';
3. in case you use absolute path for your links in the site you will also have to do a find and replace for your href tags.

---
Tags: php, focus-lab-master-config
---


# Question
Title: How to display entries from current category grouped by another category
I have content entries in a channel called resources.

Resources primary categories are whitepapers and downloads.

Secondarily, the entries are categorized by "brand"

What I want to do is grab the current category id (e.g. downloads) but then display the entries grouped by "brand"

This is my code.

```
{exp:channel:category_heading channel="resources"}
{!--grab main category we're viewing. E.g. we're viewing "downloads" in the "resources" channel--}
<?php $category = '{category_id}'; ?>
{/exp:channel:category_heading}

{!-- loop through the brands --}
{exp:channel:categories category_group="2" show_empty="no"}

    <h2 style="float:left; clear:both; width:100%;">{category_name}</h2>

    {!-- now display entries from this main category (e.g. downloads) that are also categorized under the current brands --}
    {exp:channel:entries category="<?php echo $category; ?> & {category_id}" channel="resources" disable="member_data|pagination|trackbacks"}

        <a href="{pdf}">{title}</a><br>

    {/exp:channel:entries}

{/exp:channel:categories}

```

Where it says $category and category\_id, only recognizing the latter. I can accurately print the $category to screen in the loop but the category= filter doesn't recognize it.

Thoughts?

# Answer
> 0 votes
It looks like you have a mix of using php on input and output in the same template. Output while setting $category (EE tags run first, then output {category\_id} for use in php), and input while echoing $category (PHP runs first and outputs $category as a string for use in an EE tag).

So you'll only be able to set the template for one or the other. You could use something like Stash to set the variables instead of php, or move the interior channel entries to an embedded template.

UPDATE:

```
{exp:stash:set name="main_category_id" parse_tags="yes" trim="yes"}
    {exp:channel:category_heading channel="resources"}
        {category_id}
    {/exp:channel:category_heading}
{/exp:stash:set}

{exp:channel:categories category_group="2" show_empty="no"}
    <h2 style="float:left; clear:both; width:100%;">{category_name}</h2>

    {exp:channel:entries
        category="{exp:stash:get name='main_category_id'}&{category_id}"
        channel="resources"
        disable="member_data|pagination"
        status="not closed"
        dynamic="no"
        parse="inward"
    }
        <a href="{pdf}">{title}</a><br>
    {/exp:channel:entries}
{/exp:channel:categories}

```

# Answer
> 1 votes
I would construct the filter/entry relationship differently to avoid nesting a channel entries loop inside the channel categories loop.

**SOLUTION REQUIRES:**

```
Pixel & Tonic's Playa add-on (http://docs.pixelandtonic.com/playa/)
Low's Seg2Cat add-on (http://gotolow.com/addons/low-seg2cat/docs)

```

**CHANNELS**

```
• Resources {resources}
• Brands {brands}

```

**RESOURCE CATEGORY GROUP**

```
• Resource Type
   - Downloads {downloads}
   - White Papers {white-papers}

```

**RESOURCE CUSTOM FIELDS**

```
• Resource Asset {resource_asset}
• Resource Brand {resource_brand}
   - Type: Playa
   - Field Label: Brand
   - Field Short Name resource_brand
   - Is this a required field? YES
   - Allow multiple selections? NO
   - Show expired entries? YES|NO
   - Show future entries? YES|NO
   - Channels: Brand
   - Categories: Any
   - Authors: Any
   - Statuses: Open
   - Limit entries to: All
   - Order entries by: Entry Title in Ascending Order

```

**TEMPLATE CODE**

```
http://www.example.com/resources/downloads/

{exp:channel:entries channel="brands" dynamic="no" disable="..."}
    {if {exp:playa:total_parents} > 0}

    <h1>{title}{if segment_2} > {segment_2_category_name}{/if}</h1>

    {exp:playa:parents channel="resources" category="{segment_2_category_id}"}
        <a href="{resource_asset}">{title}</a><br />
    {/exp:playa:parents}

    {/if}

{/exp:channel:entries}

```

I have not tested the overhead for this solution, so I do not know how it would compare to the Stash solution above.

---
Tags: php
---


# Question
Title: What are the best practices for having multiple Matrix field on one Safecracker form?
I have a safecracker form with 4 very similar ( a few of the same colmumn names ) Matrix fields. When I click the + button to add a row to one of the Matrix fields it adds 4 rows each with a number 1 on the rows. The second field add three rows with a number one and third adds two rows with a number one.

# Answer
> 2 votes
Matrix is smart enough to know one unique Matrix field from another. But, are you using template conditionals to do any display logic? If so, you might have the field tags for each unique field appearing more than once in the template.

(If you are inadvertently initializing the same fields more than once, the JavaScript would be included more than once on the page, causing duplicate actions to occur on various events.)

For example, something like...

```
{if segment_X}
  Edit entry #{segment_X}:
  {field:my_field_name}
{if:else}
  Add a new entry:
  {field:my_field_name}
{/if}

```

...could cause the sort of issue you're describing.

---
Tags: matrix
---


title: Randomize Filenames of Uploaded Files

text:
# Question
Title: Randomize Filenames of Uploaded Files
I'm allowing members to upload images. Is there a way to tell EE that the uploaded files should be assigned a randomized filename? I need this feature for privacy reasons and to prevent collisions.

I'm using Safecracker and Matrix, if that matters.

# Answer
> 1 votes
Assets and Channel Images both automatically prevent file-name collisions on upload, and both are Safecracker compatible.

For privacy, you can obfuscate the name (and even make it time-sensitive) using Channel Images' Locked URL tags (only for files in Channel Images), or using the Link Vault plugin (for any file, anywhere).

# Answer
> 2 votes
Photo Frame does this, and much much more. You can define any filename format you want. It works within Safecracker and is compatible with Matrix and Assets.

Sample Filename Format:

```
{random_string}-{height}-{width}.{extension}

```

So this would generate a file called, "s2f4leQs-450-250.png"

https://objectivehtml.com/photo-frame

---
Tags: file-uploads
---


title: Exp:resso Store Send Orders to Supplier

text:
# Question
Title: Exp:resso Store Send Orders to Supplier
I have a client that I am implementing Exp:resso Store for. The client does not keep the items for in stock but rather orders them directly from the supplier once an order is placed and the supplier ships directly to the customer. Does anyone know if Exp:resso Store has such a capability to send order confirmations to the supplier once the customer has placed the order and payment is confirmed? This capability would also need to be able to bundle all items from an order to a single supplier if it so happens as client wouldn't want the supplier to get multiple requests for the same order.

Thanks

# Answer
It should be possible, I am going to explain a bit of what happens to help clarify.

* Emails are linked and sent out based upon order status.
* Orders can transition through multiple order status and therefor send out multiple emails. - By default Store creates an order status of "New" and sets that as the default order status.
* There is also a generic email template that is created and linked to the status of "New".
* When the user places the order and has a valid payment the order is considered complete and the default status is applied to the order and the linked email is sent out.

So if you wanted your supplier to know that the user has placed an order you can set them up as a BCC recipient in the email template settings for the email template that you have linked to the default status.
> 1 votes

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


# Question
Title: Pagination - blank pages and weird numbering
I have enough results for 2 pages, but my pagination links show 3 pages of results, the 3rd page being blank. Also, the segment that should show the pagination page number (i.e. P1, P2) says P2 for the second page, and then jumps to P4 on the third page. Anyone ever seen this before?

```
{exp:channel:entries channel="message" dynamic="no" limit="2" paginate="bottom" orderby="date" sort="desc" disable="categories|category_fields|member_data"}
        {series_association}
        {if series_association:no_results}
        <ul class="message-list">

            <li class="media-view">
            <h2><u><a href="{path=media/media-view/{url_title}}">{title}</a></u> - <i><h5 class="inline-header">{message_date format='%F %j, %Y'}</h5></i></h2>
            <p>{message_summary}</p>
            </li>
        {/if}

        {if "{count}" == "{total_results}"}</ul>{/if}
        {/series_association}
        {paginate}

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

        {/paginate}

    {/exp:channel:entries}

```

# Answer
The number jumping is dictated by the number of entries you're showing on the page. You have two entries, and so they go up in 2s, i.e.

Page 1: Entries **0** and 1

Page 2: Entries **2** and 3

Page 3: Entries **4** and 5

As for the blank page, the tag is paginating the channel entries returned from the channel entries tag. If there are 5 entries in the channel, you'll get 5 entries back and so 3 pages in the case. It doesn't look like you're outputting any content from the relationship, e.g. `{series_association:title}`, only if there are no results from the relationship?
> 1 votes

# Answer
As Dave has mentioned the number that you see in the URL (PXXX) does not have a correlation to the page that you are on in the sense that you think. In your example you have a limit of 2 entries per page so that is why you are seeing the number after P increment by 2 for each page. If you were to navigate to the second page then click the link back to the first page of entries you would see "P0" in the URL.

The number after P tells EE to offset the entries in the loop by that number. So in your example

Page 1: Entries 1 and 2 - URL Value: P0 - Offset Value: 0

Page 2: Entries 3 and 4 - URL Value: P2 - Offset Value: 2

Page 3: Entries 5 and 6 - URL Value: P4 - Offset Value: 4

Basically for page 2 of your results EE is automatically replacing this opening channel entires tag (notice the offset parameter being added)

```
{exp:channel:entries channel="message" dynamic="no" limit="2" offset="2" orderby="date" sort="desc" disable="categories|category_fields|member_data"}

```
> 1 votes

---
Tags: pagination
---


# Question
Title: Pulling images from FF Matrix through a weblog
I am trying to pull images from the FF Matrix field of a weblog to go into a slider on my webpage (here). Currently, I can have it pull from the weblog, but if I try to call the images, I get a server error.

My code on the page is

```
    {exp:weblog:entries weblog="wrv" entry_id="{segment_4}" disable="trackbacks|categories|member_data"}

    {if cf_wrv_images!=""}
     <div id="slider2">
    {cf_wrv_images}
        <img src="{exp:imgsizer:size src="{cf_wrv_main_img}" width="360" justurl="yes"}" rel="{exp:imgsizer:size src="{cf_wrv_main_img}" height="40" justurl="yes"}">
    {/cf_wrv_images}
    </div>
    {/if}
    {/exp:weblog:entries}

```

The weblog category is wrv. Currently, the page is pulling the main image (which is used on this page) instead of the entry's images. The code that isn't working is

```
        {exp:weblog:entries weblog="wrv" entry_id="{segment_4}" disable="trackbacks|categories|member_data"}

    {if cf_wrv_images!=""}
     <div id="slider2">
    {cf_wrv_images}
        <img src="{exp:imgsizer:size src="{img}" width="360" justurl="yes"}" rel="{exp:imgsizer:size src="{img}" height="40" justurl="yes"}">
    {/cf_wrv_images}
    </div>
    {/if}
    {/exp:weblog:entries}

```

"img" is the column name that I'm trying to pull from, but when I insert it into src, I get a server error telling me that the page isn't formatted correctly.

Help would be greatly appreciated!

# Answer
Apparently the issue was that the images were larger than the server allowed. This meant that the imagesizer couldn't even access them since the server would intercept the request and deny it.

Thanks to AllInOne for your suggestions.
> 1 votes

---
Tags: ee1, image
---


# Question
Title: Prevent multiple users from editing the same item
Working on a site with several steps that have to be done by different editors. I am afraid of data loss through cross-editing (two or more users editing an entry at the same time).

The item should not be locked down completely, I would just like to have a warning displayed. This would prevent accidental lockdown (someone leaves their browser open while editing a post and goes to lunch).

This all has to happen on a Safecracker form.

There is one add-on on devotee, but the reviews say that it breaks Zoo Admin and the author seems to be unresponsive.

# Answer
Checkout Publisher or Publisher Lite by Brian Litzinger. I have been using Publisher since the beta release without problems.
> 2 votes

# Answer
I've used Edit Alarm in the past with pretty good results. I didn't use it with Zoo Admin, so I'm not sure if this is the same add-on you're referring to, but it's free and will likely do what you need with very little footprint. If you want more advanced features, I would also go with Justin's recommendation of Publisher.

http://devot-ee.com/add-ons/edit-alarm
> 1 votes

---
Tags: safecracker, users, editor
---


# Question
Title: Assets and Rackspace White screen on save
I am trying to add rackspace cloud files to assets, but when saving I get white screen. Any ideas why?

EE 2.5.5 Assets 2.1.3

I have tried with amazon s3 , and private and public repos on both to test.

# Answer
Try uploading using the native File module and verify that the directory is in fact writable by EE.
> 2 votes

---
Tags: assets, cloudfiles
---


title: Loop Break functionality?

text:
# Question
Title: Loop Break functionality?
Does ExpressionEngine support the "break" functionality in its loops?

```
{exp:channel entries
  channel="foo"
}
  {if some_arbitrary_condition}
    {!-- Do Break(exit the loop) --}
  {/if}
{/exp:channel entries}

```

# Answer
I found out that there is no break functionality for Expression Engine as of now.

The closest thing that can emulate it is using this code

```
{if count == "1"}
…output count here…
{/if}

```

It would still do the conditional for each iteration but you only execute the code inside once.

Thanks to @Bhaskar Yadav for the link
> 0 votes

# Answer
I think Mark Croxton's Switchee plugin might do what you're looking for, but not in that syntax. It'll let you create multiple case statements and also accepts regex patterns.

http://devot-ee.com/add-ons/switchee
> 0 votes

---
Tags: loop
---


title: Plug In Order Execution

text:
# Question
Title: Plug In Order Execution
In my template, my custom plugin is parsed before others plugins, **is there a way to say to EE that I want my plugin to be parsed at the end?**

```
    {exp:gwcode_categories parse="inward"}
{exp:mycustom_plugin:s value="{cat_id}"} //ex: 1, my log file says this is ok!

{/exp:gwcode_categories}
{exp:mycustom_plugin:g value"} //should say:1 but in my log file, the constructor of my plugin is called before GWcode Categories

```

My plugin has persistence, and that works fine outside EE 2.5.5

# Answer
> 0 votes
You'll have to use an embed -- OR -- use Mark Croxton's Stash to store the category id in a stash variable before using it somewhere else in the template.

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

---
Tags: plugin
---


# Question
Title: Low Search - Is it possible to do a date range (or any range) search in Low Search where multiple ranges are passed?
```
<select multiple="multiple" name="range:birthday[]" id="birthday">
    <option value="<?php echo date('Y-m-d', strtotime('-20 years')).';'.date('Y-m-d', strtotime('-18 years')) ;?>">18-20</option>
    <option value="<?php echo date('Y-m-d', strtotime('-25 years')).';'.date('Y-m-d', strtotime('-21 years')) ;?>">21-25</option>
    <option value="<?php echo date('Y-m-d', strtotime('-30 years')).';'.date('Y-m-d', strtotime('-26 years')) ;?>">26-30</option>
    <option value="<?php echo date('Y-m-d', strtotime('-35 years')).';'.date('Y-m-d', strtotime('-31 years')) ;?>">31-35</option>
    <option value="<?php echo date('Y-m-d', strtotime('-40 years')).';'.date('Y-m-d', strtotime('-36 years')) ;?>">36-40</option>
    <option value="<?php echo date('Y-m-d', strtotime('-50 years')).';'.date('Y-m-d', strtotime('-41 years')) ;?>">41-50</option>
    <option value="<?php echo ';'.date('Y-m-d', strtotime('-50 years')) ;?>">50+</option>
</select>

```

If I choose only one item, it works. But if I choose more than one item, it returns empty result.

Is it possible to do a date range (or any range) search in Low Search where multiple ranges are passed?

# Answer
I guess your experiment says enough. No, the range syntax does not support multiple items as parameter values. So `range:field="10;20"` is supported, `range:field="10;20|30;40|50;60"` is not. Will make a note of it as a FR.
> 1 votes

---
Tags: low-search
---


# Question
Title: Low Search - How to search fields with Date fieldtypes
I would just like to know how Date fields are searched.

In order to do this, I want to know in what format should I search.

Do I search datetime as a timestamp? as a string?

# Answer
*When using the range filters*, Low Search will transform a given date for a date field to a UNIX timestamp, using `strtotime()`, unless an integer is given; then a timestamp is assumed.

Most dates in EE are stored as UNIX timestamps, which are accurate to the second. When you enter a date without a time, 00:00:00 is assumed as time (standard strtotime behaviour).
> 1 votes

# Answer
Low Search automatically detect the date field. You should search the date in the format of yyyy-mm-dd (like 2012-01-01).
> 0 votes

---
Tags: low-search
---


# Question
Title: Stash + Matrix slugs for multiple entries
I'm trying to use Stash to replace {image\_n} tags in the content fields, like also mentioned on:

using Stash to replace Matrix image slugs

http://devot-ee.com/add-ons/support/stash/viewthread/3013

I get that working just fine but when I try this on a page with multiple entries, the images simply show the same matrix images (of the first entry) and not different images per entry. I'm assuming this is due to the images being saved as snippets, so I figured instead of that, adding a context to the stashed data would do the trick, but I just can't get it to work. Can anyone help me out? Here's what I have now:

```
{exp:stash:set_list name="bloglist" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries channel="blog" limit="5"}

        {stash:item_title}{title}{/stash:item_title}
        {stash:item_entry_id}{entry_id}{/stash:item_entry_id}{!-- For potential use as context --}
        {blog_images}
            {exp:stash:set name="image_{row_count}" type="snippet"}
                <img src="{image_file:url}">
            {/exp:stash:set}
        {/blog_images}
        {stash:item_body}{blog_body}{/stash:item_body}

    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="bloglist" parse_vars="yes"}

    <h1>{item_title}</h1>
    {item_body}

{/exp:stash:get_list}

```

# Answer
The problem you're having is that you are setting the value of `{image_x}` on each iteration of the channel entries loop, overwriting the value saved in the previous iteration. One approach you could try would be to parse the placeholders in the {blog\_body} field immediately after setting the variables in an iteration, and before the whole list is captured:

```
{exp:stash:set_list name="bloglist" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries channel="blog" limit="5"}

        {stash:item_title}{title}{/stash:item_title}
        {stash:item_entry_id}{entry_id}{/stash:item_entry_id}

        {blog_images}
            {exp:stash:set name="image_{row_count}" type="snippet"}
                <img src="{image_file:url}">
            {/exp:stash:set}
        {/blog_images}
        {exp:stash:parse parse_vars="yes"}
            {stash:item_body}{blog_body}{/stash:item_body}
        {/exp:stash:parse}

    {/exp:channel:entries}
{/exp:stash:set_list}

```
> 1 votes

---
Tags: matrix, stash
---


title: Playa in a Low Variable and Stash

text:
# Question
Title: Playa in a Low Variable and Stash
Ok so I am using a Stash embed / view model approach.

I have a custom filed Playa with specific articles for a product. I also have a Low Variable storing a playa of related articles for a category.

I am using this in a Stash embed.

In my model I am trying to set the data so:

```

    {!-- RELATED ARTICLES --}
    {exp:stash:set_list name="related_articles" debug="yes" parse_tags="yes"}

        {cf_paper_specific_articles}
            {stash:url_title}{url_title}{/stash:url_title}
            {stash:test_title}P {title}{/stash:test_title}
            {stash:abstract}{cf_article_short_abstract}{/stash:abstract}
        {/cf_paper_specific_articles}

        {exp:low_variables:pair var="lv_articles_inkjet_paper" var_prefix="category_articles"}
            {stash:url_title}{category_articles:url_title}{/stash:url_title}
            {stash:test_title}C {category_articles:title}{/stash:test_title}
            {stash:abstract}{category_articles:cf_article_short_abstract}{/stash:abstract}
        {/exp:low_variables:pair}

    {/exp:stash:set_list}

```

The top part works ok and I get my product specific articles as expected. But the bottom section, parsing the playa in the low variable, does not get parsed, resulting in output like:

```
P A Simple, Accurate Print Viewing System Using Grafilite Lights    Set up an inexpensive colour accurate print viewing area using Grafilite lights.
C {category_articles:title} {category_articles:cf_article_short_abstract}

```

Before moving to Stash embeds, I had this working succesfully like this:

```

### Related Articles

            {cf_paper_specific_articles}
               {title}{cf_article_short_abstract}
            {/cf_paper_specific_articles}

            {exp:low_variables:parse var="lv_articles_inkjet_paper" var_prefix="category_articles"}
                C- {category_articles:title}{category_articles:cf_article_short_abstract}
            {/exp:low_variables:parse}

            {exp:playa:children field='cf_paper_brand' var_prefix="brand" }
                {exp:low_variables:parse var="lv_articles_{brand:url_title}" var_prefix="brand_articles"}
                     ##### B- {brand_articles:title}{brand_articles:cf_article_short_abstract}
                {/exp:low_variables:parse}
            {/exp:playa:children}

```

(there's an extra bit there that works too...but I want to get the more basic case working first!)

I have tried various parse="inward" type things...but no dice. The nested nature of stash-\>low vars-\>playa is doing my head in and I am hoping smarter brains than me can see why this doesn't work!!

# Answer
> 1 votes
I would guess that the Low Variables tag pair returns a formatted Playa tag pair to the template, rather than actually parsing the Playa tag itself.

Your `{exp:stash:set_list}` has `parse_tags="yes"` set which by default will parse one "shell" of tags inside it (just the outer shell). The first Playa tag pair `cf_paper_specific_articles` will have already been "parsed" once (actually, just replaced with a Playa tag pair) by the outer channel entries tag, and so Stash will parse that one without issue. The second Low Vars tag pair will then be parsed by stash, but as it just exposes another shell (the Playa tag) you need Stash to make a second pass with it's parser or it will just try to capture the un-parsed Playa tag.

TL;DR: add `parse_depth="2"` to the `{exp:stash:set_list}` tag.

---
Tags: ee2, playa, stash, parse-order, low-variables
---


# Question
Title: Low Search - Is it possible to do fulltext search on a channel entries comments?
Using Low Search, is it possible to do fulltext search on a channel entries comments?

If so, then how? If not, are there any possible alternative actions one can do to do so?

# Answer
> 1 votes
No. Low Search always returns **entries**. The search index used for the fulltext search is currently populated with entry data only.

---
Tags: low-search, comments
---


# Question
Title: Store/Google Analytics transactions discrepancy
Is there any reason why Store might not be logging transactions with Google Analytics apart from JS being disabled/unavailable? We have some orders not showing up in GA and the client is keen on identifying the underlying cause.

# Answer
> 2 votes
Store relies on the customer landing on the payment complete/invoice page for the Google Analytics e-commerce tracking to work.

Depending on which gateway you are using (especially if it is an off-site gateway), some customers might simply close their browser after they see the gateway's "payment complete" page, and not click through to your final invoice URL. If that is the case, there is no way for the orders to be reported to GA.

---
Tags: expresso-store, analytics, google
---


# Question
Title: Playa 4.4.3 no longer relating to other site
I upgraded to 4.4.3 from 4.3.3. EE 2.5.5

I have an MSM install where I am relating the content of 1 field on one site to the content of another field on another site.

4.3.3 works great. Upgrade to 4.4.3 and I get the error: "No entries exist for this related channel." on the custom field when trying to publish a new entry.

I rolled back to 4.3.3 and I can use Playa in this custom field again.

Ideas?

# Answer
Further searching in StackExchange found this related post: Playa 4.4.2 MSM - No entries exist for this related channel

I applied the hack and Playa works for me now.
> 2 votes

---
Tags: playa, pixelandtonic, multi-site-manager, v2.5.5
---


# Question
Title: Safecracker Registration: Label, Field, Error for Member fields?
Is there a way to access the label, field value, and error of Member fields in a Safecracker form? I'm looking for something like http://ellislab.com/expressionengine/user-guide/modules/safecracker/#field-my-field-name, but for member fields. Thoughts?

# Answer
> 3 votes
Safecracker only supports channel fields. You'll want to use something like FreeMember, Solspace User, or Zoo Visitor to update member data. (there are a few other addons that also do this, try searching devot-ee for them)

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

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

http://devot-ee.com/add-ons/zoo-visitor

# Answer
> 1 votes
I would recommend Zoo Visitor as it's set up is the easiest i've seen and the support is very good. I've used it on at least 10 projects and it's up to par.

---
Tags: safecracker, safecracker-registration, member-details
---


# Question
Title: Using exp:playa:parents, I'd like to then access content from a different playa field at the parent
Parent channel: consultations Has 2 child fields: patients & doctors

I am on the patient dashboard, accessing the related consultation content using:

```
{exp:playa:parents entry_id="{entry_id}" channel="consultations" show_future_entries="yes" show_expired="yes"}

```

this is working fine. Except that I want to grab the name of the doctor assigned to this consultation, so I am trying to do this:

```
Physician: {cf_consult_doctor}{title}{/cf_consult_doctor}

```

but its not showing me anything. Can I access data like this, essentially going up from a child to the parent and then down to a different child? I tried using exp:playa:siblings but its within the exp:playa:parents tag which doesn't seem to work.

# Answer
> 5 votes
You can, you just need to hold Playa’s hand a little so it knows which entries all of those tags belong to. You do that with Playa’s `var_prefix` param:

```
{exp:playa:parents ... var_prefix="consultation"}
  Physician:
  {consultation:cf_consult_doctor var_prefix="doctor"}
    {doctor:title}
  {/consultation:cf_consult_doctor}
{/exp:playa:parents}

```

---
Tags: playa, parent, child
---


title: DB Connection Error

text:
# Question
Title: DB Connection Error
My site was pointed to an IP without an attached domain. Now that the domain is pointed there, the pages stopped resolving and I get an error 500 message. After some trouble shooting I found:

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/EE\_Config.php

Line Number: 207

which points to:

```
$query = ee()->db->get_where('sites', array('site_id' => $site_id));

```

I have looked at the database config file and nothing seems wrong. I took out the direct IP links and it now points to the domain. No usernames or passwords changed so any idea on what needs modifying?

# Answer
> 1 votes
Is the database on the same server as the files? if so, many hosting providers allow you to just use "localhost" for the host name value in a connection. Have you tried that?

Does it work if you change it back to the IP?

---
Tags: database, error, domain
---


# Question
Title: Views at the cost of caching - worth it?
I want to keep track of the number of times my single entry page is viewed. However, it seems that I have to disable page caching in order to do this. How much of a performance penalty will that be? Are there alternatives to counting the number of page views? I want to be able to display the page views, sort by page views, etc.

# Answer
> 2 votes
On an average site I would say that although there will be a performance impact it is highly unlikely to create any issues, or even be noticed.

When you scale up to bigger sites these things can be an issue but I think you need to be pulling a lot of traffic for that to become serious.

Of course, this is just my opinion and completely anecdotal. Faster is better but I do firmly believe that many folk worry about this unnecessarily. Often quite fast is fast enough.

# Answer
> 0 votes
Are you using ExpressionEngine to track page view? The way I generally desable all tracking in EE and rely on external services to provide me with the analytics I need. That way, I can be totally independent from caching.

To me EE is not the right tool for that. Any dedicated analytics service will be better at it.

Google Analytics is such a service at an entry level. While sufficient for most users, you might want to supplement it with other systems on bigger projects.

---
Tags: channel-entries
---