# Question
Title: Free Shipping Products Apply to Order Shipping
When you have a product that is marked as *free shipping* and a product that has paid for shipping in the same basket, I would imagine that you would still pay for shipping.

A particular client of mine wants it so that if you add any product with *free shipping* you get free shipping for your entire order.

Is this possible?

# Answer
> 1 votes
Your assumption is correct. "Free Shipping" products do not contribute to the total weight used for shipping calculations, but if you have at least one non-free shipping item in your cart, then there will still be a shipping cost.

It's not possible to trigger that rule (one free shipping item makes whole cart free shipping) using the built in methods. You would therefore need to write an extension (or custom shipping method) which checks for any item in the cart, before adjusting the shipping cost to zero.

The extension hook you would need to use is `store_order_shipping_methods`.

https://exp-resso.com/docs/extension\_hooks.html#shipping\_hooks

---
Tags: expresso-store
---


# Question
Title: Safecracker File client side validation options?
I'm trying to find the definitive way of **validating whether a Safecracker File custom field has been filled in or not**. The server side method using the Codeigniter validation class only semi works for me, and I'd much rather get client side validation working first anyway.

Has anyone found a reliable way of doing this? Ideally it'd be a validation library like **parsley.js**, but I can see that to use that you need to add **data-validate="parsley"** to the **form element** \- something that isn't possible using Safecracker.

Any help much appreciated.

Jim

# Answer
> 0 votes
So this turned out to be fairly simple in the end. You just need to add the data-validate attribute to the form tag using jquery or vanilla JavaScript. Works a treat.

---
Tags: safecracker, validation, safecracker-file
---


# Question
Title: How can I toggle up/down votes on ratings?
I'm using the Solspace Rating module and I'd like to be able to allow the user to toggle their vote on ratings.

If a user votes up but later wants to "unvote" or change their vote how can I accomplish this? It seems that I can allow duplicate votes, but this does not solve the problem.

# Answer
You can delete a rating using the `{exp:rating:delete}` tag: http://www.solspace.com/docs/rating/delete/

After deleting the rating, the user can try and rate again. That would be the "unvote".
> 2 votes

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


# Question
Title: Export chronologically-correct shortlist of Calendar events?
I’m working up a festival website and wondering if there would be a way to use Calendar to create and export a schedule of entries from the program i.e. users select or add entries to some kind of favourites list which can then be output as a chronologically correct timetable????

Failing this, will Solspace Favourites allow the list to be built but not necessarily in date/time order?

# Answer
You could use Solspace Favorites to build a list of event entries. Then, you could use this list to create a pipe-delimited string of favorite entry\_ids and use that in the `event_id=""` parameter of `{exp:calendar:cal}`. `{exp:calendar:cal}` would then take care of putting events in chronological order.

Keep in mind that you will be able to favorite event entries (i.e. the event entry created in the CP, which is used by Calendar to calculate occurrences), but not specific occurrences. For saving specific occurrences, maybe Freeform or Channel Forms could be used to store this kind of saved data.
> 1 votes

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


# Question
Title: How to upload HTML file for site verification
I need to upload an html file to my site in order to verify my site for a Pinterest Business account. I am new to expressionengine and have no idea how or where to do this. Any help or advice would be much appreciated.

# Answer
> 2 votes
1: create template with this html file name & content

2: use ftp to upload file

---
Tags: file-uploads
---


# Question
Title: Low Yearly Archives: Exclude current year
Firstly thanks for this handy plugin.

I am trying to exclude the current year from my archive list.

So in 2014, my tag looks like:

```
{exp:low_yearly_archives channel="news" end_year="2013" }

```

Yet 2014 is listed...as is 2013 which is empty.

I've tried a few variations but no luck. Am I misunderstanding the documentation?

Is it possible to exclude the current year?

Thanks again for all your EE extensions.

CJ

# Answer
> 2 votes
Two ways to go about this:

**1. Use a conditional**

```
{exp:low_yearly_archives channel="news"}
    {if year != '{current_time format="%Y"}'}
        ...
    {/if}
{/exp:low_yearly_archives}

```

**2. Use PHP on Input**

```
{exp:low_yearly_archives channel="news" end_year="<?=(date('Y')-1)?>" end_month="12"}
    ...
{/exp:low_yearly_archives}

```

---
Tags: low-yearly-archives
---


title: ExpressionEngine on Nginx server

text:
# Question
Title: ExpressionEngine on Nginx server
Recently, I moved an EE site from Apache server to Nginx server. But there seems some issues while accessing any other page/link rather than HOME. Its showing only home page. I know that Nginx server does allow htaccess rules so I tested by with index.php on the same but no luck.

**PS**: EE Control Panel working perfect and I am using NSM Config Bootstrap

Could anyone please help if have faced such an issue? I 'll highly appreciate your help.

Thanks,

# Answer
What configuration you use? what rules you setup in your nginx configs? For example, I use next configuration for Nginx+PHP-FPM:

```
server
{
    server_name www.example.com;
    return      301 $scheme://$host$request_uri;
}

server {
    listen 80;
    server_name example.com;

    #access_log  /dev/null;
    #error_log /dev/null;

    access_log /home/www/example.com/log/example.com-access.log;
    error_log  /home/www/example.com/log/example.com-error.log info;

    if ( $http_user_agent ~* (nmap|nikto|wikto|sf|sqlmap|bsqlbf|w3af|acunetix|havij|appscan) ) {
        return 403;
    }

    root /home/www/example.com/public/;

    client_max_body_size       20m;
    client_body_buffer_size    128k;
    client_body_temp_path      /var/nginx/client_body_temp;

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
        access_log        off;
        log_not_found     off;
        expires           360d;
    }

    location ~ /\. {
        access_log off;
        log_not_found off;
        deny all;
    }

    location / {
        # the index directive checks first for "index.html" because
        # sometimes you need to rename "offline.html" to "index.html"
        # to take the site down during an update
        # if you can, move this to the HTTP level;
        index index.html index.php;

        # accept URI without index.php
        try_files $uri $uri/ /index.php;

        # Remove index.php
        rewrite    ^/index\.php(.*)    $1    permanent;
    }

    # insensitive case on extension of PHP files
    location ~* \.php$ {
        # Zero-day exploit defense.
        # http://forum.nginx.org/read.php?2,88845,page=3
        # Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine.  And then cross your fingers that you won't get hacked.
        try_files $uri =404;

        expires off;
        fastcgi_pass unix:/dev/shm/php-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param MAGE_RUN_CODE default;
        fastcgi_param MAGE_RUN_TYPE store;
        include fastcgi_params;
    }
}

```
> 4 votes

---
Tags: nginx
---


# Question
Title: Expresso Store v2: Cart ID the same as Transaction ID
How can I make the transactionID equal the orderID?

My client would like them to be the same to make it easier for them to match up.

For some reason on this latest install of Store v2.0.6 running on EE v2.7.2 the numbers are out of sinc by around 20.

The latest order came though as #62 but the transaction ID for it was #42.

Can anyone please point me in the right direction to make them the same from now on?

Thanks.

# Answer
> 2 votes
After some great support from the guys at Exp-resso I now know what's happening here.

**From Exp-resso:**

*"What's happening is that in Store v2 a 'cart' can take up an order ID even if they are not complete. So if someone is on the site and has started adding items to their cart but not yet checked out then this will reserve an order ID as it is still an active session. This is actually a feature rather than a bug as it means that people can come back to the site within 24 hours and carry on where they left off with their cart which is good for goal conversion completed checkouts. Technically this was still the case in Store v1 but carts did not always take up an order ID so they would appear more sequential."*

There is no bug, but rather a new way of assigning cart ID's. Thanks Exp-resso for the quick replies/support.

---
Tags: expresso-store
---


# Question
Title: Conditionally display a relationships field if not empty (native relationships field)
I am not sure if anyone can help me!

I'm using the following code to display a list of articles and it works, however there are two issues.

The first is the date of each article is the same for each list item, when it should be different.

The second issue is that if the relationships field is empty, I want to NOT display any code, including the H4 tag.

So if there are NO related papers, nothing in the HTMl will show.

I have tried a number of things, maybe I need to use entry id?

Best wishes.

Graham

```
<!-- Related Papers -->
<div class="row">
<div class="large-12 columns">
<h4>Related Papers</h4><hr>
{exp:channel:entries channel="policy_papers" status="open" limit="10"}
{pp_related_papers}
{if pp_related_papers:count == "1"}
<ul>
{/if}
<li><a href="{path="policy-papers/papers"}/{pp_related_papers:url_title}"><h5>{pp_related_papers:title}</h5></a>
<h6 class="entry-meta">by {pp_related_papers:pp_author_one} {if pp_related_papers:pp_author_two != ""}and {pp_related_papers:pp_author_two}{/if} | <time datetime="{entry_date format="%Y-%m-%dT%H:%i"}" pubdate>{date_heading}{entry_date format="%d %F %Y"}{/date_heading}</time></h6><hr></li>
</ul>
{if pp_related_papers:count == pp_related_papers:total_results}
</ul>
{/if}
{if pp_related_papers:no_results}No related entries{/if}
{/pp_related_papers}
{/exp:channel:entries}
</div>
</div>
<!-- End Related Papers -->

```

# Answer
regarding second q, possible stash will help you

```
{exp:channel:entries channel="policy_papers" status="open" limit="10"}
 {pp_related_papers}
    {exp:stash:append name="related_papers"}
    {if pp_related_papers:count == "1"}
    <ul>
    {/if}
    <li><a href="{path="policy-papers/papers"}/{pp_related_papers:url_title}"><h5>{pp_related_papers:title}</h5></a>
    <h6 class="entry-meta">by {pp_related_papers:pp_author_one} {if pp_related_papers:pp_author_two != ""}and {pp_related_papers:pp_author_two}{/if} | <time datetime="{entry_date format="%Y-%m-%dT%H:%i"}" pubdate>{date_heading}{entry_date format="%d %F %Y"}{/date_heading}</time></h6><hr></li>
    </ul>
    {if pp_related_papers:count == pp_related_papers:total_results}
    </ul>
    {/if}
    {if pp_related_papers:no_results}No related entries{/if}
     {/exp:stash:append}
{/pp_related_papers}
{/exp:channel:entries}

{if {exp:stash:not_empty name="related_papers"}}
<!-- Related Papers -->
    <div class="row">
        <div class="large-12 columns">
        <h4>Related Papers</h4><hr>
            {exp:stash:get name="related_papers"}
        </div>
    </div>
<!-- End Related Papers -->
{/if}

```
> 1 votes

---
Tags: relationships, date-format
---


# Question
Title: Datagrab import, P&T dropdown not registering
I'm importing a CSV of around 60 dogs using Datagrab.

The import works fine but when I use Solspace Super Search, it seems to be ignoring the gender of the dog (a P&T dropdown field).

If I resave the entry, it's fine, search works great.

I can't fathom whether this is a Super Search issue or a Datagrab issue. When I look at the field in the db after import, the value is definitely there.

Any ideas?

# Answer
Can you try rebuilding the Super Search Lexicon? (go to: SuperSearch \> Utilities).

I have a feeling that Super Search only updates this if you add the entries through the Control Panel.
> 1 votes

---
Tags: supersearch, datagrab, field-pack, csv
---


# Question
Title: Load EE Field Type in Third Party Module
I am trying to load wygwam field type into a custom module, on my localhost the following works:

```
require_once(APPPATH . 'fieldtypes/EE_FieldType.php');
require_once(PATH_THIRD.'wygwam/ft.wygwam.php');
$wyg = new Wygwam_ft();

```

however when i upload to my server i get the following error:

```
require_once(../system/expressionengine/fieldtypes/EE_fieldType.php): failed to open stream: No such file or directory

```

I dont know why thats happening. Is there a better way to load the wygwam Field type? or is there any other way to do this?

# Answer
> 3 votes
Looking carefully at your error message, you may have some incorrect capitalization of the EE\_Fieldtype class file name. `EE_Fieldtype.php` is the correct way (uppercase F, lowercase t). Likely your localhost is case insensitive but your server is not.

---
Tags: wygwam, module, fieldtype
---


title: Google indexing weird EE URL's

text:
# Question
Title: Google indexing weird EE URL's
One of our clients is having a problem with Google indexing incorrect URL's.

The shop templates are using something like...

```
{if segment_2 != "" AND segment_3 == "" AND segment_4 == ""}
    Parent Category List
    e.g. http://website.com/shop/parent/
{if:elseif segment_2 != "" AND segment_3 != "" AND segment_4 == ""}
    Child Category List
    e.g. http://website.com/shop/parent/child/
{if:elseif segment_2 != "" AND segment_3 != "" AND segment_4 != ""}
    Product
    e.g. http://website.com/shop/parent/child/product/
{/if}

```

But, they are getting URL's such as...

Which obviously don't exist and are picking up on the incorrect pagination amount etc.

Why would this happen, and how can this be stopped? E.g. how can we enable a 404 error for these kinds of pages.

The only way I've been able to fix it is for EE to check if the segments are a valid category or product, and then throw a message such as "No products found" or "Category doesn't exist"

But I just don't know how it's finding and generating these weird URLs. Obviously the "P1130" exists because it's showing ALL products, but that page shouldn't be accessible.

# Answer
Try adding this within your channel:entries tag:

```
{exp:channel:entries ....}
  {if no_results}{redirect="404"}{/if}
{/exp:channel:entries}

```

This should trigger a 404 error on paginated pages that have no entries in them.

If you install Mo' Variables, you can enable an `{if paginated}` conditional for your templates. Then you can get a bit more specific and only trigger this 404 for paginated pages:

```
{exp:channel:entries ....}
  {if no_results}{if paginated}{redirect="404"}{/if}{/if}
{/exp:channel:entries}

```
> 3 votes

---
Tags: conditionals, url, segments, google
---


# Question
Title: Solspace Rating - {if rating_comment_no_results} is never true!
I'm using Rating 3.2.3 and EE 2.7.2.

In my template, the tag `{if rating_comment_no_results}` never returns true and never displays its content, even when there are no comments for that rating.

Template code (this is on a single entry page inside channel:entries):

```
{embed="vendor/.ratings" entry-id="{entry_id}" vendor-type="{categories show_group="10" limit="1"}{category_url_title}{/categories}"}

```

And that embed looks like this (some pieces removed for brevity):

```
{exp:rating:entries precision="2" orderby="rating_date" sort="desc" img_height="14" img_width="14" collection="directory" entry_id="{embed:entry-id}" limit="200"}

{exp:rating:comments
     rating_id="{rating_id}"
     limit="1"
     status="open|closed"
}
<div class="vendor-reply">
<h5>Reply from {title}</h5>
<h6>{rating_comment_date format="%F %d, %Y"}</h6>
<div class="restrict-height">
{rating_comment}
<div class="overflow"><a href="#">Read more…</a></div>
</div>
</div>
{if rating_comment_no_results}
{if logged_in_member_id == author_id}
{embed="vendor/.rating-reply" rating-id="{rating_id}"}
{/if}
{/if}
{/exp:rating:comments}

{/exp:rating:entries}

```

And then inside that next embed we have:

```
{exp:rating:comment_form
    form:class="review-reply"
    rating_id="{embed:rating-id}"
    return="vendor/rating-reply-thanks/{segment_2}"
    status="closed"
    require_membership="yes"
    anonymous="no"
}
    <label>Reply to this review <span class="expl">This option is available only to the listing owner</span></label>
    <textarea class="autosize" placeholder="Write your reply…" name="comment" /></textarea>
    <a class="btn directory submit" href="#">Submit Reply</a>
{/exp:rating:comment_form}

```

With the `{if rating_comment_no_results}` conditional in place, the second embed never shows, even when the conditional is true. If I remove that conditional it shows as expected so there's no problem with the embeds or other code. The conditional simply doesn't work.

Any ideas Solspace?

# Answer
> 1 votes
Try `{if rating_no_results} ... {/if}`, which is the "no results" conditional used in the other Rating tags. Looks like the "comment" part should be removed in the docs.

---
Tags: solspace, solspace-rating, no-results
---


# Question
Title: Solspace Rating - where do rating comments go?
I'm using `Rating:Comments` and `Rating:Comment_Form` for the first time. I've successfully set up the form and comments display loop, and submitted my first test comment. I'm submitting comments with a "closed" status status to I can approve them before they show up.

My question is, **where do I find these comments in the EE CP so I can moderate them and change their status to open?**

They are not listed anywhere in the Rating module tabs or as regular EE comments! Am I missing something?

I've made my comments loop display closed comments and I can confirm the comment was saved and shows up there. So it's there somewhere I just don't see any part of the user interface that allows me to see the comment or change its status.

EE 2.7.2 Rating 3.2.3

# Answer
Rating comments are stored in the exp\_rating\_reviews table. There is no moderation tools at this time, but we hope to add this in future releases.
> 0 votes

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


title: Search in Grid field - Relationship

text:
# Question
Title: Search in Grid field - Relationship
I have a question concerning the function of research in Grid field, specifically on a relationship field. Here's my problem:

I have a grid field for a product catalogue, with many fields for each product specification. One of them is a relationship field, that catch the data from a "brand" channel. So I have

> {exp:channel:entries channel="my\_channel"}
>
> {catalogue}
>
> {catalogue:brand}
>
> {catalogue:brand:brand\_title}
>
> {/catalogue:brand}
>
> {/catalogue}
>
> {/exp:channel:entries}

that shows me all the products on www.mysite.com/catalogue.

What I would like is to filter those products based on the brand, something like

segment\_2 == brand\_title

that will show, for example, all the Apple products on www.mysite.com/catalogue/apple and so on.

Is it possible? Thanks to everyone who will help me.

# Answer
> 0 votes
I resolved using Matrix + Playa, although I'd have preferred to use native functions like Grid. Here's my code:

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

{catalogue search:brand="{segment_2}"}

{brand}

{brand_title}

{/brand}

{/catalogue}

{/exp:channel:entries}

```

Where {catalogue} is a Matrix field and {brand} is a Playa field that catch the data from the "brand channel". The dynamic="no" allows me to show only filtered entries in www.mysite.com/catalogue/(name of brand) based on {segment\_2}, otherwise the list would remain blank.

# Answer
> 2 votes
Have you considered the reverse? e.g. start at the brand channel and get the parents (e.g. products)? Might be more easy.

Grid is quite new and the relationship field also was recently changed (2.6) search and categories are not mature i guess (Relationship field tag parameters). Have you also tried Grid search:column\_name=?

---

**edit** as noted in the comments below: "Currently it is not possible to get the parents of a relationship field that is inside of a Grid field".

An alternative is to use stash to store each item in a list, and store the brand with each item. On output or on setting the list, you can filter by brand. (e.g. match= against=)

See examples on: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset\_list%7D

```
{exp:stash:set_list name="my_list" parse_tags="yes"}
  {exp:channel:entries channel="my_channel"}
    {catalogue}
      {stash:item_title}{catalogue:title}{/stash:item_title}
      {catalogue:brand}
        {stash:item_brand}{catalogue:brand:brand_title}{/stash:item_brand}
      {/catalogue:brand}
    {/catalogue}
  {/exp:channel:entries}
{/exp:stash:set_list}
...
{exp:stash:get_list .... }

```

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


# Question
Title: What typically are the things that slow down an ExpressionEngine installation?
I'm just wondering if there are certain guidelines to bear in mind if you want to ensure an EE site stays fast. What typically are the things that slow down an ExpressionEngine installation?

* Does the number of entries in the system have a large impact?
* How about the number of global variables you've set (especially when using Low Variables excessively)?
* Does the number of addons in the third party directory play a role?
* What about a site that was upgraded from EE 1.xx?

I realise this is a lot of questions. I'm just trying to work out why one of my sites is way slower than the others (same hosting).

Cheers

Jim

# Answer
> 4 votes
There's a boatload of great resources on this topic. Here are a few recommendations to get you started:

**Install the EE Debug Toolbar**
http://devot-ee.com/add-ons/ee-debug-toolbar
Adam's suggestion of enabling template debugging is a good one. This add-on is a great way to uncover potential issues. Be on the lookout for high query counts and process bottlenecks. There isn't a hard and fast rule for what's excessive, as it depends largely on the functionality and content structure of your particular site / page.

**Make Sure You're Using Appropriate Caching Where Possible**
http://ellislab.com/expressionengine/user-guide/optimization/caching.html
If you're relatively new to EE, this one is huge.

**Review the Answers for Related EE StackExchange Questions**
https://stackoverflow.com/questions/13041463/whats-the-optimal-amount-of-queries-an-expressionengine-page-should-load
Add-ons and front-end performance
What are the recommended ways to get to the bottom of slow load times in EE?

**Do a Google Search for EE Performance**
https://www.google.com/search?q=expressionengine.com+performance&oq=expressionengine.com+performance&aqs=chrome..69i57.4743j0j4&sourceid=chrome&espv=210&es\_sm=119&ie=UTF-8

**Check Out Stash**
http://devot-ee.com/add-ons/stash
There are a 101 uses for Stash, most of which will help keep your template code more dry and efficient. For starters, I'd recommend checking out Stash Variables, which are fairly simple to wrap your head around (some of the Stash concepts can get complex quickly) and can be super useful in a variety of situations.

**Give this Podcast on EE Performance a Listen**
http://ctrlclickcast.com/episodes/ee-speed-optimization
There are some great tips in here.

**Make Sure the Non-EE Parts of Your Site are Optimized**
http://developers.google.com/speed/pagespeed/insights/
If you haven't done so already, it might be worth running your site through Google's PageSpeed tool. Generally speaking, it's a good idea to make sure you're combining and minifying your JS and CSS assets, optimizing your images, and reducing the number of http requests wherever possible.

# Answer
> 1 votes
I noticed myself that if else statements don't work like you think they do! Even if your if statement matches, also the code in the else part is executed. However you won't see the output.

I ran into this problem and my site load time was about 3 seconds. I used the add on switchee ( http://devot-ee.com/add-ons/switchee ) which makes real if else statements. This sped up my site with almost 2.5 seconds, so now loading within 0.5-1 second!

---
Tags: performance
---


# Question
Title: Parsing Modifers from Expresso Store Product Details
We're writing a reporting API and for the sake of speed have been using custom views and pulling the data with the query tag. It's all going quite well, save for one thing.. parsing the modifiers tag.

I've parsed the base64 below using php parsed on template output.. how do I convert it into some sort of html or usable info? (JSON Array?)

```
{exp:query backspace="1" sql="SELECT * FROM exp_store_orders LEFT JOIN exp_store_order_items...

    <?php
    $str = '{modifiers}';
    echo base64_decode($str);
    ?>

```

but that leaves me with an object

# Answer
In Store 1.x, the modifiers array is stored as a base64 encoded, serialized PHP array. To decode it, you need to use the following:

```
$modifiers = unserialize(base64_decode($str));

```

In Store 2, the modifiers array is simply stored as JSON. This makes life much easier. To decode it into a PHP array, simply use:

```
$modifiers = json_decode($str, true);

```
> 2 votes

# Answer
If you happen to be working with a db that has both, parsing php on output will allow you to make a mixed report work in either case. (Apologies for terrible php)

```
{exp:query..

"item_qty": "{item_qty}",
"modifiers":
<?php
$str = '{modifiers}';
if ($str[0]!="Y")
    {echo $str;}
else
    {
        $str2 =  unserialize(base64_decode($str));
        $str3 = json_encode($str2);
        echo $str3;
    }
?>

```
> 0 votes

---
Tags: expresso-store, modifiers, price-modifier
---


# Question
Title: Form Plugin, Call to undefined method EE_Functions::form_declarations()
I am writing a form from within a plugin module using EEE 2.6.1

```
    class Meal_form {

    public function __construct()
    {
        $this->EE =& get_instance();
    }

    public function form()
    {

        $form_data = array(
            "id"    => $this->EE->TMPL->form_id,
            "class" => $this->EE->TMPL->form_class
        );

        $tagdata = $this->EE->TMPL->tagdata;

        $form = $this->EE->functions->form_declarations($form_data) . $tagdata . "</form>";

        return $form;
    }
}

```

I receive the following error on form\_declarations(); Fatal error: Call to undefined method EE\_Functions::form\_declarations()

Any ideas on this?

Thanks

# Answer
> 1 votes
The method name is `form_declaration()`, not `form_declarations()`.

---
Tags: forms, plugin
---


# Question
Title: can you show screen_name of users who have liked an entry?
Channel Ratings: 4.0.4, EE: 2.7.3

I am using the channel ratings "Like" function, so the logged in users can "Like" certain products. I want to be able to display who has liked an entry. I am using this bit of code to display the "like\_author\_id" which happens to be the same as the "member\_id"

```
{exp:query
   sql="SELECT *
   FROM exp_channel_ratings_likes
   WHERE entry_id = '{entry_id}'
   AND liked > '0'
"}
   {if like_author_id != "0"}
      <a href="{path='/likes/{like_author_id}'}">{like_author_id}</a>,
   {/if}
{/exp:query}

```

I am wondering how I can display the screen\_name of the author who liked the entry.

ps. I tried to tag channel-ratings, but I couldn't with under 150 reputation.

# Answer
I'm not entirely familiar with Channel Ratings, but you should be able to do what you're looking for with the query.

Try this:

```
{exp:query
   sql="SELECT exp_channel_ratings.*, exp_members.screen_name as like_screen_name
   FROM exp_channel_ratings_likes, exp_members
   WHERE entry_id = '{entry_id}' and exp_channel_ratings.like_author_id = exp_members.member_id
   AND liked > '0'"}
       {if like_author_id != "0"}
          <a href="{path='/likes/{like_author_id}'}">{like_screen_name}</a>,
       {/if}
{/exp:query}

```

Note: You may want to change that `exp_channel_ratings.*` to use the specific fields you want to query, reducing the number of fields pulled back in your query. Could help with performance.
> 2 votes

---
Tags: query, query-module, channel-ratings
---


title: Link 2 Cartthrob Price modifiers

text:
# Question
Title: Link 2 Cartthrob Price modifiers
I have 2 separate price modifier fields the one is a list of fabric options with images for a product, the other field lists images for different types of options for the first option.

At the moment i have a list of the fabric options displaying on the front end of the site. Once a user clicks on the fabric option i want it to the display a listing of the fabric color options with images.

Is there a way i can do this?

# Answer
There's no way to do this automatically. It requires a javascript solution to check the selected fabric options and generate the second color options on the fly. Below is an example, but it's provided, as is, with no guarantees or additional support.

Here's the general idea, starting with the 2 matrix fields. The "Extras" column in the fabric options corresponds to the "Fabric ID" in the Extra Options matrix. So in this instance, Linen would have the colors red, blue, and green. Silk has yellow and blue. etc.

DISCLAIMER: I am not a javascript developer. There will probably be some techniques here that a real JS developer will cringe at. I provide this as a rough example that you'll need to tweak to suit your purposes.

NOTE: You'll need to set protect\_javascript to "n" in your EE config settings in order to parse EE tags in your javascript.

Here's the javascript code.

```
<html>
<head>
{exp:jquery:script_tag}
<script type="text/javascript">
    jQuery(document).ready(function($){

    {exp:channel:entries entry_id="ADD YOUR ENTRY ID HERE"}
    {!-- fabric_options is the short name of the fabric option matrix --}
    {fabric_options}
        var fabric_options_{option_value}_str = "{extras}";
        var fabric_options_{option_value} = fabric_options_{option_value}_str.split(",");
    {/fabric_options}

    {!-- extra_options is what I've called the color options --}
    {extra_options}
        {fabric_id} = new Object();
        {fabric_id}.option_value = "{option_value}";
        {fabric_id}.option_name = "{option_name}";
    {/extra_options}

    {/exp:channel:entries}

$(".fabric_options").change(function(){
    var selected = eval("fabric_options_"+$(this).val());
    if (typeof selected == "undefined" || !(selected instanceof Array)) {
        <!-- nothing to show -->
    }
    else
    {
        // generate a select box.
        var s = $("<select name='item_options[extra_options]' />");

        for(var i=0; i<selected.length; i++){
            $("<option />", {value: eval(selected[i]).option_value, text: eval(selected[i]).option_name}).appendTo(s);
        }

    // throws the newly minted select box into the HTML
    $(".color_select").html(s);
    $(".color_select").prepend("Select a Color:");
    $(".color_select").append("<br />");
    }

});

});

</script>

</head>
<body>

{exp:channel:entries entry_id="ADD YOUR ENTRY ID HERE"}
{exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}
{title}<br />
Choose a Fabric

<select name="item_options[fabric_options]" class="fabric_options"}>
<option value="">Select a Fabric</option>
    {fabric_options}
        <option value="{option_value}">
            {option_name}
        </option>
    {/fabric_options}
</select><br />

<span class="color_select"></span>
Quantity <input type="text" name="quantity" value="" /><br />
<input type="submit" value="Add to Cart" />
{/exp:cartthrob:add_to_cart_form}
{/exp:channel:entries}

</body>
<html>

```
> 1 votes

---
Tags: matrix, cartthrob
---


# Question
Title: Fresh migration, functioning locally, backend issues (Template Manager, Matrix)
I'm running out of ideas on how to debug this, hoping someone has some knowledge to share.

I've been working on a site locally with EE, Exp-resso Store and Matrix/Matrix Multi-Upload. All plugins are current, as is the EE install (currently 2.7.3).

I'm rebuilding a site, and I planned to move the new site to a subdirectory of the old site for remote access, testing, QA, etc. There were issues with the old site's back-end (among many other things). Details below.

While working local, I've run into no issues. However, today after moving the site successfully to the server, I'm seeing issues in the back-end. These seem to specifically relate to the Matrix plugin (it may not be Matrix's fault, but it's being affected) and the Template Manager. All of these issues were present on the old site. Apart from sharing a server and a database, the two builds are separate. Separate database entries, CSS files, JS, etc.

Dreamhost is the server. PHP 5.4. Possible FastCGI issue? I'm out of ideas.

Console is giving me this:

```
Uncaught TypeError: Object [object Object] has no method 'ee_focus'

```

# Answer
I'd guess your files didn't upload correctly to the server. Reupload all your EE files to the server... specifically, make sure your /themes directory in 100% uploaded.

Also, make sure you are changing/setting directory & file permissions on the server.
> 2 votes

---
Tags: matrix, admin
---


# Question
Title: How to make "Site Page" link field in Wygwam show URL?
When I create a link in Wygwam, a box appears that lets me choose "Site Page" and select an entry from the Pages module.

My problem is that I have several pages with the same name, because each page is accessible to a specific member group, so sometimes the list of options looks like this:

```
About
Services
Contact
Contact
Contact
Contact
Work
etc.

```

Is there a way to make that Site Page list show more detail, like the full URL, or the nested layout that you see when viewing pages in the Pages module?

# Answer
I'd guess the answer is no without a hack to the addon or building a custom extension.

If you want to go the extension route, here's a very good code starting point:
https://github.com/pixelandtonic/wygwam\_template\_links
> 0 votes

---
Tags: wygwam, pages
---


# Question
Title: Conditional input custom modifier with Expresso Store
This may seem like an easy question, but i have tried a number of things, none which work.

I want to use a custom modifier in Store to show a color, and this code needs to be in a template, but not every item needs the color input, only the entry which needs it.

How would I wrap this in a conditional {if}{/if} so that it only appears when needed?

Many thanks in advance.

input:size="Color"

Green Yellow

# Answer
A conditional based on an entry's ID might look like this:

```
{exp:store:product}
    {if entry_id == "XXX"}
            <select name="color">
                <option value="Green">Green</option>
                <option value="Yellow">Yellow</option>
            </select>
        {/if}
{/exp:store:product}

```

Replace XXX with the entry\_id.
> 2 votes

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


# Question
Title: Does Expresso Fedex Shipping plugin take product weight into account?
I'm updating a wine store site I've built for a client (http://shoptipsy.com) to add the Fedex Shipping plugin to their current Store-powered shop.

I've got the plugin integrated with production credentials supplied by Fedex. All seems to be working except that the shipping charges that the plugin returns are the same no matter how many items I have in my shopping cart.

So if I add one bottle of wine to the cart, the shipping charges for the various FedEx options are the same as when I add 100 bottles to the cart. I see the same behavior whether I'm testing on my local dev setup or on my staging server. Also, I've tried to check the charges the plugin is returning against estimates that FedEx supplies with its website calculators, and they don't match.

This obviously won't work. I can't enable the plugin on my client's site if the shipping charges are not being calculated correctly.

Anyone else run into this issue? Is there a way for me to check what info is being supplied to the FedEx API by the plugin to see if the order\_weight is being taken into account?

Thanks for any info anyone has, Adam

# Answer
> 0 votes
This sounds like an issue I came upon where Store's real-time shipping rate caching was not clearing when products changed in the cart or the shipping address changed. So if during testing you loading the shipping rate page, that rate would be cached regardless of new/deleted products or zipcode change.

Upgrading to Store v2.2.0 fixed this issue for me.

> FROM 2.2.0 RELEASE NOTES: "Fixed overzealous caching of certain shipping extension HTTP requests causing shipping prices to not update"
>
> https://exp-resso.com/docs/release\_notes.html

# Answer
> 0 votes
> Does Expresso Fedex Shipping plugin take product weight into account?

Yes. Unless you have enabled "free shipping" for any items on the publish page.

If that's not the problem, then it's probably best that you email support@exp-resso.com about this one, so that we can take a deeper look into your specific site.

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


title: Using exempt_discount_from_tax

text:
# Question
Title: Using exempt_discount_from_tax
One of the changes in the CT 2.5 update is:

ADDED: exempt\_discount\_from\_tax config variable (can be added to EE's index.php in the $assign\_to\_config) to make it so that discounts do not affect taxes.

Is it possible to get a bit of an explanation on how this works. Based in the UK I would charge tax to customers in Europe but not outside Europe. If a discount is valid in either case I need the tax to be calculated correctly in both circumstances.

# Answer
You can sort of think of it as applying the discount before or after tax. Say for example, we have a cart with a subtotal of $20, a discount of $10, and a tax of 10%.

The default method works similar to this:

(Subtotal($20) - Discount($10)) + ((Subtotal($20) - Discount($10)) * Tax(.10)) = Total($11)

(20-10) + ((20-10) * .10) = 11

With the exempt\_discount\_from\_tax config added, it works similar to this:

Subtotal($20) + (Subtotal($20) * Tax(.10)) - Discount($10) = Total($12)

20 + (20 * .10) - 10 = 12

Now with that said, that config variable was only intended to be set once. It wasn't meant to be changed on the fly. If you need to be able to configure that variable based on country code, you'll need to modify a core cartthrob file.

In third\_party/cartthrob/cartthrob/core/Cartthrob\_cart.php

Line 1132. Change

```
if ($this->core->config('exempt_discount_from_tax') == TRUE)

```

to

```
if ($this->core->config('exempt_discount_from_tax') == "y")

```

Then inside your template you'll be able to set that config using the `{exp:cartthrob:set_config}` tag pair.

```
{exp:cartthrob:customer_info}
    {exp:cartthrob:set_config}
        {set_exempt_discount_from_tax value='{if "{customer_country_code}" == "USA"}y{if:else}n{/if}'}
    {/exp:cartthrob:set_config}
{/exp:cartthrob:customer_info}

```
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Ensuring links have http:// in rich text fields
anyone know of a good plugin that looks for inline links where an editor has added the link like: `example.com` not `http://example.com` and corrects them automatically?

If it was matrix/grid compatible that'd help.

Best, Liam

# Answer
CK Editor, which is the basis for WYGWAM and Wyvern, will do this when links are added with the link button. Also look at VZ URL: devot-ee.com/add-ons/vz-url-extension which will check links for validity when entered.
> 1 votes

---
Tags: links, automation, http
---


# Question
Title: CartThrob Package Items and Options Missing
CartThrob appears to be tossing data away from package options on checkout. For example, if I have a package with 2 T-Shirts, with 3 options available per shirt, CartThrob only saves *some* of the options on checkout which leaves the data with inaccurate fulfillment data.

To test, I went and created a Package with 2 of the same items in it (1 T-Shirt twice). When I add 1 shirt with options of Black, Small, and Long Sleeve, and the other shirt with Large, White, and Short Sleeve, CartThrob only saves some of the info.

I'm using this with CartThrob 2.5 and EE 2.7.3 on PHP 5.4.7.

Am I missing something?

I've done a dump of the serialized data from the db and here's the output:

```
[product_size] => small
[product_options_other] => short
[product_color] => black
[sub_items] => Array
    (
        [0] => Array
            (
                [entry_id] => 3
                [title] => Test T-Shirt
                [site_id] => 1
                [quantity] => 1
                [price] => 40
                [price_plus_tax] => 48
                [weight] => 2
                [shipping] => 10
                [no_tax] =>
                [no_shipping] =>
                [product_size] =>
            )

        [1] => Array
            (
                [entry_id] => 3
                [title] => Test T-Shirt
                [site_id] => 1
                [quantity] => 1
                [price] => 40
                [price_plus_tax] => 48
                [weight] => 2
                [shipping] => 10
                [no_tax] =>
                [no_shipping] =>
                [product_size] => large
            )

    )

```

)

Note that the individual product arrays from the package are missing all the meta except size, but only 1 has a value.

# Answer
> 0 votes
As Chris Barrett said above, you have to check the boxes next to your product options allowing selection and you're all good.

Also, the Update Cart page/template needs to take into account whether the product is a Package ({if is\_package}) and setting up the options form fields accordingly. That was my main problem actually; the View Cart form was setup thinking the Package was a stand alone product, so was outputting the options for one of the products instead of the options for each of the products in the Package.

Here's a snippet I used to implement in the default Store template (be sure to include in the {exp:cartthrob:update\_cart\_form} tag pair):

```
{if is_package}

    {package}
    {sub:title}<br />

    {exp:cartthrob:item_options row_id="{sub:row_id}"}
        <div class="control-group">

            {if dynamic}
                <label class="control-label" for="{option_field}">{option_label}</label>
                <div class="controls">{input}</div>
            {if:else}
                {if options_exist}
                    <label class="control-label" for="{option_field}">{option_label}</label>
                    <div class="controls">
                    {select}
                        <option {selected} value="{option_value}">
                            {option_name}{if option_price_numeric != 0} +{option_price}{/if}
                        </option>
                    {/select}
                    </div>
                {/if}
            {/if}
        </div>
       {/exp:cartthrob:item_options}
    {/package}

{if:else}

    {exp:cartthrob:item_options row_id="{row_id}"}
        <div class="control-group">

            {if dynamic}
                <label class="control-label" for="{option_field}">{option_label}</label>
                <div class="controls">{input}</div>
            {if:else}
                {if options_exist}
                    <label class="control-label" for="{option_field}">{option_label}</label>
                    <div class="controls">
                    {select}
                        <option {selected} value="{option_value}">
                            {option_name}{if option_price_numeric != 0} +{option_price}{/if}
                        </option>
                    {/select}
                    </div>
                {/if}
            {/if}
        </div>
       {/exp:cartthrob:item_options}
{/if}

```

---
Tags: cartthrob, packages
---


# Question
Title: EE 2.7.2 Upgrade - Channel Form File issue
Update to 2.7.2 and keep getting an error in a Channel Form with a file field. The initial error is a javascript error. If I try to click on the "close" I am sent to the top of the page with a hash tag (#) appended to the URL.

In the channel form the field is : `{field:artist_pic}` where `artist_pic` is a file field.

If I remove the `safecracker_file` folder from the `third_party` folder, I get a page breaking error such as:

```
Error

Unable to load requested field type file:  ft.safecracker_file.php.
Confirm the fieldtype file is located in the expressionengine/third_party/ directory

```

What do I need to do in order to correct this?

*** EDIT ***

The update was from v2.5.5 when performed. The field is a file field and not a saefcracker field.

As for the js error received it is an unknow error `W3C is an unknown...` basically, not seeing the 'file' it is looking for.

*** EDIT II ***

Ok, so after speaking with my partner on this, it looks as though the previous file was never updated to a standard file field. He is making that change now. SOOOOOOO, to keep with the spirit of awarding answers on EESE, who knows if changing field types from saefcracker file fields to a standard file field keeps the data already associated to all of the entries?

# Answer
> 1 votes
It's possible you forgot to upload the /themes directory when you upgraded EE. Try reuploading all the files in that directory to be eliminate that as the source of the error.

# Answer
> 1 votes
OK... for all those out there, I apologize for the lack of communication and not changing the field type.

The data does carry over. The field type processed correctly. Once the old saefcracker fields were updated to file fields the entries had to be re-saved in order to process them as file fields. Also, the saefcracker folder had to be returned to the third party folder in order to update the fields that were included within the Matrix fields. This however, could have been due to not updating Matrix yet.

Hopefully this will help anyone else who runs into a similar issue.

# Answer
> 0 votes
You don't mention which EE version you updated from but here's some info that might help.

In v2.7.0 the SafeCracker File fieldtype was merged with ExpressionEngine’s native File field as per this blog entry (**http://ellislab.com/blog/entry/expressionengine-2.7.0-released**). I don't know what that means exactly but it may be related to your issue.

Here's the change log for that 2.7.0 version:
**http://ellislab.com/expressionengine/user-guide/about/changelog.html#version-2-7-0**

---
Tags: channel-form, ee2-upgrades, safecracker-file, saef
---


title: Custom Sort Order Puzzler

text:
# Question
Title: Custom Sort Order Puzzler
I have a channel which searches by various custom fields and returns 4 results.

What I want to do is to order them by 1,2,3,4 etc and have a custom field to order them with to that effect. No problem there.

Where the question arises is if only 3 entries are returned - there have to be 4 as each entry equals a time: 1 - 10.00, 2 - 10.30, 3 - 11.00 and 4 - 11.30.

So we need to have a conditional to show one of these but can't actually test against one as it doesn't exist. Ie if no-one has submitted an entry for 10.00 I want it to show "AVAILABLE" or some such. Doesn't seem that easy to do....

# Answer
EE can't show what it doesn't have. So the channel entries should not be the starting point of your quest, but i guess the timeslots should be.

I would either go for a frontend solution and let jquery (or a library like angular/knockout) solve the display problem. Or i would prepare a timeslot-list with stash and add the entries to another list and/or compare them. See also: https://speakerdeck.com/croxton/stash-core-principles?slide=55
> 1 votes

---
Tags: orderby
---


# Question
Title: Graphical display of multi-day calendar events?
Is there a way to graphically display multi-day events on a Solspace calendar? I am wanting to create a calendar that works like Google calendars so a multi day event displays as a color bar across the days of the event.

Just showing the title of the event on each day of the event doesn't cut it The graphical UI just communicates so much more effectively and quickly.

thanks!

# Answer
Anna is right, you can add custom classes for css to the event(s) using the {if event\_multi\_day}{/if} conditional.
> 1 votes

---
Tags: solspace-calendar
---


# Question
Title: Rich text editor - losing carriage returns in headings
Carriage returns (ctrl-enter or coded br tags) work fine in paragraphs but they're not saving in the middle of a h1 heading.

Has anyone else encountered this or am I taking crazy pills?

Thanks Amanda

# Answer
> 2 votes
I ended up going with pixel and tonic wygwam. Thanks anyway.

# Answer
> 0 votes
Your best bet is third party. The included RTE has a multitude of bugs EL just seems to keep ignoring.

---
Tags: richtext
---


title: Safari push notification

text:
# Question
Title: Safari push notification
I was wondering.. there is a plugin that provides the Safari push notifications for our ExpressionEngine websities? there are a couple of plugins for wordpress, drupal and joomla

# Answer
> 1 votes
I have not personally tested this yet, but another developer just released an extension for my add-ons Postmaster which does this.

http://devot-ee.com/add-ons/push-notifications-for-postmaster

So if you want to try that out, you also need Postmaster.

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

# Answer
> 1 votes
We developed a solution to use Safari/Web Push Notifications with EE — but since Apples Push-Notification-Service needs server-side scripts and services, this may be hard to accomblish with a EE-AddOn without offer a SaaS behind it to deliver the Notifications.

---
Tags: notification
---


# Question
Title: Automated Newsletter from ExpressionEngine with native or external mailing-service
I'm planing several newsletters for one of my project.

The goal is to send out automated daily and weekly as well as sporadic manually sent Newsletters out to several mailing-lists.

Now as I know there actually are two ways to do that: use an external service like MailChimp or CampaignMonitor (which is better?) … or use a service on our own servers.

There are several modules to link ee with an external service and there are the native or local modules like EE Mailing List and FireMail. I know that using an external service might be better because of all the mailing/blacklist/whitelist/etcpp stuff … but what are the disadvantages of those services?

The Project I'm talking about has almost 10k members and therefore there may be thousands of subscribers. The raw-data of the newsletter will be ee-templates and should be (if possible) send absolutely automaticly each day (list 1) and weekly (list 2). There will also be several mailing-lists where newsletters will be sent only manually by me/our staff.

Now since there are so many Services, Modules etc out there: What is the best solution for this use-cases? And why? What are you using? And why are you using that? Or what are your experiences with that particular solution?

# Answer
> 4 votes
Postmaster is definitely a viable option for this. You could create a Notification to send email's using MailChimp, which I think would be better than CampaignMonitor for this. You could just setup a CRON job to send these notifications whenever you wanted. And if Postmaster doesn't get you everything you need out of the box, the API could be used to bridge the gaps pretty easily.

I would avoid sending emails with PHP. You are subject to all kinds of issues, like a heavy bounce rate for your emails, spam, IP blocking, and so much more. These mailing list services do a great job, and specialize in that specific task. No to mention, their networks and performance is already setup to scale to as many email addresses as you need. I wouldn't even bother trying to build this without one of these services.

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

---
Tags: add-on, email, mailinglist, newsletter
---


# Question
Title: EE Store 2 and paid UPS extension seems to be broken
I am trying to implement the UPS Shipping Extension purchased and it appears to be broken. I've uploaded the extension, enabled it, entered in the Access Key, User ID and Password. I've setup the shipping options and entered in the source destination. Based on previous issues found here, I've made sure the country is "US".

Within my template I've added {field:shipping\_method} in the checkout tag. All I get is an empty drop down. The UPS account exists and is set up as a personal account with one access key generated.

I'm using Store 2.04 and UPS extension 1.02

I'm out of options here. I can't even troubleshoot anymore. Where did things break in this super basic setup I have?

# Answer
> 1 votes
Per the comments above:

> I just located the issue. It was how the state was being passed. I had an issue with how the states auto populate when the country is selected. Problem is solved now.

---
Tags: expresso-store, extension, shipping, ups-shipping
---


# Question
Title: Expresso Store: The number parameter is required
I'm using Payflow Pro with Paypal and I'm running into a bit of an issue. My local test server does not have an SSL setup. With that in mind, if I enter the test credit card details on the final page I can make a successful connection with the gateway and have a completed purchase. If I enter the test credit card details on a step which is before my final confirmation page, I get an error of "The number parameter is required" when I make my final purchase.

* Is this a bug?
* Do credit card details need to be submitted on the last step?
* Or, is this due to the lack of SSL in my local test environment?
* Maybe it's another issue all together?

# Answer
> 1 votes
I don't think it's due to the lack of SSL. Store 2 allows test credit card details to be submitted without having SSL enabled on your server (although you should do it anyway, for consistency between your development and production environments).

> Do credit card details need to be submitted on the last step?

Yes. With Store, payment details must always be submitted on the last step of the checkout. This is because not all gateways support separate authorize/capture operations, so we must immediately charge the supplied credit card. It would be unwise to charge the credit card without also marking the order as complete.

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


title: efficient category templating

text:
# Question
Title: efficient category templating
In the URL **www.site/recipes/meat**, the segment 2 is a category, so, to make this work, I use a template with the category´s name:

the category template, is named (**meat**):

```
{embed="recipes/.recipes" url_title="meat"}

```

The main template, is named (**.recipes**):

```
{embed="estrutura/.template"}
     {exp:stash:set name='main'}
       .........
     {/exp:stash:set}

```

So, when the category appears in the url, the main template **.recipes** is called by the category template. With, **www.site/recipes/meat**, all the entries of this category are listed.

It's working fine, but I have to create a small category template for each category. I'm curious to know if a more efficient templating way exists?

Stéphane

# Answer
By default EE looks for the category indicator in the URL, eg www.site/recipes/category/meat, then output content based on that category url title (/meat).

If you don't want to use the category indicator you'll need to use the LowSeg2Cat addon http://gotolow.com/addons/low-seg2cat \- you can then use one entries tag and one template for any category, simply by using Seg2Cat to pull in the category ID:

```
{exp:channel:entries channel="mychannel" category="{segment_2_category_id}"}
{title}
{/exp:channel:entries}

```
> 4 votes

---
Tags: templates, categories
---


# Question
Title: Solspace Rating - possible to show average of multiple fields in {exp:rating:entries}
On a single entry page I'm displaying that entry's ratings using `{exp:rating:entries}`. Within each rating returned, I'd like to display the average of some/all of the different ratings fields for that rating.

So I need something like `{overall_avg}` but it's an average of the fields in that single rating rather then an average of all ratings for that entry.

I don't see any combination of tags that can make this happen. Any creative ways to achieve this?

Here some template code. Inside my channel:entries tag on a single entry page I have this embed code:

```
{embed="vendor/.ratings" entry-id="{entry_id}" vendor-type="{categories show_group="10" limit="1"}{category_url_title}{/categories}"}

```

And then the embed template looks like this:

```
{exp:rating:entries precision="2" orderby="rating_date" sort="desc" img_height="14" img_width="14" collection="directory" entry_id="{embed:entry-id}" limit="200"}
{if count == 1}
<article class="listing-reviews" id="listing-reviews">
    <h3 class="centered"><em>{total_rating_count} review{if total_rating_count !="1"}s{/if}</em> for {title} <a class="btn directory write-edit" href="#listing-write-review">Write a review</a></h3>
{/if}
    <section class="box review" id="review-{rating_id}">
        <header>
            {if photo}
            {exp:ce_img:single class="pic" src="{photo_url}" max="45" crop="yes" alt="{name}"}
            {if:else}
            {exp:ce_img:single class="pic" src="/i/default-avatar.png" max="45" crop="yes" alt="{name}"}
            {/if}
            <h5>{name}</h5>
            <h6>{who} • {rating_date format="%F %d, %Y"}</h6>
            <div class="stars">
                {stars}{rating}{/stars}
            </div>
        </header>
        <div class="review-text">
            <div class="restrict-height">
                {review}
                <div class="overflow"><a href="#">Read more…</a></div>
            </div>
            <p class="small light">Wedding Date: {wedding}</p>
        </div>
        <ul class="ratings">
            <li>
                <label>{{embed:vendor-type}_1label}</label>
                {if rating1 !="" && rating1 !="0"}
                <div class="stars">
                    {stars}{rating1}{/stars}
                </div>
                <span class="total">{rating1}</span>
                {if:else}
                <div class="stars">
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                </div>
                <span class="total">N/A</span>
                {/if}
            </li>
            <li>
                <label>{{embed:vendor-type}_2label}</label>
                {if rating2 !="" && rating2 !="0"}
                <div class="stars">
                    {stars}{rating2}{/stars}
                </div>
                <span class="total">{rating2}</span>
                {if:else}
                <div class="stars">
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                </div>
                <span class="total">N/A</span>
                {/if}
            </li>
            <li>
                <label>{{embed:vendor-type}_3label}</label>
                {if rating3 !="" && rating3 !="0"}
                <div class="stars">
                    {stars}{rating3}{/stars}
                </div>
                <span class="total">{rating3}</span>
                {if:else}
                <div class="stars">
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                </div>
                <span class="total">N/A</span>
                {/if}
            </li>
            <li>
                <label>{{embed:vendor-type}_4label}</label>
                {if rating4 !="" && rating4 !="0"}
                <div class="stars">
                    {stars}{rating4}{/stars}
                </div>
                <span class="total">{rating4}</span>
                {if:else}
                <div class="stars">
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                    <img src="/i/star-0.png" width="14" height="14" class="rating_star" />
                </div>
                <span class="total">N/A</span>
                {/if}
            </li>
        </ul>
        <footer>
            {exp:rating:rating_vote_stats rating_id="{rating_id}"}
            {if not_already_voted}<span class="helpful"><strong>Was this review helpful?</strong><a href="/vendor/rating-vote/{rating_id}/up/">Yes</a>  |  <a href="/vendor/rating-vote/{rating_id}/down/">No</a></span>{/if}
            {if already_voted}<span class="helpful"><strong>Was this review helpful?</strong>Thanks for your vote</span>{/if}
            <a class="permalink" href="#review-{rating_id}">#</a>
            <a class="report" href="/contact">Problem with this review?</a>
            {if total > 0}<span class="light people-like">{up_votes}/{total} people liked this review</span>{/if}
            {/exp:rating:rating_vote_stats}
        </footer>
    </section>
{if count == total_rating_count}
</article>
{/if}
{/exp:rating:entries}

```

I would like to replace the line `{stars}{rating}{/stars}` with stars for the average of the other 4 fields (rating1, rating2, rating3, rating4).

If I use the rating:stats, I can only specify an entry\_id, which means I can get the average rating for the entry. I don't want that. I want the average rating of all rating fields for **single rating**. Since I cannot specify a rating\_entry\_id to the stats tag I cannot get an average for a single rating.

I hope that clarifies the question.

EE 2.7.2 Rating 3.2.3

# Answer
Working off the example from Solspace with some modifications, I got good results from the PHP below.

The main differences are:

1. I added code to check to see if each rating field had a valid entry (null or 0 are not valid in my system) and adjusted the rating count variable based on that. Then use rating count to divide for the average so the null values do not affect the average.
2. I also added code at bottom to display extra 0 stars after lower ratings so five stars are always shown.

---

```
$rating_count = 0;
if ("{rating1}">=1)
{
    $rating_count++;
}
if ("{rating2}">=1)
{
    $rating_count++;
}
if ("{rating3}">=1)
{
    $rating_count++;
}
if ("{rating4}">=1)
{
    $rating_count++;
}

$rating_avg = ("{rating1}" + "{rating2}" + "{rating3}" + "{rating4}")/$rating_count;

for($i = 1; $i <= $rating_avg; $i++)
{
    echo '<img src="/i/star-100.png" width="14" height="14" class="rating_star" />';
}

$rounded_rating_avg = floor($rating_avg);
$rating_avg_decimal = $rating_avg - $rounded_rating_avg;

switch($rating_avg_decimal)
{
    case 0.25;
        echo '<img src="/i/star-25.png" width="14" height="14" class="rating_star" />';
    break;
    case 0.50;
        echo '<img src="/i/star-50.png" width="14" height="14" class="rating_star" />';
    break;
    case 0.75;
        echo '<img src="/i/star-75.png" width="14" height="14" class="rating_star" />';
    break;
}

$rating_max_diff = 5 - $rounded_rating_avg - 1;

if ($rating_avg == $rounded_rating_avg)
{
    $rating_max_diff++;
}

for($i = 1; $i <= $rating_max_diff; $i++)
{
    echo '<img src="/i/star-0.png" width="14" height="14" class="rating_star" />';
}

```
> 0 votes

# Answer
Rating doesn't have a feature for calculating an average of rating fields for a single ***Rating* entry** (only an average of all ratings, for all fields, for a ***Channel* entry** is possible using {overall\_avg}).

You'll have to do this manually, through PHP or a plugin that specializes in calculations.

Your solution above would work:

```
{exp:ce_str:ing math_lite}({rating1}+{rating2}+{rating3}+{rating4})/4{/exp:ce_str:ing}

```

Alternatively, you could do this with PHP:

```
<?php echo ("{rating1}" + "{rating2}" + "{rating3}" + "{rating4}")/4; ?>

```

As for displaying stars, you'll also have to do this manually. Here's an example using PHP. You might be able to use a plugin (or plugins) to do something similar:

```
$rating_avg = ("{rating1}" + "{rating2}" + "{rating3}" + "{rating4}")/4;

for($i = 1; $i <= $rating_avg; $i++)
{
    echo 'Your full star image';
}

$rounded_rating_avg = floor($rating_avg); // 4
$rating_avg_decimal = $rating_avg - $rounded_rating_avg; // eg. .75

switch($rating_avg_decimal)
{
    case 0.25;
        echo 'Your quarter star image';
    break;
    case 0.50;
        echo 'Your half star image';
    break;
    case 0.75;
        echo 'Your 3/4 star image';
    break;
}

```

**Important Note**: This is just an *example*. You will have to think about and/or adapt this example to your own needs.
> 2 votes

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


# Question
Title: Getting USPS shipping working with Store 2.20
I am running Store 2.20 and EE 2.73 and I am running into Fatal error: Uncaught exceptions using the USPS shipping extension 1.01. Everything is installed and I have two products with all the dimensions added such as weight, length, width and height. Here is an image of my product entry info.

Every time I try to add a product to the cart, I always get a fatal error stating that Dimensions are missing for package; unable to calculate postage. Additional Info: All dimensions must be greater than 0.

This is a pretty intrusive error when someone is just trying to add a product to their cart and not actually going through the checkout process. Does Store call the shipping method every time a product is added to the cart? Is there a better way to handle the uncaught exceptions than killing the site? Also, I get a guzzle error stating that Couldn't resolve host 'production.shippingapis.com' \[url\] http://production.shippingapis.com/ShippingAPI.dll?. This happens pretty regularly as well. I have used Store 1.65 with the same credentials without any issues for the past few months and only started seeing this when I upgraded to Store 2.20. At the moment, a user can not even add products to a cart without one of these errors happening.

# Answer
> 2 votes
Regarding the first error:

> Dimensions are missing for package, unable to calculate postage.

It sounds like you have fixed this by changing the "Size" option from Large to Regular in the USPS extension settings.

Regarding your second error:

> Couldn't resolve host 'production.shippingapis.com'

This means that your server cannot communicate with the outside world. It's likely a problem with your web host/server (for example, a firewall blocking external requests). It's strange that it only happens sometimes though. I would test it on a different host (for example, locally), or ask your web host whether they have anything which may be blocking "curl" requests. If this is a problem for communicating with USPS, it's likely going to be a problem communicating with your payment gateway too, so it's worth getting fixed.

It's also possible that USPS was experiencing downtime while you were testing (which would explain the intermittent failures), but this seems less likely.

We're working to improve the error handling inside shipping methods, so forgive the user-unfriendly errors. However, in general, except for major issues like this (unable to communicate with USPS), the shipping extensions will normally fail silently so that your customers can continue shopping.

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


# Question
Title: Trying to build a makeshift gift card function
**Edit** When adding more than one of the same product to the cart, the qty obviously increases, but it is possible to treat one or more products separately. Ie, if i add product A twice, it shows up as two separate products in the cart? **// end edit**

I have done the following.

1) Included order\_custom1 and 2 on checkout. I use 1 to generate a random string which serves as the gift card number. I use 2 to save the value of the gift card (the item sub total)

2) Since the custom fields are inside the {items} tag pair, they are duplicated for each product (gift card) in the cart. However I'm beginning to think that it's not possible to submit more than one of each custom field, and that they are really supposed to be outside the {items} pair, is this correct?

The reason I ask is because when I output the custom fields in the order overview, I am only able to get the values saved within the last custom field (1 and 2). This is despite outputting them inside the {items} pair.

edit

If i can only submit this once per checkout, is there a way to only allow one product from a specific channel to be in the cart per order? In other words, can i force the user to only be allowed one "gift card" per order?

# Answer
> 2 votes
Correct, the order custom fields belong to the order, not individual line items, so they will be the same for all items.

A better way to approach this would be to generate the random string (gift card token) when you add the individual product to the cart, using modifiers. Store will always merge duplicate products into a single line item, however if they have different modifiers then they will not be merged.

You can start by using custom text modifiers in your product tag:

```
{exp:store:product entry_id="123" input:code="Gift Code"}

    <input type="hidden" name="code" value="random-string" />
    <input type="hidden" name="item_qty" value="1" />
    <input type="submit" value="Add to Cart" />

{/exp:store:product}

```

To let customers choose a price, you can either create modifiers on the publish page, or simply create unique products for each price, or you can enable "dynamic product prices" for the channel field, and let customers submit a `price` field.

Then, in your cart, each item will have a different unique code, and will appear as a separate line item on the invoice. Using this method you won't need to use order custom fields.

---
Tags: expresso-store
---


# Question
Title: Solspace Rating - how to use unrated "null" value but still make field required?
With Solspace Rating I'm allowing members to submit ratings in 4 rating fields. However, to some people, not all fields will apply so they can select an "N/A" option for any of the fields as needed. This option has no value ("" not "0") so it doesn't affect rating stats.

I'm using `allow_unrated=""` to specify that these fields can be submitted with no value. But, I want the fields be be required - meaning they must select a valid rating (1-5) OR the "N/A" option, but they CANNOT select absolutely no option.

The trouble is, the N/A field with null value is equal to selecting nothing, which means Rating's own server-side field validation as well as my client-side form validation script think the field is empty even when it has a valid selection of "N/A".

So as far as I can figure, there's no way to allow unrated fields AND require those fields.

Setting the value of the "N/A" option to 0 is NOT a solution as that is an actual score and therefor pulls down average rating.

Here is some simplified template code for what I'd like to do (this doesn't work):

```
{exp:rating:form
    form:class="box write-review validate"
    form_name="{channel_short_name}"
    collection="{channel_short_name}"
    required="rating1|rating2|rating3|rating4"
    allow_unrated="rating1|rating2|rating3|rating4"
    allow_duplicates="no"
    anonymous="no"
    return="/vendor/rating-thanks/{segment_2}"
    status="closed"
}

{select name="rating1"}
{option value=""}-select a rating from 1-5{/option}
{option value="1"}1{/option}
{option value="2"}2{/option}
{option value="3"}3{/option}
{option value="4"}4{/option}
{option value="5"}5{/option}
{option value=""}N/A{/option}
{/select}

{select name="rating2"}
{option value=""}-select a rating from 1-5{/option}
{option value="1"}1{/option}
{option value="2"}2{/option}
{option value="3"}3{/option}
{option value="4"}4{/option}
{option value="5"}5{/option}
{option value=""}N/A{/option}
{/select}

{select name="rating3"}
{option value=""}-select a rating from 1-5{/option}
{option value="1"}1{/option}
{option value="2"}2{/option}
{option value="3"}3{/option}
{option value="4"}4{/option}
{option value="5"}5{/option}
{option value=""}N/A{/option}
{/select}

{select name="rating4"}
{option value=""}-select a rating from 1-5{/option}
{option value="1"}1{/option}
{option value="2"}2{/option}
{option value="3"}3{/option}
{option value="4"}4{/option}
{option value="5"}5{/option}
{option value=""}N/A{/option}
{/select}

{/exp:rating:form}

```

At present I have to make all the rating fields not required so the form can be submitted with the "N/A" options, but then there's no way to indicate to the member that they have forgotten to select a rating for any of the fields.

# Answer
Here's what I came up with to solve this dilemma:

1. I used a "0" value instead of null on the N/A option values so on my client-side form validation the select boxes could easily be detected as required, and correcly identified as filled in even when the N/A option is selected.
2. Once the form is validated via javascript I ran a function to swap out all "0" values for null before the form is submitted. (I never want to submit a 0 value or it will mess up rating stats/average).
3. Form is then submitted with null values for any rating fields selected as N/A, and I've set those fields as not required in Rating's own required param so the submission is accepted. This means no server-side validation of those ratings fields but it shouldn't matter as it was already validated via javascript.

The result is a form that allows any of those fields to be unrated but also requires those select boxes to have some value selected.
> 0 votes

# Answer
An empty value or the absence of a value will trigger the server-side "required" routine. Both your "select a rating" and "N/A" options have the same value and will trigger the error.

Using the required="" parameter in this case will therefore not work in your situation. Users who select "N/A" would trigger the required error, similarly to those leaving the selection on "select a rating".

You might have better luck with a javascript-based validation approach. For example, add an attribute to your "select a rating" option and check, through javascript, if that option is selected. If it is, throw a "required" js error. There is likely a number of approaches to this, and therefore cannot give any fail-safe examples here. Further, giving js code examples here would be outside of the score of this answer.
> 1 votes

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


title: Custom Plugin to Process Form

text:
# Question
Title: Custom Plugin to Process Form
I am building a custom plugin to process a form. I am new to custom plugins and after looking at several different tutorials I am stuck on my form action. I would like to access the process form method in the class, is this correct with EE and if so, how do I go about it.

Thanks.

```
class Myform {

public function __construct()
{
    $this->EE =& get_instance();
}

public function form()
{

    $form_data = array(
        "id"    => $this->EE->TMPL->form_id,
        "class" => $this->EE->TMPL->form_class,
        "action" => //process_form()
    );

    $tagdata = $this->EE->TMPL->tagdata;

    $form = $this->EE->functions->form_declaration($form_data) . $tagdata . "</form>";

    return $form;
}

public function process_form()
{
    return "testing";
}
// --------------------------------------------------------------------

/**
 * Usage
 *
 * Plugin Usage
 *
 * @access  public
 * @return  string
 */
function usage()
{
    ob_start();
    ?>

    Documentation will go here

    <?php
    $buffer = ob_get_contents();

    ob_end_clean();

    return $buffer;
}

// --------------------------------------------------------------------

```

} // END CLASS

# Answer
> 2 votes
You create a *plugin* or *module*? Because actions is using in Modules. You can add new action to the system using next query (usually in function *install*):

```
$sql[] = "INSERT INTO exp_actions (class, method) VALUES ('module_name', 'my_action_procedure')";

```

how to get action id for specific method:

```
 $form_data = array(
        "id"    => $this->EE->TMPL->fetch_param('form_id',''),
        "class" => $this->EE->TMPL->fetch_param('form_class',''),
        "action" => ee()->functions->fetch_action_id('module_name', 'process_form');
    );

```

if you don't want to develop module, just give user option to add another template name as base for processing form, like

```
{ext:myform process_uri="home/process" form_id="my-form" form_class="super-form-class"}

```

*home/process*

```
{ext:my_plugin:process_form}

```

---
Tags: module, plugin
---


title: How parse channel entry fields content

text:
# Question
Title: How parse channel entry fields content
Is it possible parse ExpressionEngine tags *inside* the content of another tag?

```
{exp:channel:entries channel="my_channel"}
    {parseit {my_field}}
{/exp:channel:entries}

```

my\_field should contain any expression engine tag, even embed if it's possible. Maybe it's possibile using stash, but I can't got how.

Thanks

EDIT, SECOND QUESTION, added allow\_eecode:

```
<?php
    require_once "php.include/user_agent.inc.php";
?>
{embed="include/.head"}

{if segment_1 == ""}
    {exp:channel:entries channel="index" limit="1"}
        {exp:replace_plus find="index.php|.php|/app" replace="{path='site_index'}||{path='site_index'}app/" multiple="yes"}
            {responsive_body_{language_code}}
        {/exp:replace_plus}
    {/exp:channel:entries}
{/if}

{exp:channel:entries channel="multi_version|responsive" limit="1" require_entry="yes"}
    {if segment_1 != ""}
        {if no_results}
            {redirect="404"}
        {/if}
    {/if}
    {exp:replace_plus find="index.php|.php|/app" replace="{path='site_index'}||{path='site_index'}app/" multiple="yes"}
        {exp:switchee variable="{channel_name}" parse="inward"}
            {case value="responsive"}
                {exp:allow_eecode embed="yes"}
                    {responsive_body_{language_code}}
                {/exp:allow_eecode}
            {/case}
            {case value="multi_version"}
                <?php
                    if(userAgent($_SERVER['HTTP_USER_AGENT']) == "mobile"){
                ?>
                        {mobile_body_{language_code}}
                <?php
                    } else{
                ?>
                        {normal_body_{language_code}}
                <?
                    }
                ?>
            {/case}
        {/exp:switchee}
    {/exp:replace_plus}
{/exp:channel:entries}

</html>

```

that's the code, a bit complicate, but it work in other parts. the problem is in case responsive, where you can see {exp:allow\_eecode embed="yes"}. in that field i have an embed like {embed="include/.newslist"} and in my .newslist template I have:

```
test {language_code}

{exp:channel:entries channel="news"}
    {news_title_{language_code}}
    test 2
{/exp:channel:entries}

```

But I can see only "test it" in my responsive entry.

I have one news and it seems to be all fine. I can't got it.

SOLUTION:

adding dynamic="off" in embedded entries tag:

```
{exp:channel:entries channel="news" dynamic="off"}
    {news_title_{language_code}}
    test 2
{/exp:channel:entries}

```

# Answer
> 2 votes
You can try Allow EE Code

```
{exp:channel:entries channel="my_channel"}
    {exp:allow_eecode}
        {my_field}
    {/exp:allow_eecode}
{/exp:channel:entries}

```

# Answer
> 0 votes
```
<?php
    require_once "php.include/user_agent.inc.php";
?>
{embed="include/.head"}

{if segment_1 == ""}
    {exp:channel:entries channel="index" limit="1"}
        {exp:replace_plus find="index.php|.php|/app" replace="{path='site_index'}||{path='site_index'}app/" multiple="yes"}
            {responsive_body_{language_code}}
        {/exp:replace_plus}
    {/exp:channel:entries}
{/if}

{exp:channel:entries channel="multi_version|responsive" limit="1" require_entry="yes"}
    {if segment_1 != ""}
        {if no_results}
            {redirect="404"}
        {/if}
    {/if}
    {exp:replace_plus find="index.php|.php|/app" replace="{path='site_index'}||{path='site_index'}app/" multiple="yes"}
        {exp:switchee variable="{channel_name}" parse="inward"}
            {case value="responsive"}
                {exp:allow_eecode embed="yes"}
                    {responsive_body_{language_code}}
                {/exp:allow_eecode}
            {/case}
            {case value="multi_version"}
                <?php
                    if(userAgent($_SERVER['HTTP_USER_AGENT']) == "mobile"){
                ?>
                        {mobile_body_{language_code}}
                <?php
                    } else{
                ?>
                        {normal_body_{language_code}}
                <?
                    }
                ?>
            {/case}
        {/exp:switchee}
    {/exp:replace_plus}
{/exp:channel:entries}

</html>

```

that's the code, a bit complicate, but it work in other parts. the problem is in case responsive, where you can see {exp:allow\_eecode embed="yes"}. in that field i have an embed like {embed="include/.newslist"} and in my .newslist template I have:

```
test {language_code}

{exp:channel:entries channel="news"}
    {news_title_{language_code}}
    test 2
{/exp:channel:entries}

```

But I can see only "test it" in my responsive entry.

I have one news and it seems to be all fine. I can't got it.

---
Tags: stash, fields, parse
---


title: Freeform email validation possible?

text:
# Question
Title: Freeform email validation possible?
By that I mean can an email field be presented twice on a form and the entry have to match before form submission is allowed?

Best wishes Lee

# Answer
> 1 votes
Found the answer in the documentation here: http://www.solspace.com/docs/freeform/form/#matching\_fields

---
Tags: solspace-freeform
---


# Question
Title: Managing multiple columns in the Grid field
I need to set up a Grid field with several columns – perhaps 5 or more. When this field is presented in the Publishing page the columns get very narrow unless the user has a very wide browser window (which of course cannot be assumed). Does anybody know of an add-on or some other way to alleviate this issue – perhaps something that lets columns be sized in pixels rather than percentages and allows the Grid field scroll sideways on the publishing page, the same way it does when it is being defined?

# Answer
> 2 votes
If you'd rather give Grid tables a fixed width so that the individual columns don't get compressed, you can add your own css rule using **override.css.**

```
table.grid_field {
    width: 1500px !important;
}

```

This will force horizontal scrollbar for screens not wide enough and keep the grid column widths reasonable.

Instead of doing this globally, it may be more useful to target a specific Grid field. You can use a field\_id-specific selector like `#field_id_63 table.grid_field` (just make a note of your field\_id or use the web inspector to see it).

As an alternative to override.css you can also put a style tag right into your field instructions.

**Update:**

If you'd rather not have the Grid field sticking out off the side of the page, you could set `overflow: scroll;` on the `.grid_field_container_cell` which will keep everything neatly contained in the publish form, but still give you a horizontal scrollbar.

```
table.grid_field_container td.grid_field_container_cell {
    overflow: scroll;
}

```

---
Tags: grid
---


# Question
Title: document management solution for EE with folder tree upload drag n drop
I'm looking for a solution that would enable site admins to upload folders and files á la an FTP client or dropbox via a drag and drop interface. I've had a look at assets but it doesn't seem to handle folder and subfolder uploads: http://devot-ee.com/add-ons/assets

Once uploaded a site member would be able to browse and drill down these folders and see the appropriate files. Site admins would have control over which site members have access to which folders.

Is this even possible with EE or should I be looking at another solution?

Thanks

# Answer
Assets is the most advanced file manager for EE, so if it doesn't do it then there isn't an out of the box solution for EE.
> 2 votes

---
Tags: assets, file-uploads, file-manager, ftp
---


title: MSM & channel entries

text:
# Question
Title: MSM & channel entries
First time user of MSM here. I'm building 3 sites that all have the same channels. In some cases, I want only the default site to make channel entries, but want all 3 sites to have access to those entries. In other cases, I want the individual sites to insert their own channel entries and only display those entries in their respective sites.

Can I do the above in MSM?

(I thought MSM allowed me to share everything across sites. I found out during setup that I can make copies of channels, templates, etc. This means each site is working on its copy of the default site, not sharing resources. It's cause a bit of a problems for me. For templates, I will be sharing across sites via symlinks. Now, I'm trying to figure out how to deal with channel entries.)

# Answer
> 3 votes
Yes, you can pull content across sites. That the site setup process allows you to copy an existing site doesn't change that.

You can embed templates across sites using an embed statement:

```
{embed="default_site:embeds/html_header"}

```

I'm not sure what you mean by sharing templates via a symlink.

---
Tags: channel-entries, multi-site-manager, channel
---


# Question
Title: Conditional redirect after Freeform submission
I am having trouble with my form. I have four questions and if any of them are NO, then I need the user to be directed to a "not eligible" type response. However if all of the answers are YES, then I need the user to be directed to another form to complete a consent to participate.

*There is a simple variable fix, but for the life of me I cant get it to function...help please!*

```
{exp:freeform:form
    form_name="application_SANmeter_Eligibility"
    required="name|email|phone1|user_birthday|services|address_1|gender|language"

    // IF ALL ANSWERS ARE YES, THEN THIS IS WHERE I WANT THEM REDIRECTED
    return="http://www.xxxx.org/index.php/translational_research/digital_medicine/SANmeter_index/SANmeter_Consent/"

    // IF ANY ANSWER IS NO, THEN THIS IS WHERE I WANT THEM REDIRECTED
    return="http://www.xxxx.org/index.php/translational_research/digital_medicine/SANmeter_index/SANmeter_NotEligible/"

    notify="xxxx@xxxx.org"
    template="SANmeter_Eligibility_Response"
}

```

# Answer
> 2 votes
According to the docs, you can have a selection option that uses different returns. (Source: http://www.solspace.com/docs/freeform/form/ ) Here's their example:

```
<select name="return">
    <option value="application_form/thank_you">
        I will pay at the door
    </option>
    <option value="application_form/payment">
        I will pay now
    </option>
</select>

```

So you can move the return out of the {exp:freeform:form} tag and into the body of the form. I'd like make the field a hidden field, and then use some javascript to set the option value based upon the selection...

# Answer
> 2 votes
Alternative solution: use a jquery validation tool instead of multiple return options. If all fields have valid solutions (i.e. all are "yes"), then you collect the contact info. If not, they get an error message.

There are tons of options if you search for "jquery validation" like this one: http://validval.frebsite.nl/

Define what a "valid" response is, and then any non-valid response gets an error message. (also defined by you)

I spy a lot of "freeform validation" questions on stack exchange. Maybe look and see if one of those has a more specific recommendation.

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


# Question
Title: ExpressionEngine and generating PDF issue
I have used PDF Press to generate PDFs from data but somehow generated output is rendered ad text/html not PDF which looks like

> %PDF-1.3 1 0 obj \<\< /Type /Catalog /Outlines 2 0 R /Pages 3 0 R \>\> endobj 2 0 obj \<\< /Type /Outlines /Count 0 \>\> endobj 3 0 obj \<\< /Type /Pages /Kids \[6 0 R \] /Count 1 /Resources \<\< /ProcSet 4 0 R /Font \<\< /F1 8 0 R \>\> \>\> /MediaBox \[0.000 0.000 612.000 792.000\] \>\> endobj 4 0 obj \[/PDF /Text \] endobj 5 0 obj \<\< /Creator (DOMPDF) /CreationDate (D:20140206173022-05'00') /ModDate (D:20140206173022-05'00') \>\> endobj 6 0 obj \<\< /Type /Page /Parent 3 0 R /Contents 7 0 R \>\> endobj 7 0 obj \<\< /Length 74 \>\> stream 0.000 0.000 0.000 rg BT 34.016 746.579 Td /F1 12.0 Tf \[(test 123)\] TJ ET endstream endobj 8 0 obj \<\< /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding \>\> endobj xref 0 9 0000000000 65535 f 0000000008 00000 n 0000000073 00000 n 0000000119 00000 n 0000000273 00000 n 0000000302 00000 n 0000000416 00000 n 0000000479 00000 n 0000000603 00000 n trailer \<\< /Size 9 /Root 1 0 R /Info 5 0 R \>\> startxref 712 %%EOF

I have try to use that plugin http://devot-ee.com/add-ons/http-header but I'm getting same result.

With another test I have run from same hosting simple PHP code to generate PDF using FPDF and I'm able to render PDF.

I don't think this is a Virtuamin or Apache issue - neither would be forcing the HTTP header. More likely the header is being set twice in the script, perhaps once to the default of text/html and then again by add-on to application/pdf and EE force to use text/html

Any clue what can be wrong?

Thanks

# Answer
Issue related to DOMPDF library used by PDF Press.

I have modified third\_party/pdf\_press/dompdf/dompdf\_config.custom.inc.php file based on third\_party/pdf\_press/dompdf\_config.custom.inc.php file. Other way wasn’t working (probably something wrong with absolute path).

Fix above resolved issue with generating PDFs for downloading or open by a browser but not in the PDF Press preview mode.

More on that topic here: http://devot-ee.com/add-ons/support/pdf-press/viewthread/12549/P15
> 1 votes

---
Tags: add-on, plugin, pdf-press
---


# Question
Title: Matrix date field error for v2.5.10 bug and fix (at least we think so)
We found an error with Matrix v2.5.10 and EE v2.5.0. Specifically the date field was throwing an error

```
Fatal error: Call to undefined method EE_Localize::format_date() in /chroot/home/giagingo/giaging.org/html/zIyzybo7i9Yn5T/expressionengine/third_party/matrix/celltypes/date.php on line 139

```

# Answer
> 1 votes
line 139 of date.php is

```
$data = $this->EE->localize->format_date($params['format'], $data);

```

Looking at older versions of date.php we tried changing line 139 to read

```
$data = $this->EE->localize->decode_date($params['format'], $data);

```

And it worked!

---
Tags: matrix
---


# Question
Title: Freeform: No submit button on new form or duplicate form screen?
Am I nuts? Did I install the module wrong? I don't see a submit button to confirm my changes within the module. Any ideas? I can't add a field either. Button is there in that case but submitting does not do anything. Thx.

update: I'm too new to answer my own question so I'll edit:

Found the answer after I jumped the gun:

Freeform 4.0.12 ceate form button missing in firefox ie and chrome

I was missing the themes. Sheeeeeit, as Clay Davis would say, who knew you had to install those files too, to make the thing work?

You put the freeform folder under "third party" in the module distribution under \[eebase\] \> themes \> third party on your server.

Anyway I'm happy now, for now.

/amy

# Answer
> 1 votes
Reposting Amy's answer from above:

Found the answer after I jumped the gun:

Freeform 4.0.12 ceate form button missing in firefox ie and chrome

I was missing the themes. Sheeeeeit, as Clay Davis would say, who knew you had to install those files too, to make the thing work?

You put the freeform folder under "third party" in the module distribution under \[eebase\] \> themes \> third party on your server.

---
Tags: solspace-freeform
---


title: Purchased Quantity - what is it?

text:
# Question
Title: Purchased Quantity - what is it?
I am trying to set up a coupon code but I don't think I understand what purchased quantity is.

I have 6 products and want to set a code that will give a 20% discount on one of these products if one of the 6 is purchased at full price.

I am assuming in this scenario I would need to use the buy x get y plugin and that:

```
buy_x_entry_ids = 1,2,3,4,5,6
Purchased Quantity = 2
get_y_entry_ids = 1,2,3,4,5,6
Discount Quantity = 1
Percentage Off = 20
Per Item Limit = 1

```

If I put 1 x product\_1 and 1 x product\_2 in my cart no discount is applied.

If I put 2 x product\_1 and 1 x product\_2 in my cart 20% discount is applied to one product.

However if I put 1 x product\_1 and 2 x product\_2 in my cart no discount is applied.

If I remove Purchased Quantity it is better but then applies the 20% discount on a single product in the checkout.

Any ideas what the correct settings should be?

# Answer
For your scenario you should be using the buy x of a,b,c get discount plugin. https://github.com/CartThrob/cartthrob-discounts-buy\_x\_of\_abc

Your settings would look like this:

```
Purchased Quantity = 1
Discount Quantity = 1
Percentage Off = 20
Qualifying entry_ids = 1,2,3,4,5,6
Per Item Limit = 1

```
> 1 votes

---
Tags: cartthrob
---


# Question
Title: How to make CartThrob PayPal Gateway redirect to German PayPal site?
We are using the `Cartthrob_paypal_express.php` Payment Gateway with CartThrob for over a year now and it is working great.

Just yesterday I noticed that users are being taken to the English version of PayPal when clicking "Purchase". In the top right there is a language dropdown select with English, French and Spanish I believe but not German.

Logging in an purchasing works nonetheless but I would like to have the users land on the German language version since we are a German shop.

I called PayPal today but all they could tell me was that it must have something to do with the payment gateway plugin. I skimmed through the php file but couldn't find anything really (not good with php).

In the CT prefs I also coudn't find anything. Also the API username and stuff doesn't give me a clue.

Thanks and Cheers!

# Answer
> 1 votes
Adding an input for language to your checkout form should set paypal's localecode.

```
<input type="hidden" name="language" value="DE" />

```

---
Tags: cartthrob, paypal, payment-gateway, language
---


# Question
Title: Content restiction based on product expiration
I'm building a portfolio site, on which user profiles shall become invisible after a custom period of time. So users can purchase e.g. a month of public display.

Is this possible using CartThrob? Maybe having the user purchase a product with an expiration date or something?

Thanks!

# Answer
Yes, including an expiration\_date parameter in the add\_to\_cart\_form is exactly how you would do it. The expiration date is entered as days from purchase. `{exp:cartthrob:add_to_cart_form expiration_date="30"}`

Set the channel that holds your public profiles as your purchased items channel in the CartThrob \> Orders settings tab. Then the entries that get added there will have expiration dates.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Wygwam 2.7 not processing Assets tags after bulk conversion
I have a client site in which I need to convert a very large number of existing entries from ExpressionEngine's native File Upload functionality to Assets in order to take advantage of S3 storage. I have successfully converted all File fields to Assets fields and moved over the files to S3 via drag and drop in the Assets interface. Now all of those fields are properly pointing to S3.

The problem comes in with Wygwam fields. I have referred to this other SO answer which explains that previous to Wygwam 2.7 there was no way for Assets to keep track of what files were pointed to inside Wygwam fields. I have upgraded the site's Wygwam version to 2.7.

I wrote a batch process that does a regex replace on the contents of all wygwam fields and converts {filedir\_n} and hardcoded references to {asset\_m} references for the corresponding Assets S3 upload location. Now all of them simply display {asset\_m}/filename.ext, which obviously means broken images.

It was my understanding that Wygwam 2.7 would be able to convert those tags on display to the correct path. Am I missing something?

# Answer
It turns out that the linked SO answer referred incorrectly to {asset\_n} tags as opposed to {assets\_n} with the "s". This was part of the answer.

The rest of it is that Wygwam expects the assets file to be referred to as `{assets_<file_id>:<fallback_url>}`. Importantly, the number refers to the file id in table `exp_assets_files` not the source\_id in `exp_assets_sources`. The presence of the fallback url seems to be for when assets is uninstalled, or when the file reference no longer exists. You should be able to leave it blank eg. `{assets_237:}` but I haven't tested this.
> 1 votes

---
Tags: assets, wygwam
---