title: Closing up Solspace Freeform form?

text:
# Question
Title: Closing up Solspace Freeform form?
I tried to find from Solspace docs, how to close a form that is used as survey for my site users. Didnt find any info according to that. So how I can close the form without losing the data stored? Is the only way to comment out the form from template and write a notice in place?

Thanks in advance.

# Answer
> 2 votes
It depends on how you are placing the form into the page. Are you simply inserting it into the template? Is it inserted along with an entry? The logic of how the form gets "closed" is likely something you would want to handle with native EE logic/functionality rather than something specific to Freeform. Perhaps expiring the entry that makes up the page within which the form is inserted, or changing the text of that page and removing the form on the basis of a date having passed - something like that - since forms themselves, I don't believe, have any such functionality.

---
Tags: solspace-freeform
---


# Question
Title: URL redirect on browser language detection
I'm using the Browser Sniff plugin to detect for the browser language on a multilangiage site using Transcribe plugin. It's working for detecting the browser language. I want to redirect users with their browser set to Chinese(zh) to the same url with "zh" as segment\_1. So the site currently will display English at www.site.com/page and chinese at www.site.com/zh/page. Now I want to redirect users with their browser set to Chinese from www.site.com/page to www.site.com/zh/page.

I tried this, but it results in a redirect loop:

```
{exp:browser_sniff available_languages="en|zh"}
{if browser_sniff_negotiated_language == "zh"}
     {redirect="zh/{uri_string}"}
{/if}
{/exp:browser_sniff}

```

Any ideas?

# Answer
> 2 votes
The loop occurs because you're testing again and again and again...

Try this:

```
{exp:browser_sniff available_languages="en|zh"}
    {if browser_sniff_negotiated_language == "zh"}
         {if browser_sniff_negotiated_language != "{segment_1}"}
             {redirect="zh/{uri_string}"}
         {/if}
    {/if}
{/exp:browser_sniff}

```

---

## update

Since Transcribe doesn't count the language for your `segment_1`, use `{exp:transcribe:language_abbreviation}`. If you're already using this same variable on your template and having parsing issues, add a different parameter to one of them or use the `random` parameter.

```
{exp:browser_sniff available_languages="en|zh"}
    {if browser_sniff_negotiated_language == "zh"}
         {if browser_sniff_negotiated_language != "{exp:transcribe:language_abbreviation random}"}
             {redirect="zh/{uri_string}"}
         {/if}
    {/if}
{/exp:browser_sniff}

```

EECMS template parser replaces all instances of a same variable by a placeholder text to prevent evaluate them more than once. Sometimes, it happens the instances are in different scopes and not all of them are parsed back. So, use the `random` parameter.

---
Tags: redirects, multi-language, transcribe
---


# Question
Title: Cartthrob show discount before adding to cart?
I am using Cartthrob and am trying to figure out how to create a discount system. The goal is to create discounts for only certain products and set an automatic expiration date for the discounts. Where the product is displayed on the website (before adding to the cart), I would like to display the discount information such as the amount off, discounted price, etc.

Adding an expiring discount is easy with Cartthrob’s ‘Amount off Product’ discount type (where the discount applies to only specific entry IDs), however, there does not seem to be a way to show the discount information on a product page before adding the product to the cart. In the `exp:channel:entries` loop, trying to display discount information (amount off, discounted priced, etc.) using the tags described here results in unparsed tags. Once the product has been added to the cart those tags work. The documentation appears to confirm this behavior.

Has anyone using Cartthrob found a way around this limitation?

I am using EE v2.5.3 and Cartthrob v2.2.9.

# Answer
The Cart Throb discount tags will only be parsed if a customer has actually applied a discount that has been accepted which you've obviously figure already.

I think the only way you can tell someone about a discount before they add the item to their basket is by having a field in your products channel where you could add *discount details*. This would work independently of your discounts channel so you wouldn't be able to link this to the expiry date of the discount.

So you could add 2 fields to your products channel; one for the discount detail, and a date field for the expiry, that might look like this:

```
{if current_time < discount_expiry_date}
{discounts_available}
{/if}

```

Once the discount expiry date has passed, the {discounts\_available} content would be hidden.
> 0 votes

---
Tags: cartthrob, shopping-cart, discounts
---


# Question
Title: Multiple File Uploads on Freeform not working
I had the following form working until I added file upload:

```
<h3>Submission Form</h3>

{exp:freeform:form
    collection="remnants"
    required="name|article_title|article_tagline|article"
    return="submit/submitted"
    file_upload="blog_user"
}

<p>Name: <input type="text" name="first_name" /></p>
<p>Email: <input type="text" name="email" /></p>
<p>Article Title: <input type="text" name="article_title" /></p>
<p>Article Tagline: <input type="text" name="article_tagline" /></p>
<p>Article:<br /><textarea name="article"></textarea></p>
<p>Attach a File: <input type="file" name="article_image" /></p>

<p><input type="submit" name="submit" value="Submit" /></p>

{/exp:freeform:form}

```

I keep getting the following error: Article Image: The upload path does not appear to be valid.

I've allowed for up to 10 images but only one input is showing. I'm wondering if I didn't probably create the input field?

# Answer
First, try changing

```
<input type="file" name="article_image" />

```

to

```
<input type="file" name="article_image[]" />

```

(Note the brackets: `[]`)

Alternatively, you can use `{freeform:field:article_image}`, which will generate the file field for you. You can then add the `show="10"` parameter to display 10 file upload fields. This is described in the documentation for the File Upload Field: http://www.solspace.com/docs/freeform/default\_fieldtypes/#fileupload\_show

**Note**: Instead of using `show="10"`, you can set the number of file fields from the CP in the Freeform module, when editing the file upload field settings. Look under **Allowed upload count**.
> 1 votes

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


# Question
Title: solsplace calendar gives error "Fatal error: Call to undefined method Pagination_object::get_template()"
I'm using solspace calendar, but its gives Fatal Error "Call to undefined method Pagination\_object::get\_template() in /content/system/expressionengine/third\_party/calendar/mod.calendar.php on line 5363"

line number 5363 script given below

```
if ($this->ee_version >= '2.4.0')
{
    $channel->pagination->get_template();
}
else
{
    $channel->fetch_pagination_data();
}

```

FYI: EE: 2.8.1

Calendar: 1.8.5

Thanks

# Answer
Please upgrade to Calendar 1.8.6. It's the recently released version that is compatible with EE 2.8.x.
> 1 votes

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


title: Filter entries using Solspace's Tag

text:
# Question
Title: Filter entries using Solspace's Tag
I want to filter entries by the tags they contain.

This works nice, when only one tag is queried, but I need to be able to add several tags to the URL by clicking on them in the front-end and have the list of entries drill down accordingly.

Ideally I'd also be able to remove already present tags from the URL by clicking the same link again. Think of toggling a tag on and off from a query, like this:

http://www.ralphmedia.co.uk/reefine/demo\_basic

I guess this has to be achieved using JavaScript/AJAX, but I have no idea where to start building something like this.

So, can anyone please steer me in the right direction?

# Answer
One method is to check which checkboxes are checked, build a URL containing multiple tags which is recognized by Tag (see the Tag documentation about multiple tags in the URL when using `{exp:tag:entries}`), and redirect to this URL. Here's an example:

Assuming you have these three example tag checkboxes:

```
<input type="checkbox" name="tag[]" value="foo"> Foo<br/>
<input type="checkbox" name="tag[]" value="bar"> Bar<br/>
<input type="checkbox" name="tag[]" value="baz"> Baz<br/>

```

The following script will check if you checked the checkbox you just clicked, and if you did, build a string of tags to use when redirecting to the new URL:

```
$(document).ready(function (){

    $("input[name='tag[]'").click(function(e) {
        if($(this).is(":checked"))
        {
            tagUrlString = '';

            $("input[name='tag[]'").each( function (index) {
                console.log($(this));
                if($(this).is(":checked"))
                {
                    tagUrlString = tagUrlString + $(this).val() + ',';
                }
            });

            window.location.href = 'http://mysite.com/template-group/template/tag/' + tagUrlString;
        }
    })

});

```

Of course, you could remove the outer `if($(this).is(":checked"))` conditional so that the above redirection is triggered even when unchecking a checkbox (i.e. simply by clicking a checkbox).

Hope this helps moving you ahead. (Note: the above code was minimally tested. Tweak for your needs).
> 1 votes

---
Tags: channel-entries, solspace, filter, solspace-tag
---


# Question
Title: Custom no results page not showing, shows default page
I am trying to get a custom no search result page working and all I keep getting is the standar white background/ gray box with the text,

```
Search Results:
Your search did not return any results.
Return to Previous Page

```

My code for my simple search form is as follows:

```
<div class="search_box search_results_page">
                {exp:search:simple_form channel="recipes" id="recipe_search" result_page="recipes/search-result"  no_result_page="recipes/no-results" }
                    <span class="search_box_content">
                        <label for="keywords">Search:</label>
                        <input type="text" name="keywords" id="keywords" class="clear_default" value="Search for a recipe" size="18" maxlength="100">
                        <input id="recipe_submit" type="submit" value="" class="submit">
                    </span>
                {/exp:search:simple_form}
            </div>

```

The template DOES exist and lives in the same template.group as the search template.

I have also looked at this thread: Simple Search returns System Message template for No Results even when 'no\_result\_page' set

But that doesn't seem to have helped me either, I get an error:

```
Fatal error: Call to undefined function ee() in /home/sites/justmilk.com/public_html/dev.justmilk.com/jmadmin/expressionengine/modules/search/mod.search.php on line 1262

```

I am fairly new to EE so any ideas hints tips would be appreciated.

# Answer
My No Results Page had this code, which is incorrect:

```
{exp:search:search_results}

    <p>We have been unable to find any results for '{exp:search:keywords}'</p>

{/exp:search:search_results}

```

I found the answer I was looking for here:

http://ellislab.com/forums/viewthread/242817/

By using this code:

```
Sorry, there are no results for '{exp:search:keywords} {exp:search:keywords} {/exp:search:keywords}'

```

This fixed the error. All that is left to do is clean up my template.
> 1 votes

---
Tags: search, simple-search, no-results
---


# Question
Title: How to use EE classes like DB,channel API from a php file
I have a requirement in one of my EE site wherein I need to insert some data in tables and make some channel entries using EE channel API,I am able to do this within a EE template using database class or channel API..like

```
 $this->EE->db->insert("INSERT QUERY");

```

But I have to do the same thing from a Php file which is located at root (same level of index.php file). Can anyone please help me out here.

I want to know what files to be included and what classes to be initiated or anything to be able to use EE object ($this-\>EE) within in a php file (located at root).

# Answer
> 1 votes
Check out Rob Sanchez' EE Bootstrap: https://github.com/rsanchez/ExpressionEngine-Bootstrap

It does just what you're looking for. I've used it myself for some projects where I didn't want to put code inside an EE add-on.

---
Tags: php, database, channel-entries-api
---


title: Grouping Related Entries by Category

text:
# Question
Title: Grouping Related Entries by Category
I'm trying to set up a template that will group related entries by category, and display the category name and description for the first entry of each category set.

For example, this page will display an entry for a restaurant menu. The title and description for the menu are part of a single channel entry, followed by the items on the menu, which are all related entries from a products channel:

> # Menu Title
>
> Menu Description
>
> ## Appetizers
>
> ### Item 1
>
> ### Item 2
>
> ### Item 3
>
> ## Salads
>
> ### Item 1
>
> ### Item 2
>
> ### Item 3
>
> etc.

So my template code is like this:

```
{exp:channel:entries channel="menus"}
     <h1>{menu_title}</h1>
     {menu_description}
     {menu_items}
          Here's where I get stuck.
     {/menu_items}
{/exp:channel:entries}

```

I can readily display the category info with the categories tag pair:

```
{menu_items:categories}
     {category_name}
{/menu_items:categories}

```

What I can't seem to do is group them together, identify the first item etc.:

```
{menu_items:categories}
     {if count == 1}<h2>{category_name}</h3>{/if}
     <h3>{menu_items:product_name}</h3>
{/menu_items:categories}

```

I've tried several variations of the category\_archive tag, as well as the Category Sorted Entries plugin, but to no avail.

I've also tried to back into it, by starting with the categories first, but it all get very convoluted, very quickly.

I feel like there has to be a more direct approach to sorting related records. Am I wrong?

Thanks,

ty

# Answer
I managed to achieve it using embeds. It's not ideal, but it works:

```
{exp:channel:categories category_group="1" style="linear"}
     {embed="menu/_menu_entry" catID="{category_id}" catURL="{category_url_title}" catNAME="{category_name}" catDESC="{category_description}"}
{/exp:channel:categories}

```

And then the embedded template searches the related entries by category:

```
{exp:channel:entries channel="menus" limit="1"}
     {menu_items category="{embed:catID}"}
          {if menu_items:count == 1}
        <div class="category-heading">
            <h3>{embed:catNAME}</h3>
            <div class="item-note"><p>{embed:catDESC}</p></div>
        </div>
    {/if}
        <div class="item">…

```

And then the items follow. The loop repeats for each category in the group, resulting in the desired format. It has the added advantage of being fully dynamic, so if the client adds, edits, or deletes categories, it still works.
> 0 votes

# Answer
I would look at using Playa's var\_prefix parameter to avoid conflicts between your Playa variables and the outer tag pair.

Another potential issue I can see is that Playa sets the disable tag parameter to “categories|category\_fields|member\_data|pagination” by default, and you need to use the disable parameter to specify a smaller list of features to disable if you would like {categories} to be available.

Give this a try:

```
{exp:channel:entries channel="menus"}
     <h1>{menu_title}</h1>
     {menu_description}
     {menu_items var_prefix="m" disable="member_data|pagination"}
        {if "{m:count}" =="1"}
        {m:categories limit="1"}<h2>{category_name}</h2>{/m:categories}
        {/if}
        <h3>{m:product_name}</h3>
     {/menu_items}
{/exp:channel:entries}

```
> 0 votes

---
Tags: relationships, categories, related-entries
---


title: Images disappearing from Matrix field

text:
# Question
Title: Images disappearing from Matrix field
I got a weird one here, so I don't expect an exact answer, but more of a pointer in the right direction:

I'm working on a site and everything works as expected on my local server, but when I move it to staging server, images in a file Matrix column don't "stick" so to speak. When I create the entry, everything is normal, it actually seems to populate the DB since the entry appears on the site just fine, including the images, but when I go back and try to edit that same entry, the images are gone from the Matrix field (and not from plain old file fields). If I save the entry again, the images don't show up anymore on the site so it's not a problem of thumbnails not showing up on the publish page… Matrix seems to not be able to tell that images are in that field and they show up as empty on the publish page even though the images show up on the site.

The only difference I can think of is the server's setup. My local MAMP which works fine runs PHP 5.3.14. The server where Matrix doesn't work runs PHP 5.4.8.

The site runs on EE v2.3.1 + Matrix 2.2.2.1

As I mentioned before, any pointer in the right direction would be more than enough. I just don't even know where to start to troubleshoot… Thanks!

# Answer
> 3 votes
It seems this problem can now be fixed by updating to the latest version of Matrix (2.5.10) per the change log found here: http://docs.pixelandtonic.com/matrix/changelog.html

> **Matrix 2.5.10**
> Released on November 4th, 2013
> Fixed a PHP error that would prevent File cells from saving properly.

I havn't confirmed this yet, but it's in the change log. I'll be going down this path tomorrow, so I'll post my findings once I confirm that this does indeed fix the problem.

# Answer
> 1 votes
First, updating EE and Matrix is the first step

Are you seeing those entries in the exp\_matrix tables? Before and after?

And lastly, do you see any JS errors in your browser dev console?

# Answer
> 0 votes
Have you doubled-checked that in the Fields for your channel that you have File selected as the fieldtype for Matrix and have set which directory it's allowed to access and which file type (image/all) are allowed to be posted?

Failing that I'd try and synchronise your image upload directories in File Manager \> File Upload Preferences. Also ensure that paths and permissions are correct.

What does that yield?

# Answer
> 0 votes
Do all the files disappear, or just some? Do the file names contain any foreign/weird characters? Have you tried deleting and re-uploading the files to the server?

I had an issue where a single file kept disappearing from Publish page AND from the site. Every time I modified the entry I added the file, every time I saved it the file was gone. My quick troubleshoot lead me to rename and re-upload the file in question. It was a dwg file with ä and ö characters in its name. After changing those to a and o the problem went away. I never had the time to double check that those characters were really the issue, but Matrix nor Assets upgraded didn't help, renaming and re-uploading did.

---
Tags: matrix
---


# Question
Title: Field Editor: Unable to load the requested class: services_json
Since i'm not getting any response in the official support forum for FIELD EDITOR I decided to repeat the question over here in the hope someone out there knows how to solve this.

Since i started development on a ee 2.8.1 system i’m getting a "Unable to load the requested class: services\_json" error when i try to save changes to my custom field group using FIELD EDITOR.

Googling the error helped me find a similar error in the Zoo Flex Admin add-on but the solutions posted there didn't help me fix this issue. http://devot-ee.com/add-ons/support/zoo-flexible-admin/viewthread/12713

Do you have any clue how to fix this?

Greets, Bas

# Answer
> 6 votes
Search your Field Editor files for this line:

```
$this->EE->load->library('services_json');

```

I believe it's in `mcp.field_editor.php` and `libraries/Package_installer.php`. Delete those lines. It's not necessary for newer versions of EE.

I do not know if there are any other issues with Field Editor and EE 2.8, but this should clear up this particular issue.

---
Tags: field-editor
---


# Question
Title: Change name-attributes in Tell-a-friend-form?
When I use the tell-a-friend-form the form is autogenerated by the tag

```
{exp:email:tell_a_friend ...}

```

Now the name of the sender has to be "from", the name of the recipient has to be "to". Simplified example for the form generated:

```
<form method="post" action="http://www.xyz.com">
<input type="email" name="from">
...
</form>

```

Now it's important for me to change the names, because the Bootstrap-Validator astonishingly seems not to accept the same element-name twice on one page.

Is this possible or does anybody know a workaround?

Thanks in advance!

# Answer
> 1 votes
Not with the Tell A Friend form, no - these values are hard-coded, so you must submit an `input` with `name="to"`.

I suppose you could use a different `name`, then use some javascript on form submission that clones that value into a new input named `to`.

Note that although you can have form inputs with the same `name` attribute across different forms in the same document, make sure they have different `id` attributes.

---
Tags: forms, tell-a-friend
---


# Question
Title: Is there something like Low Reorder just for Categories?
I'm in the process of taking things out of our codebase and into content where they belong, things like navigation and listings of categories. I really enjoy the features offered up by the Low Reorder add-on. I use Draggable to manage the order of categories within a category group, but I would only need a subset of these categories.

E.g. given a category group of:

* Alpha
* Beta
* Carrot
* Doc
* Elephant
* Mouse

I may just want 3 of those in a custom order in one place, 4 of them in a different order in another, but all I'd need are the category names, url\_titles, and in the desired sequence. Don't need entries. Just the categories.

I might just go ahead and make a channel just for entries with 1:1 relation to categories (maybe along with a WB Category Select field as the relation) and then use Low Reorder to create subsets as desired. But I really want to avoid having to essentially enter content twice and any overhead of channel:entries when all I really need is a list of category names and url\_titles. I suppose a bonus would be getting to using the entry title over the category name as an option or something.

I could add custom fields to the category group(s), but then you wouldn't be looking at the set in front of you.

Before I set off to do this I figured I might as well ask the community if there is anything like Low Reorder just for categories? Or if there's an existing module, add-on, or method to do this that slip passed me?

Thanks.

# Answer
> 1 votes
I wound up using Taxonomy v3.

I was thinking of going the "easy" route of just using existing channels and using Low Reorder in a somewhat ad-hoc basis... but a few things occurred to me which I was neglecting:

* `{exp:channel:entries}` is expensive. Better to avoid it.
* Every time I add a new entry it would still be added to a set which is made worse if there are multiple sets to a channel.

All I really needed was a way to make simple, customizable lists that preferably tied *directly* to categories and/or entries. Tying things to categories doesn't seem to exist, so perhaps a way to match url\_titles and mentioning the category group id somewhere.

Going through devot-ee I narrowed my options down to NavEE and Taxonomy. NavEE is really simple and looks like it'd help get the job done, but for $10 more Taxonomy offers further customization via custom fields. I kind of dislike having to refer to trees via their id as opposed to some kind of text reference as it's just easier code-wise between development and other versions of a site... but it's got enough features for my needs.

To simulate a list of categories I make a new tree and add custom links where the link is the category's url\_title. If needed I can add a custom field to mention which group the category is in. ~~The "tricky" part is that using the `{exp:taxonomy:nav display_root="no"}` tag results in outputting~~ To avoid an unordered list e.g. `<ul>...loop thru nodes...</ul>` use `style="linear"` (haven't tried this yet, hat tip to @iain urquhart).

~~To work around it hypothetically you could use stash's list methods. I didn't spend a whole lot of time on it but I couldn't get `{exp:stash:set_list}` to work if it was wrapping it, but perhaps append\_list inside of it would work. What I ended up using was either surgeree's `strip_tags` method or stash get's strip\_tags parameter.~~

To get actual category data I use Cat2, I have my own fork that I can get custom field stuff. ...should have probably added a way to get the images, too...

In the end the one caveat that comes to mind is that if you change an url\_title of a category, you'd have to change this everywhere you have used it manually. May want to refer to the category's id instead of url\_title if that is an issue.

Now if I could just learn to cache instances of taxonomy and its results... and just cache in general... but that's another topic.

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


title: Pagination padding problem

text:
# Question
Title: Pagination padding problem
I have problem with the page\_padding parameters in paginate.. there's my code

```
{exp:channel:entries channel="serie_emission"  url_title="{segment_2}" disable="categories|category_fields|member_data" limit="1" status="open|OffMEO"}
    {exp:playa:parents channel="episode_emission" limit="6" var_prefix="ep" paginate="bottom" disable="categories|category_fields|member_data"}
        <div class="bloc1_element_listeVideo">
            <a href="{path='/emission/{url_title}/{ep:url_title}'}">
                <span class="titreElement_Video">TEXT</span>
                <span class="MeoElement_Video">{ep:entry_date format="%j %F %Y"}</span>
            </a>
        </div>
        {ep:paginate}
            {pagination_links   page_padding="5"} {!--  page_padding NOT WORKING --}
                <div class="paginationEmission">
                {first_page}
                        <a href="{pagination_url}" class="page-first"><<</a>
                {/first_page}
                {previous_page}
                        <a href="{pagination_url}" class="page-previous"><</a>
                    {/previous_page}
                    {page}
                        <a href="{pagination_url}" class="page-{pagination_page_number}                      {if current_page}active{/if}">{pagination_page_number}</a>
                    {/page}
                    {next_page}
                        <a href="{pagination_url}" class="page-next">></a>
                    {/next_page}
                    {last_page}
                        <a href="{pagination_url}" class="page-last">>></a>
                    {/last_page}
                </div>
            {/pagination_links}
        {/ep:paginate}
    {/exp:playa:parents}
</div> <!-- # bloc1_listeVideo -->
</div> <!-- #mobContent -->
{/exp:channel:entries}

```

Even if i have 10pages,, i only see 2 page on each 'side'..

Thanks

# Answer
> 0 votes
The `page_padding` parameter was added in EE 2.8, so you'll need to upgrade in order to use it.

---
Tags: playa, pagination
---


# Question
Title: PHP Error in PT Field Pack - Pill: "Array to string conversion Filename: fieldpack/ft.fieldpack_pill.php"
I'm not sure if I'm only just noticing this error, or if it just came up from some reason...

EE v2.7.2
PT Field Pack v2.1.1

**The Error:**

> A PHP Error was encountered
> Severity: Notice
> Message: Array to string conversion
> Filename: fieldpack/ft.fieldpack\_pill.php
> Line Number: 132

If I comment out line 132 in fieldpack/ft.fieldpack\_pill.php the error goes away, and the fieldtype *seems* to work just fine:

Any ideas what could be causing this? Is commenting the line out going to cause other problems?

# Answer
> 2 votes
I just had this issue too on same installation. I had installed a new fieldtype (Plate Picker), which uses the `$settings['options']` array too to store the field\_type settings. Problem is that P&T pill assumes all values inside `$settings['options']` are string values, but with my new field\_type they are not.

I didn't dig deeper into EE Fieldtypes to find out what's the default way to store field\_type options, so I don't know exactly who should fix this.

Instead of completely commenting out the line, you should be able to fix this by adding an extra line of code on line 130:

```
foreach($settings['options'] as $name => $label)
{
    if (is_array($label)) continue; // Added

    if ($r !== '') $r .= "\n";
    $r .= $name;
    if ($name !== $label) $r .= ' : '.$label;
    if (isset($settings['default']) && $settings['default'] == $name) $r .= ' *';
}

```

# Answer
> 2 votes
Field Pack gives you the option to specify a name and value pair, so in your field you could set:

```
[value] : [name]

```

which might equate to say

```
1 : Yes
0 : No

```

This would then display in your pill field as a Yes/No button, but allow you to use the value instead of the name in your template logic. eg.

```
{if pill_field == '1'}

```

The code you've commented out looks like its doing some checking on your field values, and *I think* its saying if the name and label are not identical, return the data in the format

```
$name : $label

```

So to answer your question, commenting this line out probably will have an impact on how the field works.

We use the field pack a lot but haven't come across this. I'd say its less likely to be an issue in the ft.fieldpack\_pill.php file though.

What have you set as the default values in the field?

---
Tags: php-errors, field-pack
---


title: query inside channel entries tag

text:
# Question
Title: query inside channel entries tag
I have a channel entry and I can return the {author\_id} but what I would like to do is return more fields from author

```
{title}
{business_name}

```

What is the best way to achieve this?

# Answer
You can use

```
{exp:member:custom_profile_data member_id="{author_id}"}
    <p>{username}</p>
{/exp:member:custom_profile_data}

```

Change the username tag in any member\_field you like,

List with the variables to use: ee user-guide

or you can also use your own custom tags
> 1 votes

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


# Question
Title: Zoo Triggers Path Paramter adding Root of Site to URL
I have EE running with Structure, Transcribe and Zoo Triggers, I have categories in my 'Shop' channel of 'cds', 'digital' and 'merchandise'. Zoo Triggers displays the categories correctly and it displays the entries related to that category correctly but the link it generates is adding the root of my site no matter what I put in the path parameter (my test site is in a sub folder of my main domain). So what I am getting from the following code is:

```
{exp:zoo_triggers:categories channel="shop_item" css_id="subNav" show_counter="no" path="{site_url}index.php/{segment_1}/category"}
     {category_name}
{/exp:zoo_triggers:categories}

```

www.mywebsite.com/http://www.mywebsite.com/clients/client-name/index.php/shop/category/cds

Instead of

http://www.mywebsite.com/clients/client-name/index.php/shop/category/cds

Anyone ever run into this before? Or have a fix for it?

Thanks. Stephen.

\** UPDATE \** This is now working as it should, Zoo Triggers released an update.

# Answer
> 0 votes
Double check your system settings and you config.php file to make sure it's not in there.

---
Tags: structure, transcribe, zoo-triggers
---


# Question
Title: Wygwam not showing or loading in Channel Entry
Upgraded our EE install to 2.8.1, installed Matrix plugin and also upgraded an older version from Wygwam to the latest version, but Wygwam isn't showing in the Matrix publish field. Any ideas or thoughts where to look?

# Answer
Have you cleared your browser cache, database cache and refreshed? Wygwam is very sensitive to this.
> 1 votes

---
Tags: matrix, wygwam
---


# Question
Title: Geofinder plugin - no longer works on EE2.8.1
I have a fresh install of EE2.8.1

I want to use the Geofinder plugin and do a location search. On my result page, I am getting serious errors.

```
Fatal error: Call to undefined method EE_Template::assign_relationship_data() in /vagrant/xxx.dev/system99/expressionengine/third_party/geofinder/mod.geofinder.php
Call Stack: 0.0000 644616 1. {main}() /vagrant/xxx.dev/index.php:0 0.0023 648744
 2. require_once('/vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php') /vagrant/xxx.dev/index.php:188 0.1334 2785712
 3. call_user_func_array() /vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php:319 0.1334 2785848
 4. EE->index() /vagrant/xxx.dev/system99/codeigniter/system/core/CodeIgniter.php:0 0.1334 2785928
 5. EE_Core->generate_page() /vagrant/xxx.dev/system99/expressionengine/controllers/ee.php:68 0.1346 2966928
 6. EE_Template->run_template_engine() /vagrant/xxx.dev/system99/expressionengine/libraries/Core.php:703 0.1363 2994440 7. EE_Template->fetch_and_parse() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:157 0.1534 3191400
 8. EE_Template->parse() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:209 0.1542 3199400
 9. EE_Template->tags() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:466 0.1621 3217496
 10. EE_Template->process_tags() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:1178 0.1707 4095136
 11. Geofinder->location_results() /vagrant/xxx.dev/system99/expressionengine/libraries/Template.php:1559

```

Have anyone went around it

Thanks

Developer - Rob

# Answer
> 3 votes
I have gotten this to work with a little massaging. I am trying to contact big robot and send them the patch currently. But you can change the plugin in two places to get it working.

In the mod.geofinder.php file around line 169 you can change

```
$this->EE->TMPL->tagdata = $this->EE->TMPL->assign_relationship_data($this->EE->TMPL->tagdata);
$this->EE->TMPL->var_single = array_merge($this->EE->TMPL->var_single, $this->EE->TMPL->related_markers);

```

to

```
if (version_compare(APP_VER, '2.6.0', '<')) {
    $this->EE->TMPL->tagdata = $this->EE->TMPL->assign_relationship_data($this->EE->TMPL->tagdata);
    $this->EE->TMPL->var_single = array_merge($this->EE->TMPL->var_single, $this->EE->TMPL->related_markers);
}

```

and you need to change the function render\_with\_page\_fix($channel, $limit, $offset) to a completely different function

```
function render_with_page_fix($channel, $limit, $offset) {
        if ($channel->enable['pagination'] == TRUE)
        {

            if (version_compare(APP_VER, '2.8', '>=')) {
        $this->EE->load->library('pagination');
        $pagination = $this->EE->pagination->create();
        $this->EE->TMPL->tagdata = $pagination->prepare($this->EE->TMPL->tagdata);
        $total_items = $channel->total_rows;
        $per_page = $this->EE->TMPL->fetch_param('limit');
        $pagination->build($total_items, $per_page);
        if ($pagination->paginate === TRUE)
        {
          $pagination->build($total_items, $per_page);
        }

        return $pagination->render($channel->return_data);
      } else {
                $channel->pagination->EE->pagination->total_rows = $channel->total_rows;
                $channel->pagination->get_template();
                $channel->return_data = preg_replace(
                    "/".LD."paginate".RD.".+?".LD.'\/'."paginate".RD."/s",
                    "",
                    $channel->return_data
                );
                $channel->pagination->build($channel->total_pages);

                $config = array();
                $config['first_url']    = rtrim($channel->pagination->basepath, '/');
                $config['base_url']     = $channel->pagination->basepath;
                $config['prefix']       = 'P';
                $config['total_rows']   = $channel->total_rows;
                $config['per_page'] = $limit;
                // cur_page uses the offset because P45 (or similar) is a page
                $config['cur_page'] = $offset;
                $config['first_link']   = lang('pag_first_link');
                $config['last_link']    = lang('pag_last_link');
                $config['uri_segment']  = 0; // Allows $config['cur_page'] to override

                $channel->pagination->EE->pagination->initialize($config);
                $channel->pagination->page_links = $channel->pagination->EE->pagination->create_links();
                $channel->pagination->EE->pagination->initialize($config); // Re-initialize to reset config
                $channel->pagination->page_array = $channel->pagination->EE->pagination->create_link_array();

                $channel->pagination->current_page = floor(($offset / $limit) + 1);
                $channel->pagination->total_pages = $channel->total_pages;

                return $channel->pagination->render($channel->return_data);
            }
        } else {
            return $channel->return_data;
        }
    }

```

That should get it working.

Cory

---
Tags: cartthrob, geofinder
---


# Question
Title: Unable to connect to database using WAMP
I turned debugging on with my local installation, and find out that i cant get into database.

A Database Error Occurred Unable to connect to your database server using the provided settings.

Filename: C:\wamp\www\siteA\system\codeigniter\system\database\DB\_driver.php

Line Number: 124

I have checked the config and database.php files and all should be good to go. Any idea what i could do, to get into CP?

Thanks in advance.

# Answer
It sounds to me like you'll need to setup a multi-environment `/system/expressionengine/config/database.php` file. Here's a glimpse of how I typically set mine up:

```
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ($_SERVER['HTTP_HOST']  == 'PRODUCTIONSERVER.com') {

    $active_group = 'production';

} elseif ($_SERVER['HTTP_HOST']  == 'DEVELOPMENTSERVER.com') {

    $active_group = 'development';

} elseif ($_SERVER['HTTP_HOST']  == 'YOURLOCALDOMAIN.dev') {

    $active_group = 'local';

} else {

    $active_group = 'production';
}

$db['local']['hostname'] = 'localhost';
$db['local']['username'] = 'root';
$db['local']['password'] = 'YOUR PASSWORD';
$db['local']['database'] = 'DATABASENAME';
$db['local']['dbdriver'] = 'mysql';
$db['local']['pconnect'] = FALSE;
$db['local']['dbprefix'] = 'exp_';
$db['local']['swap_pre'] = 'exp_';
$db['local']['db_debug'] = TRUE;
$db['local']['cache_on'] = FALSE;
$db['local']['autoinit'] = FALSE;
$db['local']['char_set'] = 'utf8';
$db['local']['dbcollat'] = 'utf8_general_ci';
$db['local']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';

$db['development']['hostname'] = 'DEV HOST NAME';
$db['development']['username'] = 'DEV USER NAME';
$db['development']['password'] = 'DEV PASSWORD';
$db['development']['database'] = 'DEV DATABASE';
$db['development']['dbdriver'] = 'mysql';
$db['development']['pconnect'] = FALSE;
$db['development']['dbprefix'] = 'exp_';
$db['development']['swap_pre'] = 'exp_';
$db['development']['db_debug'] = TRUE;
$db['development']['cache_on'] = FALSE;
$db['development']['autoinit'] = FALSE;
$db['development']['char_set'] = 'utf8';
$db['development']['dbcollat'] = 'utf8_general_ci';
$db['development']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';

$db['production']['hostname'] = 'PRODUCTION HOST NAME';
$db['production']['username'] = 'PRODUCTION USER NAME';
$db['production']['password'] = 'PRODUCTION PASSWORD';
$db['production']['database'] = 'PRODUCTION DATABASE';
$db['production']['dbdriver'] = 'mysql';
$db['production']['pconnect'] = FALSE;
$db['production']['dbprefix'] = 'exp_';
$db['production']['swap_pre'] = 'exp_';
$db['production']['db_debug'] = TRUE;
$db['production']['cache_on'] = FALSE;
$db['production']['autoinit'] = FALSE;
$db['production']['char_set'] = 'utf8';
$db['production']['dbcollat'] = 'utf8_general_ci';
$db['production']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';

?>

```

I hope that helps!
> 2 votes

# Answer
hummm try to have a look on your .htaccess file. And have a look to in the index.php in the site root to verify the system path:

```
 $system_path = './system';

```

The path on your local/wamp server could be different from the production site
> 1 votes

# Answer
The basing settings inside (database.php in the config folder) when using Wamp for EE are:

```
    $db['expressionengine']['hostname'] = 'localhost';
    $db['expressionengine']['username'] = 'root';
    $db['expressionengine']['password'] = '';
    $db['expressionengine']['database'] = 'name_of_your_database';
    $db['expressionengine']['dbdriver'] = 'mysql';$db['expressionengine']['pconnect'] = FALSE;
    $db['expressionengine']['dbprefix'] = 'exp_';
    $db['expressionengine']['swap_pre'] = 'exp_';
    $db['expressionengine']['db_debug'] = TRUE;
    $db['expressionengine']['cache_on'] = FALSE;
    $db['expressionengine']['autoinit'] = FALSE;
    $db['expressionengine']['char_set'] = 'utf8';
    $db['expressionengine']['dbcollat'] = 'utf8_general_ci';
    $db['expressionengine']['cachedir'] = '/localhost/system/expressionengine/cache/db_cache/';

```
> 0 votes

---
Tags: control-panel, database
---


# Question
Title: Expresso Store - Stripe Payment Gateway - token submitted, error: 'undefined' is not a function (evaluating '$checkout_submit.off("click")')
I'm getting this error on the final step of my checkout process with Stripe.

```
'undefined' is not a function (evaluating '$checkout_submit.off("click")')

```

The page doesn't reload, the button has no function and is not submitting.

* I have the correct name on the submit button
* Correct Private and Public API Key with Stripe and in the JS
* The token is passing through to the hidden field in my template
* I'm not registering a member on checkout
* inline errors are off

The checkout html is as follows (I apologize for the spacing, I've removed the containing grid divs):

```
{exp:store:checkout
 form_class="form-horizontal"
 return="store/order/ORDER_HASH"
 secure="yes"
}

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

   <h3>Billing Details</h3>
   <p>{billing_name}<br />
   {billing_address1}<br />
   {billing_address2}<br />
   {billing_city} {billing_postcode}<br />
   {billing_state_name}<br />
   {billing_country_name}<br />
   {billing_phone}<br />
   {order_email}</p>

                      <h3>Shipping Details</h3>
                          <p>{if shipping_same_as_billing}
                                  Same as Billing Details
                              {if:else}
                                  <b>{shipping_name}</b><br />
                                  {shipping_address1}<br />
                                  {shipping_address2}<br />
                                  {shipping_city} {shipping_postcode}<br />
                                  {shipping_state_name}<br />
                                  {shipping_country_name}<br />
                                  {shipping_phone}</p>
                              {/if}

            <legend>Payment</legend>

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

            <div class="control-group">
                <label class="control-label" for="payment_method">Payment Method</label>
                <div class="controls">
                    <select id="payments" name="payment_method">
                        <option value="Stripe" selected>credit card</option>
                        <!--<option value="paypal_express">paypal</option>-->
                    </select>
                </div>
            </div>

            <div class="pays" id="paypal_express" style="display:none">
            <h3>Checkout with Paypal</h3>

            <input type="text" name="order_email" placeholder="Your Email Address" />

            </div><!-- end paypal -->

            <div class="pays" id="Stripe">

              <div class="control-group">
                  <label class="control-label" for="payment_card_no">Card No</label>
                  <div class="controls">
                      <input type="text" id="payment_card_no" data-stripe="number" value="" />
                  </div>
              </div>

              <div class="control-group">
                  <label class="control-label" for="payment_name">Name</label>
                  <div class="controls">
                      <input type="text" id="payment_name" data-stripe="name" value="" />
                  </div>
              </div>

              <div class="control-group">
                  <label class="control-label" for="payment_exp_month">Expiry</label>
                  <div class="controls">
                      <select id="payment_exp_month" data-stripe="exp-month" style="width:auto">
                          <option value=""></option>
                          {exp_month_options}
                      </select>
                      <select id="payment_exp_year" data-stripe="exp-year" style="width:auto">
                          <option value=""></option>
                          {exp_year_options}
                      </select>
                  </div>
              </div>

              <div class="control-group">
                  <label class="control-label" for="payment_csc">CVC</label>
                  <div class="controls">
                      <input type="text" id="payment_csc" data-stripe="cvc" value="" class="input-mini" />
                  </div>
              </div>

        <input type="hidden" id="payment_token" name="payment[token]" value="" />

        <div class="form-actions">
            <a href="{path='store/checkout2'}" class="btn">Back</a>
            <input id="checkout_submit" type="submit" name="submit" value="Place Order" class="btn btn-success" />
        </div>

```

Javascript:

```
$( document ).ready(function() {

 $(function() {
  $.getScript('https://js.stripe.com/v2/', function() {
      Stripe.setPublishableKey('pk_live_xxxxxxxxxxxxxxxxxxxxxxx');
  });

  $checkout_submit = $("#checkout_submit").click(function() {

      if ($("[name='payment_method']").val() == "Stripe") {

          $checkout_submit.attr('disabled', true);

          Stripe.card.createToken(${(this.form), stripeResponseHandler);

          return false;
      }

   });

  function stripeResponseHandler(status, response) {
      /* Re-enable the checkout submit button */
      $checkout_submit.attr('disabled', false);

      /* Check whether we have a valid credit card */
      if (response.error) {
          alert(response.error.message);
      } else {
          /* Set the card token and submit the checkout form */
          $("#payment_token").val(response.id);
          $checkout_submit.off("click").click();
      }
    }
});

```

});

# Answer
You haven't posted your javascript code, so it's hard to tell exactly where the error is coming from. However,

```
'undefined' is not a function (evaluating '$checkout_submit.off("click")')

```

means that `$checkout_submit` is undefined. That means you haven't created this variable yet. So presumably, right before this error you want to do something like:

```
var $checkout_submit = $("#my_checkout_button");

```

My guess is that you already have something along these lines, but there is a typo in the variable name.

Update:

Yes, you can normally assign variables like that in javascript:

```
var $checkout_submit = $("#checkout_submit").click(function() {
    // etc
});

```

However, the `$checkout_submit` variable won't be defined **inside** the callback function, because it doesn't actually exist until **after** the `click()` method finishes executing. So you need to split it into two lines:

```
var $checkout_submit = $("#checkout_submit");
$checkout_submit.click(function() {
    // now you can use $checkout_submit here
});

```
> 2 votes

---
Tags: expresso-store
---


title: Total for {item:quantity} in CartThrob

text:
# Question
Title: Total for {item:quantity} in CartThrob
I am looking for a way to output the total amount of products purchased, similiar to {exp:cartthrob:total\_items\_count} for the cart only that I want to pull it from the "orders" channel (to be used in the order confirmation email).

I have:

```
Articles ordered: {order_items:total_results}

```

Which outputs how many *different* articles were purchased but not the **totals**. Like if a customer bought:

2 x Product A

3 x Product B

the above tag would output "2". I am now looking for a way to also output "5".

I have tried all different kind of tag combinations and fiddled around with CT arithemtic also but can't get it straight. Maybe this is only possible with an sql query, but since I am not good with those I am first asking here.

Thanks and Cheers

# Answer
> 0 votes
We came across this issue before and used the query module like this to get the total item count.

```
{exp:query sql="SELECT SUM(quantity) AS total_items_count FROM exp_cartthrob_order_items WHERE order_id = {entry_id}"}
{total_items_count}
{/exp:query}

```

You'll probably need to use this outside of your *order\_items* tag pair as it would be in a loop that might not get you the result you want.

Also, we never used this in the confirmation email, but in a *My Account* page on the site - but this is the query to get the information you want.

---
Tags: cartthrob
---


# Question
Title: Weird If statement behaviour inside channel:form
I'm building a page containing a channel form to allow users to edit their posts, and I thought I'd add an `{if}...{/if}` statement to prevent them editing other users' entries. The permissions on the channel are set correctly, but this was just to get around the error message on form submission. So I added this:

```
{exp:channel:form .... entry_id="{segment_3}"}
  {if author_id <> member_id}
    {redirect="home"}
  {/if}
{/exp:channel:form}

```

The issue then, was that the code redirected even when author\_id = member\_id. This seemed bizarre, so as a test, I changed the above code to read:

```
{exp:channel:form .... entry_id="{segment_3}"}
  {if author_id <> member_id}
    Not Equals
  {if:else}
    Equals
  {/if}
{/exp:channel:form}

```

and found that regardless of which entry I edit, the statement returned

> Not Equals

Upon a bit more playing around, I found that if I add an `{author_id}` tag above the `{if}...{/if}` statement, it worked properly. It seems that unless I echo the `{author_id}` before the comparison, `{author_id}` is... blank?

Can someone explain this?

# Answer
> 1 votes
That sounds like expected behaviour. If you're using `{author_id}` in the context of a Channel Form then it is to *submit* and entry into ExpressionEngine. Therefore until you do make a submission the form has no `author_id` even though the entry does. It's a little different to the Channel Entries tag in that respect as that's just retrieving an entry.

By outputting `{author_id}` before the conditional in the same template you're effectively setting a value to be compared. You could get around this by simply setting the `author_id` as a hidden input above the conditional in a similar way as you're doing now, or you could pass it in as an embed variable.

Looking at what you're trying to achieve however, you could just look to include the `author_only="yes"` parameter to the Channel Form along with a return parameter.

```
{exp:channel:form channel="my_channel" entry_id="{segment_3}" author_only="yes" return="template_group/template/ENTRY_ID"}

    ...

{/exp:channel:form}

```

This would then ensure that only the author of the entry can edit it and would fall back to the system Message Pages if the user isn't authorised. *You can then style or control those how you choose but that's another question in itself. :)*

---
Tags: conditionals, channel-form, ifelse
---


# Question
Title: Disabling Cartthrob via database - How to?
I have large scale website with cart throb added version 2.00xx. I have updated the EE from 2.1.3 to the latest 2.8.1 and I've got a lot of errors, but at least I had cp available. Under extensions section I had list of extensions - some of them was disabled - including Cartthrob pro. Since I enabled it, I completely lost the CP. Now it shows blank page. I'll really appreciate somebody to give me a tip how can I disable this extension via my sql admin by directly changing a record in the database?

# Answer
> 3 votes
You can temporarily disable ALL addons by adding this to your config file:

```
$config['allow_extensions'] = 'n';

```

This should allow you to access the Control Panel and then attempt to delete Cartthrob from there (if you're sure you don't want to delete all your sales data!). If that fails then look in the `exp_modules` and `exp_extensions` tables in the database and delete any and all entries for Cartthrob in there (as Cartthrob comprises of both a Module and an Extension). This will effectively delete Cartthrob and you should be able to load up your Control Panel and allow all other extensions in your config.php file again.

The `exp_cartthrob_x` tables will still remain in the database but you can delete these if you're absolutely sure you don't want any of your ecommerce data.

---
Tags: cartthrob, add-on, database
---


# Question
Title: Email Contact Form and multiple required fields
Based on EE documentation to have multiple required fields I need to make the name= attribute an array by using "required\[\]" but when I do that those fields still are not required (no errors returned).

Form code looks like:

```
        {exp:email:contact_form user_recipients="no" recipients="myemail@domain.com" charset="utf-8"}
        <div class="col-md-6">
            <fieldset id="contact_details">
            <table class="table table-hover">
            <tbody>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="company">Company Name <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Company Name" id="company" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="fname">First Name <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="First Name" id="fname" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="name">Last Name <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Last Name" id="name" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="address1">Address <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Address" id="address1" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="address2">Address 2</label>
            <div class="col-md-9"><input type="text" class="input-text" value="" title="Address 2" id="address2" name="address2"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="city">City <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="City" id="city" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="state">State/Province <span class="required">*</span></label>
            <div class="col-md-9">
                            <select class="required-entry" id="state" name="required[]">
                            <option value="">State/Province</option>
                            <option value="AL">Alabama</option>
                            <option value="AK">Alaska</option>
                            <option value="AZ">Arizona</option>
                            <option value="AR">Arkansas</option>
                            <option value="CA">California</option>
                            <option value="CO">Colorado</option>
                            <option value="CT">Connecticut</option>
                            <option value="DC">District of Columbia</option>
                            <option value="DE">Delaware</option>
                            <option value="FL">Florida</option>
                            <option value="GA">Georgia</option>
                            <option value="HI">Hawaii</option>
                            <option value="ID">Idaho</option>
                            <option value="IL">Illinois</option>
                            <option value="IN">Indiana</option>
                            <option value="IA">Iowa</option>
                            <option value="KS">Kansas</option>
                            <option value="KY">Kentucky</option>
                            <option value="LA">Louisiana</option>
                            <option value="ME">Maine</option>
                            <option value="MD">Maryland</option>
                            <option value="MA">Massachusetts</option>
                            <option value="MI">Michigan</option>
                            <option value="MN">Minnesota</option>
                            <option value="MS">Mississippi</option>
                            <option value="MO">Missouri</option>
                            <option value="MT">Montana</option>
                            <option value="NE">Nebraska</option>
                            <option value="NV">Nevada</option>
                            <option value="NH">New Hampshire</option>
                            <option value="NJ">New Jersey</option>
                            <option value="NM">New Mexico</option>
                            <option value="NY">New York</option>
                            <option value="NC">North Carolina</option>
                            <option value="ND">North Dakota</option>
                            <option value="OH">Ohio</option>
                            <option value="OK">Oklahoma</option>
                            <option value="OR">Oregon</option>
                            <option value="PA">Pennsylvania</option>
                            <option value="RI">Rhode Island</option>
                            <option value="SC">South Carolina</option>
                            <option value="SD">South Dakota</option>
                            <option value="TN">Tennessee</option>
                            <option value="TX">Texas</option>
                            <option value="UT">Utah</option>
                            <option value="VT">Vermont</option>
                            <option value="VA">Virginia</option>
                            <option value="WA">Washington</option>
                            <option value="WV">West Virginia</option>
                            <option value="WI">Wisconsin</option>
                            <option value="WY">Wyoming</option>
                            </select>
                   </div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="zip">Postal Code <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Postal Code" id="zip" name="required[]"></div>
            </div>
            </td></tr>
        </tbody>
        </table>
        </fieldset>
        </div>

        <div class="col-md-6">
        <fieldset id="contact_details">
        <table class="table table-hover">
        <tbody>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="telephone">Telephone <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Telephone" id="telephone" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="telephone2">Telephone (Alternative)</label>
            <div class="col-md-9"> <input type="text" class="input-text" value="" title="Telephone Alternative" id="telephone2" name="telephone2"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="from">Email <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry validate-email" value="" title="from" id="from" name="from"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="message">ADD A NOTE <span class="required">*</span></label>
            <div class="col-md-9"><textarea rows="3" cols="5" style="height:150px;" class="input-text" title="Message" id="message" name="message"></textarea></div>
            </div>
            </td></tr>
        </tbody>
        </table>
        </fieldset>

        <div class="form-group">
            <input type="submit" style="margin-right:7px;" class="btn btn-block btn-plain pull-right" value="Submit" name="submit">
        </div>

        </div>
        {/exp:email:contact_form}

```

Any clue what is going on? Or maybe I should to use off the shelf extension like Solspace Freeforms?

# Answer
The Email Contact Form doesn't support custom fields other than the defaults of:

* From
* To
* Subject
* Name
* Message
* Captcha

By the looks of your example you're looking to include a lot more than that.

Solspace Freeform is a popular option but there are other notable options which may be a better fit for your needs including DevDemon Forms and ProForm. They're certainly worth investigating and generally with the power of these addons and the FreeForm being...well...free, the default Email Contact Form is something which I don't see used very often.
> 1 votes

---
Tags: forms, email-contact-form
---


# Question
Title: Low search to implement multiple channel entries
I have a problem in retrieving data from different channel field.

i want to search all enteries of news to check if its matched. Please tell me how i Can do that. I am writing my code below.

Below code is working for a single channel entry and not for multiple

```
{exp:low_search:form
     collection="news"
     search_mode="any"
     result_page="news/view"}
     <div id="txthint">dqwdqq</div>
     <input type="text" class="search-query input-small" name="search:title"  id="search:title" >
{/exp:low_search:form}

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

{/exp:low_search:results}

```

# Answer
Low Search's Form tag doesn't take any filter parameters, at least not since v3. You're defining 2 filter parameters (`collection` and `search_mode`) on the Form tag, but you should add these parameters to the Results tag or add them as (hidden) input fields in side the Form tag.

Also, I'd recommend using `name="keywords"` (utilizing the Keywords filter) instead of `name="search:title"` (which is the Field Search filter).
> 2 votes

---
Tags: low-search
---


title: Solspace-Rating Spam

text:
# Question
Title: Solspace-Rating Spam
I've implemented the solspce-ratings plugin on a client website and have enabled the captcha, but am still getting spammed. Any ideas on what else I can do to avoid getting spam ratings ?

# Answer
The best way to beat form spam for EE imho is to use http://devot-ee.com/add-ons/accessible-captcha, which turns captcha into a much better working q&a. This has solved all automated spam for me.
> 1 votes

# Answer
I am using the add-on Snaptcha, 14 US$. The user has to type nothing, it uses the honeypot-principle and generates a invisible field; spambots trying to fill out this field are blocked. It blocks literally 100-thousands of spam-attempts on my site, every some weeks one gets through. I could highly recommend this one.
> 0 votes

---
Tags: spam, solspace-rating
---


# Question
Title: Multiple Playa fields in Channel Form not updating
I am using {exp:zoo\_visitor:update\_form\> on a rather large Profile page for members to update their details.

It seems that you can only update one playa field at the time - I have experimented wrapping the {exp:zoo\_visitor:update\_form\> tags around all form entries and each separate but the Playa fields don't update together.

---

**Update**: I replaced all Playa fields with the native Relationships field (yikes!) but these fields seem to hold the data. There is also a Matrix field, which doesn't hold the data but after replacing this with the native Grid field it's behaviour maintains.

Surely this is all JS related but I am not able to debug this....

include\_jquery="no" has no effect.

---

## Running 2.7.3

# Answer
**FYI:** pushed by the need to keep using Matrix & Playa and not having to deal with the ugliness of the native Grid & Relationships fields (what were they thinking?) I resolved this issue by separating the Matrix and Playa fields into another template.

Convinced that these issues are caused by too many different jQuery calls and sequencing these correctly might resolve these issues.

The Profile page will require a small UI change, adding some sub navigation to the second template.
> 1 votes

---
Tags: matrix, playa, channel-form
---


title: Possible to generate yearly archives?

text:
# Question
Title: Possible to generate yearly archives?
Are there any plugins that make it possible to have yearly archives in EE? I'm talking about something like the current archives-by-month (January, February, etc. with the ability to paginate), but listing all entries posted in a full calendar year. I'm looking at moving to a responsive design, and want the date-based archives in the top menu like they are now...but I would love the option to link to a paginated template that lists all entries in a given calendar year (all entries in 2011, all entries in 2012, all entries in 2013...and so forth.) That would really shorten the top nav a LOT.

# Answer
> 3 votes
Actually, Low Yearly Archives should work for you, in combination with the native channel:entries tag. If you don't use the `{months}{/months}` variable pair to output the months, but just use the years to link to something like `/such/obsessive/distractions/2014`, then you could simply use the `year=""` parameter to output entries for that year.

# Answer
> 1 votes
Maybe this is what you are looking for? http://devot-ee.com/add-ons/low-yearly-archives

# Answer
> 0 votes
You could do that kind of archive using `stash` `match` and `against` parameters and pagination.

Have a look at the example here: https://gist.github.com/croxton/6219973

# Answer
> 0 votes
You can filter entries by using a year in the URL: mysite.com/archives/2012

```
{exp:channel:entries channel="my channel" year="{segment_2}"}
// show all entries from year in URL
{/exp:channel:entries}

```

Here's the documentation: http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#id68

---
Tags: ee2
---


# Question
Title: ee()->api_channel_entries->save_entry() $data argument
Based on the documentation, here is the signature for the method that inserts a new entry or update an existing one.

```
ee()->api_channel_entries->save_entry($data, $channel_id, $entry_id, $autosave);

```

My question is that, what should be the contents for $data?

Say for example I have Channel A which has only one custom field, "foo"

Do I do this?

```
$data = array (
    'title' => 'bar',
    'url_title' => 'bar'
    'foo' => 'bar'
);

```

or this?

```
$data = array (
    'title' => 'bar',
    'url_title' => 'bar'
    'field_id_<field id of foo>' => 'bar'
);

```

Or is the contents of `$data` should be something else entirely? Do I need to input required field?

# Answer
This is a pretty late answer, and you likely already figured it out, but the $data array should use the database 'field\_id\_#' as the array key. So if the field id of your custom field 'foo' is 5, for example, then your data array would be:

```
$data = array (
    'title' => 'bar',
    'url_title' => 'bar',
    'field_id_5' => 'bar',
);

```
> 4 votes

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


# Question
Title: Postmaster: Can we send HTML & Text in one email using multi-part MIME? If not, how do we line break in plain text?
I have looked at the Postmaster docs, other questions on ee.stackexchange, and the Postmaster support forums at devot:ee, but have not seen an answer for these two.

1. Can Postmaster send a multi-part MIME message with HTML and plaintext via the expressionengine mail service? If so, how?
2. If it can not send both HTML and plaintext in a single email, when sending in plaintext do I need to specify \r\n in the parcel code for linebreaks? Is the preview pane supposed to show plaintext linebreaks, or does it only parse html?

My preference settings for sending text email in the parcel editor look like this:

* **Mail Type:** Text
* **Protocol:** Mail
* **Character Set:** UTF-8
* **CRLF:** \r\n
* **Newline:** \r\n

If have tried the following variations in the parcel editor:

```
Dear {screen_name},
blahblahblah

Dear {screen_name},\r\n
blahblahblah

Dear {screen_name},"\r\n"
blahblahblah

```

None of the above combinations show a linebreak in the preview window.

# Answer
> 1 votes
The default support for both HTML and plain text emails is a little limiting right now. In Postmaster v2, I am going to redo the UI and make it possible to have two different templates for HTML and plain text. There is no ETA on this, but this by far the most requested and desired feature. The underlying API is already setup (for the most part) to handle this, but the way it currently works is like this:

If you create a new parcel with an HTML template, it will strip the tags and attempt to format the email as best as it can for the plain text version. If plain text is used by default, then no html version will be sent. The preview pane however is always setup display HTML formatted emails. This is an oversight and an inherent flaw in Postmaster v1.x. In version 2, I will like be removing the preview pane all together in favor of saving templates as files and previewing them like a regular template.

The email should send properly with the line breaks though. It's the preview pain that won't respect them.

---
Tags: postmaster, html-email
---


title: Relationships with Channel Videos

text:
# Question
Title: Relationships with Channel Videos
I am needing to obtain a count for every video being parsed through Channel Videos via relationship entries. I want to continue using a grid with my layout so the content can scale like the rest of the site.

I have a channel of entries which is nothing more than a DevDemon Channel Entries field which contains groups of videos. Each of these groups can be added to other channel entries as modules. So you may have a Lesson Module with 5 groups of videos and each video group could have 1-?? videos in it.

I was using an embed for the relationship loop, but I was loosing count each time and starting over at 0/1, so I started trying to calculate the numbers via raw PHP. I am completely open as a better way of doing this because I am banging my head against the desk. lol

Here was my latest attempt:

```
<ul class="classes available-classes clearfix">
    <?php $count = 0; ?>
    {exp:channel:entries
        disable="category_fields|member_data|pagination"
        category="1"
        channel="program_module"
        status="open"
        show_future_entries="no"
        show_expired="no"
    }
        {video_groups_to_include}
            {exp:channel_videos:videos
                status="open"
                entry_id="{video_groups_to_include:entry_id}"
            }
                <?php
                    $count++;
                    echo $count;
                    if( $count==1 || $count==5 || $count==9 || $count==13 || $count==17 || $count==21 || $count==25 || $count=29 || $count==33 || $count==37 || $count==41 || $count==45 || $count=49 || $count==53 || $count==57 || $count==61 || $count==65 || $count==69 ){
                        echo "<li class='row-fluid'><ul><li data-id='id-{video:id}' class='span3 {video_groups_to_include:categories}{category_name}{/video_groups_to_include:categories}'>";
                    }else{
                        echo "<li data-id='id-{video:id}' class='span3 {video_groups_to_include:categories}{category_name}{/video_groups_to_include:categories}'>";
                    }
                ?>
                    <a href="{site_url}lessons/{video_groups_to_include:categories}{category_url_title}{/video_groups_to_include:categories}">
                        <em class="overflow-hidden"><img src="{video:img_url_hd}" alt="{video:title}" /></em>
                        <span>
                            <strong>{video:title}</strong>
                            <i>{video:description}</i>
                        </span>
                    </a>
                <?php
                    $count++;
                    if( $count==4 || $count==8 || $count==12 || $count==16 || $count==20 || $count==24 || $count==28 || $count=32 || $count==36 || $count==40 || $count==44 || $count==48 || $count=52 || $count==56 || $count==60 || $count==64 || $count==68 || $count==72 ){
                        echo "</li><ul></li>";
                    }else{
                        echo "</li>";
                    }
                ?>
                </li>
            {/exp:channel_videos:videos}
        {/video_groups_to_include}
    {/exp:channel:entries}
</ul>

```

Hopefully it's clear what I am trying to achieve. Basically, I need a new row after ever 4th video parsed. (4 column layout)

# Answer
Ok, so for this one, I might have been able to use stash to store the videos and then dump them out, but I felt it was easier to just enable PHP on output for this template and use the following:

```
<?php $counter = 0; ?>
<ul class="portfolio recent-work clearfix">
    <li>
        <ul class="row-fluid">
            {exp:channel:entries
                disable="category_fields|member_data|pagination"
                category="1"
                channel="program_module"
                status="open"
                show_future_entries="no"
                show_expired="no"
            }
                {video_groups_to_include}
                    {exp:channel_videos:videos
                        status="open"
                        entry_id="{video_groups_to_include:entry_id}"
                    }
                        <?php $counter++; ?>
                        <li data-id='id-{video:id}' class='span3 {video_groups_to_include:categories}{category_name}{/video_groups_to_include:categories}' style="margin-right: 0;">
                            <a href="">
                                <em class="overflow-hidden"><img src="{video:img_url_hd}" alt="{video:title}" style="width: 100%;" /></em>
                                <span>
                                    <strong>{video:title}</strong>
                                    <i>{video:description}</i>
                                </span>
                            </a>
                        <?php if (($counter % 4) == 0) { echo "</li></ul><ul class='row-fluid'>"; } else { echo "</li>"; } ?>
                    {/exp:channel_videos:videos}
                {/video_groups_to_include}
            {/exp:channel:entries}
        </ul>
    </li>
</ul>

```

Hopefully this helps someone down the road...
> 0 votes

# Answer
You can easily do this with the switch variable. Have a look at my answer on this posting. The answer refers to matrix, but really it should be applicable in any looping tag pair that support the switch variable, and I think, though it's not mentioned in the documentation, it should be supported in Channel Videos.
> 0 votes

---
Tags: relationships, php, count, channel-videos
---


title: New to EE - looking for some insight

text:
# Question
Title: New to EE - looking for some insight
new to EE (version 2.6.1) although I have used a handful of CMS's like WP, Joomla and Teamsite.

I was tasked today with something I could use help with.

I need to create a submission form, that will store the form fields in a dbase, and display these records on a subsequent page.

Looks like EE is using MySQL 5.1.61

Example. You are a non profit company who wants to be listed in our "partners" page catalog.

You fill in our form:

* Organization name
* Products or Services
* Area of Service
* Keywords
* Contact Name
* Contact Email
* Contact Phone
* \[etc\]

Saves to dbase.

On the "Catalog of Partners" page... I basically read the dbase table and display each partner.

I can get into the "Manage Database Tables" section of admin console, but don't see how I can create my own table.

I also see what I think is some type of "addon" called "ProForms" which has some pretty straight forward settings, but doesn't look like there is a place to control the actual form fields I need?

Am just hoping for a bit of guidance. Thanks all.

# Answer
Welcome to the EE community!

Have a look at an add-on called Freeform. This is a free add-on that allows you to create different forms (there's a paid version if you need additional functionality, but from what you've said the free version should be fine). There's plenty of documentation to get you started as well.

Freeform saves all the entries to the database, so there's no need to go creating your own tables. You can then output any of the data submitted through Freeform using the {exp:freeform:entries} tag.

You can use EE's built in captcha (or other more accessibility friendly approach) to keep spam entries at bay, and you can set entries to have a pending status until you've validated them.

A different approach would be to allow people to register on the site using EE's member management features - registered users could then update their own profile through their member accounts. This would need a little more development work but make your *partners* page a little more self-service. Your proposed approach would work fine though.
> 2 votes

# Answer
The idea behind EE is that you don't need to manage database tables. using the admin interface to create channels and custom fields will do all that for you. I suggest you start by reading an EE overview: http://ellislab.com/expressionengine/user-guide/intro/the\_big\_picture.html

basically, your set up requires a channel to store "partners". you'd then want to create custom fields at least for all of the form fields that you are capturing. you can then use the "channel form" (http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/) to allow partners to sign up. by default, you'd want those entries to be "closed" (not published) until an admin can review/edit/approve before they appear on the site.

I'm not familiar with proforms but it surely looks like you can control the actual form fields by simply dragging them into the form (second screenshot at http://devot-ee.com/add-ons/proform-drag-and-drop-form-builder). and it looks like a powerful tool.

remember, there are no pre-build templates. the power of EE lies in giving you total freedom to build your own code (which some developers might consider a hassle).
> 2 votes

# Answer
One thing I might suggest is looking at the possibility of upgrading EE to 2.8.1. Depending on what add-ons the site currently relies upon however may make this more hassle than its worth. You may want to make a list of the add-ons that are currently installed and do a basic check for compatibility issues before proceeding. If you do decide to upgrade, test it out on a development server and **be sure to make a full backup of the database and all site files in case things go awry.**

Most of the current EE documentation for frontend input into database relies on the {exp:channel:form} tag, which used to be a 3rd-party add-on called Safecracker but which was incorporated into the core system at around version 2.7 of Expression Engine. As others have already stated, EE basically uses what are called "Channel Entries" to manage all content, and does so within already-defined database tables. The type of thing you are proposing is easily handled via template tags and channels using {exp:channel:form} for input and the {exp:channel:entries} tag for display, and does not require any database manipulation.
> 0 votes

---
Tags: forms, database
---


# Question
Title: Is there a way to see the EE upgrade history?
Normally I can put the pieces together by looking at upload dates, git history, and the `$config['app_version']` within /system/expressionengine/config/config.php. More often than not I cannot tell what previous version it was upgraded from.

This has to be logged somewhere in EE right? With dates?

# Answer
I believe what you need is in the exp\_update\_log database table. Date is the timestamp in UNIX format.
> 1 votes

---
Tags: ee2, ee2-upgrades
---


# Question
Title: How do I update or edit an entry using the Channel Entries API save_entry function?
I've looked at the EE Channel Entries API docs, but the save\_entry function does not seem to actually update an existing entry, but rather saves a new new entry over it. This seems to be the case as any fields not specified in the $data array get wiped out and the entry\_date is changed to the date the update was made.

Is there a way to simply edit/update an entry without the entry\_date being changed, yet still triggering the edit notice in the EE system? I am able to update single fields using the codeigniter db class, but doing it this way does not trigger EE's system to notice that the entry has been edited.

The main reason I want to do this is to use Postmaster's email trigger on entry edit, but doing a manual db update will not trigger this. My plugin code for the channel entries API update is below:

```
ee()->load->library('api');
ee()->api->instantiate('channel_entries');

$data = array(
     'title' => $some_title,
     'url_title' => $some_url_title,
     'field_id_17' => $some_variable,
);

ee()->api_channel_entries->save_entry($data, 4, $entry_id, FALSE);

/*
 * The number 4 in the parameters is the channel_id number where the entry is stored.
 * I have also tried using NULL in place of 4 but it then throws an error saying
 * I'm missing an API parameter.
 */

```

I would also not mind it if I could just use the codeigniter db class to update the entries, then somehow tell the EE system that the entry has been updated. Is this sort of thing possible?

# Answer
> 0 votes
OK, I've decided to bite the bullet and update my code in various places to trigger notification that the entry has been updated. For anyone who's interested and who is similarly facing this sort of issue, I'm using the following code in my plugin to accomplish this. My db query is selecting all because I have several different channels with dozens of unique fields each to account for, so this is saving me a lot of time in coding out each entry and in potentially missing some. However, I do worry about if this will cause performance issues down the line. I'm pretty new to programming in general, so of course if anyone sees a better way of doing this or thinks that my code is awful in some way please do let me know!

```
/**
 * First pull the old entry info.  I'm selecting all here because less code
 * and less chance of me missing a field and having it get wiped.
 */

$edit_results = ee()->db->select()
    ->from ('channel_data c')
    ->join ('channel_titles t', 'c.entry_id = t.entry_id')
    ->where (array(
        't.entry_id' => $entry_id,
        ))
    ->get();

/**
 *  I am unsetting the edit_date field so that the correct edit time gets posted.
 *  This particular update is for just updating the status of an entry.
 *  Any other fields to update can also be included below.
 */

if ($edit_results->num_rows() > 0)
{
    foreach($edit_results->result_array() as $row)
    {
        $channel_id = $row['channel_id'];
        $edit_array = $row;
        $edit_array['status'] = $status;
        unset($edit_array['edit_date']);
    }
}

ee()->load->library('api');
ee()->api->instantiate('channel_entries');
ee()->api_channel_entries->save_entry($edit_array, $channel_id, $entry_id, FALSE);

```

# Answer
> 1 votes
I know it seems redundant, but in the Channel Entries API you need to pass the entry\_id in the data array. EE looks to that array to determine if the entry is being edit correctly (as far as the hooks go). I have tested this and confirmed it a while back, so I assume it's still true. Without the entry\_id in the data array, the entry should get updated but in the hooks there is no way to tell if the entry is being edited without the entry\_id passed in the array. If you look through the EE core, I believe this is what they do as well.

```
ee()->load->library('api');
ee()->api->instantiate('channel_entries');

$data = array(
    'entry_id' => $entry_id,
    'title' => $some_title,
    'url_title' => $some_url_title,
    'field_id_17' => $some_variable,
);

ee()->api_channel_entries->save_entry($data, 4, $entry_id, FALSE);

```

And to further confirm... You need to pass all the values in the data array or they will get wiped out as you suggested. This is really limiting of the Channel Entries API and should be updated. If you want a robust example of how I integrate with the Channel Entries API, take a look at the new version of Channel Data. https://github.com/objectivehtml/Channel-Data

---
Tags: plugin, postmaster, update, channel-entries-api
---


# Question
Title: safecracker reference issue can't find variable EE
I'm using safecracker and getting this error:

Uncaught ReferenceError: EE is not defined

when using safecracker. I tried this solution:

http://ellislab.com/forums/viewthread/197571/P15

(moving jquery to the footer) and it didn't solve the error. I even loaded the safecracker form via ajax after the rest of the page had loaded, and it didn't solve the issue.

I noticed that if I view source, in the form action parameters there's a whole bunch of jquery UI stuff referenced - I'm not using jquery ui, and the form shouldn't need most of this stuff. On chrome, this worked properly without jquery ui, so I'm not sure what this is all about:

?ACT=10&ui=core,widget,mouse,position,draggable,resizable,button,dialog&plugin=scrollable,scrollable.navigator,markitup,thickbox,toolbox.expose,overlay,tmpl&v=1355863708&use\_live\_url=y"

I tried including jquery ui but that didn't seem to make a difference. I've attached screenshots of the error - you can feel free to check this out to see what's going on:

http://goo.gl/zTxJA

but keep in mind I'm working on it so it may change. The four screenshots shown below are for two different errors - the first two are when the form is embedded in the template, and I am using my own jquery, and setting include\_jquery="no" - the second two are when I use my own jquery, but then load the form via ajax (thus ensuring that the form loads after jquery).

This is my current ee tag for safecracker: {exp:safecracker channel="diy\_submissions" return="site/diy\_success" include\_jquery="no" allow\_comments="no" datepicker="no" logged\_out\_member\_id="5" preserve\_checkboxes="no"}

I tried removing all the actual form fields and the error still occurs, so I guess you could limit the error to the actual inclusion of safecracker alone, and not to any of the field types used within.

I also put just the form into its own template, allowed it to include jquery, and it loads nothing at all (with no console errors). The source of the code is this:

```
    <html>
<head><title>Test Form</title></head>
<body>
{exp:safecracker channel="diy_submissions" return="site/diy_success" include_jquery="yes" allow_comments="no" datepicker="no" logged_out_member_id="5" preserve_checkboxes="no"}
<p class="prompt_text">
  Have a recipe, occasion or project idea that uses Carapelli? <br />
  We'd love to showcase it in our gallery.
</p>
<div class="content_detail_content">
  <nav class="subnav">
    <a class="subnav_link collect active" data-ident="collect" data-count="0">Collect</a>
    <a class="subnav_link assemble" data-ident="assemble" data-count="1">Assemble</a>
    <a class="subnav_link share lastitem" data-ident="share" data-count="2">Share</a>
  </nav>

    <div class="project_content_container">
      <div class="project_text_section collect active">
        <textarea name="submission_collect" value="{submission_collect}">Enter ingredients or supplies needed.</textarea>
      </div>
      <div class="project_text_section assemble">
        <textarea name="submission_assemble" value="{submission_assemble}">Enter project or recipe directions.</textarea>
      </div>
      <div class="project_text_section share">
        <p>
          Perfect! Now give it a name, upload a photo of the finished
          product and submit your brilliant Carapelli idea!
        </p>
      </div>
      <div class="project_title share">
        <label for="title">Name</label>
        <input name="title" value="{title}" id="title" type="text" maxlength="100">
      </div>
      <div class="upload_button collect active">
        UPLOAD PHOTO <span class="choose">{field:submission_collect_file}</span>
      </div>
      <div class="upload_button assemble">
        UPLOAD PHOTO <span class="choose">{field:submission_assemble_file}</span>
      </div>
      <div class="upload_button share">
        UPLOAD PHOTO <span class="choose">{field:submission_share_file}</span>
      </div>
      <div class="next_button">
        <span class="next">NEXT STEP</span>
      </div>
      <div class="submit_button" style="display:none;">
        <button name="submit" class="ideas_submit">SUBMIT IDEA<br />
        FOR APPROVAL</button>
      </div>
    </div>
</div>
{/exp:safecracker}

</body>
</html>

```

# Answer
If you are loading jQuery at the bottom of the page, safecracker will fail because it's adding javascript into the middle of your page before jQuery has loaded.

Make sure that you either:

Load jQuery in your header OR; Use Stash to output your {safecracker\_head} tag below your jQuery in your main template.
> 1 votes

# Answer
The things mentioned in the other answers here may cause this issue. Another cause can be that "Guests" are not allowed to post entries in the channel channel form / safecracker is set up to post to. When loading the page w/o being logged in you will then get "ReferenceError: EE is not defined" .. in the CP, navigating to Member Groups -\> Guests and selecting that these are allowed to post to the channel will fix the issue. Be aware of the implications of this change though (guests will be allowed to post entries to that channel).
> 0 votes

---
Tags: safecracker, forms, jquery, saef
---


title: Show discount related to product

text:
# Question
Title: Show discount related to product
I'm creating discounts in Expresso Store that use the "match entries field".

Is it possible to show the offer details on the single product view. Most likely from within a product tag?

It would be nice to be able to advertise the discount & offer. Such as buy 5 of these products, get 10% off.

# Answer
Not automatically. You could just set these as a global variable either as a snippet or using something like Low Variables and then pull these into the corresponding products pages. This way you only have to update in one place and it updates site wide. It wont be directly linked to the offers from a fully automated point of view but will probably be the easiest way to go about it.

Alternatively you could always run a custom query in your Product page using the Query Module where you retrieve the products that match that discount and if that matches the Entry ID for the product currently being viewed then pull out the Discount and the Notes fields and display that on the page. That would provide a more automated solution but would require a little bit of SQL if you're comfortable with that.
> 1 votes

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


# Question
Title: List of highest rated entries in Solspace Rating
I got this problem: My entries are rated (star-rating, just submits a value between 1 and 5). Now I want to show on a single-entry-pages the top-rated entries of the category the actual entry is in. Example: We are on entry-page "Snoopy" which is filed in the category "dogs". I want a list like "Best rated entries in dogs: \- Snoopy xxxxx \- Other dogs xxx \- My dog xx \- My mother's dog xx

I tried for hours and hours, but with no success. Perhaps anybody could give me a hint what I am doing wrong?

I got a lot of code snippets that all don't work, here is one:

```
<ul class="">
{exp:rating:rank channel="{my_channel}" limit="3" category = "2" dynamic="no"}
 {exp:rating:stats}
  <li>
   {title} - {overall_avg}
  </li>
 {/exp:rating:stats}
{/exp:rating:rank}

```

This one just shows me nothing. If I remove the exp-rating-stats-loop it only shows me 3 times the actual entry. I would appreciate any help very much - thanks!

EDIT: FURTHER EXAMPLES

Here are some examples: In an empty template this generates the correct output, 5 entries with their titles:

```
{exp:rating:rank category="24" limit="5"}
{title}
{/exp:rating:rank}

```

while in my standard-template there is no output. When I add the parameter dynamic="no" I get the entry of the page I am.

EDIT 2: EXP:CHANNEL:ENTRIES-LOOP

When I put it OUTSIDE the exp:channel:entries-loop, it works. My loop is

```
{exp:channel:entries channel="{snp_my_channel}" limit="1"
disable="member_data|trackbacks|pagination" track_views="two"
status="open" cache="no" refresh="2500"
require_entry="yes"}

```

But I need it inside the loop. Is there perhaps any parameter missing?

# Answer
The issue was that `{exp:rating:rank}` was inside a `{exp:channel:entries}` tag pair.

Since both tags share the same Channel Entries library and have many variables and tags in common, you will run into **variable clashes**. In other words, EE will be confused about which variables to parse for which tag pair, etc. Use `{exp:rating:rank}` outside of `{exp:channel:entries}`, or use an embed for `{exp:rating:rank}`. In other words, use:

```
{exp:channel:entries /* your other parameters */}
  // Some entry data
  {embed="rating/rank"}
{/exp:channel:entries}

```

or even better:

```
{exp:channel:entries /* your other parameters */}
  // Some entry data
{/exp:channel:entries}

<h3>Top entries</h3>
{exp:rating:rank /* your other parameters */}
  // Some ranked entry data
{/exp:rating:rank}

```
> 1 votes

# Answer
Perhaps it miss the entry id:

```
{exp:rating:stats entry_id="{entry_id}"}

```

Or could be a parsing problem: try to insert: parse="inward"

```
{exp:rating:rank channel="{my_channel}" limit="3" category = "2" dynamic="no" parse="inward"}

```
> -1 votes

---
Tags: solspace, solspace-rating
---