title: Freeform encoding attachment URL

text:
# Question
Title: Freeform encoding attachment URL
Recently upgrade a site to 2.9.2 and Freeform 4.2.1 PHP 5.3.28 and all is going well until we spotted this oddity.

The Notifications templates setup for the customer and admin emails use this:

```
{attachments} <a href="{fileurl}">{filename}</a> {/attachments}

```

This used to link back to the file but now for some reason it's encoding the URL

```
*CURRENT*
http%3A%2F%2Fwww.example.com.au%2Fmedia%2Fpublic_submissions%2FCIM%2Fmyfilename.jpg

*OLD*
http://www.example.com.au/media/public_submissions/CIM/myfilename.jpg

```

I've no idea what could be causing this, I tried a simple `{exp:freeform:entries}` tag and it did spit out the filename but no full URL so I cant even test where the fault is.

Seriously, I'm looking for a needle in a haystack here any help greatly appreciated.

# Answer
This is a known (and reported) issue with `{fileurl}` where the URL gets URL-encoded, leading to URL entities in email notifications.

In the meantime, you can remove the URL-encoding by looking for the following like (around **line 1747**) in **/system/expressionengine/third\_party/freeform/default\_fields/freeform.ft\_file\_upload.php**:

```
$url        = urlencode($upload_prefs['url'] . $file_data['filename']);

```

...and changing it to

```
$url        = $upload_prefs['url'] . $file_data['filename'];

```
> 0 votes

---
Tags: solspace-freeform, html-entities
---


# Question
Title: Matrix and Solspace Importer issue with saving properly
I'm not sure which plugin is at fault here, but here goes. Using the latest version of all plugins, and EE.

I have an Importer task to create entries, from a feed of about 20. One field in this feed is an of images and alt text. This is mapped correctly to a Matrix field, and seemingly importing fine for all entries. See below.

However, for some entries, when attempting to output in templates, these rows in the Matrix field aren't being displayed.

```
{if '{images:total_rows}'}
    {images}
        {image_src}
    {/images}
{if:else}
    no img
{/if}

```

What's more, using the above code, you'd expect even if there was a problem with mapping, that `{images:total_rows}` would return false, and print `no img`. This isn't the case, and the whole code is seemingly skipped over.

What makes me think this is an issue with Importer, is if I go to the offending entry, where I can see the rows in the Matrix as above, and re-save that entry (without changing anything) the templating works as expected. Is it somehow possible Importer isn't saving the Matrix field properly after importing?

# Answer
I would query the matrix table for an entry that doesn't work and one that does and compare the 2 to see if there is any difference.
> 1 votes

# Answer
If you see your Matrix data in your entry, that means the data is stored somewhere on your database (or else the Matrix field would be empty). Have you tried using `{if images:total_rows > 0}` instead of a true/false condition (i.e. `{if '{images:total_rows}'}`)? Matrix data is likely stored in exp\_matrix\_XXX tables (where Matrix data gets stored) but not in exp\_channel\_data (where *searchable* Matrix data gets stored), which `{if '{images:total_rows}'}` might be relying on.
> 0 votes

---
Tags: matrix, solspace, pixelandtonic, solspace-importer
---


title: Get grandparent entry_id with Structure

text:
# Question
Title: Get grandparent entry_id with Structure
In Structure you can get the parent entry\_id using `{structure:parent:entry_id}` but is there any way to get the grandparent entry\_id?

# Answer
> 2 votes
I figured it out...

```
{exp:query sql="SELECT parent_id as grandparent_id FROM exp_structure WHERE entry_id = {structure:parent:entry_id}"}
 {grandparent_id}
{/exp:query}

```

---
Tags: structure
---


# Question
Title: How to get channel fields in {exp:structure:siblings}
How can I access channel fields in {exp:structure:siblings}? I've tried the following code and title and url get output fine but {page\_listing\_icon} doesn't get parsed.

```
{exp:structure:siblings}
   {prev}
      <a href="{url}" title="{title}">{page_listing_icon} {title}</a>
   {/prev}
   {next}
      <a href="{url}" title="{title}">{page_listing_icon} {title}</a>
   {/next}
{/exp:structure:siblings}

```

# Answer
I'd use Stash to help with this:

```
{exp:stash:set parse_tags="yes"}
    {exp:structure:siblings}
        {stash:prev_entry_id}{prev}{entry_id}{/prev}{/stash:prev_entry_id}
        {stash:next_entry_id}{next}{entry_id}{/next}{/stash:next_entry_id}
    {/exp:structure:siblings}
{/exp:stash:set}

{exp:stash:parse}
    {exp:channel:entries
        channel="pages"
        fixed_order="{stash:prev_entry_id}|{stash:next_entry_id}"
        dynamic="no"
    }
        <a href="{page_url}" title="{title}">{page_listing_icon} {title}</a>
    {/exp:channel:entries}
{/exp:stash:parse}

```
> 1 votes

---
Tags: structure
---


# Question
Title: Solspace Freeform Pro - How to pull URL title into the email subject
I am using Solspace Pro form on my website and I have no clue on how to change the subject of the email. I will be glad to know if there is a way to pull the title of a detailed page of a listing into the email subject. When a form on a detailed page is filled, I want to pull the title of that detailed page into the subject of the email when notification is sent.

# Answer
> 1 votes
The Subject is set under the Notifications tab. There you will see a list of your notifications templates. Choose the template you are using for the form in question.

For grabbing the page title, and I'm assuming the form is wrapped in a channel entries tag pair, create a hidden form field my\_subject or something, and assign it a value of {url\_title}.

Then in your notification template put {my\_subject} in as the value along with whatever you'd like in for the value of the Subject field.

---
Tags: channel-entries, solspace-freeform
---


# Question
Title: Zoo Visitor - Update profile with new fields
EE 2.9.2 & Zoo Visitor 1.3.3

I have 20 fields, 10 of which are required for users to fill out when registering. I want the users to be able to then complete the other 10 when they have been registered. The `{exp:zoo_visitor:update_form}` tag does not seem to work for these fields, I assume because they do not have any data stored in them.

So, I have to use another `{exp:zoo_visitor:registration_form}`, although submitting that complains that the original 10 fields filled out during registration has not been completed. What's the best way to approach this? Use the current setup and have the required fields hidden?

# Answer
> 0 votes
Quickly looking at it, I'm finding the following issue for those fields that are not saving.

You have:

```
<input type="text" name="{candidate_skype}" id="{candidate_skype}" value="{if candidate_skype}{candidate_skype}{/if}" />

```

Why is the name and id wrapped in {}?

Just use:

```
<input type="text" name="candidate_skype" id="candidate_skype" value="{if candidate_skype}{candidate_skype}{/if}" />

```

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


# Question
Title: Escape characters when passing variables to an embeded template
I have an embed template to which I'm passing variables from some custom channel fields. Everything works as expected until there are quotes (") inside the variable.

For example, I have the variable {article\_content} inside the "section/subsection" template containing html markup with a few paragraphs and some links. I pass the variable to the embeded template using:

```
{embed="embeds/.article_template" emb_article_content="{article_content}"}

```

On the embeded template I use:

```
{embed:emb_article_content}

```

When I render the page, everything is ok until the engine reach the first quotes (") in a link, then nothing is redered. I get something like this:

```
<p>This paragraph is alright because doesn't contain links or quotes</p>
<p>This paragraph contains a link <a href=

```

I have tried to find ways to escape the quotes but I just can't figure out how to do it.

Any ideas to solve this issue would be greatly appreciated!

# Answer
> 0 votes
I managed to solve this. I used htmlspecialchars before passing the variable and in the embedded template I used htmlspecialchars\_decode before using the variable. In case anyone is interested, it looks something like this:

On the template in which I embeded the template I did this:

```
{embed="embeds/.article_template" emb_article_content="<?php echo htmlspecialchars('{article_content}');  ?>"}

```

Then on the embedded template I decoded the variable like this:

```
<?php echo htmlspecialchars_decode('{embed:emb_article_content}'); ?>

```

I'm sure there are more efficient ways to do this but this works for now. I'd still like to hear any other solutions.

For those who want to use this solution and are beginners like me, don't forget to enable PHP in both templates with PHP parsing stage set to "Output".

Cheers!

EDIT:

This whole thing can be solved by just using simple quotes (') instead of double ones (") like this:

```
{embed='embeds/.article_template' emb_article_content='{article_content}'

```

This assumes that there are no simple quotes inside your variable, otherwise there will be conflicts as well. If you are sure there won't be any conflicts you can use this solution, but to be safe, I think I will stick to encoding and decoding any variable with possible conflicts.

---
Tags: embeds
---


title: Cartthrob and Stripe integration

text:
# Question
Title: Cartthrob and Stripe integration
Just wondered if anyone has done anything with the payment gateway within Cartthrob to try and use the "Stripe Checkout" over building your own standard checkout page... love the look of its clean simple interface over the standard checkout pages we would normally create, and that I've done so far. Also been able to integrate the mobile side of this would be much nicer and I'm sure help conversion. Just curious to know if anyone has integrated this and how they got it looking and working and if its worth even looking into , or just sticking with building your own as i have done so far with this integration.

# Answer
All sorted and integrated nicely, just used the default cartthob settings with some tweaks
> 0 votes

---
Tags: cartthrob, stripe
---


# Question
Title: Insert Custom Channel Field Grid into Database?
Is there a better way to tie into EE to create a grid field? During my module install, I am having it setup a new grid field to relate to a custom channel field group that setups up the required table information for a grid in my database. Example below. I feel there has to be a better/cleaner way to achieve this.

```
    // Create exp_channel_fields and assign by group_id
    ee()->db->insert(

        'exp_channel_fields',
            array(

                'site_id'               => 1,
                'group_id'              => 0,
                'field_name'            => 'menu',
                'field_label'           => 'Sidebar Nav',
                'field_instructions'    => 'Add links to display on sidebar nav.',
                'field_type'            => 'grid',
                'field_pre_populate'    => 0,
                'field_pre_channel_id'  => 0,
                'field_pre_field_id'    => 0,
                'field_ta_rows'         => 6,
                'field_maxl'            => 128,
                'field_required'        => 'n',
                'field_text_direction'  => 'ltr',
                'field_search'          => 'n',
                'field_is_hidden'       => 'n',
                'field_fmt'             => 'xhtml',
                'field_show_fmt'        => 'n',
                'field_order'           => 3,
                'field_content_type'    => 'any',
                'field_settings'        => $field_settings

            )
    );

    ee()->db->insert(

        'exp_grid_columns',
            array(

                'field_id'         => $exp_channel_field_id,
                'content_type'     => 'channel',
                'col_order'        => 0,
                'col_type'         => 'multi_select',
                'col_label'        => 'Nav Select',
                'col_name'         => 'nav_option',
                'col_required'     => 'n',
                'col_search'       => 'n',
                'col_width'        => 0,
                'col_settings'     => '{"field_fmt":"none","field_list_items":"link1\nlink2\nlink3","field_required":"n"}'

            )

    );

```

# Answer
> 0 votes
I believe the best approach to this was to tie directly into Expression Engine's Channel fields API.

https://ellislab.com/expressionengine/user-guide/development/api/api\_channel\_fields.html#fetch-all-fieldtypes

---
Tags: module, grid, fieldtype
---


# Question
Title: Charge shipping on free item in Cart Throb
Our client gives 'free' samples but having tried seemingly endless combinations, I don't think Cart Throb will charge a shipping rate on a free item.

I've tried to manually set the shipping rate through a hidden field, which gets added to the main data array, but it doesn't carry a value to add to the subtotal.

Does anyone know if this is case with CT? Is there a way around it?

*I could reverse the charge (apply the shipping rate to the product and set free shipping), but then they can't really promote the 'free' samples, so would rather try and get the free product with shipping if possible.*

# Answer
> 0 votes
# Me too...

I've run into the same issue... with live rates. I'm not sure what shipping plugins you're using but, regardless, I believe the problem is CT checks the "shippable subtotal" to see if it is less than or equal to 0 and, if it is, **no shipping is provided**. The following is in regards to the live rates plugins.

# The problem is with shippable\_subtotal()

Ultimately, running `shippable_subtotal()` on the cart goes through all of the products that are "shippable" and then runs `$item->price_subtotal()` for each item in the cart. If the price of the product has been set to $0, it's shippable subtotal becomes $0 as well.

Instead of checking that the shippable subtotal is less than or equal to 0, CT *should* check to see if the cart has shippable items. Just because the subtotal of shippable items is 0, doesn't mean the products don't need to be shipped. **I think this is a bug.**

# For example...

Specifically, the code I'm referring to is in Cartthrob's live rate shipping plugins that I use (`Cartthrob_shipping_fedex.php` starting on line 668 and `Cartthrob_shipping_usps.php` starting on line 797):

```
function get_shipping()
{
    $cart_hash = $this->core->cart->custom_data('cart_hash');

    if ($this->core->cart->count() <= 0 || $this->core->cart->shippable_subtotal() <= 0)
    {
        return 0;
    }
[...]

```

As you can see, if `$this->core->cart->shippable_subtotal() <= 0`, 0 is returned as the shipping cost. This is why shipping isn't charged.

# So what can we do?

There would need to be some pretty extreme modifications made to the core Cartthrob shipping plugins to fix this issue because it appears all of them use the `shippable_subtotal()` method to calculate the final shipping price.

However, for the live rates plugins, I had to modify the core code (which is obviously discouraged) to make this work.

The solution is to remove the `$this->core->cart->shippable_subtotal()` check and replace it with `count($this->core->cart->shippable_items) === 0`. The new code within the live rates plugins for `get_shipping()` would need to be modified to look like so:

```
function get_shipping()
{
    $cart_hash = $this->core->cart->custom_data('cart_hash');

    if ($this->core->cart->count() <= 0 || count($this->core->cart->shippable_items()) === 0
    {
        return 0;
    }
[...]

```

# Partial Answer

I recognize this solution is only for the live rates plugins but I wanted to submit the answer because your question wasn't specific on which plugin was being used. I haven't used the built-in shipping plugins so I don't have experience with their code. Someone else may be able to gain insight from my partial answer and expand on it for the built-in plugins.

---
Tags: cartthrob, shipping
---


title: Simple Conditional Help

text:
# Question
Title: Simple Conditional Help
Simple question here hopefully.

I have an album page that displays a track listing. With the option for up to 4 discs being displayed as show below.

**DISC 1**

Track listing

**DISC 2**

Track listing

**DISC 3**

Track listing

**DISC 4**

Track listing

**Here is my EE code**

{exp:channel:entries channel="disco" status="open" orderby="disco\_release\_date" sort="desc" limit="1"}

```
<div class="disc-tracks">

    {disco_disc2_tracks}

    <li><h4>{disco_disc2_tracks:title}</h4>
    {!--IF STATEMENT SHOWS THE DUET PARTNER AND HIDES THE (WITH) IF THERE ISN'T ONE--}
    <p>{if disco_disc2_tracks:track_duet_partner}<em>(with {disco_disc2_tracks:track_duet_partner})</em>{/if}</p>
    <p><span class="songwrittenby">Written By: {disco_disc2_tracks:track_writtenby}</span></p></li>

{/disco_disc2_tracks}

</div></ol><!-- END DISCOGRAPY DISC 2 TRACKS -->

```

{/exp:channel:entries}

I have 4 of those on the page. 1 for every disc I want to wrap everyone in an IF statement so that if no tracks are selected on the channel entries page for a specific disc aka that disc has 0 tracks selected - that it doesn't show the header "Disc 2" "Disc 3" "Disc 4" and have empty titles on my page. I have an IF statement for the duet partner already in my code above and it works great, but I can't seem to write one that can hide the whole header and div containing the Disc # and tracks.

Also the tracks are a relationship filed and I'm pulling them from another channel. See image

# Answer
> 0 votes
Ok that's simple enough. The relationship field loop is just like the entries loop. It shouldn't return anything if there isn't anything to grab. But regardless, all you should have to do is wrap your heading in a conditional and have it only display before the first returned entry from the related channel, like this:

```
{disco_disc2_tracks}
{if disco_disc2_tracks:count == "1"}
<div class="disc-tracks">
DISK 2 (you didn't include your header but I'm assuming you have something like this going on prior to the related entries loop.)
<ol>{!-- START DISCOGRAPHY --}
{/if}
<li><h4>{disco_disc2_tracks:title}</h4>
{!--IF STATEMENT SHOWS THE DUET PARTNER AND HIDES THE (WITH) IF THERE ISN'T ONE--}
{if disco_disc2_tracks:track_duet_partner}<p><em>(with {disco_disc2_tracks:track_duet_partner})</em></p>{/if}
<p><span class="songwrittenby">Written By:         {disco_disc2_tracks:track_writtenby}</span></p></li>

{if disco_disc2_tracks:count == disco_disc2_tracks:total_results}</ol></div>{/if}
  {/disco_disc2_tracks}

```

So the idea is start the div and the list on condition that at least one entry is returned by count by the related entries loop (for each disk) and close it on condition that the returned entry by count is the last returned entry. I also recommend moving the markup around the track duet partner INSIDE the conditional as well - otherwise you would have paragraph tags (empty) when one doesn't exist.

# Answer
> 0 votes
Maybe this works, wrap your code around this. It then should say if my\_field "disco\_disc2\_tracks" is NOT empty then show stuf.. If empty do not show stuff.

{if disco\_disc2\_tracks != ""}....{/if}

{if disco\_disc2\_tracks != ""}

```
{disco_disc2_tracks}

<li><h4>{disco_disc2_tracks:title}</h4>
{!--IF STATEMENT SHOWS THE DUET PARTNER AND HIDES THE (WITH) IF THERE ISN'T ONE--}
<p>{if disco_disc2_tracks:track_duet_partner}<em>(with {disco_disc2_tracks:track_duet_partner})</em>{/if}</p>
<p><span class="songwrittenby">Written By: {disco_disc2_tracks:track_writtenby}</span></p></li>

```

{/disco\_disc2\_tracks}

{/if}

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


# Question
Title: Remove add_to_cart_form button after a fixed quantity of a certain product added to cart
I need to be able to limit how many of a certain product can be added to the cart.

I thought I could use `{cart_items_info}` with an `{entry_id}` parameter to limit to the product I'm targeting and then use a conditional based on `{total_items}`, e.g.

```
{exp:cartthrob:cart_items_info entry_id="XXX"}
{total_items} {!-- returns the total of other items in the cart too, not just the entry_id specified --}
{if total_items <=5} … {/if}
{/exp:cartthrob:cart_items_info}

```

but the tag seems to return the whole cart total items regardless of whether I use the `entry_id` param or not.

Is this a bug with `cart_items_info` or is there another way I should be going about this?

# Answer
> 0 votes
We had a scenario where free samples are offered by the client, but they only wanted customers to be able to request 1 sample pack at a time to discourage people buying the cheaper samples instead of the real product.

On the product page we have the following:

```
<div class="add-to-basket">
  {if {exp:cartthrob:is_in_cart entry_id="249"}}
  <p>It looks like you've already added samples to your basket. Our sample packs are free (subject to postage) so they are limited to one per customer.</p>
  {if:else}
  <button type="submit">Add To Basket</button>
  {/if}
</div>

```

The difference here is we didn't need to count the products as they were limited to just 1. Not sure whether you could use another conditional within `{if {exp:cartthrob:is_in_cart entry_id="xxx"}}`?

---
Tags: cartthrob
---


# Question
Title: Freeform Pro Form with Submission Progress
I have a freeform pro form that is using a piece of javascript to provide a progress indicator once a form is submitted. Idea is seen here: http://tympanus.net/Development/ProgressButtonStyles/

However, with this script enabled, the form will not submit. When I comment out the js, the form submits fine. I cannot figure out what I need to edit in the script to play nice with Freeform. Code is as follows:

```
function initProgressBtn(){
    jQuery('.form').each(function() {
        var form = jQuery(this);
        var sendBtn = form.find('.progress-button');
        var ajaxBusy = false;

        new ProgressButton( sendBtn.get(0), {
            callback : function( instance ) {
                var progress = 0,
                interval = setInterval( function() {
                    progress = Math.min( progress + Math.random() * 0.1, 1 );
                    instance._setProgress( progress );

                    if( progress === 1 ) {
                        instance._stop(1);
                        clearInterval( interval );
                    }
                }, 200 );
                form.trigger('startProgress');
            }
        });

        function onSendForm(e) {
            e.preventDefault();
            if(!ajaxBusy) {
                ajaxBusy = true;

                jQuery.ajax({
                    url: form.attr('action'),
                    type: form.attr('method'),
                    data: form.serialize(),
                    dataType: 'text',
                    success: function() {

                    }
                });
            }
        }

        form.on('submit startProgress', onSendForm);
    });
}

```

Any help would be greatly appreciated - thanks!

# Answer
> 1 votes
I was able to fix this by adding the redirect url directly in the javascript:

```
success: function() {
window.location.href = "redirected-page.html";
}

```

---
Tags: solspace-freeform, forms, javascript
---


# Question
Title: Not getting notification of required fields
I have a Freeform Pro form that has a few required fields and uses a submit button to check server response time. The form works fine, stores the data in the Freeform database when submitted, etc. But when the required fields are not provided, there is no notification provided that the fields are invalid. The form is not submitted when these fields are invalid, but the user is still redirected to my confirmation page staying the form was submitted.

I know this has something to do with my submit button. When I remove the javascript from the submit button, it works as it should.

Here is my code:

```
{exp:freeform:form form_name="contact" form:class="form" required="first_name|last_name|email|phone|user_message"}
                <fieldset>
                    <div class="header">
                        <h2>Contact us for an initial consultation</h2>
                        <p>If you would like a member of our staff to contact you for a free initial consultation on your case, please complete this form, or call us toll-free at <a href="tel:8777048050" class="tel-link">877-704-8050.</a></p>
                    </div>
                    <div class="input-area">
                        <div class="row">
                            <div class="col input-holder">
                                {freeform:field:first_name attr:placeholder="First Name"}
                            </div>
                            <div class="col input-holder">
                                {freeform:field:last_name attr:placeholder="Last Name"}
                            </div>
                        </div>
                        <div class="row">
                            <div class="col input-holder">
                                {freeform:field:email attr:placeholder="Email"}
                            </div>
                            <div class="col input-holder">
                                {freeform:field:phone attr:placeholder="Phone"}
                            </div>
                        </div>
                        <div class="row">
                            {freeform:field:user_message attr:placeholder="Your message..."}
                        </div>
                        {freeform:field:page_url}
                        <button type="submit" class="progress-button" data-style="shrink" data-horizontal>Submit</button>
                    </div>
                    <div class="footer">
                        <p>This web site is designed for general information only. The information presented at this site should not be construed to be formal legal advice nor the formation of a lawyer/client relationship.</p>
                    </div>
                </fieldset>
            {/exp:freeform:form}

```

And the script that runs the submit button:

```
// progress button init
function initProgressBtn(){
    jQuery('.form').each(function() {
        var form = jQuery(this);
        var sendBtn = form.find('.progress-button');
        var ajaxBusy = false;

        new ProgressButton( sendBtn.get(0), {
            callback : function( instance ) {
                var progress = 0,
                interval = setInterval( function() {
                    progress = Math.min( progress + Math.random() * 0.1, 1 );
                    instance._setProgress( progress );

                    if( progress === 1 ) {
                        instance._stop(1);
                        clearInterval( interval );
                    }
                }, 200 );
                form.trigger('startProgress');
            }
        });

        function onSendForm(e) {
            e.preventDefault();
            if(!ajaxBusy) {
                ajaxBusy = true;

                jQuery.ajax({
                    url: form.attr('action'),
                    type: form.attr('method'),
                    data: form.serialize(),
                    dataType: 'text',
                    success: function() {
                    window.location.href = "/request-received/";
                    }
                });
            }
        }

        form.on('submit startProgress', onSendForm);
    });
}

```

Is there are way to use the javascript for submission but still utilize freeform/ee's form validation? Thanks for any help.

# Answer
> -1 votes
I was able to resolve this by using Forms JS validation which is a great EE addon.

---
Tags: solspace-freeform, forms, ajax, validation
---


title: MX Select Plus, multi-select style

text:
# Question
Title: MX Select Plus, multi-select style
I just installed this module hoping to have the nice multi-select interface, but not so! I'm seeing a javascript conflict in the console. See screenshot attached. Any thoughts to resolve?

# Answer
> 0 votes
Finally figured this one out. Our install uses Focus Labs global config, which rearranges the modules / themes folder structure. Initially, we had the module & theme directory in this location. After moving to the default EE location, the module worked as expected.

---
Tags: mx-select-plus
---


# Question
Title: How do I link entry to the correct section when pulling from multiple channels?
The search results feature allows you to use {auto\_path} to take you to the correct template\_group/template, however, I need a similar solution for regular garden variety channel entries.

I have a news feed section on the home page that displays the 3-5 most recent entries from five different channels. The code is like this:

```
<h4>Recent News Posts</h4>
<ul class="inline-list">
  {exp:channel:entries channel="community|government|education|business|history" limit="3"}
    <li><a href="/news/{url_title}">{title}</a></li>
   {/exp:channel:entries}
</ul>

```

Currently I have a generic "news" placeholder in the path, but what I need is to direct each entry to its appropriate section. Outside the search results {auto\_path} I have not been able to find anything. I am open to suggestions.

# Answer
> 1 votes
I may be reading this wrong and so if I am then I apologise but could this not work for you?

```
  <h4>Recent News Posts</h4>
<ul class="inline-list">
  {exp:channel:entries channel="community|government|education|business|history" limit="3"}
    <li><a href="/{channel_short_name}/{url_title}">{title}</a></li>
   {/exp:channel:entries}
</ul>

```

You then won't need to use any conditionals which add extra processing time to your template and if you ever add more channels then you won't need to add any more conditionals into the code either.

# Answer
> 1 votes
One way is to use a conditional based on `channel_short_name` like this:

```
{exp:channel:entries channel="community|government|education|business|history" limit="3"}
    <li>
        {if channel_short_name == "news"}
            <a href="/news/{url_title}">{title}</a>
        {if:elseif channel_short_name == "community"}
            <a href="/community/{url_title}">{title}</a>
        {if:elseif channel_short_name == "government"}
            <a href="/government/{url_title}">{title}</a>
        {/if}
    </li>
{/exp:channel:entries}

```

For the sake of the example I just did three of your channels, but you'd want to add a clause in the conditional for each one.

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


# Question
Title: Force devdemon channel files to open pdf's in a browser
I need to make channel files locked url to open pdf's in the browser rather than prompting users to download. I can't see this as an option, is it possible?

# Answer
The issue is the obfuscated link provided by the locked URL doesn't have a file type. So this means Google isn't reading it and it can't be shown as a web page. If you want the browser to show it like a web page you have to use the regular url.

Brad
> 0 votes

---
Tags: devdemon, channel-files
---


title: Freemember error message

text:
# Question
Title: Freemember error message
I installed Freemember as an addon module for Expression Engine. I'm still getting this error when I try to set up registration form.

```
Error

In order to use the encryption class requires that you set an encryption key in your config file.

```

I'm using EE 2.7.3 and PHP Version 5.3.2 . I have added this to my config.php file

```
$config['encryption_key'] = "l49YGsxdrq3VcNJdxTWQcaKKhBKREfNb7nbGSxOxBPMnHumuzCVkwa9xoTFHkBq";

```

So why I am getting this error message?

Thanks you, randy

# Answer
Make sure it is not being overwritten in the config.php file. At the bottom of the config file, the encryption key is declared as blank, so make sure the key is entered there, or below these lines of code

```
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Sessions class with encryption
| enabled you MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = '';
```
> 2 votes

---
Tags: freemember
---


# Question
Title: PHP errors in control panel; main site still working
NOTE: I am a non-technical person and know nothing about PHP. I can follow step-by-step instructions though.

I am running EE v2.5.5

I am getting PHP errors on my control panel which won't go away with a refresh. I have NOT changed any files, however I did open and peek around a few files through my FTP site two weeks ago to see if I could find the code for my tags.

Since then, these errors are constant.

It is NOT effecting my front end site (www.justfrances.com) but it IS effecting my ability to search for previous posts on the control panel to edit things. It's also slowed a lot of the control panel functions and has meant that I have to refresh after posting a new entry.

Any thoughts on WHY or on how to fix this?

I tried looking at other threads on this, but nothing seemed to work (or make sense) for me

Thank you, Just Frances

# Answer
> -1 votes
UPDATE: A knowledgeable PHP friend solved ALL errors for me by adding a new line of code on line number 145:

$plugin\_info = array();

That fixed ALL errors and the site is running as normal now.

# Answer
> 3 votes
`$plugin_info` is a required array for ExpressionEngine 2.x plugins. The PHP class providing the functionality for the plugin will work fine without it, but that is where the information for installed plugins is pulled to be displayed in the control panel.

You can find the full details here: ExpressionEngine Plugin API: `$plugin_info` array

e.g.:

```
$plugin_info = array(
    'pi_name'         => 'Member List',
    'pi_version'      => '1.0',
    'pi_author'       => 'Jane Doe',
    'pi_author_url'   => 'http://example.com/',
    'pi_description'  => 'Returns a list of site members',
    'pi_usage'        => Memberlist::usage()
);

```

# Answer
> 0 votes
This error looks like Expression Engine is having trouble with reading your plugins.

In the control panel when you go to Add-ons \> Plugins, do you see a list of plugins there?

Are they what you expect?

Similarly on the FTP side, when you go /system/expressionengine/third\_party do the file permissions seem right? Are you seeing the folder that you expect?

---
Tags: control-panel, error, php, php-errors
---


# Question
Title: MX google maps loads insecurely over https
MX Google Maps does not display in a channel form when the page is loaded over HTTPS. I get the error:

```
The page at 'https://www.fakesite.com/members/manage-listing/474' was loaded over HTTPS, but requested an insecure resource 'http://maps.google.com/maps/api/js?sensor=false'. This request has been blocked; the content must be served over HTTPS.

```

It also stops all of my other JavaScript from running

# Answer
edit the file `/system/expressionengine/expressionengine/third_party/mx_google_map/ft.mx_google_map.php` and change the following lines

On line 135, change:

```
ee()->cp->add_to_foot('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>');

```

To

```
ee()->cp->add_to_foot('<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script>');

```

and on line 856, change:

```
ee()->cp->add_to_foot('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>');

```

To

```
ee()->cp->add_to_foot('<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script>');

```

By removing the "http:" from both of the urls you are allowing the browser to choose which protocol to use.
> 1 votes

---
Tags: mx-google-map
---


title: Channel Ratings Comments Spam

text:
# Question
Title: Channel Ratings Comments Spam
Hi I use Channel Ratings with comments on my website, but lately I'm receiving 'spammed' ratings with comments about viagra!!! Do you have a way to prevent this from happening??

Best regards

Dave@Daliz

# Answer
Since Channel Ratings uses ExpressionEngine's native commenting system, you should look at general solutions for combatting comment spam, including enabling Captcha as @gabriel\_b suggests.

I have had success in the past using Ben Croker's Snaptcha add-on to prevent automated spam attacks.
> 1 votes

# Answer
Why don't you enable Captcha-s? This should prevent you from getting automated SPAM
> 1 votes

---
Tags: devdemon, channel-ratings
---


title: Search Results with category based URLs

text:
# Question
Title: Search Results with category based URLs
We have a site with 1 products channel and the URL's are constructed from the categories that the products fall into e.g.

`/template_group/category_parent/category_child/title`

This is all fine when generating links (via conditionals based on segments) within an exp:channel:entries tag however on the search results page I'm at a loss as to how to get the appropriate parent and child category entries into the URL to each result. Can anyone suggest an approach?!

# Answer
OK - I found a solution using the {categories} tags...

`<a href="/template_group{categories limit="1"}/{category_url_title}{/categories}/{url_title}`"\>
> 0 votes

---
Tags: categories, search, gwcode-categories
---


title: CE Cache pre - sales questions

text:
# Question
Title: CE Cache pre - sales questions
Three questions:

1. I see a lot of unanswered questions in here on CE Cache - is the add on still being supported / used?
2. I want to use CE-Cache for pages that look at incoming variables (like segment, and embed) and cache the resulting version of the page based on those. For example:

embed variable - area = 1

I want to cache a version of the resulting template as "1", "2", etc. to match the incoming value of area. So a page that is normally dynamic for each person's area, would pull up the right cached version of the page. Can CE Cache do that?

3. I to use PHP on output in some of my templates - can CE Cache work with that? Or will that not get parsed?

# Answer
> 1 votes
Well, just to answer this, as I bought the plugin:

1. Not sure if it's still supported.
2. I was able to use segment / embed variables to specify unique cache names, so I could cache part / all of a template to a unique ID based on the specific incoming url. That was perfect for my purposes
3. the php does not get parsed but is part of the cached file. So you see all the EE code / queries are parsed and executed, but the php is still parsed last. Still, this seems to speed things up pretty much, at least in my case. The EE queries seem to be the biggest resource hogs.

One thing I did notice was that some "layout" variables didn't like being inside the cache tags, but I didn't investigate enough to see if there's a workaround. I didn't need to cache those.

Anyway, the plugin works well for my application, I suspect most sites would gain something by using it.

-jim

---
Tags: ce-cache
---


# Question
Title: Alternative ways to configure tags without using segment variables
I'm using EE for a few years now and pretty often I'm setting up segment variables to dynamically configure tags - like this:

```
{exp:channel:entries
    channel="{segment_2}"
    entry_id="{segment_3}"
    author_id="{segment_5}"}

{/exp:channel:entries}

```

Although this is working fine, it tends to make URLs pretty long, which I despise. :(

Now, I've already tried native template routes as well as Resource Router, Stash and other third-party options, but I can't figure out an alternative way to set these dynamic parameters reliably.

Am I missing something?

Is there another method like maybe setting variable across page-loads?

# Answer
The Channel Entries tag can also take Dynamic Parameters. You specify which ones you would like to allow to be configured from GET/POST with the `dynamic_parameters=` Channel Entries tag parameter.

If you need maximum control—essentially control of the tag itself—via the URL, this is the way to go. It's not for every use case, as @james-smith points out above, the Channel Entries tag does a lot for you automatically without usurping control of the tag. But in instances where you want to usurp that control to the URL, it can be very handy.
> 1 votes

# Answer
Are you aware of the `dynamic` nature of the `channel:entries` tag? It won't handle author\_id, but by default it will automatically filter itself if it detects a url\_title, entry\_id, category\_url\_title/category id, dates, or pagination markers in the URL. Here's a full explanation:

http://www.jamessmith.co.uk/articles/expressionengine\_url\_schematic

You need to be a little bit careful about passing segment data directly into a channel entries tag as you could accidentally expose content that was meant to be private.

Alternatively, if you're looking for more advanced filtering, try Reefine.
> 0 votes

---
Tags: configuration-variables
---


title: Matrix & EE 2.9.2 SQL Error

text:
# Question
Title: Matrix & EE 2.9.2 SQL Error
I am using version 2.9.2 EE and Matrix 2.6.1 (both the latest versions of each software). Each time I try to publish a channel entry that has a Matrix fieldtype I am getting the following error message. Can anyone assist me with why I am getting this error.

A Database Error Occurred Error Number: 1054

Unknown column 'is\_draft' in 'where clause'

SELECT row\_id, col\_id\_1, col\_id\_2, col\_id\_3, col\_id\_4, col\_id\_5 FROM exp\_matrix\_data WHERE field\_id = 105 AND entry\_id = 937 AND is\_draft = 0 ORDER BY row\_order ASC

Filename: third\_party/matrix/ft.matrix.php

Line Number: 3044 Thanks

# Answer
You're missing a database column that was added in Matrix version 2.5 for compatibility with Better Workflow. It sounds like you may have updated the files for that add-on but not triggered the update by visiting Add-Ons \> Fieldtypes \> Matrix to trigger Matrix’s update script.
> 1 votes

---
Tags: channel-entries, matrix, pixelandtonic, file-uploads, sql
---


title: Total members limit?

text:
# Question
Title: Total members limit?
I have a site using EE 2.5.2, they have a count of the total members of the site on the homepage using:

```
{member_total}

```

The site has recently gone over 10,000 members and the counter has gone back to 0 and started counting up from 0 again.

Am I correct in assuming there's a limit of 9999 members that the tag can process and is there a way around this?

# Answer
> 0 votes
Turns out {member\_total} was correctly counting the total members at over 10,000, the font was just the same as the background colour, so the last digit was just hidden.

---
Tags: members
---


# Question
Title: Update page content via ssh rather than web interface
Im attempting to update page content (template content more specifically) in vim over ssh and have experienced trouble with the changes being committed.

## For example:

I have a common footer template where I am changing some information. Through ssh, I navigate to the file, open in vim, and write the changes. *everything is ok to this point*

I go to the website and the change **has not** been committed… even with hard refresh.

Then, if I navigate to the same footer file in the web interface, the change still isn't present. If I go ahead and make the change there, as you would imagine, it works just fine.

## So my question is:

Is there some cache setting or configuration option that makes editing the template files directly on the server as functional as committing changes through the gui?

# Answer
> 1 votes
1) Verify the template files system path is correct:

Design \> Templates \> Global Preferences

2) Generally speaking, you can clear the current cache by navigating to "Tools \> Data \> Clear Caching". You can also try deleting all of the cache files in the /system/expressionengine/cache/ folder but I haven't tried that for this type of scenario.

---
Tags: templates, server, content, workflow, template-manager
---


# Question
Title: Insert Code into Middle of Channel Entry Post
I have a channel that stores ads (HTML ads I created and the Google Adsense Code block), and displays either my html or Google's JS to allow a random ad on each page load. I want to insert that channel entry code from my Ad Channel in the middle of every post from my Article Channel – say after the 6th paragraph.

I could split the post entry field into two fields and do something like: " {postHalfOne}{adCodeSnippet}{postHalfTwo} ", but that doesn't allow for changing the breakpoint in the future.

Basic HTML can be inserted after a certain number of paragraphs via javascript, but it is my understanding that javascript can not be used to pass ExpressionEngine code. My test code works to insert HTML (fiddle), just not with my exp:channel:entries code. Can I change my code to work with EE or is JS the wrong solution here?

# Answer
> 1 votes
Another option would to go with a Blocks or Content Elements approach, where your content is actually a list of content building blocks. Then you can have any combination: text-ad-text, text-ad-ad-text, text-ad-text-ad-text, text-somethingelse-text-ad-text, etc.

The value of that is that editors can just click on an "Ad" button, instead of needing to remember that the syntax is `{advertisement}` to include an advertisement. And you can have a little bit more flexibility (especially if you need multiple ads).

*Disclosure: I wrote Blocks.*

# Answer
> 0 votes
A couple of options here.

One is to wrap your entry content in the Allow EE Code plugin, and then include your ad code via an embed wherever you ant it to appear in your entry, e.g.

```
{embed="_embeds/ad"}

```

The other option is to use something like NSM Transplant, with which you can do something like this.

Include this as a "token" for your ad inside your content:

```
{advertisement}

```

Then in your template:

```
{exp:nsm_transplant:body}

  {exp:channel:entries channel="ads" limit="1" dynamic="no"}
    {exp:nsm_transplant:content id="advertisement"}
      {ad_code}
      {!-- Whatever you need to include here for your ad to render --}
    {/exp:nsm_transplant:content}
  {/exp:channel:entries}

  {exp:channel:entries channel="articles" limit="1"}
    <h1>{title}</h1>
    {content}
    {!-- {advertisement} inside of {content} will be parsed and replaced with the content inside of {exp:nsm_transplant:content} above --}
  {exp:channel:entries}

{/exp:nsm_transplant:body}

```

---
Tags: channel-entries, javascript, embeds, variable, snippets
---


title: Best Hosting for Expression Engine?

text:
# Question
Title: Best Hosting for Expression Engine?
Whats the best hosting for Expression Engine sites?

# Answer
> 1 votes
I personally use Nexcess. A hosting solution that’s right for ExpressionEngine, plus they are EllisLab's Official Enterprise Hosting Partner.

https://www.nexcess.net/expressionengine/hosting

# Answer
> 0 votes
Any Linux based server will do but I generally choose Amazon Web Services for enterprise level sites; although I personally run a church based site successfully on a $5 DigitalOcean droplet:

http://digitalocean.com

http://aws.amazon.com/

As of now the only hosting companies that I avoid are the "no-names" and Bluehost.

Note that if you don't have much hosting experience, you're probably better off with a hosting provider that has a "Control Panel" that makes it easy to setup FTP access. MediaTemple utilizes a service called Plesk which is robust and fairly intuitive to use.

http://mediatemple.com

---
Tags: ee2, hosting
---


# Question
Title: "Related products" add to cart button in sidebar not adding to cart (Exp:resso Store)
On a product info/detail page, the sidebar is showing "related products" which are selected in the CP via Playa. I have them showing up properly but the Add to Cart button doesn't work right **if the product has modifiers**. When clicked, the page doesn't go to the return URL set in the return parameter of the `{exp:store:product}` tag pair. Instead, it goes to the same product URL but no content shows up. If the product does **not** have modifiers, it gets added to the cart correctly.

Here is the code for the related products that show up in the sidebar:

```
{if wine_related_wines}
          <h3>You May Also Enjoy</h3>
          {exp:playa:children
            channel="shop_wines"
            var_prefix="w"}

            {exp:store:product entry_id="{w:entry_id}" return="cart"}
              <div class="cta">
                <h5 class="wine-name-price">

                    <a href="/shop/wines/{w:url_title}">
                      <span>{w:wine_year} {w:wine_varietal}</span>
                      {w:wine_vineyard}{w:title}{/w:wine_vineyard}
                      {w:wine_title_suffix}
                      <span class="price">
                        {if "{w:wine_details:price}" == "$0.00"}

                          {modifiers}
                            {if modifier_type == 'var'}
                              {modifier_options limit="1"}
                                ${price_inc_mod_val}
                              {/modifier_options}
                            {/if}
                          {/modifiers}
                        {/if}
                        {if "{w:wine_details:price}" != "$0.00"}
                          {w:wine_details:price}
                        {/if}
                      </span>
                    </a>
                </h5>

                <input type="hidden" name="item_qty" value="1">
                <input type="submit" name="submit" value="Add to Cart" class="button tiny">
              </div>
            {/exp:store:product}
          {/exp:playa:children}
        {/if}

```

I've tried changing `{price_inc_mod_val}` to just `{price_mod}` but that doesn't help. I'm sure I'm missing something simple here.

# Answer
First make sure that your sidebar is not nested in your main product form since that will cause issues, but I doubt that is the case since products without modifiers work fine.

From the looks of it you are not actually selecting the modifier in your conditional. So Store is not able to add the item to the cart properly.

Try adding

```
<input type="hidden" name="{modifier_input_name}" value="{option_id}">

```

into your conditional like so:

```
{if wine_related_wines}
  <h3>You May Also Enjoy</h3>
  {exp:playa:children
    channel="shop_wines"
    var_prefix="w"}

    {exp:store:product entry_id="{w:entry_id}" return="cart"}
      <div class="cta">
        <h5 class="wine-name-price">

            <a href="/shop/wines/{w:url_title}">
              <span>{w:wine_year} {w:wine_varietal}</span>
              {w:wine_vineyard}{w:title}{/w:wine_vineyard}
              {w:wine_title_suffix}
              <span class="price">
                {if price_val == 0}

                  {modifiers}
                    {if modifier_type == 'var'}
                      {modifier_options limit="1"}
                        <input type="hidden" name="{modifier_input_name}" value="{option_id}">
                        {price_inc_mod}
                      {/modifier_options}
                    {/if}
                  {/modifiers}
                {/if}
                {if price_val > 0}
                  {w:wine_details:price}
                {/if}
              </span>
            </a>
        </h5>

        <input type="hidden" name="item_qty" value="1">
        <input type="submit" name="submit" value="Add to Cart" class="button tiny">
      </div>
    {/exp:store:product}
  {/exp:playa:children}
{/if}

```

Also on a side note you would usually use the `price_val` in your conditionals so you don't have to worry about currency formatting and using `"" or {}` around your conditional content (I adjusted your price conditionals in my code above).

From the Store 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
> 2 votes

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


title: Mystery template loading

text:
# Question
Title: Mystery template loading
A brand new EE 2.9 installation and it is NOT loading the updated version of a template. The template is called "index", lives in a "home" group and is set to be the Site Homepage

The Template manager shows the new version, the file on the server shows the new version, the website shows the old version.

If I go to "example.com" it shows the old version.
If I go to "example.com/index" it shows the new version.

If I create NEW group with a NEW template as the homepage it STILL loads the original old "index" template from "home" group.

I have: Cleared all EE caches, ensured template caching is turned of, cleared all browser caches, tested on Firefox, Chrome and IE.

WTF?

**Update:** Deleted template files from server and Template Group from EE and IT STILL shows the old template! Checked the "exp\_templates" table and it shows NO templates.

# Answer
Remove index.html from document root of webserver. I had stupidly left a a sample file and forgot about it.
> 0 votes

---
Tags: templates
---


# Question
Title: Group entries which have the same custom field using Stash?
I want to display multiple lists of entries on the same page, but with entries that have the same custom filed grouped together. I'm not able to use categories to do this and wondered if it would be possible to use Stash to achieve the desired results. This is along the lines of what I'm trying to achieve:

```
{exp:channel:entries channel='tour' disable="category_fields|member_data" show_future_entries="yes" orderby="tour_date_start" sort="asc" search:tour_type="tour"}
                    <div class="unit3">
                        <a href="{url_title_path='tours/'}">
                        <div class="unit1 unitpadding grey overview">
                            <h3>{tour_name}</h3></a>
                            <ul>
                                <li><a href="{site_url}tours/{url_title}">{tour_date_start format="%j %F"} – {tour_date_end format="%j %F %Y"}</a>
                                </li>
                                <!--alternative tour dates to be outputted here if entries have the same {tour_code_short}->
                                <li><a href="{site_url}tours/{url_title}">{tour_date_start format="%j %F"} – {tour_date_end format="%j %F %Y"}</a>{/alternative_tour_dates}
                                </li>
                                <!-- end alternative tour dates -->
                            </ul>
                        </div>
                    </div>
{/exp:channel:entries}

```

I feel like this might work with stash, but am not sure the best way to approach it? Could anyone offer any advice or guidance? Thanks.

# Answer
You can use the `match` and `against` parameters to filter a list by the value of one or more columns.

```
{!-- set the list --}
{exp:stash:set_list name="groceries"}

   {stash:title}Cox Apple{/stash:title}
   {stash:color}green{/stash:color}

   {stash:title}Jazz Apple{/stash:title}
   {stash:color}yellow{/stash:color}

   {stash:title}Banana{/stash:title}
   {stash:color}yellow{/stash:color}

   {stash:title}Brocoli{/stash:title}
   {stash:color}green{/stash:color}

   {stash:title}Pepper{/stash:title}
   {stash:color}red{/stash:color}

{/exp:stash:set_list}

{!-- get all yellow groceries --}
{exp:stash:get_list name="groceries" match="#^yellow$#" against="color"}
    {title},
{/exp:stash:get_list}

```

This page in the wiki has a more advanced example of the technique, uisng a custom index to match against multiple columns:

https://github.com/croxton/Stash/wiki/Filtering%20lists%20with%20match%20against
> 1 votes

# Answer
You could try the 'Group By' extension, this effectively adds a SQL style 'GROUP BY' parameter to the channel entries tag - https://github.com/nathanpitman/group\_by.ext.ee\_addon
> 0 votes

---
Tags: stash, custom-fields, related-entries
---


title: Display, don't edit Profile:Edit field

text:
# Question
Title: Display, don't edit Profile:Edit field
I'm trying to figure out a way to display and not have a profile:edit field be editable.

If I try and remove the {custom\_fields} tag and add each input field separately, the data won't save.

Any clue how to do this?

# Answer
> 1 votes
Are you trying to display them, or edit/save them? To display them you can just show the fields not as inputs?

---
Tags: profile-edit
---


# Question
Title: How to Filter or Block Excessive Spam in Site Search
I'm getting a crazy amount of spam traffic through supersearch. They are all for 13-digit ISBNs (book UPCs). Since we are an online bookstore, I didn't notice it at first, but we're getting about 1000 searches per hour(!) for products obviously unrelated to our website (we sell construction books).

Is there a way I can filter or block this spam? For that matter, is there a way I can find the IP address where these searches are coming from (assuming the IP address is static)?

# Answer
Try adding Snaptcha to your supersearch form. It really is very good at preventing automated form submissions.

Although supersearch is not supported natively, it is easy to add to any form by just adding the following tag to your template in between your form opening and closing tags:

```
{exp:snaptcha:field}

```
> 2 votes

---
Tags: solspace, supersearch
---


# Question
Title: Expression Engine Importer(solspace) scheduled cron jobs don't update entry
I scheduled the import job using curl, but it doesn't update the entries. If I visit the link in browser, it works fine.

# Answer
Seems like your crontask isn't configured correctly.

1) Verify your curl statement works properly by running it in Terminal (Mac) or Putty (Windows).

and

2) Verify you're configuring your crontask correctly. Are you storing it in the right file (or configuring it correctly in Plesk?). Consult your hosting company if need-be.
> 2 votes

---
Tags: solspace-importer
---


# Question
Title: Does channel ratings (4.0.8) work with EE version 2.9.2?
I have channel ratings in place from dev demon (4.0.8) and running on EE 2.9.2, using the default code supplied in the docs as follows:

```
{exp:channel_ratings:rating_comment_avg entry_id="{entry_id}"}
    <ul>
        <li>Value For Money: {rating:value_for_money:stars} ({rating:value_for_money:avg} of 5)</li>
         <li>Taste: {rating:taste:stars} ({rating:taste:avg} of 5)</li>
         <li>Quality: {rating:quality:stars} ({rating:quality:avg} of 5)</li>
         <li>OVERALL: {rating:overall:stars} ({rating:overall:avg} of 5)</li>
     </ul>
{/exp:channel_ratings:rating_comment_avg}

{exp:comment:form channel="products" rating:collection="products" entry_id="{entry_id}" dynamic="off" rating:enabled="yes"}
    {if rating:already_rated} You have already reviewed this product.{/if}
    {if rating:not_rated}
         <label for="name">Name:</label> <input type="text" name="name" value="{screen_name}" size="50" /><br />
         <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br />
        {rating:fields}
            <label>{rating:field_title}</label>
             <select name="{rating:form_name}">
                 <option value="1">1</option>
                 <option value="2">2</option>
                  <option value="3">3</option>
                  <option value="4">4</option>
                  <option value="5">5</option>
              </select>
         {/rating:fields}

        <label>Review</label>
         <textarea name="comment" cols="70" rows="2"></textarea> <br />
         <input type="submit" value="Submit Review">
    {/if}
{/exp:comment:form}

```

If I take out the variable "rating enabled=yes" from that form, the comments form renders perfectly. Once I put this in the form as above, I get no form rendered at all.

My channel allows comments (even said 'allow guests' for the laugh) and the form appears, and my admin panel renders the module information correctly, so I know my themes are in the right spot.

Am I missing something? If so, I would love a tip-off on what's wrong.

Edited for my comment below: I can enter information as a guest if I allow guests and I can rate items, but this is not showing up in my module's home page.

# Answer
To view comment reviews in the Channel Ratings control panel you need to click on "Reviews". Please see screenshot.
> 0 votes

---
Tags: devdemon, channel-ratings
---


# Question
Title: low events conditional to show event date that lasts for more than one day
I am using low events for my calendar. I am trying to find conditional that will allow me to show both my event start date and event closing date when my event lasts more than one day and just the start date when the event is only on one day.

So in the code below showing the start and end\_date means if the event is only on one day we see that date twice.I need an conditional to apply to the end\_date code section which is based on the event being more than one day.

Thanks for any help

```
            <figcaption class="news-event__caption">
                <time itemprop="startDate" content="{event_date:start_date format='%Y-%m-%d'}" datetime="{event_date:start_date format='%Y-%m-%d'}">
                    <span class="day">{event_date:start_date format="%d"}</span>
                    <span class="month">{event_date:start_date format="%F"} </span>
                     <span class="day"> {event_date:end_date format="%d" }</span>
                     <span class="month">{event_date:end_date format="%F"}</span>
                     </time>
            </figcaption>

```

# Answer
Try using the :one\_day modifier.

```
{if '{event_date:one_day}' != 'y'} Show stuff for multiple days {/if}

```
> 1 votes

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


title: Freeform - allowed file types

text:
# Question
Title: Freeform - allowed file types
I'm using Freeform 4.1.8 and EE 2.8.1 . I have a Freeform form with an upload file field. It's uploading all files ok, except docx .

I've checked that docx is in the mimes.php file, the upload directory is set to all file types. I've tried adding in allowed\_file\_types="\*" to Freeform but it's still not working.

My Freeform code looks like this:

```
 {exp:freeform:form collection="applications"
  return="careers/apply/thank-you"
  notify_admin="yes"
  admin_notify="email@address.com"
  admin_cc_notify="email@address.com"
  template="admin_notify"
  send_attachment="yes"
  file_upload="uploaded_CVs"
  allowed_file_types="*"
  send_user_email="no"
  notify_user="no"
  require_captcha="yes" }

```

My File upload Field looks like this:

```
 {freeform:field:upload_cv show="1" allowed_file_types="*"}

```

Edit: I set up a Channel Form to see if I could upload docx files through that, and it worked fine. It looks like it's just Freeform that won't let me upload them.

# Answer
Freeform 4.2.1 and 4.2.2 brought a number of bug fixes for upload handling (some reported by me). See the change log for details.

I'm not certain what you are seeing is a FreeForm bug but I would definitely recommend updating before going too deep into troubleshooting.
> 1 votes

# Answer
Turns out it was a simple fix, In Freeform \> Fields \> Field Settings \> Allowed File Types I had dox instead of docx.
> 1 votes

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


# Question
Title: MX Notify Control Sending Incorrect Data
I'm trying to get MX Notify Control setup to handle new entry and updated entry notifications for an event registration channel I created. Currently the notifications are working for 10 of the 11 notifications, however there is one custom status that often sends data from a different entry than the one been updated to this problematic status. It should be noted that the same issue occurs when attempting to setup the notification with my Postmaster module as well.

Below is an example of the code I'm using for the e-mail template for this notification that always sends the wrong data or better described it will send the data for the first entry in the channel with the 'Hours-Confirmed' status which is usually not the correct one or the one being updated. I will also mention that the template below doesn't seem to be the issue though as the same problem happens if you update an entry to the 'Hours-Confirmed' status from the control panel.

```
<h3>Event Hours Confirmed</h3>
{exp:channel:entries channel="vip_event_registration" status="Hours-Confirmed" limit="1"}
<p>Your hours have now been confirmed for {vip_event}. According to our records, you attended this event for {vip_hours_total} hours.  Thank you for participating in a VIP event!</p>
{/exp:channel:entries}

```

The code above e-mails the incorrect data when an older entry is updated to the 'Hours-Confirmed' status as it always sends the data for the first entry with the 'Hours-Confirmed' status starting from the most recent entries.

On the front-end template I'm using a search parameter for my Safecracker status update form like this, **search:entry\_id="{segment\_3}"** and I have it setup so the correct entry\_id is always in segment\_3 of the URL. I need to also create that association for the e-mail notification so it will send the correct data but not exactly sure how to go about that. In fact I thought that functionality was or should be built-in to both MX Notify Control and Postmaster but it doesn't work in either for this one status. My only ideas at this point are to keep the 10 working notifications and setup a custom PHP script for the 11th one that's causing all these problems with incorrect data being sent.

Another interesting point to note is that if I go to the control panel and look at an older entry, not change anything but just submit it again, then I'll get an e-mail notification with the data from the most recent entry with the 'Hours-Confirmed' status.

The same is also true for the Postmaster module. It's strange that 10 of the 11 e-mail notifications are now working with MX Notify Control but there is one status that sends incorrect data in both MX Notify Control and Postmaster.

Any tips or suggestions to help resolve this issue with the incorrect entry data being sent would be greatly appreciated, thanks!

# Answer
MX Notify Control requires that you manually specify the `entry_id` for any `channel:entries` tags:

```
<h3>Event Hours Confirmed</h3>
{exp:channel:entries channel="vip_event_registration" status="Hours-Confirmed" limit="1" entry_id="{entry_id}"}
<p>Your hours have now been confirmed for {vip_event}. According to our records, you attended this event for {vip_hours_total} hours.  Thank you for participating in a VIP event!</p>
{/exp:channel:entries}

```

Using Postmaster, you need to similarly use `entry_id={parcel:entry_id}`.
> 1 votes

---
Tags: postmaster, mx-notify
---


# Question
Title: Channel Form javascript error when using Bootstrap
I'm using Channel Form (Safecracker) on a site which is using Bootstrap.

I'm getting this error:

> Uncaught TypeError: Cannot read property 'msie' of undefined

in this script: ACT=10&ui=core,widget,mouse,position,draggable,resizable,button,dialog,datepicker&plugin=markitup,toolbox.expose,overlay,tmpl&file=underscore,cp/date&v=1412459416&use\_live\_url=y

It happens even if I create form for channel that does not have any fields at all (did that for testing)

Have anyone else experienced similar issue and have a solution for it?

# Answer
This usually happens with duplicate jquery files. You can add either of these parameters

```
include_jquery="no"
```

```
include_assets="no"
```
> 2 votes

---
Tags: safecracker, javascript, bootstrap
---


# Question
Title: How to output a grid field within a relationship?
I was wondering how I output the contents of a grid field from within a relationship. I've got two related entries and everything is showing correctly except the grid (which contains an image and text field).

I have tried a number of variations but haven't been successful yet

```
{relationship}
...
  {relationship:grid_field}
    {relationship:grid_field:image}
    {relationship:grid_field:text}
  {/relationship:grid_field}
{/relationship}

{relationship}
...
  {relationship:grid_field}
    {grid_field:image}
    {grid_field:text}
  {/relationship:grid_field}
{/relationship}

{relationship}
...
  {relationship:grid_field}
    {relationship:image}
    {relationship:text}
  {/relationship:grid_field}
{/relationship}

{relationship}
...
  {grid_field:relationship}
    {grid_field:relationship:image}
    {grid_field:relationship:text}
  {/grid_field:relationship}
{/relationship}

```

etc. Does anyone know the correct way to do this? The three dots represent the other content / fields. The way I have been outputting the other fields is as so: `{relationship:field_name}` and that has been working fine.

Any help would be greatly appreciated, thank you.

**edit**

```
  {embed='includes/header'}
  {exp:channel:entries channel="project" status="not Closed"}
  <div class="col-100 content-area">
    <div class="container">
      <div class="row">
        <main class="col-sm-8 col-md-8">
          <h2>{title}</h2>
          <div class="flexslider">
            <ul class="slides">
              {project_image}
              <li data-thumb="{exp:ce_img:single src='{project_image:image}' height='102' width='170' crop='yes' url_only='yes' allow_scale_large='yes'}">
                {exp:ce_img:single src="{project_image:image}" height="330" width="555" crop="yes" attributes='alt="{project_image:alt_tag}"'}
              </li>
              {/project_image}
            </ul>
          </div>
          {project_content}
        </main>
        <aside class="col-sm-4 col-md-offset-1 col-md-3 sidebar">
          <h3>Project Overview</h3>
          <div class="project-overview">
            {if client != ""}<p><strong>Client:</strong> {client}</p>{/if}
            {if project_cost != ""}<p><strong>Project cost:</strong> {project_cost}</p>{/if}
            {if location != ""}<p><strong>Location:</strong> {project_location}</p>{/if}
            {features}
            {if features:feature != ""}
            {if features:count == 1}
            <p><strong>Features:</strong></p>
            <ul class="project-features">
              {/if}
              <li>{features:feature}</li>
              {if features:count == features:total_rows}
            </ul>
            {/if}
            {/if}
            {/features}
            <p><strong>Sectors:</strong> {exp:gwcode_categories entry_id="{entry_id}" group_id="1" style="linear"}<a href="{path='sectors'}/{cat_url_title}">{cat_name}</a>{if cat_count != results}, {/if}{/exp:gwcode_categories}</p>
            <p><strong>Services:</strong> {exp:gwcode_categories entry_id="{entry_id}" group_id="2" style="linear"}<a href="{path='services'}/{cat_url_title}">{cat_name}</a>{if cat_count != results}, {/if}{/exp:gwcode_categories}</p>
          </div>
          {testimonial}
          {if testimonial:quote != ""}
          <blockquote>
            <h3>"{exp:excerpt}{testimonial:quote}{/exp:excerpt}"</h3>
            <p>- {testimonial:quotee}</p>
          </blockquote>
          {/if}
          {/testimonial}
        </aside>
      </div>
    </div>
  </div>

  <div class="col-100 project-col">
    <div class="container">
      <div class="row">
        <div class="col-sm-12">
          <h2>Related Projects</h2><a href="{path='projects'}" class="more-link"> View all</a>
        </div>
      </div>
      <div class="row project-row">
        {projects_related status="not Closed" limit="2"}
        <div class="col-sm-6">
          <div class="row">
            <div class="col-sm-12">
              <h3>{projects_related:title}</h3>
            </div>
          </div>
          <div class="row">
            <div class="col-md-6">
              {projects_related:project_image limit="1"}
              {exp:ce_img:single src="{projects_related:project_image:image}" height="199" width="360" crop="yes" attributes='alt="{projects_related:project_image:alt_tag}"'}
              {/projects_related:project_image}
            </div>
            <div class="col-md-6">
              <p><strong>Location:</strong> {projects_related:project_location}</p>
              <p><strong>Brief details:</strong> {projects_related:project_brief}</p>
              <a href="{path='projects'}/{projects_related:url_title}" class="more-link">Find out more</a>
            </div>
          </div>
        </div>
        {/projects_related}
      </div>
    </div>
  </div>
  {/exp:channel:entries}
  {embed='includes/footer'}

```

# Answer
This works in my tests when accessing a child relationship:

```
{relationship_field}

    <p>Child entry title: {relationship_field:title}</p>

    {relationship_field:grid_field}
        Column 1: {relationship_field:grid_field:grid_column_1} <br>
        Column 2: {relationship_field:grid_field:grid_column_2} <br>
        {!--   etc...   --}
    {/relationship_field:grid_field}

{/relationship_field}

```
> 4 votes

# Answer
I'm going to throw in my solution here because overall I find it much simpler.

```
{exp:channel:entries channel="relationship_channel" dynamic="no"}

  {relationship_field}

    {relationship_field:title} // the title of our channel entry which has the grid

    {relationship_field:grid_field} // starts our loop inside of the grid

      {grid_field:grid_field_label} // we don't need to specify that we're in the relationship anymore, just that we're in the grid.

    {/relationship_field:grid_field}

  {/relationship_field}

{/exp:channel:entries}

```

Hope this is helpful to someone.
> 0 votes

---
Tags: relationships, grid, related-entries
---


# Question
Title: Security of an Action URL called from AJAX
I have an action URL, index.php?ACT=23, that calls a function which inserts some info into the database.

This is being called from an AJAX function, so I can't control where it is called from.

My concern is that it would be easy to set up a script to call this URL repeatedly and thus insert loads of data and probably bring the site down.

Should I be concerned, what can I do to prevent this?

# Answer
What data does the script which is being triggered with action URL accept? If that's EE form submission, then you should not worry if you follow standard EE forms security settings/practice.

If it's a custom script that accepts ANY data, then you of course might need to add additional protection to it.

There's a separate chapter in EE docs on security guidelines. Make sure your add-on follows those, specifically look into "Cross Site Request Forgery" section.

The short answer is: it's impossible to answer your question without seeing the code.
> 2 votes

---
Tags: module, security, action
---


# Question
Title: Need to turn off thumbnail recreation when synchronizing files - possible?
I brought up this issue with the developers when EE 2 first came out and at the time there was no solution. I am now wondering if anyone has created any hacks, workarounds or add-ons that solve the issue?

The problem is the fact that EE insists on recreating all thumbnails every time you synchronize an upload destination. It does not recreate small or medium images (unless you tell it to) but there's no way to avoid the thumbnail recreation, which means that a batch addition of say, 100 images, to an already large gallery will take a very long time to process since all previous images will have their thumbnails recreated.

# Answer
> 2 votes
I haven't tried myself it yet, but looking at the code I'm 99% sure this will do the trick:

1. Open `system/expressionengine/controllers/cp/content_files.php`
2. Navigate to `function do_sync_files()`
3. Find the portion of code that says `$thumb_created = $this->filemanager->create_thumb` (line 1320 and following ones in EE 2.9.2)
4. Change `FALSE // Overwrite existing thumbs` to `TRUE // Don't overwrite existing thumbs`

---
Tags: files, thumbnails
---


# Question
Title: Selling products inside EU with UK VAT and outside EU with VAT deducted
My client sells products from the UK to EU member countries and worldwide. The site is built on Expresso Store 2.5.

Product prices have been entered inclusive of tax and a tax rate of 20% UK VAT has been created applicable to EU member countries. I've also checked the box *included in price* for this tax rate.

If a customer from outside the EU comes to purchase from the site, the 20% VAT should not be charged. I had assumed 20% should be deducted from the the value of the basket but this doesn't appear to be the case.

Customers outside the EU are being charged the same price, just the VAT breakdown is not shown. They should really pay the price - less the tax, but I cannot work out how to set this up. I've tried setting up a 'Tax Exempt' tax rate but this didn't work.

I tried alternatively entering prices exclusive of tax but it became problematic displaying prices inclusive of tax (to EU customers) on the product pages. This also produced the tax rounding issues associated with Store v1.

I've studied other e-commerce sites and they manage to charge the lower price and get around tax-rounding issues. Has anyone experienced similar difficulties setting up Store?

# Answer
In short you will have to use tax-exclusive pricing or develop an extension that would actually subtract the 20% for orders outside of the EU. The reason for this is that if you set a product to $50.00 with tax inclusive pricing and a tax of 20% your actual item price would be $41.67 but at the same time if you have a tax inclusive price of $50 and a 0% tax the item amount jumps to $50 and the tax is $0. So Store is actually calculating the totals correctly just not how you want them to be calculated.

If I remember correctly in either the 2.2 or 2.3 release the Store team had a bug fix that helped with rounding issues associated with taxes and sales percentages so that should address most of the issues that you have with tax-exclusive pricing (albeit a pain in the butt to have the content editors calculate the totals). It should also be mentioned that you you can enter prices to 4 decimal places to help with rounding issues

```
$41.6666 * 1.2 = 49.99992
or
$41.6667 * 1.2 = 50.00004

```

This is why I recommend going with the extension approach because you could calculate the totals and adjustments pragmatically and keep a simple publishing approach for your content creators.

There is however another possible option depending on your product complexity if you are not comfortable with PHP (this should really only be considered as a last resort). You would keep your tax-inclusive pricing option that you have currently set you would then add a "variable single sku" option to your products with a specific name lets say "country" as an example with 2 options `EU` and `Not EU`. Where `EU` has no price modification and `Not EU` has a value of negative whatever to get the items actual price. Then in your template you would need to somehow gather the users location via IP2Location or similar. Then you would need to have some logic for your country modifier to preselect the proper modifier based upon the users location.

(Let me say again that the other possible solution above is not the ideal situation and I would really not recommend that you use an approach like that but it does it work if you absolutely have no other option.)
> 1 votes

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


# Question
Title: Working with staging server and production server - can they share the same Assets locations?
I have 3 installations of my website: beta, demo, and production. Template and functionality changes are made on beta, content is entered on demo and everything moves to production as it is approved.

We are using Assets for all of our, um, assets (images, audio files, etc.). I would like to move everything to Amazon S3 and have all 3 installations point to one place so that I don't have to have 3 copies of everything. Is this possible? In order to update the database, right now, I back up the version on demo and move it to the other locations. So that would have the index information, right?

If anyone has any other ideas on the best way to store assets in one location for use in multiple installations, I would appreciate hearing about them.

# Answer
I have a client that has a similar setup with Assets and S3 and it works without issues, content created on local, dev, staging has no issues being added to the live site or any combination of that.

I also have a client that has dev, staging and live instances on the same server and I have the upload path folders symalinked to the live for dev and staging. Which works without issues. In this case usually the live DB is transfer to the dev and staging DB to test out new features or troubleshoot/change templates with real content from the live site.
> 2 votes

# Answer
Not a bad approach; I'm using it on a large project now and we haven't had too many issues.

In our setup, development/staging share the same database but have their own file system for templates/snippets/EE.
> 1 votes

---
Tags: assets, pixelandtonic
---


# Question
Title: Synchronise Files programmatically/automatically
I'm using phantomjs via an extension to save a screenshot into an EE file directory, but before it's accessible in the admin area, I need to synchronise files.

I can't see anything in the docs for how to go about this, does anyone know if this is possible?

# Answer
Take a look at line 1187 in `system/expressionengine/controllers/cp/content_files.php`. The function `do_sync_files()` is called by the synchronize page. This would be in the EE 2.8.1 core files.

You could probably write a script that calls that function or else re write the logic for your own use (I think it checks a bunch of environment variables that would not let it work from the command line).
> 2 votes

# Answer
Did you ever get the code for auto sync working? I am in need of the same functionality and would rather not reinvent the wheel.
> 0 votes

---
Tags: file-uploads, extension, sync
---


# Question
Title: Displaying multiple categories separately
I am having difficulty understanding how to display multiple categories inside an entry. This example is for a church website where sermons have multiple categories, such as which service it was in, and who the speaker was.

This is what I'm trying to accomplish:

```
{exp:channel:entries channel="sermons" limit="10" orderby="entry_date" sort="asc"}
    <div class="post">
        <h3><a href="{title_permalink='sermons/'}">{title}</a></h3>
        <time>{entry_date format="%F %j, %Y"}</time>
        <span class="speaker">{speaker_name}</span>
        <span class="service">{service_name}</span>
    </div><!--/.post-->
{/exp:channel:entries}

```

As you can see, I want to display the two categories inside the entries loop, but I'm not sure how to do this.

Any guidance would be greatly appreciated. Thank you much!

# Answer
> 0 votes
You want to use the categories tag pair (not to be confused with exp:channel:categories)

```
{exp:channel:entries channel="sermons" limit="10" orderby="entry_date" sort="asc"}
    <div class="post">
        <h3><a href="{title_permalink='sermons/'}">{title}</a></h3>
        <time>{entry_date format="%F %j, %Y"}</time>
        {categories show_group="2"}
            <span class="speaker">{category_name}</span>
        {/categories}
        {categories show_group="3"}
            <span class="service">{category_name}</span>
        {/categories}
    </div><!--/.post-->
{/exp:channel:entries}

```

The above assumes that Speaker category group is ID 2 and Service category group is ID 3.

You could do it as one loop instead of the two:

```
    {categories show_group="2|3"}
        <span class="{if category_group == 2}speaker{if:elseif category_group == 3}service{/if}">{category_name}</span>
    {/categories}

```

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


# Question
Title: Editing entries with Channel Form not working
I've created a bunch of simple entries for a channel, and I'd like guest users to be able to edit the entries. The entries are all on the index page, since this is a one-page site. No matter what I try, my Channel Form will not update the entries. This is basically straight from the docs, but submitting the form doesn't change any of the fields. Here's my code:

```
{exp:channel:entries
 channel="products"
 disable="categories|member_data|pagination|trackbacks"
 dynamic="no"
}

<img src="{product_image}" class="pure-img">
    {exp:channel:form channel="products" return="product/index" url_title="{url_title}"}
 <input name="title" type="text" value="{title}">
 {field:product_description}
 <input type="submit" value="Submit">
{/exp:channel:form}

        {/exp:channel:entries}

```

Thanks for any help!

# Answer
> 0 votes
Take the exp:channel:entries tags away....

# Answer
> 0 votes
change the url\_title on the channel form tag

```
    {exp:channel:form channel="products" return="product/index" url_title="{url_title}"}
 <input name="title" type="text" value="{title}">
 {field:product_description}
 <input type="submit" value="Submit">
{/exp:channel:form}

```

to `url_title="{segment_1}"`

---
Tags: safecracker, forms
---


# Question
Title: Pagination adding repeating index.php and template group segments to URL
I am helping someone with their Expression Engine site and I have an issue with pagination in some search results.

The pagination links are adding "index.php/templategroup/template" to the URL for each page. After the 3rd page click (where the pagination is regenerated) I run into the "Error: The URL contains too many segments." error because the URL has expanded.

For example, after the 3rd page click, i get **index.php/directory/results** repeating:

**hxxp://site/index.php/directory/results/index.php/directory/results/search&keywords=xyz**

I am familiar with codeigniter but this is my first attempt at working with expression engine.

Has anyone seen this before?

The site is running EE v. 240 and I believe they are using something called "Super\_Search" because the template reads "exp:super\_search:results"

**Edit as requested:**

SuperSearch version = 1.4.4

```
{exp:super_search:results channel="directory" paginate="both" limit="10" orderby="title" sort="desc" redirect_post="yes" status="approved"}
...content...
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
<br />
{/paginate}

{if super_search_no_results}
<p>No results match your search. Try again by selecting fewer or different criteria.
</p>
{/if}

{/exp:super_search:results}

```

# Answer
> -1 votes
Ok, so I resolved this using paginate\_base="templategroup/template" (paginate\_base="directory/results")

---
Tags: pagination, supersearch
---


title: Help with query syntax

text:
# Question
Title: Help with query syntax
Can somebody help me with the basic construction a Query module query to pull some info out of the Favorites and Tag modules from Solspace? I've tried the following using standard tags but this information isn't available that way, at least as far as I can tell.

"Here's what I'm looking to do: Create a list of tags belonging to the entries a user has in their Favorites collections.

Put differently, a user saves 100 entries (using the Favorites module) and each of those entries has multiple tags. I'd like to list all the tags for all the favorited entries in a user's favorites collections.

I've tried various queries but my sql skills are at a novice level and this seems to be an advanced query I don't know how to do. Can anyone please help me? Thanks

# Answer
This is a common question and similar responses have been provided in other threads, which are good reads to get some inspiration:

We have also (recently) added a page in our **Solspace Solutions** section on the subject: http://support.solspace.com/solution/articles/4000047779-create-a-list-of-all-unique-tags-from-a-entries-list

---

A summary here, with modifications for Favorites:

To get a list of tags from specific entries in one list, and without tags being repeated (i.e. display a list of unique tags), `{exp:tag:cloud}` can't be used because there is no `entry_id=""` parameter.

Because `{exp:tag:tags}` is repeated at each `{exp:channel:entries}` (**or `{exp:favorites:entries}`**) loop, chances are you get duplicates of some tags. You'll need to create an array of unique tags to filter out duplicates. One way to do this is with PHP.

Enable PHP in your Templates and set it to **Output**. Then create your array:

```
{!-- Start with an empty array --}
<?php $tags = array(); ?>

{exp:favorites:entries /* your parameters */}
   {exp:tag:tags entry_id="{entry_id}"}
      {!-- add the tag to the array. Duplicate tag_ids will be filtered this way --}
      <?php tags['{tag_id}'] = '{tag_name}'; ?>
   {exp:tag:tags}
{exp:favorites:entries}

```

Now your `$tags` array should have unique keys (the `tag_id`), and therefore tag\_names should be unique as well. Finally, simply loop through the unique list of tags outside of and after `{exp:favorites:entries}`. Below we're building a comma-separated list first, then trimming the final comma. Finally, we output the final string:

```
{!-- Start with an empty string --}
<?php $tag_list = ''; ?>

<?php foreach($tags as $tag) :?>
   {!-- Concatenate tags --}
   <?php $tag_list .= $tag . ", "; ?>
<?php endforeach ?>

{!-- Trim the final extra comma and display to screen --}
<?php echo rtrim($tag_list, ", "); ?>

```

There are likely other ways to do this, using Stash perhaps, but this uses native tools in EE.
> 0 votes

---
Tags: solspace-user, solspace-tag, query-module
---


title: How to import API data into EE

text:
# Question
Title: How to import API data into EE
If I wanted to consume API feeds (restful) and import that data into EE as entries, is that possible?

Ideally I would like to import a bulk amount of channels (once only), then a bunch of categories for each channel (once only/or once a blue moon), and then I want ti be able to fetch the JSON and use it with some mapping to entries in EE.

Is Solspace - importer the best tool to do this, or will I be better writing some manual PHP scripts to import them all into EE.

The final site will be thousands of pages, and then I am going to augment them with further data made available over an API.

I am really hoping EE will scale to this, as otherwise I need to write the system from scratch - how large does EE scale to?

Looking at say 500k unique visits a month viewing this imported data.

Or would this; be a better option

http://reinos.nl/expressionengine/webservice/docs

---

Excuse my long reply! * I am the thread author, just found my proper SE account!

Hello,

How was your experience using DataGrab, so I am correct in thinking if I had an API, I could make it import that into an entry, and also some custom fields?

Could you share with me as much detail as you wish, about how you found that process, and how you did it?

I would have 250 channels to create, with up to 30 categories in each, and each category would have 5-10 pages.

Lastly, is there a way I could make all the channels share the same template, all the categories the same, and all the pages the same? I.E three templates, without me duplicating them numerous times? Is there a way to smooth that flow too, I want to automate much of the entry creation as possible.

Say I had weather data, I want to be able to make a weather page for up to... 500 cities programatically, but I want each one to be a separate page. like

domain.com/channel/category/city

I am very familiar with EE, just never tried to automate content/entry creation and this would be at scale.

With datagrab, I could import the data through the API, but I can still edit it too through the usual edit content pages correct?

If I can't figure out how to do it with DataGrab, then I fear I would have to write an Angular App from scratch, but I love the EE interface and stuff.

Lastly, which plugin do you think is best? Datagrab sounds like it has more features, but I have bought SolSpace plugins before and they have always been good..

# Answer
I've used DataGrab to achieve this in the past. Solspace Importer will also do the same.
> 1 votes

# Answer
You can setup both Solspace Importer and DataGrab to handle imports via CSV, RSS, JSON request either at a single time or on a schedule without issue.

Without getting into the debate of server setup you shouldn't have issues with serving that amount of visitors on a monthly basis assuming your server setup is sufficient. I have a client site that serves almost 500k unique visits a day without issues. You can see some large sites in a recently updated blog post from Hop Studios
> 0 votes

# Answer
If all "channels" have the exact same channel custom fields, you could just create 1 channel and assign a common custom field group. You could then differentiate each entry (what you're calling "pages") based on categories. Your categories would be your city names. With that setup, you could indeed have one template, and entries would display based on the category in the URL.

For example, if you have a "`weather`" template group with a template named "`index`". You could get all entries with the "New York" category by going to: `http://example.com/weather/category/new-york`

The `weather/index` template would likely contain a `{exp:channel:entries}` tag pair, at minimum, to display entry data.

> Note: When the template's name is `index`, it's is not required in the URL. Any other name would need to have the template's name in the URL, eg. `http://example.com/weather/entries/category/new-york`

Also note that Solspace Importer is an add-on for **importing channel entry data into a channel based on external data (eg. CSV file)**. It does not create the actual channel for you, nor does it create custom fields for a channel. It does, however, create entries in your pre-established channel.
> 0 votes

---
Tags: solspace-importer, channel-entries-api, api
---


# Question
Title: Expresso Store Fatal Error: Uncaught exception 'BadMethodCallException'
EE 2.9.0, store 2.5.0 - and anytime store code appears on a page this error occurs, exception of the cart, so it looks like it is tied to the products. Take the store product code out and it renders fine. Any other page with standard EE code and it renders fine. Anyone have any ideas?

> Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to undefined method Illuminate\Database\Query\Builder::getEager()' in /home/d562657/public\_html/admin/expressionengine/third\_party/store/vendor/illuminate/database/Illuminate/Database/Query/Builder.php:1993 Stack trace: #0 \[internal function\]: Illuminate\Database\Query\Builder-\>\__call('getEager', Array) #1 \[internal function\]: Illuminate\Database\Query\Builder-\>getEager() #2 /home/d562657/public\_html/admin/expressionengine/third\_party/store/vendor/illuminate/database/Illuminate/Database/Eloquent/Builder.php(919): call\_user\_func\_array(Array, Array) #3 \[internal function\]: Illuminate\Database\Eloquent\Builder-\>\__call('getEager', Array) #4 \[internal function\]: Illuminate\Database\Eloquent\Builder-\>getEager() #5 /home/d562657/public\_html/admin/expressionengine/third\_party/\_store/vendor/illuminate/database/Illuminate/Database/Eloquent/Relations/Relation.php(281): call\_user\_func\_array(Array, Array) #6 /home/d562657/public\_html/admin/expressionengine/thi in /home/d562657/public\_html/admin/expressionengine/third\_party/store/vendor/illuminate/database/Illuminate/Database/Query/Builder.php on line 1993

# Answer
We figured it out, so we are posting it for the benefit of the community in case someone runs into this in the future. In order to upgrade store to the newest version, we renamed the store folder to '\_store' in the third\_party folder. For some reason this was being picked up by the store install in EE in only the front-end. The admin panel worked fine, but any store code with pricing in it threw the fatal error. This morning we moved that folder out of third\_party and also tested it to being renamed '.store' and it works. So is the class being picked up on one side due to the underscore, but the admin ignores it.
> 1 votes

---
Tags: expresso-store
---


title: Duplicate order numbers in Cart Throb

text:
# Question
Title: Duplicate order numbers in Cart Throb
We've got quite high traffic cart throb site which occasionally gets duplicate order numbers. The most recent one was when 2 orders were placed at exactly the same time (to the second). Both orders have been given the same title and url\_title, but obviously have different entry IDs in the database.

This must be a Cart Throb bug? Has anyone else come across this before?

This causes problems with the sales reporting so we really need to find a fix. Anyone from Cart Throb able to offer any insight?

# Answer
> 0 votes
Cart Throb's changelog shows that 2.61 includes a fix for this issue.

---
Tags: cartthrob, database, url-title
---


# Question
Title: Can you tell which version EE is just from the database?
I have a site that had all its files erased and there are no backups, but I still have the database. Is it possible to determine which specific version of EE it is, just by looking at the database?

(And no, I was not responsible for backups.)

# Answer
> 2 votes
This would only work if the install of EE had been updated at least once since initial install, but there is a log of version updates found in table exp\_update\_log. You've probably already checked this, but I thought it might be worth mentioning in case someone else runs into this issue in the future and didn't realize this table existed.

# Answer
> 1 votes
If Steven's answer doesn't get you the version number, you could deduce the general version by the table names and native fields used and comparing them to the ExpressionEngine release notes.

It might not get you to an exact release but perhaps closer than not knowing at all.

(Update: you asked for a "specific version of EE", which my suggestion will not get you.)

# Answer
> 0 votes
potentially, if you restore the db and take a look at exp\_sites table and then the site\_system\_preferences column, decode the encoded content using https://www.base64decode.org and it *might* just provide the app\_version if it was in the config originally.

---
Tags: database, update
---