title: Dynamic Parameter to stay selected

text:
# Question
Title: Dynamic Parameter to stay selected
I'm using Dynamic Parameters to filter through some channels https://ellislab.com/expressionengine/user-guide/add-ons/channel/dynamic\_parameters.html

Is there a way to get the chosen select value to stay selected rather than it default back to the first option (All Tours in my case) after posting.

```
<form method="post" action="{path='template/{segment_2}'}">
          <input type="hidden" name="csrf_token" value="{csrf_token}" />
              <select name="channel">
                  <option value="llanelly-house-tour|restoration-tour|ghostly-tour">All Tours</option>
                  <option value="llanelly-house-tour">Llanelly House Tour</option>
                  <option value="restoration-tour">Restoration Tour</option>
                  <option value="ghostly-tour">Ghostly Tour</option>
              </select>
    </div>
    <div class="small-2 columns">
    <input role="button" aria-label="Submit" name="submit" type="submit" class="button postfix submit" value="Go" />
    </form>

```

# Answer
Couple of options here.

You could use Mo' Variables to get to the `{post:channel}` variable and use that in a conditional to add the `selected` attribute to your options.

You could also use Dynamo, which offers even more functionality for dynamic parameters.

If you want to go all out, choosing a proper search/filtering add-on would be the way to go. Options are Solspace Super Search or Low Search by yours truly.
> 1 votes

# Answer
Thanks Low! Mo Variables worked perfectly. I used the following to select the post channel:

```
 <form method="post" action="{path='tour-calendar/{segment_2}'}">
          <input type="hidden" name="csrf_token" value="{csrf_token}" />
              <select name="channel">
                  <option {if post:channel == "a|b|c"} selected="selected"{/if} name="channel" value="a|b|c">All Tours</option>
                  <option {if post:channel == "a"} selected="selected"{/if} name="channel" value="a">Llanelly House Tour</option>
                  <option {if post:channel == "b"} selected="selected"{/if} name="channel" value="b">Restoration Tour</option>
                  <option {if post:channel == "c"} selected="selected"{/if} name="channel" value="c">Ghostly Tour</option>
              </select>
    </div>
    <div class="small-2 columns">
    <input role="button" aria-label="Submit" name="submit" type="submit" class="button postfix submit" value="Go" />
    </form>

```
> 1 votes

---
Tags: channel-entries, filter, dynamic, drop-down
---


title: How do I display entries by Category

text:
# Question
Title: How do I display entries by Category
The title may be deceiving and I may be missing something exceptionally obvious but I am trying to display a series of entries by category that link to external websites

The basic outcome should be like this:

### Category 1

### Category 2

I tried the basic Category Archive approach:

```
{exp:channel:category_archive channel="gardens" style="linear"}
    {categories}
        <h3>{category_name}</h3>
    {/categories}
        {entry_titles}
            <a href="{external_url}">{title}</a><br />
        {/entry_titles}
{/exp:channel:category_archive}

```

This gets the correct structure but it is looking for an internal reference and simply appends the external URL to the site url.

After some searching on StackExchange I found this option:

```
  {exp:channel:category_archive channel="botanical_gardens" style="linear"}
    {categories}
        <h3>{category_name}</h3>
        {exp:channel:entries channel="botanical_gardens"}
          <a href="{garden_url}">{title}</a><br />
        {/exp:channel:entries}
    {/categories}
  {/exp:channel:category_archive}

```

However it displays all the entries under each category. I need something that merges the functionality of these two options and allows the URL to be to an external site.

# Answer
The reason the code you grabbed off SE is returning all entries under each category is that you haven't limited the inner loop by the category that the outer loop is currently in. You need to pass the category\_id to the inner loop:

```
    {exp:channel:category_archive channel="botanical_gardens" style="linear"}
    {categories}
        <h3>{category_name}</h3>
        {exp:channel:entries channel="botanical_gardens" category="{category_id}" disable="member_data|pagination"}
          <a href="{garden_url}">{title}</a><br />
        {/exp:channel:entries}
    {/categories}
  {/exp:channel:category_archive}

```

The reason this approach is typically used is that the category archive tag doesn't return custom fields - which is what your URLs are stored in. This is why the field name is showing in the rendered HTML.

You'll also want to make sure you disable as much as you can on the inner loop as this nested loop approach can spawn a lot of queries. I've used it a number of times but if you are expecting 100's of categories with 1000's of entries I would look to a different organizational approach like relationships.
> 3 votes

# Answer
Your first attempt looks correct.

What format are the urls in the field you are using? If they don't contain http:// then it's likely to be assumed they are relative to the existing site.

An extension such as VZ URL extension could help you out here by ensuring that the url stored include the protocol.
> 1 votes

---
Tags: categories
---


title: Add Dropdown in Channel Form

text:
# Question
Title: Add Dropdown in Channel Form
I've created Select Dropdown fieldtype and populated it manually. How do I display the select in a channel form?

The EE documentation states: This creates a standard HTML drop-down list.

However when I add the {fieldtype} to my channel form nothing appears.

How do I add the Dropdown to my channel form?

# Answer
> 1 votes
As per the documentation for displaying select lists in Channel Forms:

> If you’re creating a select list, you’ll need to pull in the options, using `{options:my_field_name}` but otherwise things look pretty similar:

```
<select name="my_field_name" id="my_field_name">
  {options:my_field_name}
    <option value="{option_value}"{selected}>{option_name}</option>
  {/options:my_field_name}
</select>

```

---
Tags: safecracker, fieldtype
---


# Question
Title: Adding playa entry into field (e.g. related gallery)
Anyone know the best way to add a playa related entry (in this case a gallery) directly into a post area (wygwam or richtext field for example)? I need to have flexibility here, so could be 1 or 20 galleries per entry.

In WP you'd be able to drop in the \[gallery\] tag or similar (can't remember exactly, it's been a while). I was thinking there'd be some kind of integration with playa+wygwam but I can't see anything in the wygwam field config/advanced settings...

Any ideas?

# Answer
> 0 votes
I have not tired it, but take a look at the Shortcode plugin here: https://devot-ee.com/add-ons/shortcode

It says it work like the WordPress shortcode API which does allow you to use shortcodes to create functionality inside of text-editors.

---
Tags: playa, wygwam, richtext
---


# Question
Title: Combine multiple categories into one select option
I am creating a website for an apartment complex where the user can find apartments based on a floorplan. I have Low Search installed and am attempting to create a filtered search form using categories assigned to each apartment.

**Question:** is there a way to combine multiple categories into one option in a select dropdown? For example, I have six categories (floor 1, floor 2, floor 3, floor 4, floor 5, floor 6).

I want two select options where each option returns results for three of the six categories. If you choose the first option, it will return results for entries categorized with floor 1, floor 2 or floor 3. If you choose the second option you get entries categorized with floor 4, floor 5 or floor 6.

I've tried the following, within a Low Search form tag:

```
<label>What floor do you like?</label>

<select name="category[]">
  <option value="">--</option>
    {exp:channel:categories
      category_group="1"
      show="1|2|3"
      style="linear"
    }
      <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
          I'm afraid of heights, lower floors are preferred
      </option>
    {/exp:channel:categories}
    {exp:channel:categories
      category_group="1"
      show="4|5|6"
      style="linear"
    }
      <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
          The higher the better!
      </option>
    {/exp:channel:categories}
</select>

```

But what displays in the select dropdown is:

```
--
I'm afraid of heights, lower floors are preferred
I'm afraid of heights, lower floors are preferred
I'm afraid of heights, lower floors are preferred
The higher the better!
The higher the better!
The higher the better!

```

I am on EE 2.8.1 with Low Search 3.5.2. Any insight provided would be most appreciated!

# Answer
The `channel:categories` tag will loop through the categories given, hence the 3 rows per tag. If you only need 2 `<option>`s, but they need to target 3 categories each, then hard-coding the category IDs would be the way to go. Also, since you're allowing the user to select *one* option (rather than multiple), you don't need the square brackets in the `name` attribute.

For your copy/paste convenience:

```
<select name="category">
    <option value="">--</option>
    <option value="1|2|3"{if low_search_category == '1|2|3'} selected{/if}>
        I'm afraid of heights, lower floors are preferred
    </option>
    <option value="4|5|6"{if low_search_category == '4|5|6'} selected{/if}>
        The higher the better!
    </option>
</select>

```
> 0 votes

---
Tags: low-search
---


# Question
Title: Filter Channel Entry content parts with status parameter?
I need a way to show channel:entry content filtered by statuses open vs custom on a single entry page.

Like so: \- Show basic fields and their content if status is “open” \- Show ALL fields when status is “custom”.

I tried to use conditional inside of channel:entry loop but that didnt get me anywhere but errors. So seems that using if status=“custom” is not available for to use (bummer)...

How I can hide/show content on entry page depending on entry status?

Is the only way to make 2 channel:entry looping pairs with other having status set to “open” and putting fields I want to show inside, and then double it and changing status to “custom” and putting all fields inside of that looping pair?

Am I missing something that can be used to filter content fields with status parameter using only one channel:entry looping pair?

Thanks in advance.

# Answer
You should be able to just use the `{exp:channel:entries}` tag pair, define both statuses in the `status=""` parameter, and then use a conditional to show status-specific content.

```
{exp:channel:entries status="open|custom" ... }

    Shared fields

    {if status == 'open'}
        Fields for status Open
    {/if}

    {if status == 'custom'}
        Fields for status Custom
    {/if}

{/exp:channel:entries}

```
> 0 votes

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


title: Custom Category Fields

text:
# Question
Title: Custom Category Fields
Hmm, taking my first steps with categories and not having much joy.

I've got {meta-title} and {meta-description} category fields set up for each category. Having trouble pulling back the correct data for the category, just pulls back the first categories custom category fields.

```
{exp:channel:entries channel="{product_channel}" category_group="1"}
    {categories}
        <title>{meta-title}</title>
        <meta name="description" content="{meta-description}" />
    {/categories}
{/exp:channel:entries}

```

# Answer
> 0 votes
Ended up using Lows Seg2Cat to get the category ID. Thanks Low!

```
{exp:channel:entries channel="{product_channel}" category_group="1" category="{last_segment_category_id}"}
        {categories}
            <title>{meta-title}</title>
            <meta name="description" content="{meta-description}" />
        {/categories}
{/exp:channel:entries}

```

---
Tags: categories
---


title: Increase Screen Name Length

text:
# Question
Title: Increase Screen Name Length
The screen\_name member field is limited to 50 characters in the CP...is there a way to increase this? We have some company names for Screen Names that are longer than 50 characters.

Thanks!

# Answer
> 1 votes
Since checking for lenght is not part of screen name validation in EE, I guess you only need to change the property of database column in exp\_members table to allow, e.g. 100 characters

---
Tags: control-panel, screen-name
---


# Question
Title: Disabling pagination with paginate tag pair failing?
I just disabled pagination on a channel "main index" page while my paginate codes were still in my template and result was that all pagination tags and html content was coming out as-is breaking the page totally. Should those be ignored totally when disabling them?

I mean, now I have to delete pagination codes or at least comment them out to "save" the template settings if I ever need pagination again.

EE2.9.2

# Answer
> 0 votes
All tags that the system does not know (e.g. references to variables or fields that don't exist, or just any text wrapped between {}) is returned to the template unparsed. If you disable pagination, the system stops knowing anything about paginate tags, so they stay unparsed.

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


title: Freemember Reset Password

text:
# Question
Title: Freemember Reset Password
Having difficulty getting the reset password functionality to work.

I've got the forgot password template set up which then sends you to the reset password template on submission.

On the reset password page I just get an instant message of "Sorry, the link you clicked on does not appear to be valid, or has expired"

I receive the reset password email but clicking on the link gives me the following message "The password reset token does not appear to be valid. Please check the link you followed."

Not sure what I'm missing.

# Answer
Apologies I didn't have the reset parameter in the form

```
{exp:freemember:forgot_password return="account/forgot_sent" reset="account/reset"}
    <!-- forgot password template -->
{/exp:freemember:forgot_password}

```
> 2 votes

---
Tags: freemember
---


title: VAT on discounts

text:
# Question
Title: VAT on discounts
I have had a long discussion with Chris at CT regarding VAT calculations on discounted orders.

In my example I have a product = £15 @ 20% VAT

£12.5 * 1.2 = £15 (£2.50 VAT included).

Now I want to give a £4 discount. As VAT is calculated on the discounted sale price my thinking is that the taxable total would be £15 - £4 = £11. VAT would therefore be £1.83.

Chris believes this is wrong and it can only be one of these two scenarios:

1. (12.5 - 4) * 1.2 That makes a total of 10.2. VAT of 1.70
2. (12.5 * 1.2) - 4 That makes a total of 11. VAT of 2.5

I think neither of those scenarios give the correct VAT amount although the equations do balance out.

In CT it is not clear whether the value you put in as the discount amount includes or excludes VAT and I think the percentage amount only appears to apply to the tax inc price but not the taxed amount itself? Having done a bit of research I think the calculations should be more along the lines of:

1) If the discount is a percentage, the percentage is applied to each component. So a 50% discount would be: £7.50 of which £1.25 is VAT = £12.50 (base) + £2.50 (vat) - £6.25 (base) - £1.25 (vat).

2) If the discount is a flat amount, it needs to have the VAT component reverse-calculated A £4 discount would be: £11 of which £1.83 is VAT = £12.50 (base) + £2.50 (vat) - (£3.33 (base) + £0.67 (vat)).

Where this gets more complicated are sales which include vattable and non vattable products (such as books) and whether the discount applies to an individual line item or the cart total as a whole.

Has anyone else had issues with VAT on discounts in CT and worked out a solution.. or is my logic completely wrong!!

# Answer
I think this may depend on whether you are selling to businesses or individuals (i.e. whether any VAT can be reclaimed).

If you are selling to individuals then you should be showing prices inclusive of VAT, in which case it would make sense that the discount is applied to the gross price.

However, if you are selling to businesses then it might be preferable to apply the discount to the net price and then apply the VAT to the new value.

Ultimately, I think it's down to preference and who you are selling to but both methods should be possible within CartThrob.

I did a site a while back for a client that sold both VATtable and non-VATtable goods. It was quite complicated and needed a custom plugin to deal with it. Unfortunately it this didn't work correctly. But I now see that in the latest version of CT there seems to be a way to apply tax by product rather than on the final cart value. I have yet to test this out though.
> 0 votes

# Answer
Gov.uk can get convoluted with their explanations in places, but this 8 point reference is pretty succinct; point 8 of particular note:

**Discounts:** Charged on the discounted price (not the full price)

VAT on discounts and free gifts

So in the first instance, and with regard to the example you first presented:

**ITEM PRICE** £12.50 (+£2.50 VAT) = £15.00 **DISCOUNT** £4.00 **GRAND TOTAL** £8.50 (+£1.70 VAT) = £10.20

So Chris is correct with respect to scenario 1.

In the case where non-vat items are included, you simply make subtotal A of your non-vat items, and sub-total B of your vat chargeable items; VAT is then only calculated on the sub-total B.

((A + B) - Discount) + (B * 0.2)

The discount is applied to your subtotal, before the VAT calculationWhere 0.2 is the 20% prevailing VAT rate.

**Mixed VAT/non-VAT Items in basket**

Seems somewhat open to interpretation, with the guidance on HMRC/GOV.uk not particularly clear - but again, based on online advice/consensus, it seems that it's considered fair game to apply the discount to whichever category of item you desire (and will likely differ depending on whether the bulk of your customers are VAT registered or not).

Discounts on mixed VAT sales (see comments)
**N.B. - Delivery charges**

I know your original post didn't specifically mention this - however for completeness of answer, it is considered good practice (by some) to apportion your delivery charge as vat/non-vat, dependent on the balance of vat/non-vat goods in your basket. An article here discusses this in some depth, taking basket contents down to percentages(!):

VAT on delivery of mixed rate goods

It seems that the official guidance from HMRC is subject somewhat to interpretation - and certainly my take is generally to err on the side of caution and VAT delivery whenever any VAT-chargeable goods are present.

So in short (or not!) your logic is not illogical - but this hopefully helps to clarify Chris CT's position on the VAT, and perhaps shed light on some of the other considerations too.
> 0 votes

---
Tags: cartthrob
---


# Question
Title: Seeking clarity regarding Control Panel auto-logouts
The internal rules regarding how long users can stay logged into the CP have undergone numerous changes in the last few version of EE (mainly 2.7.x onward I think). Various config overrides were introduced and then removed again, and the Docs make reference to some changes that are not listed in the change log. So I'm getting a bit lost in what is current and what is not. Specifically:

We used to have cp\_session\_ttl and user\_session\_ttl available. Now the documentation mentions that they have been replaced in v2.8, apparently with expire\_session\_on\_browser\_close (see: documentation). But the change log for 2.8 makes no mention of expire\_session\_on\_browser\_close, in fact as far as I can see it doesn't appear anywhere on the change log page. And this expire\_session\_on\_browser\_close config setting does not seem to do *quite* the same job as the two variables in any case.

And there is also the matter that apparently there was a setting hardcoded into the system to log people out after being idle for a certain amount of time, which was unaffected by either of the two (now deprecated?) config variables.

So my question is: as of the current version (2.9.2) what is the method to control how long a user can stay logged into the CP before being booted out? Is it even possible?

(I'm particularly interested because I keep most of my config variables in a separate file (as per Focus Labs masterConfig system) so the system upgrades of EE don't necessarily remove/rewrite deprecated variables as they might otherwise do if all my config settings were inside the system folder).

# Answer
I wrote an answer to a related question a couple of days back on here: CP Session Timeout - no Solution?

That probably provides the info you need, but in short I referenced, as you have, that the previously usable session time variable `$config['cp_session_ttl']` looks to have been deprecated, which allowed for custom login session lengths.

Solution suggested was setting `$config['cp_session_type'] = 'c';` in your config.php, which will trigger an option on next login to tick 'Auto login on future visits?' - this should then provide you with a 2 week persistent login, that remains logged in even when the browser is closed.

Hope that helps!
> 1 votes

---
Tags: control-panel, logout
---


# Question
Title: Solspace USER redirect on Allow New Member Registrations? NO
If I disable Allow New Member Registrations, and a user goes to the Registration page, the error page is not displayed, but instead is embedded within the registration page, occupying the location where the registration form once was displayed.

Seems the error re-routing isn't working when Allow New Member Registrations is disabled.

Error re-routing does work for all other functions with USER

How can I get the error page to display correctly when registrations are disabled?

# Answer
> 0 votes
I'll go on a guess that you are using the Demo Templates that are provided with User. In this case, `{exp:user:register}` uses an `error_page=""` parameter to display, **on form submission**, an error page based on a template set in the parameter. In the Demo Templates, it would be `user_inc/error_template` (assuming you used `user_` as your Demo Templates prefix). This template contains embeds for a header, sidebar, footer, etc. This gives you a well-formatted error page when submitting the registration form with errors.

When you visit the registration form as-is (i.e. no form submission yet), the `error_page=""` is already triggered when "*Allow New Member Registrations*" is disabled, and the error page template content is pulled in and placed where your registration form would usually be. That means the error page's header, sidebar, footer embeds are also being added to the template, breaking the layout.

We'll make a note of this behaviour and see how we can improve this in the future, but you can get around that issue by adding conditionals in `user_inc/error_template` to not display header, sidebar, footer code when the URL contains `register` in it. Eg.

```
{if segment_2 != "register"}
  // This will only display when on an error page
  // i.e. on a page following a form submission
  // eg. {embed="user_inc/index" page_title="{title}"}
{/if}

```

That way, if you view the registration form, header, sidebar, footer, etc code will not be pulled in form the error page template, but when you submit the form with errors, you'll have a formatted error page, with header, sidebar, footer, etc.

---
Tags: solspace-user
---


# Question
Title: Disable automatic link creation from Matrix text field
I have Matrix field that has a `file cell` and `text cell` with the formatting set to `none`. If there is a url in the text cell when I access it a template it automatically creates a link. I can't seem to figure out how to disable this.

I'm currently on EE 2.8.1

Any help or pointing me in the right direction would be greatly appreciated.

# Answer
This is set on per-channel basis, not per-field.

Go to Admin -\> Channel Administration -\> Channels, click "Edit Preferences" next to your channel and set "Automatically turn URLs and email addresses into links?" to "No".
> 2 votes

---
Tags: matrix, links, text-formatting, formatting
---


# Question
Title: Matrix will not work with URL segments to set a row id
I'm trying to do something incredibly simple yet it just won't work and I'm getting frustrated. I have a list of staff members in a Matrix field. Upon selecting a staff member the user is taken to a new template with a detailed bio of that member. I'm using URL segments to pass the row\_id of the selected staff member to the bio template but when clicked nothing is displayed. If I manually enter the row\_id it works fine which leads me to believe that Matrix does not work with the URL segment variables? Here is the code I'm using:

**Page with list of staff members:**

```
{exp:channel:entries channel="staff"}
    {staff_members}
     <a href="{path='templates/bio/{row_id}'}">
    {/staff_members}
{/exp:channel:entries}

```

**Detailed Staff Template**

```
{exp:channel:entries channel="staff"}
    {staff_members row_id="{segment_3}"}
        {staff_bio}
    {/staff_members}
{/exp:channel:entries}

```

Is this not possible with Matrix or am I missing something really obvious?

# Answer
It is most likely that {exp:channel:entries} tag tries to treat your row\_id in URL as entry\_id and hence returning no results.

The solution would be to use dynamic="no" parameter and specify what URL segment contains entry url\_title/entry\_id

```
{exp:channel:entries dynamic="no" url_title="{segment_2}"}
{staff_members row_id="{segment_3}"}

```
> 0 votes

---
Tags: matrix, add-on
---


# Question
Title: EE member management with multiple groups
What are the recommended modules for managing members in channel entries that can have different member groups and member fields?

* Zoo Visitor seems to only have one group available - no use.
* Freemember seems to hook into the built in member fields, I would prefer to use channel entries.
* User from Solspace seems to be my only option?

# Answer
There is also Profile:Edit module, which is similar to Zoo Visitor, but I personally prefer it more.
> 0 votes

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


# Question
Title: New posting notification for certain member group
We have a developed a new academic forum on our site and would like to generate an email to the academic members alerting them that a new posting has been made. I realise that Administrators and Moderators can receive these notifications but there's no apparent way to identify a particular member group other than thses. I have so far tries Postmaster and MX Notify but sadly neither of these will enable me to monitor forum entries, only channel entries. I was wondering if anyone has found a way around this issue?

Regards

Richard

# Answer
> 0 votes
Check out this add-on I've developed a real while ago: Forum Notifier

If it does not do the job you need, then you probably need something more or less custom built.

---
Tags: members, module, forum
---


# Question
Title: Membrr: accept donations on top of subscription cost
I'm integration Membrr for non-profit organisation.

They want to let people purchase membership and make donation at same time (ex. the user can only purchase membership for $100, or membership ($100) plus donation ($50 or other amount)

Basically this is "pay as much as you want" model, but with minumum set and recurrent billing.

Is there a way in Membrr to add amount to subscription cost?

I know I could use EE Donations module separately, but perhaps there is way to let users pay all they want in one step?

# Answer
For anyone interested, I ended up with creating subscription plans that also include donation. There seems to be no other way around with Membrr.
> 0 votes

# Answer
I believe with Membrr you have to pre-setup your "plans" in Open Gateway and so the recurring cost is "set". As you noted you can run Membrr and Donations both, but those two things have to run separately. The only way I could think you might be able to do it would be set it up so after the form is submitted you use AJAX calls to submit one transaction for Membrr and one for EE Donations. That's less than ideal because you'll end up creating two charges, but I can't think of any other way.
> 0 votes

---
Tags: subscriptions, membrr
---


# Question
Title: Cannot Format Date fieldtype in Channel Form
I've created a Date fieldtype in Channel Fields and want to display this date in a Channel Form without the time. For example, 5/19/14 8:19 AM, I only want to display: 5/19/14.

I thought the EE date format would address this but it does not. If I add to my field tag `{my_date format="%m/%d/%y"}` the tag is displayed in the form, indicating some error. On the other hand if I add this to the form `{current_time format="%m/%d/%y"}` the date is displayed as I want.

So does the EE date format only apply to system dates, or is there a way to format the date fieldtype I created?

# Answer
For the input field in Channel Form (would that be entry date or custom date field) you can only use the format of date defined in system preferences ("US" or "European").

Though I believe you can overcome that by applying your custom rules to jQuery Datepicker.

The "format" parameter is applicable when you display the date as text in rendered template, not for display of input field itself.
> 0 votes

---
Tags: safecracker, date-format
---


# Question
Title: Update the price on the product page with custom selects
I'm trying to update the price on the product page, I'm using the "dynamic" price class.

```
<span class="store_product_price">{price}</span>

```

But because I want the options to look nice, I am actually hiding the standard expresso modifiers `<select>` element, then using some custom JS I am updating it, but when I do that, I appear to be missing a function that expresso store uses to update the price in the `store_product_price` class.

Is there a way to call that and update it?

Or will I have to loop on all the "selected" options and update the price manually? Would rather not get into maths for doing this & take advantage of expresso's method. :|

# Answer
> 0 votes
Turns out I just needed to add `.trigger("change")` to the end of my custom JS and it detected the select changing.

---
Tags: expresso-store
---


title: Check existance of layout variable?

text:
# Question
Title: Check existance of layout variable?
Is it possible to do something like the following (which doesn't work).

```
{if layout:contents}
    {layout:contents}
{if:else}
    404!
{/if}

```

thanks!

:: ed

# Answer
> 0 votes
`{layout:contents}` is no regular layout variable (it will always contain the entire contents of the template in which the `{layout="template_group/template"}` tag appeared), which is why I suspect your code sample doesn't work.

But all other layout variables should work just fine as conditionals, as in your code sample.

---
Tags: conditionals, template-layouts, layout-variables
---


# Question
Title: Showing Expired Entries in Channel Entries Edit List
So our client is constantly adding entries that have expiration dates, but in the Edit page for Channel Entries, you can't filter the list to show all expired entries for example.

Problem is that the client then has no idea which entries have expired and which haven't.

Any ideas on how to approach this? Thanks!

# Answer
> 3 votes
Have a look at the Zenbu add-on \- it will allow you to filter and sort by any field. No way to do this otherwise without hacking core files I'm afraid.

---
Tags: control-panel
---


# Question
Title: Can you use {if category == "[category name]"} to redirect a blog entry?
We have a client's multi-language site, and are NOT using any plugins to differentiate the site. The different languages are under different url paths (/fr /nl) using pages. However, for the blog element, the client wants all entries to be in one universal blog, but once you go to a French blog, the nav and other elements are French (this is done with segment\_1 of fr). Because of that, I want all blog posts in the French category to go to /fr/blog/entry/{url\_title} instead of /blog/entry/{url\_title}.

This isn't working:

```
    {exp:channel:entries channel="blog"}
                <div class="blog-entry">
                    <img src="{main-image}" alt="{title}">
     {if category_id == "41"}
       <a href="{path='fr/blog/entry/{url_title}'}"><h1>{title}</h1></a>
    {if:elseif category_id == "42"}
        <a href="/nl/blog/entry/{url_title}/"><h1>{title}</h1></a>
    {if:else}
       <a href="/blog/entry/{url_title}/"><h1>{title}</h1></a>
    {/if}
        <h5>{entry_date format="%j %M %Y"}</h5>
                    {if summary != ""}<p>{summary}</p>{if:else}<p>{entry}</p>{/if}
                </div>
    {/exp:channel:entries}

```

However, it's the if category statement that seems to be the culprit. I can replace the `<a href="/fr/blog/entry/{url_title}"><h1>{title}</h1></a>` with anything and it still shows the h1 title with a link to the /blog/entry/{url\_title} page.

# Answer
> 1 votes
You have to use the categories tag pair within your channel entries tag because you could theoretically have multiple categories assigned to an entry. IF you do have multiple categories assigned to an entry I would move the language categories into their own group so you could do:

```
{exp:channel:entries channel="blog"}
<div class="blog-entry">
    <img src="{main-image}" alt="{title}">
    {categories show_group="2" limit="1"}
    {!-- this will loop through each category assigned so you would have duplicates if in multiple categoires --}
        {if category_id == "41"}
            <a href="{path='fr/blog/entry/{url_title}'}"><h1>{title}</h1></a>
        {if:elseif category_id == "42"}
            <a href="/nl/blog/entry/{url_title}/"><h1>{title}</h1></a>
        {if:else}
            <a href="/blog/entry/{url_title}/"><h1>{title}</h1></a>
        {/if}
    {/categories}

    <h5>{entry_date format="%j %M %Y"}</h5>
    {if summary != ""}<p>{summary}</p>{if:else}<p>{entry}</p>{/if}
</div>
{/exp:channel:entries}

```

You would then be able to create another categories tag pair to show your normal categories just limit it to your other category groups.

# Answer
> 0 votes
You can definitely write conditionals based on a category's ID.

If you are indeed using the categories tag pair inside a Channel Entries tag you need to use `category_id` instead of `category` (which actually isn't a variable).

Try this instead:

```
{if category_id == "41"}
    <a href="/fr/blog/entry/{url_title}"><h1>{title}</h1></a>
{if:elseif category_id == "42"}
    <a href="/nl/blog/entry/{url_title}/"><h1>{title}</h1></a>
{if:else}
    <a href="/blog/entry/{url_title}/"><h1>{title}</h1></a>
{/if}

```

If that doesn't do the trick, then please add a little bit more of your template code to provide context for this conditional (ie, is this inside a channel:entries category variable tag pair, or something else?)

# Answer
> 0 votes
This worked (I was missing the {categories} tag. \[Note, I also had to be sure to have a template fr/blog that worked the same way as /blog\]:

```
    {exp:channel:entries channel="blog" dynamic="no"}
                    <div class="blog-entry">
                        <img src="{main-image}" alt="{title}">
        {categories}
         {if category_id == "41"}
           <a href="/fr/blog/entry/{url_title}"><h1>{title}</h1></a>
        {if:elseif category_id == "42"}
            <a href="/nl/blog/entry/{url_title}/"><h1>{title}</h1></a>
        {if:else}
           <a href="/blog/entry/{url_title}/"><h1>{title}</h1></a>
        {/if}
        {/categories}
            <h5>{entry_date format="%j %M %Y"}</h5>
                        {if summary != ""}<p>{summary}</p>{if:else}<p>{entry}</p>{/if}
                    </div>
{/exp:channel:entries}

```

---
Tags: categories
---


# Question
Title: Low Seg2Cat: Category Image filedir is not parsing
I have an issue where it seems that my category images are not being parsed properly.

`{if segment_3_category_image}<img src="{segment_3_category_image}" alt="{segment_3_category_name}" class="fright" />{/if}`

is being rendered as:

`<img src="{filedir_7}apron150x150.gif" alt="Stories" class="fright">`

Obviously, it’s getting a value for the image, but the template is not parsing the `filedir` value. Is there something that might be missing? This is sitting inside of the following page embed around `line 22`.

```
{if segment_3 =="video-tv" OR segment_3 == "radio-podcasts"}
        <div id="banner">
        {exp:channel:entries channel="shows" limit="1" disable="pagination|member_data"}
            <div class="vid-slide">
                <a href="{title_permalink='shows/'}">
                {if show_screenshot}<img src="{show_screenshot}" width="477" height="260" alt="{title}" />
                {if:elseif show_screenshot == "" AND segment_3 == "video-tv"}<img src="/assets/images/show/show_generic.jpg" width="477" height="260" alt="{title}" />
                {if:elseif show_screenshot == "" AND segment_3 == "radio-podcasts"}<img src="/assets/images/show/radio_generic.jpg" width="477" height="260" alt="{title}" />{/if}</a>
                <div class="blurb">
                    <h1>{title}</h1>
                    <p>{show_intro}</p>
                    {if segment_3 == "video-tv"}<p class="button"><a href="{title_permalink='shows/'}">Watch Now</a></p>{/if}
                    {if segment_3 == "radio-podcasts"}<p class="button"><a href="{title_permalink='shows/'}">Listen Now</a></p>{/if}
                </div>
            </div>
        {/exp:channel:entries}
        </div>
{/if}
        <section id="main">
<h1>{segment_3_category_name}</h1>
<div class="divide">
{if segment_3_category_image}<img src="{segment_3_category_image}" alt="{segment_3_category_name}" class="fright" />{/if}

{exp:low_variables:parse var="lv_shows_{segment_3}_main"}

<ul>
{exp:channel:entries channel="shows" disable="member_data" paginate="bottom" limit="12"}
<li><h2><a href="{title_permalink='shows/'}">{title}</a></h2>
<p>{show_intro}</p></li>
{paginate}
<li><p>Page {current_page} of {total_pages} pages {pagination_links}</p></li>
{/paginate}
{/exp:channel:entries}
</ul>
</div>
        </section>

        <aside id="sidebar">
{exp:low_variables:parse var="lv_shows_{segment_3}_sidebar"}<hr/>
{if segment_3 == "video-tv"}{exp:low_variables:parse var="tg_sponsors"}{/if}
{gv_subscribe}
<br/>
{gv_support-efforts}
        </aside>

```

# Answer
> 3 votes
That's looking like Low Seg2Cat. Make sure you're on the latest version and the Parse File Paths is turned on in the settings.

---
Tags: categories, low-seg2cat
---


title: Speeding up load times on this code

text:
# Question
Title: Speeding up load times on this code
The following code is causing a 8-9 second page load delay on our site and I’m trying to whittle this down however I’m not sure which conditionals to try to change in order to best affect the load times

I’ve tried using the ifelse addon from Devot:ee however it doesn’t seem to be helping at all (where I’ve placed it!)

There are about 80 categories and the code below picks out 4 of them. The channel that the products are pulled from has about 1000 entries

Using EE 2.9.0

```
    {exp:channel:categories channel="products" style="linear"}
    {exp:ifelse parse="inward"}
    {if hp-featured == "Yes"}

        <h2 class="hpH2"><a href="{path=products/l/c/{category_url_title}}">Best Selling {category_name}</a></h2>
        {exp:low_reorder:entries set="product_order" category="{category_id}" dynamic="no" disable="member_data|pagination|primary_category|categories|category_fields|misc_content|news|homepage_adverts|about" limit="3" url_title="{embed:the_url_title}" }
        <style type="text/css">
        #MI{product_code} {position:absolute; z-index:2; visibility:hidden; width:215px; margin-top:195px; background:url(/images/bg-list-moreinfo.png); padding:3px 5px; text-align:center; font-weight:normal; font-size:11px;}
        </style>
  <div class="productSingle" onmouseover="P7_autoLayers(0,'MI{product_code}')" onmouseout="P7_autoLayers(0)">
  <div id="MI{product_code}"><a href="{url_title_path='products/detail'}" title="{title} Prices and Ordering">more info »</a></div>
  <a href="{url_title_path='products/detail'}"><img src="{product_image:thumbnail}" alt="{if product_thumbnail_alt_tag !=""}{product_thumbnail_alt_tag}{if:else}{title}{/if}" title="{title}" width="225" height="225" border="0" /></a> <a href="{url_title_path='products/detail'}">{title}</a><br />
  {if '{bulk_discounts:total_rows}' == 5}
        {bulk_discounts}
            {if field_row_count == 5}from {if saleprice}£{saleprice}<s> £{price}</s>{if:else}£{price}{/if} per item{/if}
        {/bulk_discounts}
  {/if}
  {if '{bulk_discounts:total_rows}' == 4}
        {bulk_discounts}
            {if field_row_count == 4}from {if saleprice}£{saleprice}<s> £{price}</s>{if:else}£{price}{/if} per item{/if}
        {/bulk_discounts}
  {/if}
  {if '{bulk_discounts:total_rows}' == 3}
        {bulk_discounts}
            {if field_row_count == 3}from {if saleprice}£{saleprice}<s> £{price}</s>{if:else}£{price}{/if} per item{/if}
        {/bulk_discounts}
  {/if}
</div>
  {/exp:low_reorder:entries}

    {/if}
    {/exp:ifelse}
{/exp:channel:categories}

```

# Answer
> 1 votes
The code is slow because you are nesting tags. To speed up, you'll need to un-nest which will reduce the amount of queries. The linked blog post uses PHP in the template to achieve this. Nowadays, people tend to use Stash to do the same.

If you can't un-nest, you'll probably have to cache the hell out of that page.

---
Tags: categories, grid, low-reorder
---


# Question
Title: Can you limit a blog archive to a specific category?
I am not sure why this doesn't work:

```
<h3>Archives</h3>
    <ul>
            {exp:channel:month_links channel="blog" limit="12" category_id="41" show_empty="no"}
                    <li><a href="{path='fr/blog/archives'}">{month}, {year}</li>
            {/exp:channel:month_links}
    </ul>

```

I'm getting archives of months that have no entries from the category show up in the ul, so if you click them, you'd get a blank page. Why aren't they being filtered out by the 'show\_empty="no"' tag?

# Answer
> 1 votes
According to the list of parameters in the user guide, the `month_links` tag doesn't support the `category` parameter. You could use Low Yearly Archives, which does allow you to filter the archive links by category.

---
Tags: categories
---


title: Notification to the the person

text:
# Question
Title: Notification to the the person
Hej !

Free Form

* I know how make the notification, but how do I do it when I wanna send to the person who has wrote the from and I like to send.

like this Dear {first\_name} {last\_name}.

Thank you for the email ({subject}).

We take the time to read it and then to connect you as soon as possible.

Best Regards

the admin notification goes okey

# Answer
You need to configure a Notification for the form and the template tags.

See: http://www.solspace.com/docs/freeform/form/#notify\_user

**Form Settings:**

**Template Tags:**
> 1 votes

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


# Question
Title: CE Cache Static not serving cached home page
I am using CE Cache Static driver. All is getting cached and served as expected except for the home page. It is getting cached, but not served. I believe it is due to the below line of the htaccess, as the \_static\_cache\_handler.php script is NOT being triggered:

```
RewriteCond %{DOCUMENT_ROOT}/static_cache/ce_cache/90ba68/static%{REQUEST_URI}/index\.html -f

```

So, despite the fact that index.html exsists in the `ce_cache/90ba68/static` directory, the RewriteCond is not passing.

This is working for me on other servers, but not the one I'm on now.

Any ideas?

**EDIT**

I can access the cached file in the browser with no issue, so I don't think it is a permissions issue.

# Answer
I think I've found the issue and solution. It seems *sometimes* mod\_dir will be setup to do it's thing before mod\_rewrite. This means that %{REQUEST\_URI} for the homepage could end up being `index.php` instead of `/`.

To account for this, I updated the the htaccess rule:

```
#------------------- CE Cache Static Driver -------------------
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond %{DOCUMENT_ROOT}/static_cache/ce_cache/90ba68/static%{REQUEST_URI}/index\.html -f [OR]
RewriteCond %{REQUEST_URI} ^/(?:index\.php)$
RewriteCond %{DOCUMENT_ROOT}/static_cache/ce_cache/90ba68/static/index\.html -f
RewriteRule (.*) /_static_cache_handler.php%{REQUEST_URI}/index\.html [L,QSA]

```
> 2 votes

---
Tags: htaccess, ce-cache, caching
---


# Question
Title: Using stash to set a variable for use across different templates
If I understand correctly then I should be able to use Stash to set a variable on Template A and then retrieve it on Template B.

Template A contains

```
{exp:stash:set name="testvar" scope="site"}foo{/exp:stash:set}

```

Template B contains

```
Var= {exp:stash:get name="testvar" scope="site"}

```

There is nothing else on these templates but I don't get the value for testvar output on Template B.

# Answer
> 1 votes
If the 2 templates are not being used on the same page (via embed), try saving the stash variable so that it's stored in the database. Set refresh also for how long to store the variable.

```
{exp:stash:set
    name="testvar"
    scope="site"
    save="yes"
    refresh="60"
}
    foo
{/exp:stash:set}

```

---
Tags: stash
---


# Question
Title: is it possible to set and retrieve flashdata in sessions_start() hook
I'm attempting to set flashdata in the sessions\_start() hook and retrieve it on the next page load. It does not seem to work although I am able to set\_flashdata and then var\_dump the session object and see the new flashdata variable, just not able to see it or retrieve it on the next page load.

Does anyone know if you can reliably set and retrieve flashdata within the sessions\_start() hook?

# Answer
> 1 votes
Ah yes - `set_flashdata()` only works in conjunction with `ee()->functions->redirect()`, as per the docs:

> NOTE: Due to internal limitations this will only work in combination with the redirect method of the Functions class.

So it will not work in `sesions_start()` or `sessions_end()`.

---
Tags: add-on-development
---


title: Wygwam Grid Compatibility

text:
# Question
Title: Wygwam Grid Compatibility
The *Wygwam* changelog states that v3.3 "Added Grid compatibility." But when I create a *Grid* field, *Wygwam* is not offered as an available field type.

EE 2.8.1 Wygwam 3.3.1

Any ideas?

Thanks, Philip

# Answer
> 0 votes
If it's an update, try to clean the cache of your browser and of EE.

# Answer
> 0 votes
Be sure to click the Run Module Update under Addons -\> modules. Also visit the wygwam settings page. Doing these things should update the field type list in grid.

---
Tags: wygwam, grid
---


title: Variables overwritten by database

text:
# Question
Title: Variables overwritten by database
Question, then background behind the question:
We use Low Variables. When would the database overwrite our variable files on the server instead of the files overwriting what's in the database?

Background: Bitbucket had (is having) some issues. To push our sites from dev to staging we have a script that dumps the database, commits and pushes to our dev branch, merges with our staging and then pushes our staging, then checks the dev branch back out so that we are always on dev, the database that was dumped is then imported into the staging database.

This typically works great, except what seems to have happened yesterday is that our script pushed our dev branch, however since was Bitbucket was having issues, it seems that when we checked the dev branch back out it checked out an old commit. In hindsight there were a lot of things we could have done (gone through our local git -log, etc), however did I mention that this was a site for a local college and we were presenting it to the faculty 3 hours after this happen?

So it seems that when that happened, and we then ran the site, that ExpressionEngine took what was in the variable files and overwrote what was in our database. This is typically what I would expect. However after we pulled in all the files from the backup from the previous night (actual nightly file and database backups we run, not git), it seemed that the database was then overwriting our variables. We knew that the files were good (again, in hind-sight I should have reverted the database as well), however when we looked at the variables in EE and then the actual files they were bad. It was until I pulled the backup files into a non-EE folder, then manually copied the text from one into the files in the EE install that the files saved correctly and the proper variable files were in EE.

Also, it seems that only the variables were over written, not any templates. I'm just trying to understand what could have happened and how / when the whole syncing process works.

thanks

In Hindsight:
\- we should have done a full restore from the files/database backup to nip this in the butt
\- we should have looked at our local git repository for the log and what was committed before instead of just relying on Bitbucket
\- I've repeatedly stated that we shouldn't be making changes the day of presentations. Once again I got vetoed.

# Answer
Low Variables variable syncing works like this. Note that each time you save a LV in the Control Panel, its DB edit date is updated:

* Vars marked *save as file* are fetched from the DB;
* Variable directory is created if not there;
* For each file in the DB, LV checks if the file is there;
* If not, the file is created;
* If the file is there, the date is checked (using CI's `get_file_info` function);
* If the file date is newer than the DB edit date, the DB is updated;
* If the file date is older than the DB edit date, the file is updated;
* Any non-existing var-files are deleted.

To avoid any unexpected behaviour, you can choose to enable one way sync, which will only ever update the DB from files (so changes made via the CP won't update the files). This setting is also available as a config override.
> 2 votes

---
Tags: database, low-variables, git
---


# Question
Title: Expresso Store - display entries based on an availability
The items (products) come up in alpha order currently. Is there a way to push all of the “Not in Stock” items to the end of the list when displaying entries?

# Answer
I don't think there will be a way to do it without a custom query. Something along the lines of:

```
SELECT entry_id
FROM exp_store_stock
WHERE track_stock = '1'
ORDER BY stock_level DESC

```

One quick and easy way to use a custom query in place of a channel:entries tag is to use the Channel Query module. This template code works and should be a good starting point:

```
{exp:channel_query
    sql="SELECT entry_id
      FROM exp_store_stock
      WHERE track_stock = '1'
      ORDER BY stock_level DESC"
    parse="inward"
}
    {exp:store:product entry_id="{entry_id}"}
        {title}: {total_stock}
    {/exp:store:product}
{/exp:channel_query}

```

*(Tested with Store 2.3.1 and EE 2.9.0)*
> 1 votes

---
Tags: expresso-store, channel-entries, entries, sort
---


# Question
Title: Use {exp:pages:load_site_pages} to share Pages URIs across MSM sites?
The {exp:pages:load\_site\_pages} tag is not very well documented in how you use it. Gleaning from system/expressionengine/modules/pages/mod.pages.php, what it does is merges the specified site's pages URIs with the current site's. It does this in runtime - not saving to config in the DB.

The fact that it is a template tag makes it less useful because the first segment of the URL has to be specified, directing EE to the template with this tag and then possibly the second segment could be used in conjunction with Pages URIs. (Haven't quite figured that out).

The problem I'm facing is our landing pages use the first segment for Pages URIs. So for example we have /about-us that hits a page with the designated template. I tried putting this tag on our site/index and on our designated 404 to no avail. How can you alter Pages URI functionality with a template tag when Pages URI functionality is triggered pre-template?

My question is, how in the world can I make Pages URI's from one site available on another site?

# Answer
> 0 votes
The only way I could find to do this was creating an extension which functions very similarly to this tag. Basically the extension I wrote will merge Pages URIs for the current site in with other sites you designate when you save an entry in EE Admin.

Its quite simple and makes Pages URIs available across sites in MSM.

This saved us having to copy channels, entries, categories etc to other sites when all we wanted was a few landing pages. We still needed MSM however to support the alternate template and some alternate variables/snippets.

I've shared my extension on GitHub and have also updloaded to Devotee as a free addon.

https://github.com/jaseclamp/madison\_pagesync

---
Tags: multi-site-manager, pages
---


# Question
Title: Solspace Freeform Composer Template: Displaying Form ID
I have a Solspace Freeform Pro form built with Freeform Composer. I'm displaying this form within a channel entry using the Freeform Form fieldtype. This generates the full form according to the Composer template specified. Is there any way to display the form's name or ID from within the tag (or somewhere else)?

The current output looks something like `<form action="http://[my-url-here]/?ACT=34" accept-charset="utf-8" method="post">`

I would like to target certain Composer forms via Javascript and need a way to identify them.

Thanks, Brady

# Answer
You can create your own custom Composer Templates in Freeform, which allows you to pass parameters and variables similar to if you used `{exp:freeform:form}` or `{exp:freeform:composer}` in a template.

In the Freeform CP. Go to "Composer Templates" and create a new template. Under **Template Params**, you can add parameters, such as an id or class to your form:

Then, in the Composer editor ("Forms" section, after clicking the edit icon under the "Composer" column), make sure to select your custom Composer Template from the top right dropdown:

On your template, where the Freeform custom field is displayed, your form should then have the parameters that you applied in the Composer Template, eg `id=""`, `class=""`, etc. You can then target your form with javascript using id/class, for example.
> 3 votes

# Answer
All you need to do is add either of these parameters

```
form:name="YOUR_FORM_NAME"
```

```
form:id="YOUR_FORM_ID"
```

Documentation is available here: http://www.solspace.com/docs/freeform/composer/#parameters
> 0 votes

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


# Question
Title: How can I convert a text field to either Content Elements or Blocks without losing existing content?
A site I manage has thousands of entries across dozens of channels where the main textual content is stored in Wygwam fields. I'd like to convert (or perhaps duplicate and convert) those fields over to either Krea's Content Elements, or Bryan Burgers' Blocks, while retaining existing content in a Wygwam element/block inside either of those two add-ons' fields.

Is this possible, and if so, how would I do it?

# Answer
I had a similar issue in the past moving a large amount of content from one field to another in a different channel. I used MySQL to achieve this, unfortunately I'm not too good with MySQL and it was some time ago and I can't find the link I used the query from but hopefully this points you in the right direction.

What I did was;

* Most importantly make sure you have a backup!
* create the new field
* go to the Database, find out field ids etc (you will need the field\_id and field\_ft from what I remember
* use a mysql command to copy the data of the WYGWAM field to your new field

hope this helps.
> 2 votes

# Answer
There is no officially sanctioned way to do this for Blocks. And, as far as I'm aware, there is no third-party add-on that will make this easy.

Like sheferd said, you're going to want to make a backup, find the field ids in the database, etc.

1. In Blocks, create a new block type by going to Add-Ons → Modules → Blocks. Create a block type with a single Wygwam field in it.
2. This block definition will be stored in the database in `exp_blocks_blockdefinition`, and its Wygwam field will be in `exp_blocks_atomdefinition`. You'll want to grab both of those IDs.

Here's where you *might* want to drop into a custom PHP script, though it might be possible to do with just SQL.
3. Create a block by adding to `exp_blocks_block`. `blockdefinition_id` is what you looked in step #2. `site_id` and `entry_id` mean what you think they mean. `field_id` is the ExpressionEngine field that this Block will belong to (retrieved from Admin → Channel Administration → Channel Fields). `order` will probably be 1, which means it is the first block for that field. When you insert into this table, take note of the ID that is autocreated; you'll need it for when you add your content as an atom.
4. Create an atom by adding to `exp_blocks_atom`. `block_id` is the ID you got when you created a row in step #3. `atomdefinition_id` is what you looked up in step #2. `data` is your Wygwam data, retrieved from the `exp_channel_data` table.

If you run into trouble, you can fill out Blocks' support form and I'll be happy to help.
> 2 votes

---
Tags: wygwam, content-elements, richtext, blocks
---


title: Category still being output

text:
# Question
Title: Category still being output
I've tried both of the below and category 18 is still being outputted in the category list.

**Version 1**

```
{exp:channel:categories category_group="1" category="not 18"}
<a href="{path='shop/index'}">{category_name}</a>
{/exp:channel:categories}

```

**Version 2**

```
{exp:channel:categories channel="{product_channel}" category_group="1" category="not 18"}
        <a href="{path='shop/index'}">{category_name}</a>
{/exp:channel:categories}

```

Strange thing is it was working previously.

# Answer
The parameter "category" is not valid for the channel:categories tag.

You need to use " **show**='not 18' ". I am not sure how it was working for you before.

See: https://ellislab.com/expressionengine/user-guide/add-ons/channel/categories.html#show
> 0 votes

---
Tags: categories
---


# Question
Title: Shipping methods not displaying on front end
Seen the posts about a similar issue with Fedex, though in this case there's not fedex api/plugin.

I have 2 shipping methods. Both enabled in the backend.

I have tried spitting them other a couple of ways,

```
{shipping_methods}
    <option value="{method_id}">{method_title}</option>
{/shipping_methods}

```

&

```
{shipping_method_options}

```

Also this doesn't display anything:

```
{error:shipping_method}

```

I'm within a store checkout tag:

```
{exp:store:checkout require="name|address1|state|country|postcode" return="/review-and-pay" form_class="form"}

```

# Answer
Found it. I was being dumb. Set country code to "uk" on a hidden field not the actual country code that is set for the United Kingdom in the backend is "GB".
> 0 votes

# Answer
Depending on your shipping method, sometimes it won't display any results until the zip code has been submitted. So in order to pull those shipping methods, you would need to submit via ajax, or break your checkout into separate pages.
> 1 votes

---
Tags: expresso-store
---


title: Nested Tags Performance Improvements?

text:
# Question
Title: Nested Tags Performance Improvements?
Is there a better (less server intensive therefore slow) way to retrieve entries based on a category setting i.e. this is what we currently use:-

```
 {exp:channel:categories channel="products" style="linear"}
    {if show_in_main_menu == "Yes"}
      {exp:gwcode_categories cat_id="{category_id}" incl_self="no" style="linear" disable="member_data|pagination|categories|category_fields"}
        [ENTRY DATA]
      {/exp:gwcode_categories}
    {/if}
 {/exp:channel:categories}

```

This currently takes about 3 seconds per iteration on our site (and we have to do something similar in 2 other locations) so we're getting ~10 second page load times which the client isn't happy about!

# Answer
> 1 votes
Looping through categories and outputting entries within is an inherently "expensive" process. Someone will likely pipe in here with an answer that uses Stash to optimize this, but I'd suggest two options:

1. Use CE Cache to cache this area of your template.
2. Use NSM Categories to output your entries grouped by category.

---
Tags: categories, performance, gwcode-categories
---


# Question
Title: Low search not paginating results correctly
I am getting the correct search results when a user searches for a keyword. I have set the pagination limit to 12 and the first 12 searches results are shown as expected.

If a search has more than 12 results pagination is included. Although when I click a pagination link the next results page is not displaying the correct results. It is displaying 100+ results as the results of the search, regardless.

Below I have included my code:

Search Form

```
{exp:low_search:form collection="test-collection" search_mode="keywords" result_page="search/index"}</pre>
  <input placeholder="Search" type="text" name="keywords">
   <input type="submit">
{/exp:low_search:form}

```

Search Results

```
{exp:low_search:results
     query="{segment_2}"
     channel="product_swatches"
     paginate="bottom"
     paginate_base="search"
     limit="12"
}
    <div class="swatch_listing">
            <figure>
              <img src="{product_image}" alt="{title}">
                 <figcaption>
                    <span>
                        {title}
                    </span>
                 </figcaption>
            </figure>
    </div>
    {paginate}
      <section id="pagination" class="clearfix">
         <div class="pg_prev">
            {if previous_page}
                <a href="{auto_path}">« Previous</a>
            {/if}
        </div>
        <div class="pg_list">
            {pagination_links}
                {page}
                   <a href="{pagination_url}"
                      class="page-{pagination_page_number}
                             {if current_page}active{/if}"
                    >
                        {pagination_page_number}
                   </a>
                {/page}
            {/pagination_links}
        </div>
        <div class="pg_next">
            {if next_page}
                <a href="{auto_path}">Next »</a>
            {/if}
        </div>
    </section>
  {/paginate}
  {if low_search_no_results}
     <p>There were no results for this search</p>
  {/if}
{/exp:low_search:results}

```

# Answer
It's not yet clear if you're encoding queries or not.

If you are, then having `paginate_base="search"` will not include the encoded query in the pagination links, and will therefore 'forget' the query. Try either using `paginate_base="search/{segment_2}"` or removing that parameter altogether.

Since you're using Structure, make sure the actual encoded query is passed on to the tag. Structure resets the segment vars, so you might need something like Freebie instead. Turn on Template debugging to see what the actual LS tag is when it gets parsed.

> I have tried changing the low "low\_search:results" to a channel:entries tag, same results are displaying, page one has correct results and pagination has all results

Now, this points to a non-Low Search issue, as the pagination is wrong for the native tag as well. I'd recommend trying it out on a non-Structure managed template and see if the problem persists then.
> 1 votes

---
Tags: search, low-search, low, pagination
---


title: Wrong upload directory of upload field

text:
# Question
Title: Wrong upload directory of upload field
I have a Matrix upload field which doesn't show the correct upload folder.

And when I want to upload an image into that wrong folder I get the error: File aready exists. But that is not true.

It also doesn't show anything when I switch to thumbnail view.

And I'm not able to paginate trough the upload files in the upload modal window.

I disabled the cache, there is no path error. What else could this be? When I sync the folder in upload references, there is no error.

How would you debug this?

# Answer
Okay, I guess I found the error (sort of).

1. I updated everything. Now the correct folder shows up, the thumbnails work and so on. So there was just something weird going on from this old install.
2. The duplicated file problem seems to be a filename character problem. There where spaces and dots in the filename which caused the issue. Apparently these characters are not allowed but eecms doesn't say so.

Is there somewhere a setting or filename to replace irregular characters from a file during upload? Or is there a list which characters are allowed or not or is this a server environment thing?
> 0 votes

---
Tags: matrix, file-uploads
---


# Question
Title: Why won't minimee work? Works in all my sites except one in https://
The question pretty much says it, but here is some additional info:

Config file, with "siteurl" taking place of the real url:

```
$config['minimee'] = array(

    /**
     * ==============================================
     * BASIC PREFERENCES (REQUIRED)
     * ==============================================
     */

    /**
     * The path to the cache folder.
     * Defaults to site's FCPATH + '/cache'
     */
    'cache_path'        => '/var/www/vhosts/siteurl.com/cache',

    /**
     * The URL to the cache folder.
     * Defaults to $EE->config->item('base_url') + '/cache'
     */
    'cache_url'         => 'https://www.siteurl.com/cache',

    /**
     * ==============================================
     * BASIC PREFERENCES (OPTIONAL)
     * ==============================================
     */

    /**
     * Turn on or off combining of CSS assets only. 'yes' or 'no'.
     * Values: 'yes' or 'no'
     * Default: yes
     */
    'combine_css'       => 'yes',

    /**
     * Turn on or off combining of JS assets only. 'yes' or 'no'.
     * Values: 'yes' or 'no'
     * Default: yes
     */
    'combine_js'        => 'yes',

    /**
     * Turn on or off minifying of CSS assets. 'yes' or 'no'.
     * Values: 'yes' or 'no'
     * Default: yes
     */
    'minify_css'        => 'yes',

    /**
     * Turn on or off minifying of the template HTML.
     * Values: 'yes' or 'no'
     * Default: no
     */
    'minify_html'       => 'no',

    /**
     * Turn on or off minifying of JS assets.
     * Values: 'yes' or 'no'
     * Default: yes
     */
    'minify_js'         => 'yes',

    /**
     * ==============================================
     * DISABLING MINIMEE
     * ==============================================
     */

    /**
     * Disable Minimee entirely; aborts all activity
     * and returns all tags untouched.
     * Values: 'yes' or 'no'
     * Default: no
     */
    'disable'           => 'no',

   );

```

The only difference (besides https) between this site and other sites on which I have it installed & active and it works, is that that this server (client owns it) does not have an http(s)docs folder. Not sure if that is why the whole thing is being thrown off.

The CSS is wrapped in tags like this. JS files are done the same way:

```
{exp:minimee:css}
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <link rel="stylesheet" type="text/css" href="/css/mobile.css" />
    <link rel="stylesheet" type="text/css" href="/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="/css/bootstrap-responsive.min.css" />
{/exp:minimee:css}

```

# Answer
> 1 votes
Turn on Template Debugging under **Admin → System Administration → Output and Debugging**, then reload your template. Minimee will give you helpful logging messages in the template debugger at the bottom of the age.

---
Tags: minimee
---


title: User: Register Form won't validate

text:
# Question
Title: User: Register Form won't validate
Getting an error message “You must answer the question in order to post” when trying to use Solspace's User to make a front-end registration form and can't get the form to post. Can't figure this out, totally stumped although I'm sure it's something simple. Template code is as follows:

```

{exp:user:register form:name="some_name" return="loggedin/success/newmember" allowed_groups="5|9|10|11|12" admin_register="yes"}
<fieldset>
<ul>

        <li>
    <strong>Member Name:</strong>
    <p class="instructions">This is the member's full name.  Example: Habitat Gallery & Studio</p>
    <input type="text" class="input" name="screen_name" />
    </li>

        <li>
            <strong>Username:</strong>
            <p class="instructions">A condensed version of the member name.  It is used to login and as the member's URL.  Lowercase, no spaces or special characters.  Example: habitat</p>
            <h3 class="red">Lowercase, no spaces or special characters.  Example: habitat</h3>
            <input type="text" name="username" />
        </li>
        <li>
            <strong>Member Group:</strong>
            <p class="instructions">Assign member to a group.</p>
            <select name="group_id">
                <option selected="selected">Choose a group...</option>
                {select_member_groups}
                    <option value="{group_id}"}>{group_title}</option>
                {/select_member_groups}
            </select>
        </li>

        <li>
    <strong>Description: </strong>
    <textarea name="member_description" class="textarea"></textarea>
    </li>

        <li>
    <strong>Street Address:</strong>
    <input type="text" class="input" name="member_street" id="street" onchange="geocode({address:this.value+', Foo, '+'Bar'})"
           onfocus="this.select()" />
    </li>

        <li>
    <strong>Street Address 2:</strong>
    <p class="instructions">If you have a studio or apartment number, enter it here.</p>
    <input type="text" class="input" name="member_street2" />
    </li>

        <li>
    <strong>Zipcode:</strong>
    <input type="text" name="member_zipcode" />
    </li>

    <input type="hidden" name="member_latitude" id="latitude" />
    <input type="hidden" name="member_longitude" id="longitude" />

        <li>
    <strong>Business Hours: </strong>
    <p class="instructions">The days and hours your business is open</p>
    <textarea name="member_hours" class="textarea"></textarea>
    </li>

        <li>
    <strong>Email: </strong>
    <input type="email" name="email" />
    </li>

        <li>
    <strong>Website:</strong>
    <p class="instructions">Example: http://www.habitatgallery.com</p>
    <input type="text" class="input" name="member_website" />
    </li>

        <li>
    <strong>Facebook:</strong>
    <input type="text" class="input" name="member_facebook" />
    </li>

        <li>
    <strong>Twitter:</strong>
    <input type="text" class="input" name="member_twitter" />
    </li>

        <li>
    <strong>LinkedIn:</strong>
    <input type="text" class="input" name="member_linkedin" />
    </li>

    <li>
    <strong>Flickr:</strong>
    <input type="text" class="input" name="member_flickr" />
    </li>

        <li>
    <strong>Phone #:</strong>
    <input type="text" name="member_phone" />
    </li>

    <li>
        <strong>Categories:</strong>

        {categories}
        {category_selected}checked="checked"{/category_selected}
        {category_body}<label><input type="checkbox" name="category[]" value="{category_id}" {selected}>{category_name}</input></label><br />{/category_body}
        {/categories}
    </li>

    <li>
        <strong>Field of Study</strong>
        <p class="instructions">Student Members only.</p>
        <input type="text" name="member_field_of_study" />
    </li>

    <li>
        <strong>Medium</strong>
        <p class="instructions">Individual Artist Members only.</p>
        <input type="text" name="member_medium" />
    </li>

</ul>

<ul>
    <li>
        <strong>Password:</strong>
        <input type="password" name="password" />
    </li>
    <li>
        <strong>Confirm Password:</strong>
        <input type="password" name="password_confirm" />
    </li>

</ul>
</fieldset>

<input type="checkbox" name="accept_terms" value="y" checked class="hide" />
<p><input type="submit" value="Submit" /></p>

{if no_results}
<p>You do not have the correct permissions to register new members.</p>
{/if}

{/exp:user:register}

```

# Answer
> 0 votes
Assuming that your actual code does not have the {exp:user:register...} code twice, as you have it in the above code example, that error sounds like it would be related to your Register form expecting a Captcha code be entered. You'll need to put in the applicable Captcha code (or whatever code is necessary if you're using a 3rd party add-on for something more advanced than the standard EE Captcha):

```
{if captcha}
    <p>Please enter in the word you see below:
        <input type="text" name="captcha" /></p>
    <p>{captcha}</p>
{/if}

```

---
Tags: solspace-user, register
---


# Question
Title: Change Hidden field based on select choice
I've got a select field that is populated with all titles from a channel entry like this:

```
<select id="product_name" name="product_name" class="form-control">
  {exp:channel:entries channel="product_page" limit="500" disable="member_data|pagination|comments|categories" dynamic="no" orderby="title" sort="asc"}
    <option value="{title}" {if freebie_2 == url_title}selected{/if} data-productid="{product_id}">{title}</option>
  {/exp:channel:entries}
</select>

```

I've also got a hidden field that I need to populate the value with a value pulled from the data-product-id attribute of the selected option.

```
<input id="product_id" name="product_id" type="hidden" placeholder="Product Id" class="form-control input-md" value="{freebie_3}">

```

I"m not sure how best to approach this.

My current javascript is below and not working. On change the value is removed and set to "undefined"

```
//Populate hidden field with data-attribute from select on quote-center page
$(document).ready(function(){

    $('select#product_name').on('change', function() {

        var prod_id = $('select#product_name:selected').data('productid');

      $('#product_id').val(prod_id);
      console.log('product id is ' + prod_id);
    });

});

```

And a JS Fiddle is here: http://jsfiddle.net/pgzfLo24/

# Answer
I'm so stupid. The selector is incorrect vor the variable prod\_id. Needs to have option added. See below:

```
//Populate hidden field with data-attribute from select on quote-center page
$(document).ready(function(){

    $('select#product_name').on('change', function() {

        var prod_id = $('select#product_name option:selected').attr('data-productid');

      $('#product_id').val(prod_id);
      console.log('product id is ' + prod_id);
    });

});

```

Now everything works.
> 0 votes

---
Tags: forms, javascript
---


# Question
Title: About to upgrade, what are EE differences between 2.81 and 2.92?
About to upgrade my personal site and went to Ellislab website for download and they have 2 versions for download. 2.81 and 2.92

Going through the EE bug tracker appears I may have several items that I will need to edit core files if I end up with these all ready listed bugs.

Is there a reason some of us would not want to upgrade to 2.92 now? with Forums 3.1.17?

I'm currently running 2.81.

Thanks \`mike

# Answer
In cases like this, you should check out the Change Log.

There are a couple of changes that stand out:

* EE2.9 requires at least PHP 5.3.10 (EE2.8 requires 5.2);
* In EE2.9, the conditionals parser has had an overhaul. This means your templates can be more performant, but conditionals are also more error-prone.

As so often, it's a case of YMMV.
> 1 votes

---
Tags: forms, upgrade, ee2-upgrades
---


title: Channel Form with AJAX

text:
# Question
Title: Channel Form with AJAX
I try to make channel form submit via ajax, but stuck now. I have a page showing the list of channel entries, when user clicks on edit link, which is next to each entry, it shows a panel () which contains template partial where I have the channel form. Simply when user clicks on the edit link, it just calls:

```
$('#contentedit').load('/malls/_editmall/' + id);
$('#paneledit').toggle('slide', { direction: 'right' });

```

where I have template partial is \_editmall. And the code in the partial is as follows:

```
<div id="entry-body">
  {exp:channel:form channel="malls" include_jquery="no" json="yes" entry_id="{segment_3}"}
    <label for="title">Title</label>
    <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();">
    <label for="url_title">URL Title</label>
    <input type="text" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50">
    <input type="submit" name="submit" value="Submit">
  {/exp:channel:form}
</div>

```

I put the following code in the example to the main template (I tried also in partial though),

```
<script type="text/javascript">
    $(document).ready(function() {
        $('#publishForm').ajaxForm({
            dataType: 'json',
            success: function(data) {
                if (data.success) {
                    // success!
                } else {
                    console.log(data);
                }
            }
        });
    });
</script>

```

So I expect that the page will just save and stay in the page as it is. But instead it opens the url of the partial, and shows the json (success) on the page. And yes, I have reference to both jquery and jquery form plugin.

You can see my page here

Any idea what I'm doing wrong?

# Answer
> 0 votes
Have you tried ajaxForm at it's most simple state?

```
 $('#publishForm').ajaxForm(function() {
     alert("Thank you for your comment!");
 });

```

Try that and on your exp tag take json="yes" off.

# Answer
> 0 votes
I think you may need to also add include\_assets="no"

HIH.

---
Tags: safecracker, ajax
---


title: Structure Entries and Hide From Nav

text:
# Question
Title: Structure Entries and Hide From Nav
Within Structure there is an option to "Hide From Nav". This works well and hides the choice from the nav tag. However, it also appears to hide it from the tag exp:structure:entries that is being used. Is there a way to keep entries from hiding the page?

I tried override\_hidden\_state="yes" however it no effect on the entries tag.

Help!

Brad

# Answer
I believe you need one of the newer (beta) versions of SE. 1.3 or later. There is some info here on their support site and a link to a newer version of SE. I have a vague memory of using this on a project a few months ago.

https://getsatisfaction.com/twobelowzero/topics/hide\_from\_nav\_variable
> 1 votes

# Answer
Brad, you're referencing Structure:Entries (http://buildwithstructure.com/tags#tag\_entries) **NOT** structure\_entries (http://devot-ee.com/add-ons/structure-entries) which some of the answers and comments are referring to.

Assuming it is the Structure native tag, then the documentation only states it supports the same **variables as a channel tag** \- not that it supports the structure:nav parameters.

Your reference to the existing code:

```
{exp:structure:entries channel="portfolio" parent_id="{structure:page:entry_id}" disable="categories|category_fields|member_fields|pagination"}

```

Would mean that structure:entries tag would ignore `channel` and `disable` and they do nothing.

So the parameter isn't supported, possibly email Structure support to request they include in a future version?

Solution... (warning hack alert)

"hidden" (hidden from nav) is a column in the structure table (with a row for each page). The structure:entries tag takes the parameter parent\_id and calls a function called get\_child\_entries passing the parent ID. This function does the SQL query and has it hard coded in to ignore any entry set to hidden.

**2 solutions (the quick way):**

modify lines 1115 - 1120 of sql.structure.php (v3.3.10)

```
$this->EE->db->select('entry_id')->from('structure')->where(array(
    'parent_id' => $parent_id,
    'entry_id !=' => 0,
    'hidden !=' => 'y',
    'site_id' => $this->site_id
))->order_by('lft', 'asc');

```

Change to:

```
$this->EE->db->select('entry_id')->from('structure')->where(array(
    'parent_id' => $parent_id,
    'entry_id !=' => 0,
    'site_id' => $this->site_id
))->order_by('lft', 'asc');

```

Removing the hidden reference in the WHERE clause. Downside this will change ALL calls to `{exp:structure:entries}`.

**Alternative solution:**

Add the parameter for override\_hidden\_state in the entries function (starts from line 111 in mod.structure.php) and pass it to get\_child\_entries as a second parameter. In get\_child\_entries (from line 1110 in sql.struture.php) add the extra parameter (giving it a default value of "n" to ensure all existing calls continue to work) an modify the SQL call to reflect the choice of showing hidden or not. I've not gone into the exact code examples as I expect the 1st solution would be suitable for most people and you've already solved the issue via custom SQL.
> 1 votes

# Answer
I just had to rewrite the whole thing with a custom query. Not the most fun I have ever had, but at least the relationships were very easy. It would be nice if this would work by default.

Brad
> 0 votes

# Answer
If you are using Structure:Entries plugin as Peter has mentioned above, you can simply create a category. I called mine "Include In Main Navigation". I included the `category_id` parameter in my tag pair: `{exp:structure_entries category_id="1"}`. Worked like a charm for me and didn't involve any hacking code.
> 0 votes

---
Tags: structure
---


# Question
Title: Removing a grid row from SAEF / Channel Form and saving doesn't update entry
I've got a channel form which contains a grid field and I can add and edit content with no issues. The problem however is that if I remove an entire row, and then save the edit, nothing is updated. I'm returned to the entry and the row remains.

```
{exp:channel:form channel="content" return="URL_TITLE" entry_id="{segment_3}" require_entry="yes"}

    <h1>Edit: {title}</h1>
    <input type="hidden" name="structure_uri" value="{url_title}">
    <input type="hidden" name="structure_template_id" value="36">
    <input type="hidden" name="structure_parent_id" value="0">

    <input type="text" name="title" value="{title}">

    <div id="section1" class="form-container">
       <h2>Section #1</h2>
       {field:section_1}
       <a href="#" class="add_attachment">Add Attachments?</a>
       <div class="attachments">
          <h3>Section #1 Attachments</h3>
          {field:section_1_files}
       </div>
    </div>

    <input type="submit" id="save" value="Save Changes">

{/exp:channel:form}

```

Both `{field:section_1}` and `{field:section_1_files}` are the grid fields. Once I remove a row it disappears from the page and is replaced with the;

*"You have not added any rows of data yet. Add some data?"*

But saving doesn't appear to be doing anything.

Any help would be great

Thank you.

# Answer
> 0 votes
This turned out to be a bug that EllisLab have provided a solution for.

Add the following line to the beginning of *system/expressionengine/fieldtypes/grid/views/publish.php*:

```
<input type="hidden" name="<?=$field_id?>" value="placeholder"/>

```

Here is the source link: https://support.ellislab.com/bugs/detail/20718

---
Tags: safecracker, grid, saef
---


# Question
Title: Is it possible to use store tags without it outputting a form element?
I'm in a situation on the cart/basket page where I want to use an embed, but, I want to use the checkout tag again within it, to work out some tax with php & then add it to a table.

I've accomplished it fine, though it's adding a form element to the table element. Is there a param I'm missing where I can just say form\_element="off" or something like that?

# Answer
The product tag allows you to add `disable_form="yes"` to remove the form tags.

Since you are trying to use the checkout tag however you best option would be to use the `{exp:store:cart}` tag pair for the nested content which is the exact same as the checkout tag but does not output a form tag.

> The Cart Tag behaves exactly the same as the Checkout Tag. The difference lies in performance - while the Checkout Tag provides a form, and provides options for updating and submitting the cart, the Cart Tag simply displays a cached version of the current cart.
>
> You should use the Cart Tag instead of the Checkout Tag in sidebars and headers, when you wish to display the contents of the current cart.

Full documentation for the cart tag pair.
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Using Cartthrob with Stripe - form being submitted even with errors
I'm using the Stripe payment gateway with Cartthrob which appeared to be working properly. On further inspection it appears that the form is being submitted to Stripe when the submit button is clicked even if there are errors.

Trying to disable the form submission isn't working either. This results in failed attempts in the Stripe logs.

Has anyone got Stripe working properly with Cartthrob? How are you preventing this?

# Answer
> 0 votes
Im using the straight forward validation currently and having no problems, although I'm not receiving the emails from Stripe at present or the system which is a little worrying..

which other validation are you using?

---
Tags: cartthrob, stripe
---


# Question
Title: Set price with product modifiers (not + or -)
I sell a product that the customer can either pay full price, or pay a down payment and then (outside of EE) make payments.

What I'd like is to have options/modifiers:

* "Full price" = (no price adjustment)
* "Down payment" = (set price to $100)

Is this possible without having to manually calculate {price}-x="Down Payment"? From what I can tell, I can only add or subject from {price}.

I read this: Change price with modifier, instead of + add to price, however that would break sorting/searching by price since Store would consider them all to cost $0.

Thank you!

# Answer
> 0 votes
You can use negative price modifiers to adjust your products final price.

So lets say you have a $1200 item that you would create a product with a price of $1200 then you would need to create 2 modifier options 'Full Price' with out adding a modifier value and 'Down Payment' with a value of -1100 as the modifier value.

This would allow you to still sort by price but you would need to do the math to get the value.

Another option seems like a bit overkill in your situation but would be possible. You could create a new channel with a Store Field and a relationship field. Once you have done that you would be able to create your product in the main product channel with the normal price. Then you would create another entry in the newly created channel with the down payment price and then you would need to relate the down payment product to the entry you just created.

This can add a lot of overhead and really provides a less then ideal publishing approach for your content creators.

The final option would be to create an extension that would automatically calculate the difference for you.

---
Tags: expresso-store
---


title: WSoD and Imgsizer Plugin

text:
# Question
Title: WSoD and Imgsizer Plugin
Site is running EE 2.1.3 and I'm now getting WSoD on a few of my front-end pages (notably those with imgsizer plugin enabled, the other pages without images are working fine). I've read that it's a memory issue related to trying to generate a thumbnail with Image Sizer plugin (running 2.6.4) in this related thread but no solutions are offered. I tried upgrading to newer version that's been forked on GitHub but got the same problem. I've also changed the memory allocation to 512M and still no luck. Enabling debugging in index.php yields no PHP errors on the back-end and template files are parsing correctly.

This all started when I got an error message after a member couldn't upload a file (I'm assuming it was too large although I haven't heard back from them yet). The following error came from our server:

\[19-Feb-2015 11:24:25 America/Denver\] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 17472 bytes) in /home/artdistr/public\_html/system/expressionengine/third\_party/imgsizer/pi.imgsizer.php on line 546

Now I'm getting a whole host of problems where paths aren't found (I'll only include one since there's a ton of them) from the server: Feb 26 12:24:22 2015\] \[error\] \[client 69.245.61.229\] File does not exist: /home/artdistr/public\_html/themes/template\_variables, referer: http://www.artdistrictonsantafe.com/system/index.php?S=0&D=cp&C=addons\_plugins

Thanks in advance, I'm totally stumped here.

# Answer
Ok so the answer was actually not Image Sizer but CE Image plugin, even though the initial error referenced the imgsizer plugin directory. What was happening was that there wasn't enough server resources to load the images which stopped the other plugins from loading and caused the plugins not to load dynamic files leading to other errors like directories not found.

I went into the `pi.ce_img.php` file and changed line 82 (below comments) from 60 to 256:

```

/* The PHP memory limit.
    This script needs an adequate amount of memory (measured in megabytes) allocated from your server in
    order to work. Generally, 64 should be more than enough. This value can also be overwritten in config.php. */
    private $memory_limit = 256;

```

Obviously this seems like a huge amount of memory resources (I still need to fine tune with server) but the site is loading very fast now on all pages. Hopefully this helps someone else, I could see similar problems arising with other image plugins.
> 0 votes

---
Tags: plugin, image, white-screen-of-death
---


# Question
Title: Super Search : how to decode the queries codes stored in exp_super_search_history table
Does anyone know how to decode the queries codes (stored like this YToxOntzOjU6ImZpZWxkIjthOjE6e3M6ODoidGFibGltbWUiO3M6MzoiMDFCIjt9fQ== in exp\_super\_search\_history table) to transform it in this kind of format : search="keywords=green&channel=products&category=pants+shirts&status=-closed&orderby=title+asc&limit=100"

So I can use it as a parameter in {exp:super\_search:results} tag.

Thanks in advance for the reply.

PS : already tried with a little bit of PHP (base64\_decode()) but doesn't give the format needed.

**EDIT ::**

Hi, in fact I'll explain exactly what I'm trying to do :

In a template I make a query to retrieve all the member's last saved search datas.

```
{exp:query sql="SELECT essh.*
FROM exp_super_search_history essh
INNER JOIN
    (SELECT member_id, MAX(search_date) AS MaxDateSearch
    FROM exp_super_search_history WHERE saved='y' AND member_id != '0'
    GROUP BY member_id) groupedessh
ON essh.member_id = groupedessh.member_id
AND essh.search_date = groupedessh.MaxDateSearch"}

```

Whithin this query loop I wanted to show the results of all these searches retrieved by puttting the exp:super\_search:results tags with the parameter search={query}. THat's the reason I wanted to decode the query value from exp\_super\_search\_history.

The goal is : On this page I want to loop on all the member's last saved search results and send them an email once a week with the links to all the new added entries that matches their saved criterias.

Instead of trying to decode the {query} thing you suggested me to use the Super\_Search:Search tag to build the URL string, what I did :

URL :

```
<?php
$the_url= '{if super_search_tablimme}tablimme={super_search_tablimme}{/if}{if super_search_comm}&comm={super_search_comm}{/if}{if super_search_offr}&offr={super_search_offr}{/if}{if super_search_prix-from}&prix-from={super_search_prix-from}{/if}{if super_search_prix-to}&prix-to={super_search_prix-to}{/if}';
?>

```

And after that :

```
{embed="template_group/template" the_url="<?php echo $lol; ?>" the_author="{member_id}"}

```

All works perfectly, except that on this list of results by member, I only see results filtered by criterias for the member I'm connected with.

Example 1, when I'm connected as member 1, on my list template I see :

member\_id : 1

URL = tablimme=01&offr=V&prix-from=2000&prix-to=190000

results filterd

member\_id : 2

URL =

all the results from the channel (not filtered because it doesn't have retrieved the URL, as you can see above, because I'm not connected with this member account)

Example 2, when I'm connected as member 2, on my list template I see :

member\_id : 1

URL = all the results from the channel (not filtered because it doesn't have retrieved the URL, as you can see above, because I'm not connected with this member account)

member\_id : 2

URL = tablimme=011

results filterd

I think the issue is at the Super\_Search:Search tag level, not at the Super\_Search:Results because as it is written in the Super Search Dococumentation we can add the search criterias we want in the search="" parameter.

This is for a immo project I have for a client. Can you give me help on this please ?

# Answer
So, what I did (if it can help someone) (thanks to @Solspace for his answers) :

In my template templategroup/list :

```
{exp:query sql="SELECT essh.history_id, essh.member_id, essh.results, essh.search_name, essh.search_date, essh.saved, essh.query AS my_query
FROM exp_super_search_history essh
INNER JOIN
    (SELECT member_id, MAX(search_date) AS MaxDateSearch
    FROM exp_super_search_history WHERE saved='y' AND member_id != '0'
    GROUP BY member_id) groupedessh
    ON essh.member_id = groupedessh.member_id
    AND essh.search_date = groupedessh.MaxDateSearch
INNER JOIN
    (SELECT member_id
    FROM exp_members) groupedem
    ON essh.member_id = groupedem.member_id
    AND essh.member_id = groupedem.member_id"}

<?php
 $qr       = '{my_query}';
    $decoded      = base64_decode($qr);
    $unserialized = unserialize($decoded);

    if ( ! function_exists('convertArrayToString') ) {
    function convertArrayToString($array) {

        $string = '';

        foreach($array as $i => $cell) {

            if($i == 'field') {

                foreach($cell as $i => $c) {
                    $string .= $i . '=' . $c . '&';
                }

            } else {

                $key   = key($cell) . '-' . $i;
                $value = current($cell);

                $string .= $key . '=' . $value . '&';
            }
        }

        return rtrim($string, '&');
    }
    $the_url = convertArrayToString($unserialized);
    $the_url = str_replace("+", " ", $the_url); // to delete the "+" that it places instead of a white space, otherwise it doesn't match the value of the super search criteria's value
    echo $the_url;
} else {
    $the_url = convertArrayToString($unserialized);
    $the_url = str_replace("+", " ", $the_url); // to delete the "+" that it places instead of a white space, otherwise it doesn't match the value of the super search criteria's value
    echo $the_url;
}
?>

{embed="template_group/results_list" the_query="<?php echo $the_url; ?>" the_author="{member_id}"}

{/exp:query}

```

In my template templategroup/results\_list :

```
{exp:super_search:results channel="my_channel" orderby="entry_date+desc" search_words_within_words="no" search="{embed:the_query}"}
     {if super_search_no_results}
     <p>No reslut that matches the search criterias</p>
     {/if}
     <a href="{url_title_path='goods/goods-details'}" title="Learn more about this good">{title}</a>
{/exp:super_search:results}

```
> 0 votes

---
Tags: solspace, supersearch
---


title: Channel Files Question

text:
# Question
Title: Channel Files Question
I've got a situation where I'm pulling a list of channel entries, each of which link to a page with more details. The channel is called "audio", and it contains a Channel Files field that can hold multiple audio files.

What I would like to do is this:

* If the entry contains just one audio file, do ABC.
* If the entry contains more than one audio file, do XYZ

Here is my "dumbed-down" code

```
{exp:channel:entries channel="teleconferences"}
    {exp:channel_files:files entry_id="{entry_id}" limit="1"}
        <p><a href="/{segment_1}/{url_title}">Full Details</a></p>
    {/exp:channel_files:files}
{/exp:channel_files:files}

```

If I don't put a limit on the {exp:channel:entries" tag, then it prints a link for the total number of files in the entry. So if there were 5 files in Entry A, and 1 in Entry B, it would look like this:

* Entry A
* Entry A
* Entry A
* Entry A
* Entry A
* Entry B

If I do put a limit, then I get that number per page, with pagination.

If I add a limit to the {exp:channel\_files:files} tag, then I only get one entry, but I'm unable to do ABC or XYZ on it. Basically, what I'd like to do is put a play button if there is only one audio file, or a link to the page if there are multiple audio files.

Perhaps this isn't doable but I thought I would ask the experts!!

# Answer
> 0 votes
OK, I had made it way more complicated than it needed to be, and I really wasn't coding it right. Here is what I ended up doing:

```
    {exp:channel:entries channel="teleconferences"}
    <tr>
      <td>
        {exp:channel_files:files entry_id="{entry_id}"}
            {if file:total == 1}
            --- Put a play button here ---
            {/if}
        {/exp:channel_files:files}
      </td>
      <td>The rest of my code</td>
   </tr>
   {/exp:channel:entries}

```

This works exactly as I had hoped!

# Answer
> 1 votes
Try this.

```
{exp:channel:entries channel="teleconferences"}
    {exp:channel_files:files entry_id="{entry_id}"}
        {if file:count==1}
           /// do ABC ///
        {if:else}
           /// do XYZ ///
        {/if}
    {/exp:channel_files:files}
{/exp:channel:entries}

```

Don't forget to remove the limit from `{exp:channel_files:files}`

Oh. And your closing tag should read `{/exp:channel:entries}`

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