title: Rename file upload from Channel Form

text:
# Question
Title: Rename file upload from Channel Form
I'm using:

```
{field:my-field-name}

```

to display my file upload form in Channel Forms to allow the user to upload a file.

I want to be able to change the filename and append their user ID to it but can't figure out how...the EE documentation doesn't provide any clues either.

Any thoughts?

Thanks, Dan

# Answer
You'll need to write an extension which uses the `file_after_save` hook. This hook passes you the `$file_id` and an array of info about the file called `$data`. Using this info you should be able update the file name doing something like this in your extension:

```
function file_after_save($file_id, $data)
{
    $parts = pathinfo($data['file_name']);
    $new_file_name =
        $parts['filename'].
        '_foobar_'. // whatever you want to add to the filename
        $data['uploaded_by_member_id'].
        '.'.$parts['extension'];

    ee()->load->library('filemanager');
    ee()->filemanager->rename_file($file_id, $new_file_name, true);
}

```
> 1 votes

---
Tags: safecracker, file-uploads
---


# Question
Title: How To Export channel entries with Grid information
We have Export Entries by code but We don't know format OF CSV how to store grid information in CSV FILE. also any one have idea for Export channel entries with grid information then let me know .

Thanks, Zeal PD

# Answer
One quick and dirty way is to output the data into a template then copy/paste the data into a text editor and save as a .csv

1. Create a template in EE that you'll use to output the data
2. Add a channel entries tag to get the data, something like this:

{exp:channel:entries channel="my\_channel" limit="999" status="open|closed" dynamic="no} {entry\_id}|{status}|{title}|{custom\_field}|{grid\_field}{grid\_field:fieldname1}, {grid\_field:fieldname2}{/grid\_field} {/exp:channel:entries}
3. Call up the template in your browser and copy the output.

You'll note that I use pipe separators and commas to separate grid field values in this example. You'll need to modify it to get the format you want.
> 1 votes

# Answer
I would look into using either Export It or AJW Export. I have personally used ajw-export it exports to csv. However you'll need to write sql queries.
> 0 votes

---
Tags: channel-entries, grid, export
---


# Question
Title: Expression Engine 1.x Page deletion db query
Does any one know of a custom query to extract when a page was deleted in Expression engine 1.x. We have a couple pages that just disappeared and the higher ups wants answers. Any help would be appreciated.

Thanks!

# Answer
ExpressionEngine does not log entry creation/deletion unfortunately - only user logins, and higher-level admin actions (such as creating/deleting channels, fields, and members), which can be found under **Admin → Utilities → View Control Panel Log**.

So no way to know who deleted your page (without, you know, just asking around).
> 0 votes

---
Tags: query
---


# Question
Title: Limit Shipping options based on products in cart
I'm building a store for a client that will be selling regular products alongside alcoholic products. They want to limit the shipping countries available if the cart has alcoholic products added. Is this possible in expresso store out of the box? Looking for the best way to go about it.

# Answer
Not out of the box, no. But I've done this before by using the store\_order\_recalculate\_start hook. I looped through all of the items in the `$order`, and if any product met my criteria, I set a cookie saying so (in your case, it could be as simple as saying `limit_countries` or something, but you could get more complex by storing data in a hashed array).

Then you need a plugin tag to check for that cookie, and if present you show a different list of countries during checkout.

This is a simplified example, but it's roughly the path you'd need to take.
> 0 votes

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


# Question
Title: Moving users from drupal DB to EE Database
I am in need of moving some content from Drupal site to EE site. Problem is that this content includes User accounts and passwords. Is there any way of swapping the hashing functions in EE for the one that drupal is using? So I dont need to manipulate the hashes alone nor ask all users to reset passwords?

# Answer
You will need to keep old Drupal members database and create a custom extension that will be triggered when user tries to log in for the first time (password in EE not set). It will utilize Drupal authenticate functions to check whether the user is permitted to log in and it yes - set password in EE database and log him in.
> 2 votes

---
Tags: users, password, forgot-password
---


# Question
Title: Can author's edit each others entries within Membergroup
I've got a couple of channels. One is a Standard channel. There are multiple Member groups. Each with their own part they can edit, but most entries belong to the Standard channel. Members can now edit all entries under Standard. Als the entries not belonging to them. Is it possible for members to edit the entries belonging to one of their Member's?

Thanks,

# Answer
Look under **Members → Member Groups → Edit Member Group** \- there's a section called **Channel Posting Privileges**. There is a setting there which determines whether members in a group can edit other members' entries in whatever channels they have access to called *Can edit entries authored by others*.
> 1 votes

---
Tags: members
---


# Question
Title: User Input Price within product form tag
I've got the following product form tag for adding multiple items (Donations) to a cart but can't figure out how to allow the user to input the price.

```
    {exp:store:product_form}
    {exp:channel:entries channel="{donation_channel}" dynamic="no"}
        {exp:store:product entry_id="{entry_id}" disable_form="yes" }

            <input type="hidden" name="items[{count}][entry_id]" value="{entry_id}" />

            <label class="field_label" for="price">{donation-description}
            <input type="text" name="items[{count}][item_qty]" value="" />
            </label>

            {/exp:store:product}
        {/exp:channel:entries}

           <input type="submit" name="submit" value="Make Donation" class="button expand" />

{/exp:store:product_form}

```

# Answer
> 1 votes
You need to add a `price` input for each item.

```
<input type="text" name="items[{count}][price]" value="" />

```

And of course you need the Store field for that channel set to allow user prices.

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


# Question
Title: Can you use segment variables with the Pages Module?
I have a very specific URL structure I'm trying to set up:

city-segment/venue-segment

ex. houston/the-bar

"city-segment" pulls from a City Channel while "venue-segment" pulls from a Venue Channel. I've got it set up correctly using the Pages Module, but now I'm trying to display a field from the City Channel using a third segment:

houston/the-bar/information

"information" segment should display text entered into the {venue\_info} field of "The Bar" Venue Channel Entry. I have an info template within the venue template group with this code:

```
{exp:channel:entries
  channel="venues"
  disable="categories|member_data|pagination"
  dynamic="no"
  limit="1"
  require_entry="yes"
  status="open"
  url_title="{segment_2}"
}

  {venue_info}

{/exp:channel:entries}

```

Trying to view this code gives me nothing. I'm guessing that assigning a Channel Entry to a URI using the Pages Module is preventing me from using any segment variables? If so, is there another way to solve this without using Structure?

**Venue/Info Template**

```
{layout="_layouts/.html-layout"}

{layout:set name="city" value="{segment_1}"}

Hi

{exp:channel:entries
  channel="venues"
  disable="categories|member_data|pagination"
  limit="1"
  require_entry="yes"
  status="open"
  url_title="{segment_2}"
}

  {title} Info

{/exp:channel:entries}

```

# Answer
You can do this using Resource Router instead of the Pages module. In your `system/expressionengine/config/config.php` file:

```
$config['resource_router'] = array(
    ':any/:any/(info|menu|hours|some_other_page)' => function($router, $wildcard1, $wildcard2, $wildcard3) {
        $validCity = $wildcard1->isValidUrlTitle(array('channel' => 'cities'));

        $validVenue = $wildcard2->isValidUrlTitle(array('channel' => 'venues'));

        if ($validCity && $validVenue)
        {
            $router->setTemplate('_venues/_'.$wildcard3);
        }
        else
        {
            $router->set404();
        }
    },
);

```

This example assumes you have a `_venue` template group with `_info`, `_menu`, `_hours`, and `_some_other_page` templates. In your templates can you just refer to `{segment_X}` variables as normal.
> 2 votes

# Answer
It seems like an embed might help you get the job done.

Can you you do something like this:

```
{embed="_embeds/venue" segment_2="{segment_2}"}

```

Then in your embedded template:

```
{exp:channel:entries
  channel="venues"
  disable="categories|member_data|pagination"
  dynamic="no"
  limit="1"
  require_entry="yes"
  status="open"
  url_title="{embed:segment_2}"
}

  {venue_info}

{/exp:channel:entries}

```
> 1 votes

# Answer
Did you select the information template in the Pages tab?

Your code should work fine.
> 0 votes

---
Tags: segments, pages, page-uri
---


# Question
Title: Low Search starts_with Returns All Result
I've got an issue here where a low search via a select drop down is returning all results, and I am not sure why.

Here's the search form.

```
{exp:low_search:form result_page="{segment_1}/search" form_id="last_name_search" starts_with="search:Lastname"}
        <select name="search:Lastname" id="last_name">
            <option value="" selected>Initial Last Name</option>
            {exp:low_list:each items="A|Z" range="yes"}
                <option value="{val}">
                  {val}
                </option>
             {/exp:low_list:each}
        </select>
{/exp:low_search:form}

```

I need to search a members channel by querying against the first letter of their last name. To do this starts\_with seemed to be the Field Search parameter that needed to be used. But, in the results tag, every member is being returned.

Here is the results tag.

```
{exp:low_search:results
        limit="20"
        paginate="bottom"
        query="{segment_3}"
        status="Members-id5|Staff-id7|Site_Admins-id6|Corporate-id8"}
    {!-- HTML stuffs --}
{/exp:low_search:results}

```

I checked {low\_search\_search:Lastname} and it does hold the correct lettered I want to query with, but it's not being applied to the results. What am I doing wrong here? Thanks for any help!

# Answer
> 1 votes
To quote the docs:

> \[P\]arameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag.

That means the Form tag doesn't accept any filter parameters, like `starts_with`. So try moving that parameter to the Results tag instead.

---
Tags: low-search
---


# Question
Title: style="display:none" breaks publish page when saving Error: "Not Allowed"
Having a strange issue where I am inserting google / facebook tracking snippets into a textarea custom field (formatting: none).

In one of the snippets of code an image has style="display:none", if I change to display:inline or anything else, it doesnt break. Only if set to display:none??

```
<img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=XXXXXXXXXX&cd[value]=0.00&cd[currency]=GBP&noscript=1" /></noscript>

```

# Answer
That looks like a server-generated error, not an EE-generated error. I'd inquire with your host about any `mod_security` or other hardening settings that might be enabled. Sometimes they can be very strict about what kind of data can be sent via `POST`.
> 0 votes

---
Tags: error, custom-fields, publish-layout
---


# Question
Title: Expresso Store checkout and custom field based on entry ID
Based on a documentation my code looks like (short version):

```
{exp:store:checkout channel="products" form_class="form-horizontal"}
            {items}
                TEST 1
            {exp:channel:entries entry_id="{entry_id}"}
                TEST 2
            {/exp:channel:entries}
            {/items}
{/exp:store:checkout}

```

`TEST 2` message is not displayed at all.

Any clue what is going on?

Thanks

PS. It looks like Expresso Store parsing bug. Similar issue described here

PS.2

I have wipe out whole cart/index template and put just those lines:

```
TEST:

    {exp:channel:entries channel="products" entry_id="230" dynamic="no"}
    Entry id image:
    {product_image limit="1"}
    <img src="{product_image:image}" alt="{product_image:title}" class="img-responsive"></a>
    {/product_image}
    {/exp:channel:entries}

```

And what I'm getting is only a text `TEST:` nothing else. Product with an entry ID 230 exists in the products channel.

# Answer
Thanks to Justin Long tips I have got it to work. Example code looks like:

```
    {exp:store:checkout form_class="form-horizontal"}

                {items}
                    *Some code here*
                     {exp:channel:entries channel="products" status="not closed" dynamic="no" entry_id="{entry_id}"}
                      *Custom field code here*
                      {/exp:channel:entries}
                {/items}

{/exp:store:checkout}

```
> 1 votes

# Answer
Try to use an embed to deal with parsing issues

```
{items}
    {embed="_embeds/list" id="{entry_id}"}
{/items}

```

In the embedded template set:

```
{exp:channel:entries limit="1" dynamic="off" entry_id="{embed:id}" }
    TEST 2
{/exp:channel:entries}

```

Since the {entry\_id} in your loop needs to be the one you are actually passing to the embed, then change to {embed:id}.
> 0 votes

---
Tags: expresso-store, channel-entries, checkout, entryid
---


# Question
Title: Set quantity to 1 if user has entered a price
Hi wondering how I could set quantity to 1 if the user has entered a price.

I'm adding multiple donations to cart within product form tag and want to hide the quantity input. How can I check if a price has been inputed and then set the quantity to 1.

I have the following but get an invalid conditional error in template.

```
<input type="hidden" name="items[{count}][item_qty]" value="{if "{price}" >= "1"}1{if:else}0{/if}" />

```

# Answer
Since the user is going to be entering the price after the initial page load when the EE tags are parsed you will need to use some form of javascript to listen to the individual price fields and then update a hidden hidden field tied to that particular product.
> 0 votes

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


# Question
Title: Freeform - Duplicates on Entry by Member
So we have site that allows logged in members to view job postings and send a form to apply to the job view Freeform. The issue we are looking at resolving is preventing duplicate submissions to the same job by a logged in member.

If we use "prevent\_duplicates\_on", then it will not allow the user to apply to other jobs since they all use the same form. Freeform would look in the system and find that this person (based on the members email) has already sent a submission. But, the system doesn't see that the member sent a submission to a different job.

Any way around this?

Thanks! Dan

# Answer
> 1 votes
You'll need to write an extension to perform this kind of check.

Use the freeform\_module\_validate\_begin hook, and then do something like this:

Look up entries in the `exp_freeform_entries` table which match the `author_id` to `ee()->session->userdata('member_id')`, and whatever your form field is which holds the job being applied for (ID or name or whatever) to the matching value for that field in the database.

(Look at your database directly to figure out table and field names for this, it will save you time and headaches!)

If you find a match, add a new error to the`$errors` array, and return it. Otherwise, just return the `$errors` array as you received it.

# Answer
> 1 votes
So after playing around with it and asking Solspace the solution seems to be as follows: you create a field in Freeform for the ID of the entry (in this case the job posting) that the person is responding to. You fill in this field by making it hidden to the user and automatically assigning the entry\_id of the channel entry to the hidden field. Then you use the

```
{exp:freeform:entries form_name="my_form" author_id="{embed:member_id}" search:entry_id="{entry_id}"}

```

This will give you all items in the form that have the author\_id (the person submitting the form) for a specific form. If it comes back as no results, you can display the form to the user. If it comes back with a result, you simply tell the user they have already responded to this posting.

As for the embed for author\_id, there seems to be an issue using:

```
{logged_in_member_id}

```

inside of:

```
{exp:freeform:entries}

```

tag, so you create an embed which you call with something like:

```
{exp:channel:entries}
   <h3>{title}</h3>
   <p>{body}</p>
   {embed="path_to/template_with_freeform_entries" member_id="{logged_in_member_id}"}
{/exp:channel:entries}

```

If anyone sees any issues with this, please let me know...or if there are better ways to do this (without writing an extension which I've never done before).

Hope this helps someone.

Derek, any thoughts or comments on this approach? And again, thank you for your responses.

# Answer
> 1 votes
An alternative answer to the above method of embeds is also to use the Mo Variables add-on and make {logged\_in\_member\_id} available for early parsing and then you don't have to use embeds.

So here is the final code that worked:

```
{exp:freeform:entries form_name="my_form" author_id="{logged_in_member_id}" search:form_entry_id="{entry_id}"}
    {if freeform:no_results}
        {exp:freeform:form form_name="job_application" admin_notify="{application_email_address}"}
            <input type="hidden" name="applicant_name" value="{logged_in_screen_name}"/>
            <input type="hidden" name="email" value="{logged_in_email}"/>
            <input type="hidden" name="form_entry_id" value="{entry_id}"/>
            <input type="hidden" name="post_title" value="{title}"/>
            {freeform:submit}
        {/exp:freeform:form}
    {/if}
    {if freeform:absolute_results >= 1}
        You have already submitted for this post.
    {/if}
{/exp:freeform:entries}

```

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


title: Suggestions when MSM is not an option?

text:
# Question
Title: Suggestions when MSM is not an option?
I'm in the process of developing 6 sites for a company for their membership associations. While I started with the idea that I would be using MSM (which I wasn't crazy about) to help manage everything, Zoo Visitor is not supported in that environment. So I opted to go with individual sites. The backend of all of the sites is nearly identical, short of the home page (which is managed by Low Variables) and the categories for their resources.

Anyway, we just launched site #2 and the client is already asking about a way to manage content more efficiently. They post several events that are the same across all of the companies, or at least 2-3. So when we are finished that means they will have to post them on six different sites (and update them six times should details change). I had built their current site many years ago (using Classic ASP) and they could add a single event and choose which sites they want to post it to. While the EE route is certainly an upgrade over what they had, they are taking a step backwards in some regards.

While I hadn't tested anything yet, I had considered running all of the sites from a single installation (yes, I understand the licensing issues - I would talk with Ellislab about my options and purchasing multiple licenses). Then I could use a field that allowed me to choose which "site" the content gets published to. This way they could manage everything from a single location, like they had hoped. Another idea was to publish the events to a feed of some sort, then check and pull those into the other sites. But this would mean that one of the individual sites would have to become the "host". If they wanted to convert their parent company site to EE (which they may at some point), then this would be a reasonable option. But in the meantime....

So my questions are:

* What options do I have when MSM isn't an option?
* Any suggestions for the best way to post a feed for events (including attachments)?
* Anyone have a similar experience that they wouldn't mind discussing how they handled it?

Thanks for any feedback!

Todd

# Answer
We've done this before using categories and it's worked well for our client and for maintainability.

We set it up all the domains to point to the same docroot (therefore the same EE installation). We then created a category group called "domains", and we make a category in there for each domain we're using. Then in our index.php we have this:

```
<?
switch ($_SERVER['HTTP_HOST']) {
    case 'domain1.com':
        $assign_to_config['global_vars']['domain'] = 'domain1';
        $assign_to_config['global_vars']['domain_cat_id'] = 1;
        $assign_to_config['global_vars']['domain_low_var'] = 'lv_domain1_hp';
        break;
    case 'domain2.com':
        $assign_to_config['global_vars']['domain'] = 'domain2';
        $assign_to_config['global_vars']['domain_cat_id'] = 2;
        $assign_to_config['global_vars']['domain_low_var'] = 'lv_domain2_hp';
        break;
    // etc...
    default:
        $assign_to_config['global_vars']['domain'] = 'defaultdomain';
        $assign_to_config['global_vars']['domain_cat_id'] = 3;
        $assign_to_config['global_vars']['domain_low_var'] = 'lv_default_hp';
        break;
}
?>

```

There are a few things going on here:

1. For each domain we set a global variable called `{domain}`, which we can reference in templates if we need to use it.
2. For each domain, we set the category ID from the category we made in the backend.
3. For each domain, we set the name of the low variable that controls some domain-specific content. You can also do this with an `entry_id`.

In the backend, when content is published it's categorized with whatever domains it should show on. And then our tags are simple:

```
{exp:channel:entries
    channel="news"
    category="{domain_cat_id}"
    limit="10"
}
    {title}
{/exp:channel:entries}

```

The only items that will show up from that tag are items categorized for the current domain. For low variables you can use the various template tags and pass in the `var="{domain_low_var}"` parameter to get the right content to show.

Let me know if that's helpful and/or you have any questions!
> 3 votes

# Answer
Doing each as a subdomain would allow you to run them all legally from a single instance:

* www.yourdomain.com
* office1.yourdomain.com
* office2.yourdomain.com
* etc..

You can then create groups of users for different sites and assign access to particular channels based on that group
> 0 votes

# Answer
I've done this before, but I used MSM for it. But instead of separate channels, entries and fields I used a single site as the 'master' and added checkbox fields for determining which sites an entry should be published on.

I also implemented overrides for most of the content fields, so that content could be slightly different on each site where necessary but fallback to the master content by default (beware though, this is not a very scalable solution, probably not good for 6 sites, but if the content is going to be identical then don't bother). Additionally/alternatively, editors can wrap things in the middle of a sentence with something like `<span class="uk_only">UK content only</span>` to limit bits of content to a particular site.

It's a good use-case for Switchee. Here's some example template code:

```
{exp:switchee parse="inward" variable="{global:loc}"}

    {case value="ire"}
        {if ireland_body}
            {ireland_body}
        {if:elseif uk_body}
            {uk_body}
        {/if}
    {/case}

    {case value="can"}
        {if canada_body}
            {canada_body}
        {if:elseif uk_body}
            {uk_body}
        {/if}
    {/case}

    {case default="yes"}
        {uk_body}
    {/case}

{/exp:switchee}

```

Where the content is identical and you want to use checkboxes/radios to determine which sites an entry appears you can use the `search` parameter something like this (that's a PT radio group field):

```
{exp:channel:entries
    limit="1"
    disable="categories|member_data|pagination"
    status="{global:entry_statuses}"
    site="master_site"
    search:pages_sites="IS_EMPTY|all|{global:loc}"
}
    <h1>{title}</h1>
    {pages_body}
{/exp:channel:entries}

```

The `global:loc` variable is defined per site via FocusLab Master Config, and templates are routed to the master site via a standard MSM cross-site embed (though probably better to use Resource Router add-on for that).

Finally, in order to resolve any Pages module URIs to the right place I developed the Slavedriver add-on: https://github.com/thisisjamessmith/Slavedriver

Works fairly well in my opinion, though the Publish screens can get a little overwhelming. There's also Publisher, which might help instead: https://boldminded.com/add-ons/publisher ... it's touted as multi-lingual, but the approach is really the same.

Come to think of it, this approach would probably also work without MSM (notwithstanding the licensing issue you mentioned). (In my case MSM was necessary for other reasons anyway)
> 0 votes

---
Tags: multi-site-manager, multiple-sites
---


# Question
Title: Cannot retrieve custom fields inside exp:store:checkout tag
Following Store official documentation I'm trying to include the content of some custom fields inside my {exp:store:checkout}{/exp:store:checkout} tags. According to the docs:

> Inside the {items} loop, you can use the following variables.
>
> `entry_id`
>
> The entry id of this item. If you need to access other custom fields associated with this item, you can feed the entry id into a channel entries loop:
>
> `{items}
>  {exp:channel:entries entry_id="{entry_id}"}
>  {my_custom_field}
>  {/exp:channel:entries}
>  {/items}`

So I tried to use the following code:

```
{items}
            <tr class="item_row">
                <td class="item">
                {exp:channel:entries channel='books' entry_id='{entry_id}'}

                {book_author}

                {/exp:channel:entries}
                    <h4><a href="{path='store/product'}/{url_title}">{title}</a> </h4>

                </td>
                <td class="price">{price}</td>
                <td class="qty"><input name="items[{key}][item_qty]" value="{item_qty}" class="input-mini" /></td>
                <td style="text-align:right" >{item_subtotal}</td>
            </tr>
        {/items}

```

but the content of the {book\_author} custom field doesn't show up. Switching the template debug on I can see that the entry\_id is retrieved:

```
 `{exp:channel:entries channel='books' entry_id='30'}
(0.075356 / 7.57MB) Closing Tag Found
(0.075517 / 7.59MB) Tag: {exp:channel:entries channel='books' entry_id='35'}
(0.075568 / 7.57MB) Closing Tag Found`

```

so everything looks ok, but a few lines below I read:

```
(0.093014 / 9.06MB) Calling Class/Method: Channel/entries
(0.093276 / 9.06MB) -> Class Called: Channel
(0.095509 / 9.22MB) -> Method Called: entries
(0.116360 / 10.72MB) Returning No Results Content
(0.116438 / 10.72MB) -> Data Returned

```

I also tried to use CE\_image plug-in to put a tumbnail inside the checkout page, but the plug-in tag is not processed, and the plugin's own debug details don't show-up either.

All the other product details show-up so the {exp:store:checkout} tag seems to work, that is all the details that are not called inside the exp:channel:entries loop.

Is there a reason why the code above doesn't work?

# Answer
Generally speaking, I've noticed that order can be really important with placing a channel entries loop inside of another tag. I believe the `{exp:channel:entries}` info should come right after the `{item}` tag. I'm not certain if you need the `channel='books'` tag. It should be fine, but try it without first, then if that works, go back and add it.

Having it, generally reduces the number of queries the `channels` tag needs to make, but since the items embedded, it could cause issues. So start without, then add.

```
{items}
    {exp:channel:entries entry_id='{entry_id}'}
    <tr class="item_row">
        <td class="item">
            <h4><a href="{path='store/product'}/{url_title}">{title}</a> </h4>
            {book_author}
        </td>
        <td class="price">{price}</td>
        <td class="qty"><input name="items[{key}][item_qty]" value="{item_qty}" class="input-mini" /></td>
        <td style="text-align:right" >{item_subtotal}</td>
    </tr>
    {/exp:channel:entries}
{/items}

```

Otherwise, it's just that you need the full record outputted for the `{items}` tag, which includes the `price`, `quantity`, and `subtotal` lines. Otherwise, your breaking the order.

Give that a try and see what happens.
> 1 votes

# Answer
I had similar issue and solution was to add `status="not closed"` to the `exp:channel:entries` tag from where I had pulled custom fields (GRID in my case)

Simple code:

```
{exp:store:checkout form_class="form-horizontal"}

                {items}
                    *Some code here*
                     {exp:channel:entries channel="products" status="not closed" dynamic="no" entry_id="{entry_id}"}
                      *Custom field code here*
                      {/exp:channel:entries}
                {/items}

{/exp:store:checkout}

```
> 1 votes

# Answer
It's quite likely this is a problem with parse order.

The easiest way to check for/avoid parse order issues is to use an embed:

```
{items}
    {embed="store/.checkout_item" entry_id="{entry_id}"}
{/items}

```

and in your `store/.checkout_item` template:

```
{exp:channel:entries entry_id="{embed:entry_id}"}
    {book_author}
{/exp:channel:entries}

```

This works because embed tags are parsed after everything else in the template (so you can be sure the `{entry_id}` will be passed to that tag correctly). The `store/.checkout_item` template is parsed completely separately, so you won't run into any issues caused by nesting too many tags.
> 0 votes

---
Tags: expresso-store, custom-fields, ecommerce
---


# Question
Title: WYGWAM causing Undefined property: EE::$view on validation failure of Channel Form
I'm using the latest version of ExpressionEngine (2.9.2) and the latest version of WYGWAM (3.3.3).

I've a Channel Form which includes the WYGWAM field and when I submit the form I receive the following error:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: EE::$view

Filename: libraries/File_field.php

Line Number: 704

Fatal error: Call to a member function head_link() on a non-object in /Users/joe/Sites/mywebsite/webroot/5ystem/expressionengine/libraries/File_field.php on line 704

```

However, I've noticed a few things:

1) I only receive the message if the form has validation errors, otherwise it submits fine and the record appears in the channel as expected

2) If I remove error\_handling="inline" from the form declaration then the errors are displayed fine, albeit not inline

3) If I remove the WYGWAM field then this error does not occur, even if there are/aren't validation errors and if the error\_handling="inline" is/isn't included

Can anyone shed any light on this please?

The rest of the form declaration is:

```
{exp:channel:form channel="jobs" author_only="yes" error_handling="inline" return="jobs/success" class="channel-form" datepicker="no"}

```

# Answer
> 0 votes
Having spoken to Pixel & Tonic:

> All Wygwam does when you've got the native EE file manager selected to manage files is this:

```
// load the file browser
$EE->load->library('file_field');
$EE->file_field->browser();

```

> According to the error message, the actual error is occurring in libraries/File\_field.php. If I had to guess, it would be an EE bug that has to do with anything using their native file manage on the front-end.

So, as a workaround, I've disabled inline validation and just added jQuery validation using Parsley.

---
Tags: safecracker, wygwam, validation
---


title: JS error uploading images in Editor

text:
# Question
Title: JS error uploading images in Editor
After moving my site to a secure server (SSL), uploading images via the Editor fieldtype by uploading a new file throws an javascript error, traced to the Redactor javascript file.

If I first choose an existing image, everything works fine and I can embed the image. If I first try to upload a new image and that fails, then I try to choose an existing image as before, existing images no longer works unlike if I do it right away.

Error Messages from console:

`Uncaught TypeError: Cannot read property '0' of nullredactor.min.js?v=3.2.4:4 Redactor.fn.$.Redactor.uploadLoadedjquery.js?v=1421706349:16 s.extend.proxy.ojquery.js?v=1421706349:17 H.event.dispatchjquery.js?v=1421706349:16 H.event.add.a.handle.s`

# Answer
> 0 votes
Most often these errors are caused by cross-domain ajax. Did you update URL in the general configuration to have the same https url? Since Redactor uses AJAX to upload the image, any difference in the domain will break it.

---
Tags: devdemon, editor, redactor
---


# Question
Title: Low Events in a Dynamic Title on a Channel Form
Can I use a Low Events start date in the dynamic title on my channel form?

```
{exp:channel:form
    channel="training_sessions"
    return="/mysite/training/announce-training/thank-you"
    error_handling="inline"
    secure_action="yes"
    dynamic_title="Training [training_event_details:start_date format="%Y%m%d"] [training_site_city] [training_site_state]"
}

```

This isn't working. I also tried removing the `format="%Y%m%d"` bit and it still doesn't work.

```
{exp:channel:form
    channel="training_sessions"
    return="/mysite/training/announce-training/thank-you"
    error_handling="inline"
    secure_action="yes"
    dynamic_title="Training [training_event_details:start_date] [training_site_city] [training_site_state]"
}

```

The generated dynamic title looks like `Training [training_event_details:start_date] Minneapolis MN` instead of the desired `Training 20150131 Minneapolis MN`.

Can this be done?

# Answer
I took a quick look, and Channel Form's dynamic\_title feature is somewhat limited. It simply takes the raw entry data and does a find/replace in the title based on that data. No processing, no support for modifiers or parameters, nor some sort of rule or API to allow for that sort of thing.

That means the Low Events vars, which all use modifiers (like `{events_field:start_date}`), aren't supported by Channel Form.

Instead, you'd have to use JS to modify a (hidden) title field so you can add the start date to it.

**Edit:**

Looking at the core code, you should be able fool EE by adding a (hidden) field where you enter the start date (automatically via JS or manually), which you then use in the dynamic\_title parameter. For example:

```
{exp:channel:form ... dynamic_title="Training [foo]"}
    <input type="hidden" name="foo" value="20140120">
{/exp:channel:form}

```
> 2 votes

---
Tags: safecracker, low-events
---


title: Expresso Store Custom Order Number?

text:
# Question
Title: Expresso Store Custom Order Number?
Is there a way within Exp:resso Store to change the starting number on orders so they match my client's internal invoicing numbers?

# Answer
> 1 votes
If you order number is a simple number you need to start from such as 12001 you would just need to modify the auto increment start for the `ex_store_orders` table

```
ALTER TABLE exp_store_orders AUTO_INCREMENT=12001;

```

You should be able to run this in the Tools \> Data \> SQL Manager \> Database Query Form as long as you have at least one order already in the system.

If you don't feel comfortable doing it with sql you can do it in phpMyAdmin or something like Navicat.

If you need an order ID that is numbers and letters you would need to either create an extension to extend Store's default behaviors or you could store the special order number in one of the custom order fields during the checkout.

# Answer
> 0 votes
No. I suggest to print your suffix by hard coding it in your template and/or notification emails templates.

```
{exp:store:orders}
    <!-- order details -->
prefix_{order_id}
{/exp:store:orders}

```

# Answer
> 0 votes
Good new is the next version of Store will have separate order numbers from cart numbers and you will be able to customize this. Look for this in Store 2.5.

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


# Question
Title: How to show Low Events dates in a Postmaster parcel
How can I get a Low Events date to display in a Postmaster parcel? I want to send an email confirmation when a user submits an upcoming training session announcement.

1.) I tried this:

```
{parcel:training_event_details}

```

2.) I tried this:

```
{parcel:training_event_details:start_date}

```

3.) I tried this (a combination of this example from Low and this example from Objective HTML):

```
{exp:channel:entries channel="training_sessions" entry_id="{parcel:entry_id}" dynamic="no" status="not closed"}
  {training_event_details:start_date format="%j %F %Y"}{training_event_details:start_time format=", %H:%i"}
  {if training_event_details:one_day == 'y'}
    {training_event_details:end_time format="– %H:%i"}
  {if:else}
    —
    {training_event_details:end_date format="%j %F %Y"}{training_event_details:end_time format=", %H:%i"}
  {/if}
  ({training_event_details:duration})
{/exp:channel:entries}

```

All methods above render blank. What am I missing? Thanks!

Versions:

* ExpressionEngine: 2.9.2
* Low Events: 1.3.1
* Postmaster: 1.5.0

**Edit to fix bug (mentioned by Low in comment) in code #3:**

Here is the working code:

```
{exp:channel:entries channel="training_sessions" entry_id="{parcel:entry_id}" dynamic="no" status="not closed"}
  {training_event_details:start_date format="%j %F %Y"}{training_event_details:start_time format=", %H:%i"}
  {if '{training_event_details:one_day}' == 'y'}
    {training_event_details:end_time format="– %H:%i"}
  {if:else}
    —
    {training_event_details:end_date format="%j %F %Y"}{training_event_details:end_time format=", %H:%i"}
  {/if}
  ({training_event_details:duration})
{/exp:channel:entries}

```

# Answer
Okay, so method #3 in my question above actually DOES work. It didn't preview correctly for the entry I was looking at but when I changed to several other entries it rendered fine. There was something goofed up with that particular entry and I've since deleted it. Anyway, sorry to waste your time, Low!
> 0 votes

---
Tags: postmaster, low-events
---


title: Assets orderby Title

text:
# Question
Title: Assets orderby Title
I can't seem to be able to sort Asset files by their title, instead only by their filename through `orderby="name"`.

Is it possible to use the Title field for ordering?

# Answer
Thanks to Pixel & Tonic support, the below alteration to the plugin can support this, in case anyone is interested.

**third\_party/assets/libraries/Assets\_lib.php:765**

Replace

```
$order_by = in_array(strtolower($order_by), array('name', 'folder', 'date', 'size', 'file_id', 'date_modified')) ? strtolower($order_by) : false;

```

With

```
$order_by = in_array(strtolower($order_by), array('name', 'folder', 'date', 'size', 'file_id', 'date_modified', 'title')) ? strtolower($order_by) : false;

```

Then in the switch statement on line 913, add the following:

```
case 'title':
{
    $sql .= 'ORDER BY exp_assets_files.title ' . $order_type;
    break;
}

```
> 0 votes

# Answer
Nope. According to the docs you can only order by file\_id, name, folder, date, and size.
> 1 votes

---
Tags: assets, pixelandtonic
---


title: Conditional on price

text:
# Question
Title: Conditional on price
Hi wondering if it's possible to do a conditional on price inside of the product tags.

For example..

```
{if price > '0.00'} Hello {/if}

```

I'd like display different formatting if price is more than 0.00

# Answer
You would probably want to use `price_val` in your conditionals since it will output just the value minus any currency formatting.

```
{if price_val > 0}Hello{/if}

```

If you have a product with a price of £10.00 price\_val would output 10.00

You can add `_val` to any of the price related tags like `{sale_price_val}` or `{price_inc_mod_val}`

From the docs:

> All price variables are pre-formatted according to your currency formatting settings. If you want the unformatted amount, simply append \_val to the variable.
> 3 votes

# Answer
Looks like this is working:

```
{if price != "£0.00"} Hello {/if}

```
> 0 votes

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


# Question
Title: Why won't SuperSearch look in Matrix field to find results?
I am trying to figure out why my technology channel won't return any results when using keywords contained in a wygwam text field within a matrix row. The search yields results for this section when keywords are the title of the entry, so channel is set correctly and I am receiving results. If I search a term not contained in the title, but within the matrix field I get results from other channels, but not from my technology channel.

**Versions**

* EE 2.9.0
* SuperSearch 2.2.2
* Matrix 2.6

**Search template**

```
<form method="get" action="{path=search/results/search}">
     <input type="text" name="keywords" id="keywords" placeholder="Search">
     <input type="submit" />
</form>

```

**Result template**

```
{exp:super_search:results channel="technology_update"}
        ...output content here...
{/exp:super_search:results}

```

**Matrix field**

`{technology_rd}` is my matrix field. Which has `Is field searchable?` set to `Yes` as well as the `Is col searchable?` checkbox selected for the wygwam textbox in the matrix row.

I recently updated the module form 2.1.4 to 2.2.2 as I noticed a number of Matrix related improvements in the the changelog to no avail. Any ideas what I could be missing here? Any help would be greatly appreciated, thanks!

# Answer
Was the field and Matrix columns set to "searchable" ***after*** creating entries with Matrix content? If so, that data might not yet be in the `exp_channel_data` database table, in which Super Search searches. Re-saving the entries would populate `exp_channel_data` with searchable Matrix content, and Super Search should then be able to detect the entry.
> 1 votes

---
Tags: matrix, solspace, supersearch
---


title: Download to Excel or csv solutions

text:
# Question
Title: Download to Excel or csv solutions
We need to get download functionality where channel entries can be downloaded to an Excel spreadsheet (preferably) or a csv at a push.

Been looking at Export\_It and using it which is ok but ran into two problems which apparently are not solvable - at least have never got any results investigating them - so need maybe another solution.

The problems in question were/are:

1) Strange characters in the spreadsheet if the file contains accented foreign characters. I believe integrating PhpExcel with Export\_It should fix this but I never got this working and no-one on PhpExcel forums or elsewhere seems to know anything about the error.

2) We need to be able to take data from TWO categories in the download: i.e. **category="1&2"** in the parameters. Have not been able to find out if Export\_It supports this but it seems not as it doesn't work.

So we need another solution. Has anyone successfully implemented PhpExcel as a stand-alone in EE? Are there any other modules or solutions you might recommend?

# Answer
One really flexible and simple shortcut to exporting a .xls spreadsheet of Channel data is to generate an html table using an ExpressionEngine template, save the page as a file, and then open the file with MS Excel.

1. Create a template (eg `export.group/index.html`)
2. Output all the necessary data using a `channel:entries` loop and any other necessary template tags.
3. Load this template on the front end in your browser (above example template would load at `example.com/export`)
4. Either save the webpage as a file and *manually* set the file extension to `.xls` or use the HTTP Header plugin to automatically force download and set the appropriate file extension for you.

Example template code including force download of `.xls` file:

```
{exp:http_header
    content_disposition="attachment"
    filename="myfile.xls"
    content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
<table>
    <thead>
        <tr>
            <th>Entry ID</th>
            <th>Title</th>
            <th>Author</th>
            <th>Created</th>
            <th>Updated</th>
            <th>Status</th>
            <th>Tool File</th>
            <th>Tool URL</th>
        </tr>
    </thead>
    <tbody>
        {exp:channel:entries
            channel="tools"
            disable="category_fields|member_data|pagination"
            dynamic="no"
            limit="999"
        }
            <tr>
                <td>{entry_id}</td>
                <td>{title}</td>
                <td>{author}</td>
                <td>{entry_date format="%Y-%m-%d-%H:%i"}</td>
                <td>{edit_date format="%Y-%m-%d-%H:%i"}</td>
                <td>{status}</td>
                <td>{tool_file}</td>
                <td>{tool_url}</td>
            </tr>
        {/exp:channel:entries}
    </tbody>
</table>

```
> 2 votes

---
Tags: export
---


# Question
Title: How to display a channel entry without hard coding an entry ID?
I have a channel named Bios that has six fields of information per person. I want to dynamically generate a bootstrap modal with the selected person’s bio info when their photo is selected from a page. I see I can hard code it for a single person using entry\_id but is there any way else to pull the correct data without resorting to making a template for each person and using the URL segment variables?

This is my first time working with ExpressionEngine for a site build. I tested it out using entry\_id just to make sure I was pulling the channel fields correctly:

```
<div class="modal" id="bioModal">
  <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header text-blue">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    {exp:channel:entries channel="bios" entry_id="9"}
          <img src="{bio_photo}" class="bio-photo img-responsive" alt="bio photo">
          <div class="bio-header">
            <h4 class="modal-title">{bio_name}</h4>
            <h5 class="modal-title">{job_title}</h5>
          </div>
        </div>
        <div class="modal-body text-black">
          <p class="bio-details">{bio_details}</p>
        </div>
    {/exp:channel:entries}
        <div class="modal-footer">
          <a href="#" data-dismiss="modal" class="btn">Close</a>
        </div>
      </div>
    </div>
</div>

```

# Answer
> 0 votes
If you'd like to generate a div.modal for each of the entries in your bios channel, this is approximately what you're looking for, I think:

```
{exp:channel:entries channel="bios" dynamic="no"}
<div class="modal" id="bioModal">
  <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header text-blue">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
           <img src="{bio_photo}" class="bio-photo img-responsive" alt="bio photo">
          <div class="bio-header">
            <h4 class="modal-title">{bio_name}</h4>
            <h5 class="modal-title">{job_title}</h5>
          </div>
        </div>
        <div class="modal-body text-black">
          <p class="bio-details">{bio_details}</p>
        </div>
        <div class="modal-footer">
          <a href="#" data-dismiss="modal" class="btn">Close</a>
        </div>
      </div>
    </div>
</div>
{/exp:channel:entries}

```

The "dynamic='no'" prevents the exp:channel:entries loop from guessing which entry you're trying to view based on the URL.

I think that's what you were getting at... follow up if not.

---
Tags: channel-entries
---


# Question
Title: How do I write a conditional based on search results?
I have a section set up to display contents based on category URL information and it works great. However, when I do a search, the search result URL has a unique value in segment\_4 that doesn't fit into any of the designated categories:

> http://rouviere.com/photo/image/fall-colors-alpine-loop-utah9/5918ab43c62403abdef86474b6228f32

In this case I would prefer to hide the conditional content, but I am not sure how to work that segment\_4 value into a conditional since it will change with each search return.

I am thinking along the lines of **only display the content if segment\_4 is not a number**.

# Answer
I'm not sure I understood you, but the conditional you mentioned is:

```
{if !(segment_4 ~ "/^\d+$/") } the `segment_4` isn't a number{/if}

```

I hope it helps.
> 1 votes

# Answer
If you don't already have URL Helper ( https://devot-ee.com/add-ons/url-helper ) or Seg2Cat ( http://gotolow.com/addons/low-seg2cat/ ) installed, I'd suggest installing URL Helper (they both use the same syntax; URL Helper has a few more variables, so that's the one I'd recommend getting; both are free).

Once you've got that, you'll have access to a couple of new variables you can use for some conditionals to test whether or not segment 4 (or any other segment) is a valid category or not.

I suspect you could use something like this...

```
{if "{last_segment_category_id}" == ""}The last segment is not a category{/if}

```

... and work out a way to achieve what you're looking for.
> 0 votes

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


# Question
Title: Multiple required fields in Channel Form without setting required in CP
I need to set multiple fields as "required" in Channel Form/Zoo Visitor, but I can't find anything in the documentation that describes how to do this. I can't set the fields to be required in the CP because validation needs to happen at form level, not entry level.

None of the following works:

rules:field\_1|field\_2=“required" rules:field\_1=“required"|field\_2=“required" rules:field\_1=“required" rules:field\_2=“required"

Anyone got any ideas?

# Answer
> 0 votes
The following syntax works:

`rules:field_1="required" rules:field_2="required"`

The problem was to do with Field Pack radio buttons, which aren't validating properly.

# Answer
> 0 votes
According to the documentation the required rules should work. If they don't I'd recommend posting a bug report here.

# Answer
> 0 votes
I think there is an error in your rule formatting

```
rules:field_1="required"|field_2="required"

```

I'm not sure that type of condition is allowed in the rules parameter

---
Tags: safecracker, zoo-visitor
---


title: Importing assets programmatically

text:
# Question
Title: Importing assets programmatically
What I (or or customer) want to do is as follows:

1. An existing external API has regularly updated documents for different products
2. The existing product channel in EE will hold an ID that is recognised by the API and will return (amongst other things) the external path to the document
3. The existing product channel also has an asset field (pixel & tonic) that is able to store the file locally
4. Now I want to update that file regularly (eg every 24h) by downloading it and storing it in the asset field.

Any ideas how it can programmatically insert or update files in a chosen Pixel & Tonic Asset field?

rg, Tim

# Answer
All files in asset fields are stored in a bunch of the `exp_assets_*` tables. You can insert/delete/update rows to make the changes you want. For instance, you can add new files to `exp_assets_files`, and update rows in `exp_assets_entries` and/or `exp_assets_selections` to make the assignments to entries.

Alternatively, you can `include PATH_THIRD . "/assets/libraries/assets_lib.php"` and then use some of the methods in `Assets_lib()` to handle adding to the appropriate rows.

Finally, you could also upload the items yourself and then force Asset to re-index the source by hitting their re-index ACT endpoint with the right data.
> 1 votes

# Answer
I would need more information, but for an initial quick reply on my assumptions, my instinct is that for importing and synching (as in not *re-importing* data but rather *updating*) the indispensable DataGrab might suit the bill. It allows you to import multiple formats, from RSS to XML and JSON, etc., and specify a key (think database index/key) so that duplicate keys won't be re-introduced to your database.

In your case you would be able to key the external unique identifier to your internal (EE) unique identifier, and thus not only *import* your records, but also *update* them if they change on the other side. Sweet.

As for the programmatic part: set a cron job to poll ExpressionEngine's native `?ACT=XX&id=XX` urls and the system will update whenever you wish. ;-) If you're stuck with only having image URLs to work with but you wish to actually bring in the images, I believe that Causing Effect's CE Image will work with an external URL (fist time the page loads) and thereafter use the local file. So as long as you can get the image's URL into EE, you can have the system (via CE Image) pull it in for you. I don't know how I would integrate this with Assets, but I haven't actually thought that part through. I'm sure you'll be able to come up with *something.* :-)

I'm using DataGrab extensively on a client site to bring in RSS feeds of medical articles. I'm able to filter the incoming feeds to only import articles that contain certain words (since I don't want non-relevant articles) and it's superb, a deceptively simple-looking Swiss Army Knife of data import, and one I recommend ***highly.***

Check it out!
> 0 votes

---
Tags: assets, import
---


# Question
Title: Setting a category from segment in .xls download template
We've set up a template to download an .xsl file of entries in a number of specific categories (with much help in this SE thread) - all works fine if we hardcode the category ID but if we tray to make the template dynamic by getting the category ID from the URL segment it fails (see below).

Is it possible to dynamically set the Category ID like this? Or any other way?

```
{exp:http_header
    content_disposition="attachment"
    filename="myfile.xls"
    content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
<table>
<tbody>
{exp:channel:entries channel="my channel" category="{segment_3}" disable="category_fields|member_data|pagination"
}
<tr>
<td>{title}</td>
<td>{field_one}</td>
<td>{field_two}</td>
</tr>
{/exp:channel:entries}
</tbody>
</table>

```

# Answer
> 2 votes
It should work fine. You're just missing a `dynamic="no"` on your `channel:entries` tag.

Try it like this:

```
{exp:channel:entries
    channel="my channel"
    category="{segment_3}"
    disable="category_fields|member_data|pagination"
    dynamic="no"
}

```

---
Tags: categories, segments, export
---


# Question
Title: Low variables & Matrix - Make a row act like an entry
Is it possible to have a "main page" that pulls through a Low Variable tag pair with all the matrix rows, and then a view page to view each page with more details about that "one matrix row"?

```
{exp:low_variables:pair var="franchises_for_sale"}
    {field}
    <a href="/businesses/franchises-for-sale/{some_uri_tag_like_page_uri}">View this matrix row</a>
{/exp:low_variables:pair}

```

# Answer
You could use `row_id` to get to the right row.

```
{exp:low_variables:pair var="franchises_for_sale"}
    {field}
    <a href="/businesses/franchises-for-sale/{row_id}">View this matrix row</a>
{/exp:low_variables:pair}

```

And on the `businesses/franchises-for-sale` page:

```
{exp:low_variables:pair var="franchises_for_sale" row_id="{segment_3}"}
    {field}
{/exp:low_variables:pair}

```

If you want something more readable, try creating a column for a url\_title (which you'd have to fill out yourself) and use `search:my_column="{segment_3}"` instead.
> 0 votes

# Answer
Low had the best answer (use row\_id to get the right row), but I wanted to answer Third\_Hyperion's question in the comments (I'm trying to get involved with answering more, and I'm new)

For "No Results" I would consider using an If Statement prior to the matrix, comparing the row\_id being provided with the number of rows in the Low Variables matrix field.

```
{if {franchises_for_sale:total_rows} < {segment_3}}
  {redirect="404"}
{/if}

```
> 0 votes

---
Tags: matrix, low-variables
---


# Question
Title: Increase File upload for expression engine
Site is on a dedicated server, i want to be able to increase the max upload file size.

.zips of around 5mb are fine however i want in excess of 50mb to be uploaded. At the moment i get the following error:

```
This form has expired. Please refresh and try again.

```

# Answer
> 1 votes
This isn't really an EE question. You would have to consult your host about increasing the max file upload size, see this old post for more information:

https://ellislab.com/forums/viewthread/151764/

---
Tags: solspace-freeform
---


# Question
Title: Using the world "From" in long text fields causes data to not save
This issue has been happening for quite some time on one of our projects. I haven't been able to find a clear reason for it. We have never been able to replicate it on a different server, so we know it certainly has, in part, to do with the server, but even other installs of different CMSs (like Wordpress) on the same server do not trigger this issue.

The install is a little outdated (EE2.5.5), but I'm not sure I can convince our client to spend the time upgrading the EE install, especially if I can't say with certainty that it'd solve the issue.

This happens on Front-End channel forms as well as Admin Panel channel entries.

What happens is this: If the post is very large (500 words or more) and at some point the word "from" is used in a textarea (wygwam OR standard EE textareas), the post will say that it has "saved" but in fact, the content does not get saved, and the old content persists. It appears to be a XSS prevention (server being concerned about sql injections), but as I mentioned, it only happens for EE data, and not other CMSs.

A friend of mine mentioned that it could be the Apache mod\_security, and I forwarded that to the Client's hosting provider, and they said that plugin isn't on the server.

Modules/Extensions involved in this EE install:

* Calendar
* Forms
* Low Search
* Low Seg2Cat
* Low Variables
* Matrix
* Membrr
* Mo'Variables
* NavEE
* P&T Field Pack
* Profile:Edit
* SafeCracker
* SEO Lite
* Stash
* Wygwam
* Zoo Flexible Admin

Any ideas? Any more information needed to help? I'm more than willing to provide information to help solve this once and for all.

# Answer
> 1 votes
It actually sounds like it has to do with MySQL `TEXT` versus `LONGTEXT`. Try changing the type for your WYGWAM fields and see if that corrects it.

---
Tags: safecracker, wygwam, profile-edit, membrr, v2.5.5
---


# Question
Title: Templates with playa returning blank pages
I have a fully-functioning EE site (which I didn't build) but I am migrating over to a new server, and everything is operating as it should with the exception of pages that have playa code in it. If I remove the playa code, the page works.

Playa 4.4.5 / EE 2.7.3 / PHP 5.3.2

Here is an example of code that works on the old server but not on the old:

```
{exp:stash:set_list
    name="related_insights"
    parse_tags="yes"
  }
  {exp:playa:children
     field="cf_hm_related_resources"
     status="open"
     disable="members"
    }
    {lv_md_related_insights}
  {/exp:playa:children}
{/exp:stash:set_list}

```

I've tried deleting cache. I've tried enabling debugging. All I get is a blank page unless I remove this snippet of code. Any ideas? Any ideas on what I can do to get some insight into what's happening?

# Answer
> 0 votes
White pages or blank pages in EE are typically caused by PHP hitting memory limits.

First step is to check your PHP error logs... if the error is logged there, it'll indicate the issue. If it's memory, the solution is to increase the memory to which PHP has access in the php.ini file.

Another place it look is in the system/index.php file. Enable debugging in the file so you can see the error... You may need to remove the conditional code around the error reporting all together to see it.

Information on this page in the help docs might help:
https://ellislab.com/expressionengine/user-guide/troubleshooting/general/blank\_pages.html

---
Tags: playa, stash
---


# Question
Title: Other structure tags not working inside {exp:structure:nav} tag
I have a scenario where I want 3 levels to show in my main menu, except for one specific level 2 page where I don't want to show its children.

Using hard-coded IDs works fine, eg: {exp:structure:nav start\_from="/" show\_depth="3" exclude="100|101|102" }

But when I replace the hard coded IDs with the structure tag that generates these IDs, it doesn't work: {exp:structure:nav start\_from="/" show\_depth="3" exclude="{structure:child\_ids\_for:14}" }

Anyone have any ideas? I've also tried using snippets and and embedded template and neither work, though a snippet does work when the hard-coded IDs are in the snippet, just not when {structure:child\_ids\_for:5} is in the snippet.

Here's the code I've tried using embeds:

In the header:
{embed="embeds/main\_menu" hideStudentPages="{structure:child\_ids\_for:14}"}

In the embed:

{exp:structure:nav start\_from="/" show\_depth="3" include\_ul="no" add\_level\_classes="yes" show\_overview="yes" exclude="{embed:hideStudentPages}" }

Thanks in advance, Justin

# Answer
> 0 votes
Why not just use the `start_from=` tag? Would be a simpler approach than muddying up your templates with embeds.

You'd do something like this for each section:

```
{exp:structure:nav start_from="/about-us" show_depth='1' max_depth='1' has_children_class='yes' show_overview="yes"}

```

Configure your options for however you need the HTML markup to be on the front-end.

You can read about that here:

http://buildwithstructure.com/tags#tag\_navigation

---
Tags: structure
---


# Question
Title: Exp:resso Store - add shipping cost after shipping country selected
Is it possible to add shipping cost on the summary checkout page? ie *after* the user has selected shipping destination?

# Answer
If you have a multi-part checkout it is as simple as putting the shipping options tag pair on any step after the user has entered their shipping details.

If you are allowing users to sign-up for memberships and have linked the billing & shipping details either to custom member fields or ZooVisitor fields the users should have this repopulated on subsequent visits so it shouldnt be an issue.

Something that I usually employ on the stores that I build if shipping/taxes come into play is to have a calculate tax and shipping field that is displayed in the cart summary area.

So once a user has added an item to their cart I would show the cart summary with an input for their shipping city & state. Once they fill the data you update the cart which should now get relevant shipping and tax information setup for them before they even get to the checkout pages.

It should be noted that you need to use the `{expo:store:checkout}` tag pair to show your cart summary with this approach since the `{exp:store:cart}` tag **does not** output form tags for performance reasons.
> 0 votes

---
Tags: expresso-store
---


# Question
Title: Default Expresso Store to most expensive modifier when using add to cart in search results
I have a shop using Expresso Store where we have add to cart buttons in the site search results but as some products have modifiers we are seeing an error as follows when trying to use these:

I would like these add to cart buttons on results pages to default to the highest value modifier. Is that possible?

To clarify, I do not want to show the modifier options on the results pages, these will appear only on the actual product detail pages.

# Answer
There is not really a built in way to preselect the most expensive modifier by default.

Having said that, then you should be able to get around that as long as you setup some publishing standards. The easiest way should be to make sure that either the first or last modifier is the most expensive.

If you have done that you should simply need to add the modifier as a hidden field. It would look something along the lines of the following:

```
{exp:store:product entry_id="{entry_id}"}

  <h2>{title}</h2>
  {if modifiers}
      {modifiers}
        Price: {price_inc_mod}

        {modifier_options}
          {if option_last}
          {!-- this could also be if option_first if you decided to make the first option most expesnsive --}
            <input type="hidden" name="{modifier_input_name}" value="{option_id}">
          {/if}
        {/modifier_options}
      {/modifiers}
  {else}
    {!-- if no modifiers show regualr price --}
    Price: {price}
  {/if}
  <input type="text" name="item_qty" value="" />
  <input type="submit" name="submit" value="Add to Cart" />
{/exp:store:product}

```

This assumes that you are passing in the entry id and that each product has its own form and quantity. IF you were wanting all the results to have a single form submit with the ability to add multiple items to the cart at a single time you would need to wrap this in the Product Form tag pair and adjust the template at bit.
> 1 votes

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


# Question
Title: Can I use the {ext:freeform:composer} tag inside a richtext field?
I would like to be able to add a form within a rich text field (or wygwam) but it just renders the tag as a string instead of pre-processing it. Is there a way around this? (parse="inward" doesn't work.)

any help would be great.

# Answer
You would need to use something like the Allow EE Code plugin if you want to parse EE tags like that.

Having said that FreeForm has a fieldtype already built into the Pro version that allows you to select one of your available forms and insert it in the page. This is probably the ideal approach so your editors don't have to worry about proper EE syntax.
> 1 votes

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


# Question
Title: SKU search from front end with Expresso Store
My client has asked to be able to search by Expresso Store SKU on the front end of their website. Is this even possible and if not what data would I need to manipulate in Store into a common custom entry field in order to make the SKU searchable?

We are currently using Low Search and the Low Search Store add-on to facilitate search.

```
{exp:low_search:results
    channel="book_library|products|products_postcards"
    store:price:min="0"
    query="{segment_2}"
    result_page="/shop/results"
    limit="20"
    paginate="both"
    status="not closed|Pending Review|Draft"
    }

```

# Answer
If you grab the latest release of Low Search Store, you can use the `store:sku` parameter.

If you're using Low Search v3.4.0+, you can also use the parameter `store:search:sku`, which behaves like a Field Search parameter.
> 1 votes

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


title: Escaping characters in category names?

text:
# Question
Title: Escaping characters in category names?
I have an EE category name that contains an ampersand-- i.e. "Coffee & Tea." I'm displaying this name as the header for a listing of cafes and tea houses using the `{category_name}` field, and I'm trying to figure out the best way to properly escape the character for output to HTML. It seems that I can actually name the category within EE as

```
"Coffee & Tea"

```

so that it will be properly rendered, although I'm not sure if this approach is at all problematic? Ideally, I'd like for EE to handle it automatically. Any thoughts? Thanks for any insight here.

# Answer
It's always been curious to me that EE doesn't automatically encode entities in category names. But this quick plugin will do the trick for you.

```
{exp:format_characters}{category_name}{/exp:format_characters}

```
> 3 votes

# Answer
That would be fine and is the 'proper' way to write a literal ampersand. You shouldn't get any problems.

The {category\_name} field is something variable. An arbitrary string that can change without the category id changing. Think of it like the 'human readable' identifier for the category.

For that reason if you are doing any template logic to check for particular categories you should always use the {category\_id} as it is a constant and cannot (or should not) change.
> 2 votes

---
Tags: categories
---


# Question
Title: Newsletter input email only refresh page when submit
I am using campaign monitor on a expressionengine website. I copy/paste my code from campaign monitor in my footer. There's only a input for my e-mail field and another input to submit. The problem I am facing right now is that when I click on submit the page only refresh. It doesn't go where the action parameter of my form tag

```
<form action="..." method="post">
<p>
    <label for="fieldEmail">Email</label><br />
    <input id="fieldEmail" name="cm-ituykik-ituykik" type="email" required />
</p>
<p>
    <button type="submit">Subscribe</button>
</p>

```

To be 100% sure that the problem was my code, I tried to link a mailchimp's newsletter and it did the same thing. When I click on submit, the page only refresh and nothing happens.

ExpressionEngine version : 2.5.3

# Answer
> 0 votes
You have forgotten to close the form tag.

```
</form>

```

---
Tags: campaignmonitor, newsletter
---


title: Evaluate two conditionals for content

text:
# Question
Title: Evaluate two conditionals for content
I have a page where I want to display either a featured image or an image gallery in the left corner of a text block, which wraps around the image. Pretty basic.

If I use just a single image for the story, I have a class that shows a border around the image. If I decide to use a gallery (via a grid field), the images rotate, and the user can click on them to view larger versions. Also pretty simple.

The complication is evaluating whether either of the two is empty, and if so, show the one that has content. Further, if neither the gallery or single image have any content, show nothing.

I attached my code in Image1 You can also view an example here of the gallery, and HERE of what a single image is supposed to look like (second link is not coded, only "About" template is). The main "About" link is where I have a single image uploaded, but does not show.

Thank you all for any help you can give!!

# Answer
> 0 votes
Have you tried to check for the `total_rows` variable?

```
{if gallery_section:total_rows > 0}
    {gallery_section}
        [...]
    {/gallery_section}
{if:elseif about_image_single}
    [...]
{/if}

```

---
Tags: conditionals, ifelse
---


# Question
Title: Output same entry multiple times in a channel loop
i was wondering if it was possible to output the same entry multiple times using the entry\_id parameters on the channel:entries loop.

Example:

```
{exp:channel:entries entry_id="14|14|14"}

```

I need this function to work with Shortlist module from Squarebits to manage a simple cart.

Someone had the same problem before?

# Answer
> 2 votes
Not in that fashion, but if you stashed the item (using the Stash add-on) you could grab it a bunch of times without having to repeat the entries loop.

# Answer
> 0 votes
I'm the developer of Shortlist

Short answer : **No**.

Longer : **Yes, but it takes extra work**

Outputting repeated entries in the same loop is *possible* at the template parsing level, but is **explicitly prevented by the channel:entries template parsing method**.

The specific part at which channel-\>entries() does it's duplicate checking and removal in the build\_sql\_query() method, around line 2717 (in 2.9.2). That is their safety catch to stop repeats.

If you needed to do your own thing, you can, but you'll need to do a lot of leg work to get around it. To do that you'll need to load up a Parser instance yourself and pass it the entry data directly.

Note - Prior to 2.7.x this was simpler, and Shortlist did have an implementation that worked around things, but with the abstracted parser there's a lot of extra leg work to get it working.

---
Tags: loop, shortlist
---


# Question
Title: Stash, Parsingorder (?) and conditionals if content exists
I am sorry to ask this, but I am stuck here.

I must change (on two places) a css class if a channel entree exists. If yes, the class must be unit-70, if no, unit-90. This code below does not work, I do not know why. (when setting stash hardcoded it works as expected)

```
{exp:stash:set name="content_block_mid" parse_tags="yes" parse_conditionals="yes"}
  {exp:channel:entries
    channel="news_flash"
    disable="categories|category_fields|pagination|member_data"
    dynamic="no"
}
    {if no_results}unit-80{/if}
    {if count >= 1}unit-70{/if}
  {/exp:channel:entries}
{/exp:stash:set}

```

Can someone please point me in the right direction, obviously I am missing something here. I tried many options, but got lost because nothing works. This seems to me the simpliest of solutions, but I fail even here. Thank you!

# Answer
Might try using 'unprefix' for the nested channel entry tags:

```
{exp:stash:set
    name="content_block_mid"
    parse_tags="yes"
    parse_conditionals="yes"
    unprefix="my_prefix"
}
    {exp:channel:entries
        channel="news_flash"
        disable="categories|category_fields|pagination|member_data"
        dynamic="no"
    }
        {if my_prefix:no_results}unit-80{/if}
        {if my_prefix:count >= 1}unit-70{/if}
    {/exp:channel:entries}
{/exp:stash:set}

```
> 0 votes

---
Tags: templates, stash, parse-order
---


title: Change EE native multi edit?

text:
# Question
Title: Change EE native multi edit?
Just wondering if it's possible to change what fields appear on the multi edit screen. Currently the editable fields in multi edit are, Title, Url title, Status, Entry date, Make entry sticky, & Allow comment.

My end goal is to allow fields from the Store module in the multi edit screen.

Thanks in advance!

# Answer
> 6 votes
I think the closest you'll get is using the Henshu add-on, from Zenbu Studio. It's basically designed to implement bulk/inline editing in the edit entries list.

# Answer
> 2 votes
The Bulk Edit add-on can do this for you, I've used it successfully in the past.

---
Tags: ee2
---


# Question
Title: Content on a page defined by text in a field, publications by year
I know someone out there has done this before. I need to build a publications page that will show it's list of publications by a given year which has been filled in a channel field. I've googled I looked at the EE docs and I am not quite sure how to build this.

I have a channel field that will be filled with a 4 number year my content managers. Here is my basics. It of course lists all years in descending order but i need to make a separate page for "2015, 2014, 2013, etc."

Thanks for looking.

```
{exp:channel:entries
   channel="publications"
   orderby="pub_year"
   sort="desc"
   paginate="both"
   limit="8"
   }

          <h3 style="font-size: 1em; margin-bottom:3px;">{pub_year}</h3>

          <p><a href="{pub_year}">{title}.</a></p>
         <!-- Etc. -->

{/exp:channel:entries}

```

# Answer
If you could use the search parameter in conjunction with the url so you could access each year with something like

http://yoursite.com/template\_group/year/2015

Then in your code you could do:

```
{exp:channel:entries
   channel="publications"
   orderby="pub_year"
   search:pub_year="={last_segment}"
   sort="desc"
   paginate="both"
   limit="8"
   }

          <h3 style="font-size: 1em; margin-bottom:3px;">{pub_year}</h3>

          <p><a href="{pub_year}">{title}.</a></p>
         <!-- Etc. -->

{/exp:channel:entries}

```
> 0 votes

# Answer
Thanks for your help Johnathan, this put me on the right path. The final piece missing is (dynamic="no"). It appears it seems to think these are "id"s and is not returning the correct results. So the full answer is. Again Thanks!!

```
{exp:channel:entries
   channel="publications"
   orderby="pub_year"
   search:pub_year="={last_segment}"
   dynamic="no"
   sort="desc"
   limit="8"
   }

        <h3 style="font-size: 1em; margin-bottom:3px;">{pub_year}</h3>

        <p><a href="{pub_year}">{title}.</a></p>
         <!-- Etc. -->

{/exp:channel:entries}

```
> 0 votes

---
Tags: channel-entries, templates, fieldtype, fields, channel-fields
---


# Question
Title: How do include a file path in a jQuery statement?
I am working on a photo portfolio page that uses fancy-box to display larger images of the photographs. This also includes a optional Buy Now link in the title area of the photo.

The code for the photo thumbnails and related popup images is as follows:

```
{exp:low_reorder:entries set="portfolio_low_sort"  limit="500" }
    <a class="fancybox project {categories}{category_name} {/categories}"  href="{large_image}" title="{title}"><img src="{portfolio_thumbnail}" alt="{title}" width="262" height="175"></a>
{/exp:low_reorder:entries}

```

The jQuery code to include the Buy Now button and Pinterest link:

```
$(document).ready(function() {
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
openEffect  : 'elastic',
closeEffect : 'elastic',
nextEffect  : 'fade',
prevEffect  : 'fade',
nextSpeed   : 1250,
prevSpeed   : 1250,
beforeShow  : function () {
if (this.title) {

// Add pin it button
this.title += '  <a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"  data-pin-height="28"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_28.png" /></a> ';

// Add buy now button
this.title += '<a href="/photo/image/{url_title}/" data-url="' + this.href + '"><span>Buy now</span></a> ';
}
},
helpers : {
title : {
type: 'inside'
}
}
});
});

```

Currently I have a link to the image page where the user can Buy Now and this is where I get stuck. Because this is jQuery and not part of the entry, I am not sure how to bring in the "url\_title" part.

Any guidance on this would be appreciated.

# Answer
> 2 votes
The url title is not specified in your script. I would recommend putting the url title in a data attribute in the html code.

```
<a data-urltitle="{url_title}" class="fancybox project {categories}{category_name} {/categories}"  href="{large_image}" title="{title}">...</a>

```

then get that attribute in the js

```
// Add buy now button
var urltitle = this.data('urltitle');
this.title += '<a href="/photo/image/"+urltitle+"/" data-url="' +
this.href + '"><span>Buy now</span></a> ';
}

```

---
Tags: channel-entries, jquery, links
---


# Question
Title: Where does {exp:calendar:events...} know where to get data from?
I am very new to EE so please be gentle.

I have 3 template files, all with some static content and then this code:

```
{exp:calendar:events calendar_id="52" sort="asc" dynamic="off" status="current"}
// HTML, outputting the fields
{/exp:calendar:events}

```

Now the only difference in the code in each file is the calendar\_id="number" (numbers are 52,114,117). So this is where the code specifies which entries to display. Okay got it.

But what I want to know is if I created a channel in the future, and created a template. In that template I wanted to output the entries, how would I know which "calendar\_id" to reference?

# Answer
> 1 votes
One quick and easy way to glean a Calendar ID is just to go to *CP \> Add-ons \> Modules \> Calendar \> Calendars* and look at the output there. It gives you a list of all your calendars by name, and includes Calendar ID's.

---
Tags: loop, calendar-events
---


# Question
Title: Channel Forms: Members can't edit entries authored by others
I have a channel form that allows members of a certain member group (Authors) to create one entry and to edit it. Then, members of a different member group (Coordinators) should be able to edit those entries, using a similar Channel Form in a separate template.

For some reason, members of Coordinators can't edit entries by Authors' members via Channel Forms. Viewing the template's source, nothing that is inside the `{exp:channel:form}` tag is rendered. They **can** edit those entries using the CP, though.

I've double checked Coordinator's permissions. They have access to the channel. I enabled "Include Members in PUBLISH page multi-author list?" for both groups, and all the channel entries privileges (can view/edit entries authored by others, etc) for Coordinators.

This is the form:

```
{exp:channel:form
     class="entry"
     channel="requirements"
     datepicker="no"
     entry_id="{segment_3}"
     return="requirements/teams"}

        <h3>Team: {title}</h3>
        <input type="hidden" name="title" value="{title}">
        {!-- other fields here --}
        <label for="comments">Comments or specific requests:</label>
                <textarea cols="50" rows="4" id="comments" name="comments">{comments}</textarea>
        <p><input type="submit" class="button" value="Submit"></p>

{/exp:channel:form}

```

Super Admin can edit those entries, that's why I suspect is a member privilege error.

What am I missing? Thank you!

# Answer
I've also been struggling with this exact same situation for quite a while, it seems to be an EE bug.

Here's what I did to resolve it. Your markup is fine, your member settings are also fine. The only member setting that is vital to this operation is the "Can edit entries authored by others" under "Channel Posting Privileges" in the Member Group settings.

Open the channel entries api library file:

```
system/expressionengine/libraries/api/Api_channel_entries.php
```

```
line 1043
```

Compare it should read something like below:

```
if ($data['author_id'] != ee()->session->userdata('member_id') && ee()->session->userdata('group_id') != 1)
```

It should be:

```
if ($data['author_id'] != ee()->session->userdata('member_id') && ee()->session->userdata('group_id') != 1 && ee()->session->userdata('can_edit_other_entries') != 'y')
```

EE is forgetting to check our "Can edit entries authored by others" in that conditional and that is why it's not saving our update.
> 5 votes

---
Tags: safecracker, members
---


# Question
Title: Is it possible to lock a template in Template Manager?
We have a template which is literally a template in the original sense: i.e. it contains code which is intended to be copied and pasted into a newly created template.

Is it possible to 'lock' this in anyway so this base code cannot be changed only copied to a new template where any changes can take place?

# Answer
I can see couple ways to do this:

1. Create a special group as copy of SuperAdmin, but w/o rights to edit specific template group, where you will keep your original templates.
2. You can activate option Save Template as files. The files still be available for modification in CP. But you can protect some of them by change file permissions.
> 3 votes

---
Tags: templates, control-panel
---


# Question
Title: Any easy way to do a Find/Replace in all entries and fields?
I know there is the Search & Replace functionality built into the control panel but I'm hoping to find a way to do this on all entries and fields without having to run it individually for each field. Has anyone else done this before?

# Answer
Another option: Low Search has a really nice Find & Replace that allows you to select multiple fields and even restrict by category, a replace preview, and replace log.
> 1 votes

# Answer
You would have to do that on the database side thru PHPMyAdmin or Sequel Pro or something like that. It goes without saying that that is dangerous so always make backups! But that would be by far the fastest way to do it!
> 0 votes

# Answer
As Mark pointed out, you would need to do this in the database. Here's a sample query you could use. MAKE BACKUPS beforehand though!

```
UPDATE exp_channel_data SET field_id_1 = REPLACE(field_id_1,'string to find','string to replace');

```

You would need to update the 'field\_id\_1' with whatever field you're trying to do the find/replace on.
> 0 votes

---
Tags: ee2, control-panel
---


# Question
Title: Is it ok to create a member manually in the database?
I am using a payment gateway that is not supported by any of the existing modules/plugins. They can provide a script that I an modify to write directly to the data.

I tested by: Logging in via phpmyadmin and adding a new row to the member table. I entered username, screenname, password (selected sha1), group, language, time zone and hit go.

It created the member, and when I logged in first time a SALT value was added.

Unique\_id remained blank, and crypt\_key has a NULL value.

I have httpd authentication enabled in EE. I am able to log in to the templates successfully using the new login.

Will not having the unique and crypt key screw things up and this is a bad idea?

Thanks for your advice!

# Answer
I've had to build a member importer for a client's website in which I did the same thing you're thinking about doing: inserting a member directly into the database.

As long as you add all of the fields that are required, you are good to go. Just look up the EE way of adding members and duplicate that.

Just don't forget about the `exp_member_data` and `exp_member_homepage` tables. I didn't include those at first, and members wouldn't work until I fixed that.
> 2 votes

---
Tags: members, authentication
---


# Question
Title: Can I use Free form to submit a calendar event in the front and post it the backend for all the events?
Im trying to built a event calendar that uses free form to submit the event home page and then use the calendar. So, if any wants to submit an event they can do so and then someone can go on the backed and approve the event.

# Answer
> 4 votes
If you would like user submissions to *directly* polulate the calendar, then you should use Channel Form and have users submit the events as entries in the calendar Channel.

Assuming you are using Solspace Calendar, see the docs on Using with Channel Form.

This same approach of using Channel Form holds true if you are displaying events using the native Calendar Tag, too (since those are also just Channel entries).

If you absolutely need to use Freeform for your user event submissions and have them automatically become Channel entries, then you'll probably need to make an extension to convert the Freeform entries to Channel entries.

---
Tags: calendar
---


# Question
Title: Low search showing repeating/too many results
The search is returning too many results and repeating the same result entries more then once.

I have a second collection set up almost exactly the same which doesn't do this.

Any idea what is going on? Thanks for looking.

Search box code

```
  {exp:low_search:form result_page="publications/pub_results"}
     <fieldset>
       <input type="search" name="keywords" id="keywords"/>
       <button type="submit">Search Publications</button>
     </fieldset>
  {/exp:low_search:form}

```

Results page code (with mark up simplified)

```
    {exp:low_search:results query="{segment_3}" limit="10" collection="publications_c" search_mode="auto"}
  {if count ==  1}

           <p>{pub_year}</p>

              <h4 style="margin-left:12px; margin-bottom:0px; margin-top:0px; padding-top:0px;"><a href="{url_title}">{full_title}.</a></h4>

                   {/if}

             {if count == total_results}</ol>{/if}
                {if no_results}<p>No search results. Check your spelling or try a different search term.</p>{/if}
              {/exp:low_search:results}

```

# Answer
To quote the docs:

> \[P\]arameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag.

That means the Form tag doesn't accept any filter parameters, like `collection` and `search_mode`, which are part of the Keywords filter. So try moving those parameters to the Results tag instead.

Also, the parameter `name` is not a valid on the Form tag. If you're trying to set an html attribute to the form-tag, use `form_name` instead.

**Edit:** After investigation, it turned out the Results tag was nested inside a channel:entries tag, and the code inside the Results tag was wrapped inside a `{if count == 1}` conditional. The problem was solved after these issues were addressed.
> 1 votes

---
Tags: templates, search, low-search
---


# Question
Title: Run plugin without affecting loading time (external)
I have a plugin which doesn't actually integrate with the website. It's purpose is to grab a column of the channel entries table and manipulate it every 24 hours. The plugin will only run each time a cookie expires (24 hours).
Is there a way to have this plugin run without affecting the page load. Currently, by calling the plugin in the template, the page doesn't load until the plugin has completely run.

Am I right to think that I would really need to be write a external PHP script and use CRON to run this every 24 hours?

Or is there a way to do it within the EE environment. I was hoping to use the built in codeigniter library that's built into EE.

Thank you.

# Answer
You can do this by developing your add-on as a module rather than a plugin since only modules can use EE actions. (See the EE docs for an explanation of the difference between the types of add-on.)

More info on EE actions here.

Essentially, you need to develop a module to perform your desired action, then call the associated ACT URL (e.g. http://example.com/index.php?ACT=123) using a cron job on your server.
> 4 votes

# Answer
You can make a module - like Steve advice. Use Yeoman ExpressionEngine Add-On generator to simplify developing process. On server you will need to setup cron with wget:

```
execute cronjob every day at 3am
00 03 * * * wget http://example.com/index.php?ACT=XX&task_id=1

```

Or if you want something really quick and simple:

1. Create a special template with some secret name, like *http://example.com/kab47jov825yub976on* (secret name need just to prevent accidental request)
2. Place your plugin tag inside this template
3. Setup CRON request on one of many available cronjob web services. For some project we use setcronjob.com \- for 2y was only 1 time when task was failed

-or- you can setup same CRON job as for module

execute cronjob every day at 3am 00 03 * * * wget http://example.com/kab47jov825yub976on/
4. Enjoy.
> 4 votes

---
Tags: php, database, plugin, mysql, codeigniter
---


title: Conditional statement issues

text:
# Question
Title: Conditional statement issues
**EE v2.4.0** (Updating is not an option at this time)

Hello! The photo gallery that we use still shows up even when no photos are added. Basically what I'm trying to do is get the image gallery to show only if a user uploaded an image. I've done this type of thing before on 2.9.2, but for some reason (I suspect a version issue) it's not working.

Here is the original code:

```
        <div class="left article_image">
          <ul data-orbit>
          {article_images}
                <li>
                  <img src="{image_matrix_image}" alt="">
                  <div class="caption">
                    <p>{image_matrix_cutline}<em>  ({image_matrix_byline})</em></p>
                  </div>
                </li>
            {/article_images}
          </ul>
       </div>

```

And here is what I've added:

```
     <div class="left article_image">
       {if article_images}
          <ul data-orbit>
          {article_images}
                <li>
                  <img src="{image_matrix_image}" alt="">
                  <div class="caption">
                    <p>{image_matrix_cutline}<em>  ({image_matrix_byline})</em></p>
                  </div>
                </li>
            {/article_images}
          </ul>
          {if:else}
          {/if}
       </div>

```

So you see, what should be an easy task, is just not working. **The result is both an empty album *not* showing and an album with images *not* showing.** How big of a newbie am I and what am I missing? I have tried moving around the ifs and ifelses. I have also tried using '== true'.

Any help is greatly appreciated. Thank you so much!

Picture of empty image slider above.

# Answer
> 2 votes
If I read your code correctly, you use Matrix field to keep images. Try next code for this:

```
 <div class="left article_image">
   {if article_images:total_rows>0}
      <ul data-orbit>
      {article_images}
            <li>
              <img src="{image_matrix_image}" alt="">
              <div class="caption">
                <p>{image_matrix_cutline}<em>  ({image_matrix_byline})</em></p>
              </div>
            </li>
        {/article_images}
      </ul>
      {if:else}
      {/if}
   </div>

```

---
Tags: conditionals, ifelse, image-galleries
---


# Question
Title: Photo Frame add-on -- customize alt attribute?
I just installed the Photo Frame EE add-on and I'm really impressed with the image editing functionality. I'm unsure, however, as to whether it's possible to include a variable in the image `alt` attribute? *Before* installing Photoframe, my EE template markup was as follows for the image field in question:

```
<div class="item-photo">
    <img src="{item_photo}" alt="{item_name} photo">
</div>

```

After integrating Photo Frame as the field type for `{item_photo}`, I changed the EE markup as follows:

```
<div class="item-photo">
    {item_photo}
</div>

```

Photo Frame generates the full `<img>` markup, and creates an `alt` attribute from the name of the published channel entry. I'm wondering how I might customize the value of this attribute, as I've done with my original EE template markup.

Thanks for any assistance here from those who may be using the Photo Frame add-on; and please let me know if my question is unclear in any way.

# Answer
> 1 votes
You can use the same template code as before. Just need to add {item\_photo:url}

```
<div class="item-photo">
    <img src="{item_photo:url}" alt="{title} photo">
</div>

```

---
Tags: add-on, module, image, channel-fields
---


title: Repositioning images

text:
# Question
Title: Repositioning images
We've uploaded a bunch of images into EE but when they're added into templated image sections, many of them are too high or too low. Is it possible to reposition these images in EE without having to fix them and then re-upload into EE?

# Answer
You could crop them in the template to make them the correct size / aspect ratio.

Here's a free addon for that: https://github.com/bjornbjorn/img.ee\_addon
> 2 votes

---
Tags: image
---


title: Expresso Store AJAX multi-step checkout

text:
# Question
Title: Expresso Store AJAX multi-step checkout
I'm having trouble making an Expresso Store multi-step checkout process work via AJAX. I have the checkout steps working as individual pages, and have attempted to AJAXify the submission of each step via the following pattern of jQuery (replacing "form" below with the correct checkout form):

```
$('form').on('submit', function(e) {

e.preventDefault();
$.ajax({
    type: "POST",
    url: $(this).attr('action'),
    data: $(this).serialize(),
    success: function(data) { console.log(data); }
});

});

```

This AJAX query correctly submits the form variables of the checkout step, however the "data" variable returned is a JavaScript object containing all checkout variables (correctly updated).

What I want is for "data" to return the HTML of the next checkout step page, like what happens when pressing the "Next" button of the un-AJAXified form.

I think the issue is that the AJAX above doesn't tell the server it was the Next button (with name="next" attribute) pressed, and the server bases its response on which form button was pressed… but I'm how sure how I would tell the server which button was "pressed" via AJAX.

Any ideas how I can get this working?

# Answer
> 2 votes
It would be ideal if Expresso Store actually just send you a json response, but like you've mentioned, it returns the whole order object, including form errors (if any). You can see this in the module code under **Store \> src \> Action \> CheckoutAction.php**

It returns this:

`if ($this->ee->input->is_ajax_request()) {
 $this->ee->output->send_ajax_response(array_merge($cart->toTagArray(), static::$form_errors));
}`

So, you will need to handle the different steps of your checkout process yourself using multiple ajax calls. What we've done before is have separate ajax templates for the steps like "checkout-step1", "checkout-step2", etc. In these templates you'll have the `{exp:store:checkout}` tags as per normal.

Then in your javascript files, at a minimum, you'll have an "initialize" and a "submit" function for each step. like "Checkout.initStep1", "Checkout.submitStep1", etc. You can also have an optional "update" function if you don't want the next step to load, but you're only updating something on the same step, like item quantities.

On first load you'll then "Checkout.initStep1", which simply loads in the step 1 template via ajax.

In step 1's "submit" function, on success of your ajax call you will then call the "Checkout.initStep2" function to load in your step 2 template. It can look something like this (just flesh it out a bit):

`Checkout.submitStep1 = function() {
 $.ajax({
 url : '/ajax/checkout-step2',
 success: function(response) {
 $('#checkout_form2_wrapper').html(response);
 fl.Checkout.initStep2();
 },
 error: function(xhr, status, err) {
 // throw error here
 }
 });
};`

On your last step, after payment has been made and the order successfully processed, you can simply redirect to your success template with something like:

`window.location.href = '/checkout/success/' + order_hash;`

If you are using the Google Analytics enchanced ecommerce tracking, make sure to add a hidden input field named "submit" in your last step, so the Expresso Store cookie can be set, that's needed.

Hope this helps set you on the right track.

---
Tags: expresso-store
---