# Question
Title: Update Wizard 2.8.1 to 2.9.0 hangs and doesn’t complete
I have been trying to upgrade EE 2.8.1 to 2.9.0 but the Update Wizard just loads for a very very long time and then gives a 404 error.

After trying this a couple of times I removed the “installer” directory. CP now says “2.9.0” at the bottom, but it also gives this warning:

> Your ExpressionEngine installation’s version (2.8.1) is not consistent with the reported version (2.9.0). Please update your installation of ExpressionEngine again.

Has anyone else experienced this? How can I get the Update Wizard to finish completely or find out why it hangs?

# Answer
> 1 votes
First think I'd check is that the server meets EE's minimum server requirements:
https://ellislab.com/expressionengine/user-guide/installation/requirements.html

There is a server Compatibility Wizard you can download here:
https://ellislab.com/expressionengine/user-guide/installation/requirements.html#server-compatibility-wizard

---

If the server meets the requirements, I'd next run the installation in another browser that is not Chrome. Chrome seems to hold on to cache way too aggressively which may be the source of the issue.

# Answer
> 0 votes
I was having the same problem and I just updated the app version in config.php and the warning went away. It's probably a result of restoring your previous config.php file without making this edit on line 14.

```
$config['app_version'] = "281";

```

change to

```
$config['app_version'] = "290";

```

# Answer
> 0 votes
What add-ons you had when you tried this update? If you had Freeform you better take out this folder fro third party during the update and then simply add it back.

This can be said for any other add-ons you just need to double check you don't have anything that can cause this hanging.

Why you temporarily remove third party add-ons during the update. Right after wizard finishes - you can add them back.

In Any case by altering the config file version is working as well as long system files are updated and DB scripts are successful.

---
Tags: update, 2.9
---


# Question
Title: Expresso Store - Pin Payments does not complete checkout
I'm using Expresso Store 2.3.1, and trying to get take payments via the Pin Payments gateway using Pin.js. This is near identical to the Stripe.js where a card token is added to the form then the token is posted to the server no the card details.

I have everything working right upto the point that I post the form with the card token to Store. I've demonstrated it working upto this point by disabling the post of the form to the server. When I do this you can clearly see the card token in the hidden input.

But when it posts to the server, I don't get any errors in the console or on the page, and I'm returned to the same checkout page.

I've removed inline errors in case there were any hidden errors I was missing.

Here's the relevant javascript:

```
    // 1. Wait for the page to load
$(function() {

  // 2. Create an API object with your publishable api key, and
  // specifying 'test' or 'live'.
  //
  // Be sure to use your live publishable key with the live api, and
  // your test publishable key with the test api.
  var pinApi = new Pin.Api('pk_tlFaC6Qk0MDp4wdNsa-noQ', 'test');

  var form = $('form.pin'),
      submitButton = form.find(":submit"),
      errorContainer = form.find('.errors'),
      errorList = errorContainer.find('ul'),
      errorHeading = errorContainer.find('h3');

  // 3. Add a submit handler to the form which calls Pin.js to
  // retrieve a card token, and then add that token to the form and
  // submit the form to your server.
  form.submit(function(e) {
    e.preventDefault();

    // Clear previous errors
    errorList.empty();
    errorHeading.empty();
    errorContainer.hide();

    // Disable the submit button to prevent multiple clicks
    submitButton.attr({disabled: true});

    // Fetch details required for the createToken call to Pin Payments
    var card = {
      number:           $('#cc-number').val(),
      name:             $('#cc-name').val(),
      expiry_month:     $('#cc-expiry-month').val(),
      expiry_year:      $('#cc-expiry-year').val(),
      cvc:              $('#cc-cvc').val(),
      address_line1:    $('#address-line1').val(),
      address_line2:    $('#address-line2').val(),
      address_city:     $('#address-city').val(),
      address_state:    $('#address-state').val(),
      address_postcode: $('#address-postcode').val(),
      address_country:  $('#address-country').val()

    };

    // Request a token for the card from Pin Payments
    pinApi.createCardToken(card).then(handleSuccess, handleError).done();
  });

  function handleSuccess(card) {
    // Add the card token to the form
    //
    // Once you have the card token on your server you can use your
    // private key and Charges API to charge the credit card.
    $('<input>')
      .attr({type: 'hidden', id: 'payment_token', name: 'payment[token]'})

      .val(card.token)
      .appendTo(form);
      console.log(card.token);

    // Resubmit the form to the server
    //
    // Only the card_token will be submitted to your server. The
    // browser ignores the original form inputs because they don't
    // have their 'name' attribute set.
    form.get(0).submit();
  }

  function handleError(response) {
    errorHeading.text(response.error_description);

    if (response.messages) {
      $.each(response.messages, function(index, paramError) {
        $('<li>')
          .text(paramError.param + ": " + paramError.message)
          .appendTo(errorList);
      });
    }

    errorContainer.show();

    // Re-enable the submit button
    submitButton.removeAttr('disabled');
  };
});

```

And here's my checkout code:

```
      {exp:store:checkout
                form_class="form-horizontal pure-form pure-form-stacked pin"
                return="checkout/order/ORDER_HASH"
                payment_method="Pin"
               }

                {if no_items}
                    {redirect="checkout"}
                {/if}

                <input type="hidden" id="address_line-1" value="{billing_address1}" />
                <input type="hidden" id="address_line-2" name="{billing_address2}" />
                <input type="hidden" id="address_city" name="{billing_city}" />
                <input type="hidden" id="address_state" name="{billing_state}" />
                <input type="hidden" id="address_postcode" name="{billing_postcode}" />
                <input type="hidden" id="address_country" name="{billing_country}" />
            <div class="pure-g">
                <div class="pure-u-1 pure-u-md-1-2">

            <fieldset>
                <legend>Payment</legend>

                {if error:payment_method}
                    <div class="pure-control-group">
                        <div class="alert alert-error">{error:payment_method}</div>
                    </div>
                {/if}

                <div class='errors'>
                    <h3></h3>
                    <ul></ul>
                </div>

                <div class="pure-control-group">
                    <label class="control-label" for="cc-number">Card No</label>
                    <div class="controls">
                        <input type="text" id="cc-number" value="4200000000000000" />
                    </div>
                </div>

                <div class="pure-control-group">
                    <label class="control-label" for="cc-name">Name</label>
                    <div class="controls">
                        <input type="text" id="cc-name"  value="TEST USER" />
                    </div>
                </div>

                <div class="ontrol-group">
                    <label class="control-label" for="cc-expiry-month">Expiry</label>
                    <div class="controls">
                        <select id="cc-expiry-month" style="width:auto">
                            <option value="01">01</option>
                            {exp_month_options}
                        </select>
                        <select id="cc-expiry-year"  style="width:auto">
                            <option value="2016">2016</option>
                            {exp_year_options}
                        </select>
                    </div>
                </div>

                <div class="pure-control-group">
                    <label class="control-label" for="cc-cvc">CSC</label>
                    <div class="controls">
                        <input type="text" id="cc-cvc" value="123" class="input-mini" />
                    </div>
                </div>

            </fieldset>
        </div>

    </div>
    <div class="form-actions">
        <a href="{path='checkout/step2'}" class="pure-button">Back</a>
        <input type="submit" name="btnSubmit" value="Place Order" class="pure-button pure-button-primary" />
    </div>

{/exp:store:checkout}

```

This one really has be beat. While I think I might be seeing an issue where Pin.js intercepts every form submission and get's a new token for every form submission, if I disable Pin.js and manually add the token that was previously issued, it still won't give a meaningful response after post.

# Answer
I managed to get this working but only after two hours of debugging.

* Pin.net requires address-line1, address-city
* Using form.get(0).submit() will not work if you submit button has name="submit"
* Store redirects you to the same page if no POST\['submit'\] is found. Your submit button must be named "submit" e.g. name="submit"
* If you disable (disabled="disabled") your submit button it will not be "POSTED", so Store will redirect you to the same page

So instead of using form.submit() i used a click handler on the submit button.

Here is my example code

```
<html>
<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src='https://cdn.pin.net.au/pin.v2.js'></script>

    <script>
    // 1. Wait for the page to load
    $(function() {

        // 2. Create an API object with your publishable api key, and
        // specifying 'test' or 'live'.
        //
        // Be sure to use your live publishable key with the live api, and
        // your test publishable key with the test api.
        var pinApi = new Pin.Api('pk_kmzTxiNh25A6lU1sZIgmqQ', 'test');

        var form = $('form.pin');
        var submitButton = form.find(":submit");
        var errorContainer = form.find('.errors');
        var errorList = errorContainer.find('ul');
        var errorHeading = errorContainer.find('h3');

        // 3. Add a submit handler to the form which calls Pin.js to
        // retrieve a card token, and then add that token to the form and
        // submit the form to your server.
        submitButton.click(function(e) {
            e.preventDefault();

            // Clear previous errors
            errorList.empty();
            errorHeading.empty();
            errorContainer.hide();

            // Disable the submit button to prevent multiple clicks
            submitButton.attr({disabled: true});

            // Fetch details required for the createToken call to Pin Payments
            var card = {
                number:           $('#payment_card_no').val(),
                name:             $('#payment_name').val(),
                expiry_month:     $('#payment_exp_month').val(),
                expiry_year:      $('#payment_exp_year').val(),
                cvc:              $('#payment_csc').val(),
                address_line1:    $('#address-line1').val(),
                address_line2:    $('#address-line2').val(),
                address_city:     $('#address-city').val(),
                address_state:    $('#address-state').val(),
                address_postcode: $('#address-postcode').val(),
                address_country:  $('#address-country').val()
            };

            // Request a token for the card from Pin Payments
            pinApi.createCardToken(card).then(handleSuccess, handleError).done();

            return false;
        });

        function handleSuccess(card) {
            // Add the card token to the form
            //
            // Once you have the card token on your server you can use your
            // private key and Charges API to charge the credit card.
            $('<input>')
                .attr({type: 'hidden', name: 'payment[token]'})
                .addClass('card_token')
                .val(card.token)
                .appendTo(form);

            // Turn off the click handler and click it
            submitButton.off('click').val('processing...').removeAttr('disabled').click();
        }

        function handleError(response) {
            // Empty the card token
            form.find('.card_token').val('');

            errorHeading.text(response.error_description);

            if (response.messages) {
                $.each(response.messages, function(index, paramError) {
                    $('<li>')
                        .text(paramError.param + ": " + paramError.message)
                        .appendTo(errorList);
                });
            }

            errorContainer.show();

            // Re-enable the submit button
            submitButton.removeAttr('disabled');
        }
    });
    </script>
</head>
<body>

{exp:store:checkout
    form_class="form-horizontal pure-form pure-form-stacked pin"
    return="store_example/order/ORDER_HASH"
    error_handling="inline"
    payment_method="Pin"
}

    {if no_items}
        {redirect="store_example/checkout"}
    {/if}

    <div class='errors' style='display:none'>
        <h3></h3>
        <ul></ul>
    </div>

    <input type="hidden" id="address_line-1" value="{billing_address1}">
    <input type="hidden" id="address_line-2" value="{billing_address2}">
    <input type="hidden" id="address_city" value="{billing_city}">
    <input type="hidden" id="address_state" value="{billing_state}">
    <input type="hidden" id="address_postcode" value="{billing_postcode}">
    <input type="hidden" id="address_country" value="{billing_country}">

    <fieldset>
        <legend>Payment</legend>

        <label>Card No</label>
        <input type="text" id="payment_card_no" value="">

        <label>Name</label>
        <input type="text" id="payment_name" value="">

        <label>Expiry</label>
        <select id="payment_exp_month" style="width:auto">
            <option value=""></option>
            {exp_month_options}
        </select>
        <select id="payment_exp_year" style="width:auto">
            <option value=""></option>
            {exp_year_options}
        </select>

        <label>CSC</label>
        <input type="text" id="payment_csc" value="" class="input-mini">
    </fieldset>

    <input type="submit" name="submit" value="Place Order">

{/exp:store:checkout}

</body>
</html>

```
> 1 votes

---
Tags: expresso-store, payment-gateway
---


# Question
Title: EE 2.8.1 mailing list This form has expired
when SOME people try and add their email to the mailing list they get this error:

The following errors were encountered

This form has expired. Please refresh and try again. Return to Previous Page

# Answer
Add

```
$config['disable_csrf_protection'] = 'y';

```

to your config.php and you're done.
> 0 votes

# Answer
ExpressionEngine uses an anti CSRF technique where it assigns a value to a hidden field (i believe the field name is `csrf_token` (`XID` in version \< 2.8.0) and assigns the same value to a session. At form processing stage it compares the two and if they dont match the form returns an error. I believe the error you are getting is the one that gets returned when this happens.

If the visitor is getting this error, the form might be cached at the server / network level, delivering them a stale CSRF token. Are all of the affected users on the same network? Corporate firewalls could be delivering stale pages, for instance.
> 1 votes

---
Tags: forms, mailinglist
---


# Question
Title: {Switch} and Mod for even/odd amount of entries
I have a html structure where two entries are grouped into one div, so what I do is this:

```
{exp:channel:entries channel="bullets" dynamic="no"}
     {switch='<div class="bullets">|'}
           <div class="col-lg-6 col-sm-6">
                                ...some content...
           </div>
     {switch='|</div>'}
{/exp:channel:entries}

```

This works great as long as I have an even number of entries in the channel. If I have an odd number the closing is not being added.

I was wondering if I can somehow do something like this:

```
{if total_results mod 2 != 0}
   </div>
{/if}

```

to make sure I have a closing tag if I have an odd number of entries.

Any suggestions?

# Answer
> 4 votes
Well, if you want a modulus operator, use a modulus operator!

```
{if total_results % 2 != 0}
   </div>
{/if}

```

Maybe you can find it easier this way:

```
{exp:channel:entries channel="bullets" dynamic="no"}
     {if count = 1 OR count % 2 == 1}
     <div class="bullets">
     {/if}
           <div class="col-lg-6 col-sm-6">
                                ...some content...
           </div>
     {if count == total_results OR count % 2 == 0}
     </div>
     {/if}
{/exp:channel:entries}

```

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


# Question
Title: Incomplete orders - they add to order ID?
I see that Store adds the order ID to incomplete orders.

So there is no accumulative counting of proper orders (orders miss IDS). Is there a way to change this so only actual orders receive an order ID?

Thanks.

# Answer
> 2 votes
Actually Store creates an ID for each cart, not only incomplete orders. Currently there is no way around this. In the future we would like to take the current ID and call it a Cart ID and add a separate Order ID for complete orders.

---
Tags: expresso-store
---


# Question
Title: Solspace FreeForm : How to send file via Ajax with FreeForm
I have forms made with FreeForm Pro on a website (some with Composer, others by the Template way) that are validated and sent by Ajax. I followed the code given on Solspace documentation.

Here's my code :

```
<script type="text/javascript"
        src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>

<script type="text/javascript">
    jQuery(function($){
        var $form            = $('#ajax_form');

        $form.submit(function(e){
            //hide all errors
            $('.error_message').hide().html('');

            //jquery ajax shortcut
            $.post(
                //form url (Freeform autodetects ajax)
                $form.attr('action'),
                //form params
                $form.serialize(),
                //data handler
                function(data)
                {
                    // -------------------------------------
                    //    `data` is a json string that jQuery
                    //    automatically detects and converts.
                    //    data {
                    //        //posting successful?
                    //
                    //        "success" : true/false,
                    //
                    //        //object containing error messages
                    //        //if success is false
                    //        //multiple error messages are an array
                    //        //single error messages are a string
                    //
                    //        "errors"    : {
                    //            "field_name1"    : 'single error message',
                    //            "field_name2"    : [
                    //                'multiple error messages',
                    //                'for the same field'
                    //            ]
                    //        }
                    //
                    //        //the return url of return="" if set, or this current url
                    //
                    //        "return_url"    : "http://yoursite.com/return/segment/"
                    //    }
                    // -------------------------------------
                    if (data.success == false)
                    {
                        //data.errors
                        $.each(data.errors, function(i, item){

                            var $errorHolder = $('[name="' + i + '"]').
                                                    parent().find('.error_message');
                            var error         = ($.isArray(item) ? item.join('<br/>') : item);

                            //does the error holder field exist?
                            if ($errorHolder.length > 0)
                            {
                                $errorHolder.append('<p>' + error + '</p>').show();
                            }
                            //lets add it to general errors
                            else
                            {
                                $generalErrors.append('<p>' + error + '</p>').show();
                            }
                        });
                    }
                    else if (data.success)
                    {
                        $('#ajax_form').hide().html('');
                        $('.message_success').slideDown();
                    }
                }
            );

            e.preventDefault();
            return false;
        });
    });
</script>

```

The thing is : when I add a file field to the form, the form is sent but the file is not attached to the mail and not saved in the database. I searched everywhere to fix this but have issues to do it. Asked Solspace (they send me this link : http://hayageek.com/jquery-ajax-form-submit/#multipart-form to help me but I can not apply it to my form).

Does anyone has a clue for me please?

Versions used : FreeForm Pro 4, EE 2.8.2

# Answer
> 2 votes
The documentation code is an *example*, and therefore may need tweaking for fit your particular goals.

File fields are different from "regular" fields, since no text or data is present inside the field when submitting, as you would have it with text fields for example. The above code simply serializes the form's *text* data to be sent through ajax, and therefore the file attachment is not part of the submitted data. That also means no file is saved in the database, and no file attachment is sent with a notification email.

The link you provided ended with this comment:

> Same functionality you can get by using Ajax Form plugin.

I would suggest building the form using this Ajax Form plugin. It's a fairly popular plugin, and has been around for a long time. The following is a **very** old forum discussion about using this plugin with Freeform 3.x (could be used with any form using files, really), http://www.solspace.com/forums/viewthread/666/ Hopefully it's useful information in addition to the plugin's official documentation.

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


title: Bets way to protect direct link?

text:
# Question
Title: Bets way to protect direct link?
I am using Channel Images and obfuscating the links so a user cannot see the path, but I want to protect the full link using htaccess well. The user will be able to see the images, zips, or files in an EE template, but can direct link DL the source as well.

What is the nest way to check if user is logged into EE as a certain membership group before being able to access via a direct link? I have searched and saw that it can be done via an ACT url or a php script, but I have no idea how to write it.

Any existing modules or scripts out there?

Thanks!

# Answer
> 1 votes
Take a look at Protected Links. This will allow you to limit link usage by IP, Member group, Member ID as well as hotlinking protection (and more I think!) You can also create links via the CP or have it generate links on-the-fly.

# Answer
> 0 votes
I suggest you to take a look at Link Vault and Client Downloads. They're both good and coded by trustful developers.

---
Tags: htaccess, authentication
---


title: Playa jquery error

text:
# Question
Title: Playa jquery error
is anyone else getting an error in jquery when using playa in single entry mode?
The error is:

`Error: Syntax error, unrecognized expression: #{DEFAULT} -> jquery.js:23`

multiple entry selection mode works fine.

All the functionality still seems to work except the built in search/filter.

EE 2.9.0 playa 4.5.1

other misc addons(yes, there may be some out of date ones there):

* bridge
* bw\_category\_count
* child\_categories
* cookie\_plus
* developer
* devotee
* dm\_shortee
* fieldpack
* freebie
* freeform
* fusion
* human\_filesize
* img\_download\_sizer
* imgsizer
* low\_seg2cat
* matrix
* mx\_cloner
* mx\_title\_control
* pagination
* power\_truncate
* pt\_dropdown
* pt\_field\_pack
* pt\_list
* pt\_switch
* selectatron\_migrator
* the\_selectatron
* url\_encode
* url\_tube
* wygwam
* youtube

# Answer
This is a known bug - already fixed locally. We will be getting an update out later this week to address it.
> 0 votes

---
Tags: playa, error, javascript
---


title: Conditional based on file extension

text:
# Question
Title: Conditional based on file extension
I have a piece of code whereby I adjust the output of a file depending on it's file extension:

```
{section_1_files}
  {section_1_files:file}
    {if {extension} == 'jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF'}
      <figure>
        <img src="{url}" alt="{section_1_files:label}" />
      </figure>
    {if:else}
      <div class="file">
        <a href="{url}">{section_1_files:label}</a>
      </div>
    {/if}
  {/section_1_files:file}
{/section_1_files}

```

However it doesn't seem to be working properly. If I add `{extension}` below the `{section_1_files:file}` line then `jpg` is displayed on the front end. The following code currently outputs this:

```
  <div class="file">
    <a href="http://domain.co.uk/uploads/test-image.jpg">Test image</a>
  </div>

  <div class="file">
    <a href="http://domain.co.uk/uploads/test-file.docx">Test file</a>
  </div>

```

Any help would be greatly appreciated.

# Answer
Just use the Contains and the Concatenation operators to check if the file extension appears on the list:

```
{section_1_files}
  {section_1_files:file}
    {if "|jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|" *= "|" . extension . "|" }
      <figure>
        <img src="{url}" alt="{section_1_files:label}" />
      </figure>
    {if:else}
      <div class="file">
        <a href="{url}">{section_1_files:label}</a>
      </div>
    {/if}
  {/section_1_files:file}
{/section_1_files}

```

I don't have time now to check if the *contains operator* is case sensitive. If you could test it, please update this answer.

Why not to check for the `{mime_type}` using the begins operator?

```
{section_1_files}
  {section_1_files:file}
    {if mime_type ^= "image/" }
      <figure>
        <img src="{url}" alt="{section_1_files:label}" />
      </figure>
    {if:else}
      <div class="file">
        <a href="{url}">{section_1_files:label}</a>
      </div>
    {/if}
  {/section_1_files:file}
{/section_1_files}

```
> 2 votes

# Answer
change `{if {extension} == 'jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF'}` to

```
{if section_1_files:extension== 'jpg' || section_1_files:extension=='JPG' ...

```
> 2 votes

---
Tags: conditionals, files
---


title: Mass Delete Submissions in Freeform

text:
# Question
Title: Mass Delete Submissions in Freeform
I have a client using Freeform (free) 4.2 that has about 30K of submissions between two forms. They have no need to save these and I'd like to clear them out or better yet set them up to do it. I see no "delete all" in the Freeform CP so assume my options are either duplicate the form, delete the original, and then rename the new one. Or get crafty with SQL queries at the db level.

Any other options I'm missing, or has anyone done this and have some pointers?

# Answer
There currently isn't any way to delete all entries for a form.

Each form has its own DB table just for entries (For performance and the allowance of many forms with many different custom fields). All other information regarding the form is stored in another table, thus a TRUNCATE query would accomplish the clearing without damaging the table:

```
TRUNCATE TABLE exp_freeform_form_entries_FORMID

```

Replacing FORMID with the ID of the form you want to clear out.

```
TRUNCATE TABLE exp_freeform_form_entries_1

```

If you are uncomfortable doing manual SQL queries, there is a duplicate form button on the forms page, but unfortunately at the moment it does not copy field structure (This is on our bug list.) so you'd need to manually click each field you wanted on the duplicated form, use a dummy name, delete the first form, rename the new form, etc.
> 2 votes

---
Tags: solspace-freeform
---


# Question
Title: Why i'm getting only one entry on Gmaps map?
This is my code:

```
{exp:gmaps:init}

{exp:gmaps:geocoding width='100%' height='100%' marker='yes' map_types='roadmap|terrain' map_type='Hybrid' scroll_wheel='yes' zoom_control='yes' pan_control='yes' map_type_control='no' scale_control='yes' street_view_control='yes' address_format='[city]' div_id='mymap'}
{address}
{exp:channel:entries channel='travels' disable='categories|member_data|pagination|trackbacks' dynamic='off' cache='yes' refresh='512640' orderby='date' sort='asc'}
{scheda_del_viaggio orderby='city' sort="asc"}{city}|{/scheda_del_viaggio}
{/exp:channel:entries}
{/address}
{marker:html}
{exp:channel:entries channel='travels' disable='categories|member_data|pagination|trackbacks' dynamic='off' cache='yes' refresh='512640' orderby='date' sort='asc'}
{scheda_del_viaggio orderby='city' sort='asc'}
<h1 class="h3-like text-strong">[location]</h1>
<a href="{title_permalink={segment_1}}">
<span class="h3-like first-letter">{title} - {travel_check_in format="%d %F %Y"}</span>
</a>|
{/scheda_del_viaggio}
{/exp:channel:entries}
{/marker:html}
{/exp:gmaps:geocoding}

```

I dont understand why I'm getting only one entry title for the channel 'travels' on my map..

# Answer
Only had a very very quick look at this one and admittedly being very very naughty haven't tried the code out but noticed that you have a cache set. Did you by any chance load the page when you only had the one entry and then tried again before the cache had refreshed perhaps? Just a quick thought though.
> 1 votes

# Answer
Try changing dynamic="off" to dynamic="no"
> 0 votes

---
Tags: channel-entries, google-maps, title
---


# Question
Title: Display cartthrob subtotal + tax + discount - shipping
On my shopping cart page I'd like to display the total (inc tax & discounts!) but not including shipping costs. I can't find a tag for this unless I'm missing something.

Any suggestions?

# Answer
I haven't tested it, but I'm assuming the {exp:cartthrob:cart\_subtotal\_minus\_discount} tag doesn't include the tax? Perhaps then it would be best to calculate the {exp:cartthrob:cart\_subtotal\_minus\_discount} + {exp:cartthrob:cart\_tax} values using javascript or an EE math plugin like one of these:
> 1 votes

# Answer
I did it by creating a partial (includes/cart\_subtitle.html):

```
{!-- Calculate total without delivery --}
{exp:cartthrob:arithmetic expression="({embed:subtotal} - {embed:discount}) + {embed:tax}"}

```

and in the main template:

```
{embed="includes/cart_subtotal" discount="{exp:cartthrob:cart_discount prefix="" thousands_sep=""}" tax="{exp:cartthrob:cart_tax prefix="" thousands_sep=""}" subtotal="{exp:cartthrob:cart_subtotal prefix="" thousands_sep=""}" }

```

Bit ugly, but it works :)
> 0 votes

---
Tags: cartthrob, ecommerce, tags
---


# Question
Title: Low Search for location/proximity searches
Is it possible to use Low Search for creating a store finder kind of search?

I'm currently using Channel Search in combination with Google Maps for ExpressionEngine and while it's pretty good the search system also uses a large number of categories. I'm seeing some performance problems because of this.

I've recently used Low Search on another site to search through and filter a large number of categories and I've been really impressed by its speed.

So what I'm hoping I can do is combine Low Search with Google Maps for ExpressionEngine to get a fast search system which allows the user to search for properties within a radius of a specified location.

# Answer
Low Search's Distance filter requires that lat/long values are stored in **two separate channel fields**. Also, you need to feed it lat/long values yourself; it won't take data like a post code as a starting location.

If these conditions are met, you can use the Distance filter to filter entries by distance/proximity. If not, then you'd need a custom filter or extension to allow for it.
> 2 votes

---
Tags: search, low-search, google-maps-for-ee
---


title: Timing out while editing

text:
# Question
Title: Timing out while editing
I'm finding that that system is logging me out while editing a post very quickly. Is it possible to change the time period so that I have longer before it times out?

# Answer
Prior to EE 2.8 (and after 2.2 I think) there's a hidden config variable called `cp_session_ttl` that allows you to set the time in seconds after which a cp session will expire if there has been no user activity. I *think* you can also set a value of `0` to have sessions not expire (untested).

As of 2.8 this is replaced by `expire_session_on_browser_close`

You can set config variables in your `config.php` (which you can find at `system/expressionengine/config/config.php` unless you've moved things around).
> 1 votes

---
Tags: system
---


title: Channel Form Edits Not "Sticking"

text:
# Question
Title: Channel Form Edits Not "Sticking"
I created a channel:form for creating entries and it works fine. However, when I attempt to edit the content of the entry, the edits don't take and it returns the original entry values.

Edits to the same entry in the Control Panel save fine, so there is something wrong with my form.

Here is the code for the edit entry form:

```
{exp:channel:form channel="facilities" entry_id="{segment_3}" author_id="CURRENT_USER"  return="test/preview/ENTRY_ID" }

<input type="hidden" id="facilityCounter" value="1" />
 <div id="facilities">
   <fieldset class="facility-info">

    <dl>
    <dt><label>Facility Name*</label></dt>
    <dd class="validate"><input type="text" name="{title}" class="required" value="{title}"></dd>

    <dt><label>Street address*</label></dt>
    <dd class="validate"><input type="text" name="{facility_street_address}" class="required" value="{facility_street_address}"></dd>

    <table class="city-state-zip">
        <thead>
            <tr>
                <th scope="col">City*</th>
                <th scope="col">State*</th>
                <th scope="col">Zip*</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="validate"><input type="text" name="{facility_city}" class="required"  value="{facility_city}"></td>
                <td>
                            <select name="{facility_state}">
                            <option selected value="{facility_state}">{facility_state}</option>
                            <option value="AL">Alabama</option>
                            <option value="AR">Arkansas</option>
                        <option value="FL">Florida</option>
                        <option value="GA">Georgia</option>
                        <option value="KY">Kentucky</option>
                        <option value="LA">Louisiana</option>
                        <option value="MI">Mississippi</option>
                        <option value="NC">North Carolina</option>
                        <option value="SC">South Carolina</option>
                        <option value="VA">Virginia</option>
                     </select>

                </td>
                <td class="validate"><input type="text" name="{facility_zip}" class="zip required" value="{facility_zip}"></td>
            </tr>
        </tbody>
    </table>
    <input type="image" src="/photos/btn_submit-survey.png" alt="" value="Submit">
</div>
</div><!-- end div.facility-form -->

{/exp:channel:form}

```

I have confirmed permission and do not receive any errors. I would appreciate any insights into why the edits are not saving.

# Answer
> 1 votes
You currently have:

```
name="{facility_state}"

```

I think this should be:

```
name="facility_state"

```

Same applies to your other fields.

---
Tags: safecracker
---


# Question
Title: How to check total amount of entries in a channel
If I'm using expression engine just using backend (for example I just write the blogs I don't code with the developer), no exposure to the code, how do I view the total amount of entries?

How do I filter those entries to show me how many drafts, how many published and so on?

Seems trivial but I don't know the answer.

# Answer
> 1 votes
When you view the Channel Entries list (Content-\>Edit) there are a number of filters available.

You can use the dropdowns to show entries from a particular channel, category, or status. There is no explicit total of entries shown but you can easily determine it from looking at the number of 'pages' there are in the listing. The list can be sorted by clicking on the column headings.

You may find that you don't have access to this list. It's dependant on how your member group has been set up.

It is also possible to set up some front-end templates which will show you the number of entries etc.

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


title: How do I update a subscription?

text:
# Question
Title: How do I update a subscription?
Doesn't seem to be a way to:

1. Update a subscription on the front end or
2. Update a subscription in the CP.

Am I missing something?

I'm in "Test" mode, and using EE 2.7.1.

# Answer
The control panel for individual subscriptions is set to be released soon and will be updated at no additional cost.
> 2 votes

---
Tags: devdemon, subscriptions
---


# Question
Title: Cartthrob not saving items to cart in Chrome (not Firefox)
I received a report from a user today that users in Chrome cannot add items to their cart. It seems to be a new problem only in the past few days, perhaps caused by a recent Chrome update.

I later discovered that this is *only* a chrome problem, and doesn't actually affect Firefox users at all.

Basically, in Chrome, the user clicks the add to cart button, the site redirects to the cart, and the cart is empty.

When I inspected the HTTP requests for both Chrome and Firefox, I noticed that in Firefox, the exp\_cartthrob\_session\_id cookie is maintained throughout the session. In Chrome, it seems to be reset on each request. Basically each request (GET product details page, POST add to cart, GET cart page) comes with a separate header that looks like:

```
Set-Cookie:exp_cartthrob_session_id=abcdefghijklmnopqrstuvwxyz; expires=Wed, 03-Sep-2014 03:17:59 GMT; Max-Age=18000; path=/

```

Why would Cartthrob be resetting the session header on every request. Is this a bug with Chrome expiring cookies, or a bug with Cartthrob? How can I get "add to cart" working again on my site?

# Answer
> 6 votes
I discovered the problem. We were using CartThrob's fingerprinting for sessions with the configuration set to "0" for the default fingerprinting method. The default method creates the fingerprint as:

```
$fingerprint = $this->EE->input->server('HTTP_ACCEPT_LANGUAGE').$this->EE->input->server('HTTP_ACCEPT_CHARSET').$this->EE->input->server('HTTP_ACCEPT_ENCODING');

```

In Chrome, the HTTP\_ACCEPT\_ENCODING header is different between GET and POST requests, which made CartThrob reset the session on POST requests from Chrome.

The problem was fixed by disabling session fingerprinting in the CartThrob settings.

---
Tags: cartthrob, sessions, shopping-cart, chrome
---


# Question
Title: Solspace importer cache folder safe to clear?
Simple question: the /system/expressionengine/cache/importer folder has grown to 130MB. Can I delete the contents without consequences or should I leave as is?

# Answer
Yes, you can empty it.

Importer temporarily stores the file somewhere to read and use it, whether you submit your original data file through a manual upload, remote URL, server path, etc. The EE cache folder is where these files are temporarily stored.
> 1 votes

---
Tags: solspace, solspace-importer
---


title: How to list currently selected tags?

text:
# Question
Title: How to list currently selected tags?
After filtering entries, my URL looks like that:

`/template/tag/tag01:tag02:tag03`

I'm wondering what's the best way to get a list of those tags in a `<ul>`. I could build the functionality in PHP but I'm thinking this functionality might be built in already since it seems pretty standard and I'm just not seeing it in the docs?

Basically, what I want to do is list all the tags that have been selected like:

`x` tag01 `x` tag02 `x` tag03

And let the user remove whatever tags they want from the result by clicking on the `x`.

Thanks for any pointer in the right direction!

# Answer
> 0 votes
Wile I agree that it seems intuitive that Solspace would allow output to a list, it's not in there. It's simple enough to create your own, though, and the following code should get you up and running with the outputting of the tags:

```
<div class="entry_tags">
  <p><b>THIS ENTRY'S TAGS:</b>
    {exp:tag:tags entry_id="{entry_id}" [tag_group_name="your_tag_group"] backspace="2" orderby="tag_name" sort="asc" }
              {if tag_count == '1'}
      <ul class="tag_list">
      {/if}
      <li class="tag_list_item"><a href="#" class="close_box">X</a> [<a href="{path='your/path'}/{websafe_tag}/">]{tag}[</a>]</li>
              {if tag_count == tag_total_results}</ul>{if:else} {/if}
    {/exp:tag:tags}
  </p>
</div>

```

Now, you will still have to create CSS to format your list inline, and you will have to code your Javascript to act when that `.close_box` is clicked, but I'm not thinking you were asking for that code, were you?

***Note****: Items in square brackets are optional.*

# Answer
> 0 votes
Thanks @dashard but that's not really what I needed. I guess my explanation wasn't clear enough. Sorry about that! I'm not showing one entry on the page. I'm showing all entries filtered by any number of tags, so my URI looks like that: `mysite.com/template/tag/tag01:tag02:tag03`and I'm showing all entries tagged with `tag01` and `tag02` and `tag03`. I want to have a list of the current "page filtering" so to speak, and let the user remove some of those tags in order to broaden the filtering if they want to.

I thought the functionality might be built in, that's why I asked… But it doesn't seem like it, so I just coded it up in PHP.

In case anyone is interested, that's how it looks like:

```
<?php
    // get the last URI segment
    $tag_segment = array_pop(explode("/", urldecode($_SERVER["REQUEST_URI"])));
    // put the tags in an array
    $tags = explode(":", $tag_segment);
    $tag_links = "";
    // loop through the tags
    foreach ($tags as $t) {
        // rebuild the tag URI segment with all tags but WITHOUT the current one
        // so when we click on a tag, it "removes" itself
        $tags_others = implode(":", array_diff($tags, array($t)));
        // build the tag list
        $tag_links .= '<li><a href="{path=tag}/'.str_replace(" ", "+", $tags_others).'">'.$t.'</a></li>';
    }
?>
<ul class="tags">
    <?=$tag_links;?>
</ul>

```

# Answer
> 0 votes
You could use `{exp:tag:cloud}` and provide a pipe-delimited list of your tags in the `tag_name=""` parameter: http://www.solspace.com/docs/tag/cloud/#tag\_name You would need to search/replace colons `:` to pipes `|`. You can do this with PHP set to **input**:

```
<?php
   $tags = '{segment_3}'; // This is parsed early, before PHP
   $tags = str_replace(':', '|', $tags);
?>

{exp:tag:cloud tag_name="<?php echo $tags; ?>"}
   // Your list of tags
{exp:tag:cloud}

```

There might be add-ons that can do the same thing, and there is also embed templates that you could use to get around parse order.

---
Tags: solspace-tag
---


# Question
Title: Internal Server Error when trying to import members with Solspace Importer
I'm trying to import a member's XML file (produced by Eric Lamb's Export It! add-on) into a new (local) EE 2.9.0 setup using Solspace Importer 2.2.5.

I set everything up in Importer but when I try to run it, it gives me an Internal Server Error. Here's what I got in the console: http://cl.ly/image/1U3k0r2n3i0B

The XML file is 6.5MB and contains ~330 members.

Not sure how to fix / get it working.

# Answer
Had to submit a support ticket over at Solspace and got help right away. Solution was to set the Unique Field setting to something other than member\_id and the import worked beautifully. Big thanks to Nicolas Bottari. :D
> 2 votes

# Answer
I think you should try to narrow down the error a little more. Cut the list in half and try each half individually. Does one half go through and the other error? Put aside the working half and cut the bad half into two, and do it again. Keep doing this until you get either a specific XML node causing the issue or figure out it's more about quantity. (You'd basically be doing a Binary Search).

If it errors even when you send a single, known-good member to it, I'd consider walking through the module and `exit()`ing in various places until it errors before you `exit()`.
> 2 votes

# Answer
The URL that's throwing the error looks odd. You've obscured it so it's hard to say for sure but why would Importer be targeting /admin.php?

Is that what you expect? Shouldn't it be /system/index.php?

I do use Importer but not with XML files, I'm not on 2.9.0 yet so no certain what's changed.

You said it's a new local set up so I'd look first to see if your EE preferences/configs are set correctly as well as checking my .htaccess (which for me is the cause of the vast majority of my 500 errors).
> 0 votes

---
Tags: members, solspace, import, solspace-importer
---


title: Pre-Sales Questions

text:
# Question
Title: Pre-Sales Questions
I have a few pre-sales questions about Subscriptions.

1. Can it handle subscribers who pay by cash/cheque? Can they be kept in a Pending group until offline payment confirmed?
2. Can notifications be sent out in advance of a subscription expiring rather than just when expired or renewed? For example, a reminder sent out 4 weeks before the sub expires.
3. Are there any conflicts with other Member addons such as Zoo Visitor?

Very excited by this addon.

# Answer
1. No it can't do offline payments, we started with Stripe & Authorize.net
2. Is this for non-renewing Subscriptions? Or also for auto-renew?
3. No conflicts, we do want to support member registration and subscription signup on the same form. Would love to hear your set up.

We want to gather as much feedback/ideas as possible. Please get in touch via our contact form so we can keep track of all requests.

We already received some pretty crucial feedback in the last few days.
> 2 votes

---
Tags: devdemon, subscriptions
---


title: Voucher Error When Trying to Redeem

text:
# Question
Title: Voucher Error When Trying to Redeem
Seems to work when I add the missing 'billing\_at' column to the database table.

Maybe it was intended to be 'created\_at'?

# Answer
> 1 votes
This bug has been fixed internally and an update will be released very soon.

---
Tags: devdemon, subscriptions
---


title: Payment gateway not showing

text:
# Question
Title: Payment gateway not showing
Good morning folks,

small but very irritating problem. Store2 comes with the Omnipay/Buckaroo payment gateway that's way outdated. Buckaroo switched to a new communication protocol in februari 2014.

The Omnipay github contained the new version and i was able to update this and get it to work for the three payment methods that already showed up in store2.

Then came the problemmy bit, i extended the method to include some functionality not yet implemented in the updated github version. Reason behind this, clients can pay via buckaroo using a few different methods (iDeal, CC, belgium bank, German banks, etc). When you handoff the payment to buckaroo without specifying what to use they show the user a selection screen. Since that selection screen is already part of my site design I need to handoff the payment to Buckaroo with a selector in the request.

**The Omnipay Github version includes 3 methods (iDeal, CC, Paypal). I needed a few extras so i created those. Problem is, their NOT showing up inside Store2.**

Who can point me in the right direction? I've asked the good folkes at DevDemon multiple times but haven't received a response yet (and we're a few weeks down the road already).

With kind regard, Bas van Ginkel

Updated Omnipay Github https://github.com/omnipay/buckaroo/tree/master/src

My Github Version https://github.com/ginkelb/store-buckaroo/tree/master/store\_buckaroo/Omnipay/Buckaroo

# Answer
> 1 votes
We resolved this via our internal ticket system:

Omnipay has a “curated” list of supported gateways, if your gateway is not listed, it won’t be loaded.

Open: store/vendor/omnipay/common/composer.json and in the extra/gateways array you will find the supported gateways.

# Answer
> 0 votes
I have experience with multiple payment gateways disappearing from the cp as well. What fixed it for me was using PHP 5.3 or lower.

I've been in touch with expresso about this months ago and devdemon only last month. On both occasions I was told it would be looked into.

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


# Question
Title: solspace calendar: only display the first occurrence of each recurring event within a set timeframe
EE 2.8.1 Calendar 1.8.6

I want to only display the first occurrence of each repeating event.

Right now I have a list of all events always displaying the next upcoming occurrence.

```
{exp:calendar:cal calendar_id="{embed:calendar_id}" event_limit="{embed:event_limit}" date_range_start="today" show_months="6" pad_short_weeks="n" dynamic="off"}
<li><a href="{path='events/event'}/{event_id}/">{event_title} - Details >></a> {event_start_date format="%F %j, %Y"}
{if event_summary}<br />{event_summary}{/if}
{if event_location}<br />Location: {event_location}{/if}
{if event_cost}<br />Cost: {event_cost}{/if}<br /><br />

</li>
          {if no_results}
          <li>No events could be found within the specified time range for this Calendar.</li>
          {/if}
{/exp:calendar:cal}

```

# Answer
The following solution, from the Solspace support site, might be what you are looking for:

How to display a chronological list of events, with each unique event appearing only once

It's also been mentioned in these threads:

**Summary**:

One approach is to use PHP to create an array of unique events, and display your event data only when the event is encountered for the first time in {exp:calendar:cal}. Here's an example (turn on PHP for your template and set it to Output):

```
{!-- Create the arrays --}
<?php
    $event_ids = array();
    $event_data = array();
?>

{!--
    // Check if the event was already encountered (i.e. is in the array),
    // and store your data in a separate array if this is the first time
    // encountering this event
--}
{exp:calendar:cal /* your other parameters here */}
<?php
    if( ! in_array('{event_id}', $event_ids) )
    {
        $event_ids[] = '{event_id}';
        $event_data[] = '* The data you want displayed *';
    }
?>
{/exp:calendar:cal}

{!-- Display event data, still in chronological order --}
<?php
    foreach($event_data as $data)
    {
        echo $data;
    }
?>

```

Of course there are likely other strategies, using PHP, Stash, or other means, but the main idea is to create a list/group/array of unique events within your timeframe.
> 1 votes

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


# Question
Title: P&T Fieldpack:Checkbox - Spitting out if conditional instead of parsing it
I am running into a problem with the fieldpack checkbox on a site I am developing.

I am using the following code inside an {exp:channel:entries} loop, but the first two entries is echoing out the if conditional as seen below.

Channel entries loop: {exp:channel:entries channel="stories" orderby="entry\_date" sort="desc" limit="20"}

if conditional:

```
{if "{story_type:selected option='Video'}"}
    <span class="prl-overlay-area o-video"></span>
{/if}
{if '{story_type:selected option="Audio"}'}
    <span class="prl-overlay-area o-video"></span>
{/if}

```

What the page shows:

as seen here: http://new.danaloeschradio.com/ (below the gunbox ad).

Can anyone help?

# Answer
> 0 votes
Looks like I figured it out. For reference in the future.

Here was the culprit:

```
{exp:ce_str:ing remove_html substr="0|150" xss_clean}

```

specifically, "substr". This method of ce\_string and P&T Fieldpack did not play nice together on the same page. I fixed it by using the following alternative method.

```
{exp:ce_str:ing remove_html truncate="150|..." xss_clean}

```

---
Tags: pixelandtonic, conditionals, pt-checkboxes
---


# Question
Title: CartThrob checkout_form outputting wrong return value
This is my template code:

```
{exp:cartthrob:checkout_form
    error_handling="inline"
    required="card_type|credit_card_number|CVV2|expiration_month|expiration_year";
    return="store/thank-you"
    authorized_redirect="cart/authorized"
    failed_redirect="cart/failed"
    declined_redirect="cart/declined"
}

<label>Testing form return</label>

{/exp:cartthrob:checkout_form}

```

This is the HTML output:

```
<form action="http://local.729beauty.com:8888/store/payment" method="post" id="checkout_form">
<div class="hiddenFields">
<input type="hidden" value="35" name="ACT">
<input type="hidden" value="http://local.729beauty.com:8888/store/payment" name="RET">
<input type="hidden" value="store/payment" name="URI">
<input type="hidden" value="25a5d098274dc3160f8523810faa9984" name="FRM">
<input type="hidden" value="inline" name="error_handling">
<input type="hidden" value="store/thank-you" name="return">
<input type="hidden" value="cart/authorized" name="authorized_redirect">
<input type="hidden" value="cart/failed" name="failed_redirect">
<input type="hidden" value="cart/declined" name="declined_redirect">
<input type="hidden" value="fhXgN84OH//7He+A4cXWnIz6lkOXlLpUertRTQuYJk9YoLaeB8gd0mFhm3KQ4xVV8iyq/WazuYN1+AO0KgMgjw==" name="AUP">
<input type="hidden" value="aMvc2dbOlMHq47x3DAetF0q8+dJgiJnc5jrQsbCok5bZFvQeDw+8fvt+f+D6okrn3XV1W13pKBGUfzk6HBx4pg==" name="AUS">
<input type="hidden" value="hm4P2Y45BfyKYFIfMctshTwj3XIK/YZTY+1SFIraj7MRXv+1mV0Cn2fXmE94ucJVlhjB342tbHStUdElrI0ofg==" name="OTF">
<input type="hidden" value="clUmg1Fh9OCt57mfBxpB2HZHhIFYx9+a55KP9LyESvVqX8kImrEyzIvRjSBsgqaMkjANz/W0LSJIH9Jzc+T9qQ==" name="LIC">
<input type="hidden" value="fpbNvFH23jf9kBAB/2uKUN0ZrABtC+gr56EyWPf90sn+zQ+WfswMD/pX+4YhRKZNNvf1SWHGRpf24C5Kj4Cl2Q==" name="VLT">
<input type="hidden" value="0fLMF9faQwPbNeSll2SEquZQ4cGiRFFERDmWW5b8TsARIEpqD/hGOPGu+6WrvhpJPGB6/7rqXqPZaw3tkHMmjA==" name="FPR">
<input type="hidden" value="8mwr+A6qu1YL2KqV+eLw+il5yAOJVnw/0/P7ydcc5AGuvAMmN0HIpAaIkDrzkiAum1FARjINlwQEBu9hdMUp2w==" name="SM">
<input type="hidden" value="+t4T56oqmiDwn1o8KwocJ5Jx9AP4aWvWR9oJII4gGBldRTK/oagDRV275nxNZN6bZvd2Y13qSYhTbVnkQjEz3g==" name="SUB">
<input type="hidden" value="19LPDjYtW4qwaVHxrR3JpFHD6WWVqtOgPKSXnpBQyM8UtCej6XppTjxBBX3w0/4gzJQGXXZaCBEi+zuolcwkEw==" name="ERR">
<input type="hidden" value="kHX0W/xf6ylW9S8tejEOu+P0VXsIwvOxt4NAT3ov7DzOXGlyqkrLUO7hrZZ95W8uH3JTEm9guHBVRf1uSsbUJtK0+7p3puGrSGMpyfkiNejqDO6GgN9bUe/4FipX6grvKwsaSrnBgg64Bqhmclyc2Bgm48fKTrlqbNcRtdsg6re8hSHGYRVhPNr1dm+VLGhzNqy797q6K8Yv1emgJl8F8Qke8j4KQEUuAOGRWrPYbiIsC/n+7uOczQ7bjRRTmoPqSqvfo7Hlsvc8DGI5iUbDgFG7YvvnM2fg9njk6d+e5gU=" name="RLS">
<input type="hidden" value="1" name="site_id">
<input type="hidden" value="91ac855ea139e6cf936f80345b0c88bbd8c2fe4e" name="csrf_token">
</div>

```

The form's action is set to something different than my return value. Any thoughts on why?

# Answer
I think it's supposed to be like that. The form will post to the page it is on and then redirect as appropriate depending on the result of the transaction. The return values are stored in the hidden fields and your successful return value is located in the 6th field down.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Problem setting a stash variable in a custom module
I'm trying to set a stash variable in a custom module I'm writing with the following code:

```
$params = array(
    'name'  => 'st_test_variable',
    'scope' => 'user',
    'type'  => 'snippet'
);
$value = "Test test";
Stash::set($params, $value);

```

However when I try and retrieve this in a template I get nothing. The code I'm using is as follows:

```
{exp:stash:get name="st_test_variable"}

```

Should this be possible to do?

Bit of additional info: I'm using Stash 2.5.7 with EE 2.5.2 (not able to upgrade right now!).

Cheers

Jim

# Answer
> 2 votes
It should be possible, since that's exactly what I'm doing on my project.

Here's my code (which is working):

in my \__construct()

```
$this->EE  = get_instance();

    if ( ! class_exists('Stash'))
    {
        include_once PATH_THIRD . 'stash/mod.stash.php';
    }

```

Then, lower down in my function, I have a function

```
function set_stash($name,$d)
{
    $params = array(
        'name' => $name,
        'scope' => 'user'
    );

    Stash::set($params,$d);
}

```

I'm thinking it's something to do with the fact you're setting it as a snippet - I'm sure, if a stash variable is a snippet, you access it via `{name_of_snippet}`, in your case `{st_test_variable}`.

Try dropping that from the variables and seeing if it works.

I'm also assuming that your add-on is executed before the stash variable tries to grab it?

---
Tags: stash, add-on-development
---


# Question
Title: How can I build an auto email alert system based on saved searches?
Ok, what I'm trying to do is build a feature for a real estate website that will allow users to do the following:

* register on the site,
* do a search of properties stored in a channel,
* save the search criteria,
* then receive an email alert when a new property is added that matches their saved search

I've done some research on this and there doesn't seem to be a straightforward way to do this in EE. I've seen MX Notify Control addon but it seems that this would alert on all new entries to a channel to all users.

Below is what I'm thinking of doing. I'm hoping I could get some input from the EE community on what they think of this approach, is it overcomplicating things or maybe there's a suggestion for a better approach.

Here goes:

* Install Solspace Super Search and Email-from-Template addons
* Allow users to register on the site using native EE functionality
* Users can then search the entries in a "Property" channel based on keyword, price, location and/or status.
* Then allow users to save their search using Solspace Super Search and their Save Search Form tag
* I could create a standalone page then that loops through all saved searches using the exp:super\_search:history tag, pull out the search criteria, use that criteria to do a search of the property channel and limit the results to ones added in the last 24 hours only.
* If entries are retrieved, create an html email with the property details and send the mail using Email-from-Template addon or possibly through Postmark App or similar.
* Set up a cronjob to run this page every 24 hours at a quiet time of the day, e.g. 4am

So, that's what I'm thinking. I know this page could become quite resource intensive with loops within loops (the more members and saved searches, the longer it will take to process) but I can't think of another way to do this.

Anybody got any suggestions, ideas or pitfalls I should consider?

Or maybe I should write a custom addon to do this?

Thanks,

Dave

# Answer
> 5 votes
Not a complete answer though, I feel it could be one piece of the puzzle or at least an option.

Have you checked out Postmaster yet?

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

> Postmaster is the definitive solution for emailing channel entries within ExpressionEngine. Create beautiful email templates using the live preview, and impose extremely fine levels of control to send emails exactly when you want. Whether it be from the publish entries page in the control, to Safecracker on the front-end, or in a custom application using the channel entries API, Postmaster is the perfect for almost any application.
>
> Postmaster supports a variety of email services including MailChimp, CampaignMonitor, SendGrid, Postmark, PostageApp, and even a full featured API to create your own.

# Answer
> 2 votes
I created similar functionality for a website a while back with a mix of PHP and EE template tags to get the results I needed. I'm not sure if there's a magical all-in-one solution that exists yet.

I'm simplifying here, but I essentially got this to work similar to the way you are describing in your question, with some differences:

* I created a db table that was used to store the contact info (I didn't have members, so I stored their provided email address), the query string that passed to Super Search, and a timestamp.
* I ran through that table using the query module. Nested within that, I used the super\_search:results tag - passing along the search query string. In each loop of the query module I compiled the email to be sent and sent it using the Postmark CodeIgniter wrapper.

I didn't have many users I had to process (under 10 at a time), so I cannot comment on the scaleabillty of it. For my purposes it seemed to work well enough though.

# Answer
> 1 votes
Hmm, i'm not familiar with how solspace saves it's search, but i'd say you could achieve what you need in a template in the way you describe, possibly with a little bit of php thrown in too. How resource intensive it is will all depend on how many properties / saved searches you have and how complex your template is too.

So, onto a add-on, well you could create one with an ACT id for your cron to hit, that way you would avoid the whole EE template parser to do your job so it would be much more efficient. Of course, dependent on how Super Search stores it's data, you would need to decode that and work it into your queries / data structures that you're using to match new properties with.

So, i think doing it in a template with a little bit of php would be much much less work for you, and i doubt the processing overhead would be anything to worry about unless your site is likely to see an awful lot of users or you're running it on really low powered shared hosting. On the other hand, the add-on route would be lots more work for you, but be much more efficient.

Your choice depends on your expected site usage i guess. I hope that answers your question adequately!

# Answer
> -1 votes
Did you succeed to reach your goal on this?

If so, do you agree to share here your final thoughts/experience on how you achieved your goal?

I have something very similar to do.

Thanks in advance.

---
Tags: email
---


title: Google Map won't show with ajax

text:
# Question
Title: Google Map won't show with ajax
I'm trying to load the objective HTML Google Maps extension with Ajax. But i don't get it to work. Before i loaded the map without ajax and that works perfect.

This is the code i use:

```
In the Template:
$('.ajax-map').load('/site/ajax_google');

<div class="ajax-map"></div>

ajax google maps file
{exp:gmap:init
<!--General-->
    id="map"
    class="ajax-map"
    language="nl"
    scrollwheel="false"
    script_tag="false"

    etc...

```

The page does find the google maps file but doesn't load the map. Anybody a idea?

# Answer
> 1 votes
If a Google map is being "revealed" with Javascript then it is necessary to trigger the map resize event when it is displayed.

If you're using Google Maps for ExpressionEngine then there is GmapHelper which you can grab and call at the appropriate time to fire the resize event.

---
Tags: ajax, google-maps-for-ee
---


title: Open Payment Method In New Tab

text:
# Question
Title: Open Payment Method In New Tab
I am using PayU discovery miles payment gateway and when the user clicks 'Place your order' on my site I would like to open the discovery page in a new tab. Would this be possible?

The code that I have:

```
{exp:store:payment
    payment_method="PayU"
    form_id="checkout_form3"
    form_name="checkout_form3"
    member_id="CURRENT_USER"
    return="checkout/success/ORDER_HASH"
    <!--secure='yes'-->
}
<button id="checkout_form3_submit_discovery" class="alert" type="submit" name="submit">Place your order</button>

{/exp:store:payment}

```

At the moment, the off-page gateway opens up in the same tab as the website.

# Answer
Try adding a target attribute to the form:

```
{exp:store:payment
   html:target="_blank"
   ...

```

That should do it.
> 1 votes

---
Tags: expresso-store, ee2, payment-gateway, checkout
---


# Question
Title: Using EE Proform tag inside Javascript - Not working
I've got protect\_javascript set to no, here's what I'm trying to do...I'm trying to insert a proform form (blog subscribe) after the 2nd paragraph in every blog post. I've got this:

```
<script>
 $( ".blogbody p:nth-child(3)" ).after( "{exp:proform:simple form='blog_subscribe' thank_you_url='/page/thank-you-for-signing-up'}" );
 </script>

```

However, it renders immediately in the footer (where the script is) and breaks the javascript. Anyone have a clue how to fix this?

# Answer
> 1 votes
This won't work because you're rendering an EE form with the DOM - EE needs to parse those {exp:..} tags in order to generate an HTML form that will work. You'd be better off generating the form in the EE template and hiding/showing it using javascript/css.

---
Tags: javascript
---


# Question
Title: Can an e-mail notification be sent when a member updates their profile?
Is there a way to have an e-mail notification sent to one or more addresses when a Member updates their information?

# Answer
> 1 votes
Yes it is.

You will need to use the member\_update\_start() hook.

Use it to fire a basic PHP mail()

# Answer
> 1 votes
You could easily do this with postmaster

---
Tags: members, email, notification, member-management
---


# Question
Title: Exp-resso Store: how to display items with no price? How to set price on the fly?
I have a channel for my products (`items`) and I want some of the entries there to **not** specify a price (meaning, leave the `price` field blank). When I loop through my items entries, it doesn't display those items where the `price` field is left blank:

```
{exp:channel:entries
    channel="items"
}
    {exp:store:product
        entry_id="{entry_id}"
    }
        {if '{price}' == ''}
            nothing
        {if:else}
            {price}
        {/if}

        <h1>{price}: {length}x{width}x{height}</h1>
    {/exp:store:product}

{/exp:channel:entries}

```

The reason I want to leave the `price` field blank is because I want to set the price of some items in the template. A lot of the items for sale won't have a set selling price. Rather, there will be a set profit margin added on top of the item's cost based on the item's category (and these profit margins per category will change from time to time).

So, the questions:

1. How do I display items that have a NULL price? If this is not possible, I guess I can just set it to any number less than 0 and consider that the case when I should set the selling price on the fly.
2. How do I set the price of an item on the fly?

# Answer
Yes, Store does support dynamic prices. However, you have to enable it when you create the field in the field group. You will see an option called "Enable Dynamic Prices", you will need to set this to Yes. Please note this is a security risk and could allow malicious users to specify any price they want to products.

After this setting you don't have to add a price to products when saving entries.

Now, when you add the product tag you can use this form field:

```
<input type="text" name="price" value="9.99">

```

The price of the product in the cart will be `9.99`.

Brad
> 2 votes

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


# Question
Title: MySQL query to output variables grouped by entry status
I have schools, teachers and students channels with each of the students and teachers channels with a field that contains the `entry_id` of the school they're related to (not actually using native EE relationships fields in this case).

I need to output a list of all the schools and their total number of teachers and students but also show which of those entries are open and pending (entries only become open after being activated via link in an invite email).

What I have so far outputs the school and the count of all students but I need to know how to change it so that I can output different variables for all students and pending ones.

```
{exp:channel:entries
    channel="schools"
    disable="categories|member_data|pagination|trackbacks"
    dynamic="no"
    orderby="title"
    sort="asc"
}

{exp:query sql="SELECT COUNT(cd.entry_id) as student_count
    FROM exp_channel_titles ct
    JOIN exp_channel_data cd ON cd.entry_id = ct.entry_id
    WHERE cd.channel_id=5
    AND cd.field_id_45={entry_id}
}

{if count==1}<p><strong>Total schools:</strong> {total_results}</p>
<ul>{/if}

    <li>{title} – {student_count}student{if student_count!=1}s{/if}</li>

{if count==total_results}</ul>{/if}

{/exp:query}

{/exp:channel:entries}

```

I'd also like to know the most optimal way to query the records from both students and teachers channels. I could double up on queries and just change the `channel_id` and `field_id_XX` but would like to know if there's a cleaner method.

# Answer
> 0 votes
Found an answer to my question:

```
{exp:query sql="SELECT
    SUM(ct.status = 'open' OR ct.status = 'pending') student_count,
    SUM(ct.status = 'pending') student_pending
    FROM exp_channel_titles ct
    JOIN exp_channel_data cd ON cd.entry_id = ct.entry_id
    WHERE cd.channel_id=5
    AND cd.field_id_45={entry_id}"
}

```

At the moment I've still got two separate queries counting from the two different channels so I'd still like to know if there's a way of combining the two.

---
Tags: mysql, query
---


# Question
Title: Freeform limit form access to certain member groups in CMS
Is there a setting somewhere to hide certain forms from certain members when they are logged into the CMS. The reason being is that, as with managing other sections/channels in Expression Engine, we need to limit member to edit only a one of the forms we have added eg. All forms are Marketing Request, Sales Request, General Enquiry but we what to have the Marketing Member Group to only have access to the Marketing Request form.

Thanks, C

# Answer
> 1 votes
Sorry, if you're looking for that functionality in the CP (blocking access to specific forms per member group), that is currently not available. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

On the front-end, however, you can do this using regular conditionals. For example, if your group\_id for "Marketing Member Group" is 7, then you could do something like this:

```
{if group_id == 7}
   /// Marketing Request form
{/if}

```

---
Tags: solspace-freeform
---


# Question
Title: Solspace Freeform and sending generated email to recipient from the form
Is there any way to send generated email (based on a template) to an address obtained from the form?

I'm looking for something similar to the tell-a-friend functionality but instead sending an email with a link I want to send generated HTML message based on a content from the landing page to email address from the form.

Also how can I get an email address sent from to be an email from the form (as your email in an example from a link above)?

Thanks for any tips.

# Answer
Let's say you have a field in your form to hold an email address, let's call it `email`. Make sure you have a Freeform field in the CP called `email` and linked to your form. You need this field to "catch"/save that information to the database, to then be used in your notification email.

Then, in your notification template, you can use `{email}` where you need it: the "From Email" setting, in your notification email body, etc.

As an extra note, notification templates also support EE tags, variables and conditionals, so you can control the content of your email body based on the submitted form content,
eg. `{if favorite_food == "apples"} Content about apples {/if}`
> 1 votes

---
Tags: solspace-freeform, tell-a-friend
---


# Question
Title: htaccess redirect to url without www with site in a sub-directory
I have a site running in a sub-directory and I'm using this htaccess:

```
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) helpdeskzorgaanbieders/$1$2 [R=301,NE,L]

        # Removes redirect to url without www
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ helpdeskzorgaanbieders/index.php/$1 [L]

</IfModule>

```

It's conform the Ellilad user guide, i just put some extra code for redirect url with www to a url without www:

```
    # Removes redirect to url without www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

```

I don't know why but if I test and add www. to the URL it send me back to the root directory (where an other EE site is also running).

Something must be wrong in my code but I can't find it.

# Answer
Problem is solve, I did change the code this way:

```
 # Removes redirect to url without www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/namesubdirectory/$1 [R=301,L]

```
> 2 votes

---
Tags: htaccess
---


# Question
Title: How can you disable entry deletion when member account removed?
My client deleted an admin (not super admin) account and it deleted all their posts. Is there a plugin or setting to stop this from happening and allows entries to be reassigned to another user account?

# Answer
> 1 votes
I think there's already an option to reassign the entries created by that member to another member. It appears as a dropdown when you go through the deletion confirmation process.

---
Tags: members, control-panel, entries, delete
---


title: Setting up redirects

text:
# Question
Title: Setting up redirects
I am currently working on a big project for a client where we are importing all of their content into ExpressionEngine. I written a script to do this which is fine, however, all of the URLS are going to be different for the new pages.

I have created an extra field in the channel for these pages which contains the pages old URL, could someone suggest a way to, when the old url is hit, to find that in the channel entries and redirect (301) to the new url?

Cheers.

# Answer
> 0 votes
Since you have added a field containing the old URL you could do something like this.

1. Ensure all "old" URLs land on your 404 template
2. Set up the 404 template with an entries tag pair which uses the search parameter to find the entry. search:"oldUrlField=xxx" (need something to grab the full URL, maybe an add-on such as Mo Variables, maybe some PHP). This will find the entry you really need to show.
3. Use the redirect global variable to send the visitor to the new URL, issuing a 301 http code.

# Answer
> 0 votes
If there's some part which can just be removed to the new URL, you can do this easily using redirect on `.htaccess` or NGINX `location`s:

```
rewrite "^/blog/\d{4}/\d{2}/\d{2}(.*)$" http://domain.com/blog$1 permanent;

```

That is an example I used on NGINX to redirect old WordPress style `URL`s to new ones.

If this isn't an option and you don't have too many redirects to do, you can create a template using `exp:channel:entries` to write the redirect rules.

NGINX:

```
{exp:channel:entries channel="channel_name" limit="500"}
rewrite ^/{old_url} http://domain.com/template_group/{url_title} permanent;<br />
{/exp:channel:entries}

```

Apache:

```
{exp:channel:entries channel="articles" limit="500"}
RewriteRule ^/{old_url} {site_url}/blog/{url_title} [L,R=302]<br />
{/exp:channel:entries}

```

Access the template, copy and paste the rules on your `.htaccess` file or NGINX location.

## IMPORTANT

Remember to test using temporary redirects first!

# Answer
> 0 votes
I'm not sure it will help you 100% in this instance and I have not used this add-on but you might want to look at Detour Pro to help manage the necessary htaccess redirects directly from within your EE Control Panel.

---
Tags: ee2, channel, url, database
---


# Question
Title: DB error when trying to update Stash to 2.5.7
This is on an EE2.5.5 install. After uploading Stash 2.5.7 and running module updates I get the following DB error:

```
A Database Error Occurred

Error Number: 1062

Duplicate entry '_last_activity-1-1-435704d2c60667f0c19a4f01903c2b85cd745d51' for key 'cache_key'

ALTER TABLE `exp_stash` DROP INDEX `key_session`, DROP INDEX `key_name`, ADD UNIQUE `cache_key` (`key_name`, `bundle_id`, `site_id`, `session_id`), ADD INDEX `expire` (`expire`)

Filename: third_party/stash/upd.stash.php

Line Number: 186

```

Any ideas? The rest of the install and the site appear unaffected by this.

# Answer
> 1 votes
As per my comment above, try uninstalling stash and reinstalling.

Glad I can help.

---
Tags: stash
---


title: Using Low Search

text:
# Question
Title: Using Low Search
Hi Was wondering if anyone can help me?

I have purchased Low Search and im stuck.

Basically the ultimate goal is to have a channel called franchise with say 200 different franchises/entries, with a textarea field in each filled with different postcodes seperated by a comma in each entry.

for example one entry would be:

Title: Conwy

Postcodes: ll21, ll22, ll23, ll24, ll25

At somepoint i may need to have a postcode more indepth for sameple ll21 5bd.

These are the postcodes that, that franchise covers.

I want to have the search only search the channel "franchise" and only searches the "postcode" field.

For the results i just want to go straight to the relevant entry.

Honeslty i really appreicate any help. Because i am so stuck.

Thanks,

Wes.

Hi Low,

```
{exp:low_search:form result_page="search/results" required="keywords" search:postcodes_covered}
 <fieldset>
<label for="keywords">Enter your postcode:</label>
<input type="search" name="keywords" id="keywords" placeholder="Enter your postcode here" class="postcode-entry" />
<span class="postcode-error">{error_message}</span>
<button type="submit" class="white-button postcode-button"><span class="fa fa-search icon"></span>Search your postcode</button>
 </fieldset>
{/exp:low_search:form}

```

Then the results tag was the bog standard one on the docs.

```
{exp:low_search:results query="{segment_3}" limit="10"}
{if count ==  1}<ol>{/if}
<li><a href="{comment_url_title_auto_path}">{title}</a></li>
{if count == total_results}</ol>{/if}
{if no_results}No search results{/if}
{/exp:low_search:results}

```

Sorry for being so Vague, i am just unsure how to go about this, thanks for help.

These are the postcodes in the entry for conwy in the postcodes\_covered field:

```
LL16,LL18,LL21,LL22,LL24,LL25,LL26,LL27,LL28,LL29,LL30,LL31,LL32,LL33,LL34,LL57

```

So the idea is that if someone searched for ll26 5he it would return the conwy entry.

Cheers.

# Answer
Although it's not clear from your question exactly *how* you're stuck, there are a couple of things you can check.

* Using `search:postcodes_covered` in your opening Form tag does nothing. You can remove it.
* You're using `<input name="keywords" ... >`, which means you're using the Keywords filter, for which you need to set up at least one Collection.
* When setting up the collection, make sure your postcode field has an assigned weight of 1 or up. Setting it to 0 will exclude it from the index, thus making it not searchable.

You can also consider using the Field Search filter. So instead of using `<input name="keywords">`, you'd have to use `<input name="search:my_postcode_field">`.

As for the Results tag: remember that it extends the channel:entries tag. So if no entries show up, that might also be due to a status not being given or the entry/expired dates.

Pro Tip: enable template debugging to see what the add-on is doing. This will help debugging, too.
> 1 votes

---
Tags: low-search
---


# Question
Title: URL Segments Keep Building Up (Using Navee)
URL segments keep building up with each link I click -- Never had this issue occur before.

Navee include:

{exp:navee:nav nav\_title="main"}

The first time I click the link, it works fine:

When I click another link, it adds the previous link to the new click link:

# Answer
> 2 votes
You need to start your URLs with a forward slash so:

`work/category/web/`

becomes

`/work/category/web/`

---
Tags: url, segments, navee
---


title: Can't get CE_Lossless to work

text:
# Question
Title: Can't get CE_Lossless to work
Has anyone had a problem with CE\_Lossless where it reports that jpegtran and jpegoptim aren't installed even though they are?

The template debugger reports:

> (0.344540 / 6.28MB) *** CE Lossless debug: It doesn't look like the jpegtran is available.
>
> (0.344585 / 6.28MB) *** CE Lossless debug: It doesn't look like the jpegoptim is available.

But if I check the server I see they are both present:

> $ which jpegtran jpegoptim /usr/bin/jpegtran /usr/bin/jpegoptim

# Answer
> 0 votes
The solution was here http://devot-ee.com/add-ons/support/ce-lossless/viewthread/13794

I needed to set a config variable for the Linux path using

> $config\['ce\_lossless\_linux\_path'\] = '/usr/bin/';

---
Tags: image
---


title: Next Prev entries with low alphabet

text:
# Question
Title: Next Prev entries with low alphabet
Anyone know if it's possible to have prev/next entry linking on a single entry page using Low Alphabet (with params for ignoring 'the', etc.) - couldn't see anything on this in the docs

Many thanks!

# Answer
No, prev/next entries is currently not available in Low Alphabet.
> 0 votes

---
Tags: low-alphabet
---


title: Removing data from members account

text:
# Question
Title: Removing data from members account
Is it possible to delete data from a specific custom member field in every member account in one operation (ie not going through every member account and deleting the data one at a time)?

# Answer
Okay this should do it for you. First of all you need to find the ID number of the member field that you wish to clear. You can do this by going to

Members-\>Member Fields

In here you should see all your custom member fields and an **ID** *(first column)* for each. Note down the number of the field that you wish to clear the data from then run this query in

Tools-\>Data-\>SQL Manager-\>Database Query Form

or a SQL tool of your own choice if you prefer.

**UPDATE exp\_member\_data SET m\_field\_id\_1 = ""**

Change the **1** in the query above to the number that you retrieved of your custom member field previously.

Hopefully that should do what you need here. Definitely backup your database first before doing this though as best practice.
> 0 votes

# Answer
Could you not simply delete the custom member field? This would also delete the data from every member account.
> 2 votes

# Answer
You could definitely do this performing a query directly upon the database although you'd want to make a backup of said database first just incase anything went awry. I'm not entirely sure if there's an add-on out there to do this sort of thing, I think there is although it would be doing the same sort of thing anyway and a direct query connection to the database would be faster.

Are you okay with performing queries directly upon your database? You would need some sort of MySQL admin panel or a MySQL client in order to do this.

What version of ExpressionEngine are you running?
> 0 votes

---
Tags: members
---


# Question
Title: Unable to post in forum module running on localhost
I have the same problem as this thread: Why can't I post topics on a Forum?

Disabling the htaccess file works, but then I have index.php back in all my urls. Any idea of the cause of this and a better fix?

Edit to add, I've pin-pointed the problem to the removal of trailing slashes using this htaccess code:

```
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R=301,L]

```

Removing that chunk makes it work ok, but it'd be nice to remove the trailing slashes on the forum urls.

# Answer
> 0 votes
Could you try this code instead.

RewriteCond %{HTTP\_HOST} !^.yoursite.com$ \[NC\]

RewriteRule ^(.+)/$ http://{HTTP\_HOST}/$1 \[R=301,L\]

You can place the code above on just two lines if you like but for some reason when I line break the code here it's placing it all back on one line again!! Grrr! :-(

---
Tags: forum
---


# Question
Title: Unable to view uploaded images from IE11
When uploading images to EE v2.7.2 from IE11 the images cannot be seen after uploading is completed. All other browsers seem to work properly.

# Answer
There: "... All other browsers seem to work properly", fixed :-).

Does explorer have a firebug/devtools like console?
Try to inspect the network response, notices in there.
> 1 votes

---
Tags: file-uploads, image
---


title: Need that magic 'Stash' moment…

text:
# Question
Title: Need that magic 'Stash' moment…
I was just wondering if someone could possibly push my brain into the correct queue so that I totally get the Stash module.

I've read all the main articles on it and really like the sound of it but I'm still not quite having that magic 'Aha' moment currently.

I can see it saving me one embed tag currently on most sites I create which is obviously great however I'm absolutely positive that there's more to it than that.

I see loads of people mentioning about keeping the markup separate from the data fetching however every time I've seen this done the data is fetched at the top of a template then set as Stash variables and then lower in the template there is the markup code with the Stash variables spat out in the place where they're needed.

I'd really like to get into the DRY principle but in my head (*at the moment until someone shows me otherwise \[purpose of this post\])* ;-) that seems pretty much the same as just placing the Channel tags and variables in with the markup. What I mean to say is that there are always going to be variables of some sort mixed in with markup so I guess I'm just not quite getting how this helps much?

I'd love it if someone could just give me a slight push in the right direction. I'm sure it won't take much but as I said before I've read all the main articles (and a fair few others) on the subject and tried it out and whilst it works great I'm just not quite having that eureka moment like I did the first time I came across ExpressionEngine.

I've got a fairly large site with many different types of pages (content types) which needs to be converted across from 1.x to the latest version of ExpressionEngine and anything I can do which can make things easier for me and going forward and that can save time then that would be great.

Hope it's okay asking this kind of question on the board here like this?

Many thanks,

Mark

# Answer
> 1 votes
Let me preface by saying that I've only developed a handful of EE sites and am not by any means a "seasoned" developer. At any rate, I did use Stash earlier this year on a semi-large project - similar to what you mentioned… upgrading and optimizing code etc.

As far as counting lines of code and the reasoning you mentioned, your argument is valid and hard to disagree with. For me, the preference of using stash I think deals a lot with readability and the way you process the workflow in your mind.

The buzzword that I'm sure you've heard, but seemed to really facilitate my understanding of stash, as well as the general concept, is "Injection".

Instead of including / pulling a header and footer into a "main template", you're creating a parent (skeleton?) template with various placeholders, and then your child template "injects" your code back into the parent template.

I know you mentioned you read the main articles, but I just wanted to add a couple in case you didn't see them -

EE made part of this concept native shortly after the project I worked on.

https://ellislab.com/blog/entry/template-layouts-in-expressionengine-2.8

Here's another one that I think is referenced on the Stash github page-

http://johndwells.com/blog/homegrown-plugin-to-create-template-partials-for-expressionengine

I also wanted to mention that the Stash *parse* option is a **huge** help as well. EE is constantly getting better, but I've run into a number of situations where it is outputting the wrong data, or not outputting data at all because of the native parse order. Stash is invaluable in working around these issues.

# Answer
> 0 votes
It sounds to me like you already have a grasp of the basics but want to delve more into the code reusability and maybe the caching aspects of Stash? I've been meaning to finish off my advanced tutorial that touches on these parts (I guess you've probably already seen parts 1 and 2? The overview section there might help too).

On large sites, Stash helps you to reuse the same markup patterns for different content and/or templates. For example if you have a complicated chunk of markup that makes up a listing item, by saving data into named variables you can reuse the exact same markup for lots of different kinds of listings. You can already achieve this natively using embeds and passing each variable as an embed variable, but this is inefficient, messy and ugly, and also doesn't allow for nested looping data, only simple strings. With Stash it just feels cleaner in my head.

As for the advantages of separating data-fetching and markup assembly instead of sprinkling channel:entries tags everywhere, For me the main advantage of this is simplified markup - all you're doing is assembling your previously saved (and cached!) variables (and nested loops for grid/relationship/category data). This approach also makes multi-layered caching possible (and also makes adding that later relatively simple).

When you mentioned that you'll be using Structure, this did set a few alarm bells ringing: if you're taking a page-based approach to assembling the site (by which I mean relying primarily on single blob of generic content for each 'page') then the advantages of Stash probably won't be so obvious, but it really comes into its own when your content is highly atomic.

---
Tags: stash
---


# Question
Title: PHP errors relating to matrix on channel form submission
EE 2.9.0 Matrix 2.6

I have a template with a channel form in it, nothing else (I've stripped it down for testing).

```
{exp:channel:form
    channel="test_channel_form"
    return="test-return"
    }
    <input type="text" name="title" id="title" value="{title}" onkeyup="liveUrlTitle();">
    <input type="submit" value="Submit">
{/exp:channel:form}

```

This is using a test channel field group with no custom fields. It returns to the correct page on submission and an entry is created.

Changing the channel to use another field group I run into problems. The field group has 5 fields, 2 textarea fields and 3 Matrix fields. I only need the text area fields in this channel form.

My template code is

```
{exp:channel:form
    channel="test_channel_form"
    return="test-return"
    }
    <input type="text" name="title" id="title" value="{title}" onkeyup="liveUrlTitle();">
    {field:news_summary}
    {field:news_body}
    <input type="submit" value="Submit">
{/exp:channel:form}

```

An entry is created OK but it doesn't return to the specified page on submission it just stays on the same page and I get the following errors.

A PHP Error was encountered Severity: Warning Message: array\_keys() expects parameter 1 to be array, null given Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: array\_keys() expects parameter 1 to be array, null given Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: array\_keys() expects parameter 1 to be array, null given Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: matrix/ft.matrix.php Line Number: 2259

A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /Users/timprint/Dropbox/Sites/imagineering/imageesys47836/codeigniter/system/core/Exceptions.php:170) Filename: libraries/Functions.php Line Number: 446

# Answer
> -1 votes
I'm adding my name to this list of having the same problem, although for me I DO have a matrix field in my public facing channel form.

EE 2.9.0 / Matrix 2.6

---
Tags: matrix, safecracker, pixelandtonic
---


# Question
Title: Redirects from Joomla to ExpressionEngine
I'm trying to create some 301 redirects from an old Joomla site to a new EE site. As you may know, Joomla URLs look something like this;

```
index.php?option=com_content&view=article&id=59&Itemid=125

```

This is obviously hitting EE's index.php. I have tried using Detour Pro but all that happens is when you hit the URL above, it just removes the index.php so i'm wondering if there is a way around this?

Thanks.

# Answer
I actually figured this out by adding the following to my .htaccess;

```
RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=44&Itemid=128$
RewriteRule ^(.*) /map? [L,R=301]

```
> 0 votes

---
Tags: redirects, redirection, detour-pro
---


# Question
Title: Conditional on Assets Field Tag that contains a quote in EE v2.9
Running up against a problem in the use of an Assets field tag in a conditional where there's single quotes entered into the field (in this case the Caption field).

Caption: Otherwise know as 'Old man's beard'.

Template code:

```
{if "{mc_media_image:caption}" != ""}

    <figcaption>
        {mc_media_image:caption}
    </figcaption>

{/if}

```

Error message returned:

```
Error

You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.

Parser State: Unexpected ‘Old’ (VARIABLE); expected RD in Template “_includes/incopy_images” on line 46.

```

The question is how can I test for the existing of content on a caption field if there's a quote in the field? EE v2.8.1 didn't have the same problem as the conditionals weren't as strict as they are now in EE v2.9

Would appreciate some help on this one thanks.

# Answer
Have you tried it without bracing and quoting? (which has always been recommended against). E.g.:

```
{if mc_media_image:caption != ""}

```
> 1 votes

---
Tags: assets, conditionals, 2.9
---


title: Remove trailing slash from URLs

text:
# Question
Title: Remove trailing slash from URLs
I would like to remove all urls with trailing slashes using the .htaccess file. I have tried a couple peices of code suggested on other questions but does not work.

Any suggestions on how to do this by modifying the code below?

```
RewriteEngine On

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png|pdf)$ [NC]
RewriteRule ^(.*)$ /index.php?$1 [L]

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

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

```

# Answer
> 6 votes
This is what I usually have in my .htaccess for this (goes right after RewriteBase /):

```
# Remove the trailing slash to paths without an extension
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

```

---
Tags: url, htaccess
---


title: Weird Javascript Issue

text:
# Question
Title: Weird Javascript Issue
Not strictly EE but I'm flummoxed all the same.

I'm trying to clean up zyteq.com.au and on this URL (http://zyteq.propeller-dev2.com/products/software) I've taken out jquery Match Height and resolved the product container sizing with CSS.

However this javascript remains and is causing all three product links in the row to direct to the URL of the first:-

```
    $("#products_box").children().hover(

    function(){

        $(this).addClass("hover");

    },

    function(){

        $(this).removeClass("hover");

    }

).click(function(e){

    url = $(this).find("a").first().attr("href");

    if (typeof(url) != 'undefined') {

        window.location = url;

        e.preventDefault();

    }

});

```

Any ideas what that does and why anyone would use it? Is it connected to jquery match height or CartThrob in any way?

Just to be sure, the last developers included it in no less than three js files… If I comment it out the link issue is solved but without understanding what it does I'm reluctant to remove it altogether.

# Answer
> 2 votes
It's pretty munted. Presumably trying to make it IE6 compatible prevented them from just using :hover on divs and using an anchor as each .item HTML5 style.

The javascipt is attempting to do some pretty run of mill stuff:

a) it's adding a .hover class to the #products\_box children on hover, which are the .row-span divs, not the .item elements. (easily replaced with just css)

b) if you click on one, and it's an .item, find the first link within the .item and point the user to the url in the anchor. (it's broken as it's just finding the first anchor in each .row-span, not the anchor in the .item the user is clicking on)

If it was me, I'd remove the js and just use CSS for the hover styles, and rewrite the html to make the .item an anchor, wrapping all the internal items.

Done!

---
Tags: cartthrob, jquery
---