title: ExpressionEngine source control via git

text:
# Question
Title: ExpressionEngine source control via git
Im trying use some form of source control with EE.

I cannot clearly see a way to decouple the database from the templates and other structures, as would be the case in a most CMSes. Creating channels and any specific entities seem to 100% tied to the database.

Has anyone been able to fully source control an ExpressionEngine installation and all of the application entities?

# Answer
> 3 votes
Can you define what you mean by "a modern CMS"? Any database driven system will face similar problems when using Git source control. This isn't specifically an ExpressionEngine problem. The only systems that wouldn't suffer this difficulty are those using flat file architecture.

I often use Git with ExpressionEngine. The only possible sticking point being, as you point out, the database.

I create a folder for database backups above my site root. Backups run either manually or by using something like BackupPro(ish) - automated via Cron. This means that the database is available in the repository.

I also use DeployHQ to deploy from the repository to the staging/production servers. The database is imported manually after deployment. This could be automated via a Bash script that runs as part of the deployment process.

There is also a wealth of useful info in this thread ExpressionEngine and GIT Process

# Answer
> 1 votes
You can source control all templates as you can set them to be saves as files.

The only thing you'll have an issue with is the db but show me a db driven cms for less then $10k that does that well.

There is heaps of info out there on how to run a EE site with GIT, a small bit of googling will get you there but many many of us run it in GIT very nicely indeed.

---
Tags: php, database, mysql, development, git
---


title: Export Expresso Store customer data

text:
# Question
Title: Export Expresso Store customer data
Client just increased scope for a project a bit by requiring us to be able to export all customer data from Expresso store so that their AS400 can store it.

I know there are some options here.. Zenbu + Hokaku, AJW Export and DataGrab.. We were already going to use DataGrab to import inventory into Expresso from their AS400 mainframe, but I wasn't entirely sure if it had reasonable export functionality that is up to this task.

Can anybody weigh in on this and advise me on my options? Do I require another plugin or can I just use Datagrab?

# Answer
It depends entirely on what format you need the data to be export into (CSV, JSON, XML, etc). Even when you have decided on a format, you probably need to massage the data into specific columns which apply to your new system.

Datagrab etc work well for import/export, I don't personally have any experience with the others. In most situations I would recommend simply writing a SQL query to gather the data you need and export it to CSV. For more complicated requirements, you could also write a simple PHP script to gather the data and display it in the format required.
> 1 votes

---
Tags: expresso-store, datagrab, export
---


# Question
Title: Expresso Store + UPS Shipping add-on - shipping method is not showing up during checkout process
I have added and enabled UPS Shipping add-on for Expresso Store, configured all settings but it seems not working in a current (even store\_example) checkout flow. Described below how to reproduce that issue.

> During the checkout process on the /checkout page there will be no shipping methods available on the drop down. Then I went to "Continue Billing Details", typed all my billing/shipping details and clicked on "Review Order". From the Confirm Order screen I clicked on Back button and then Back again to /checkout page and now I have got Shipping methods available, but when new cart is created Shipping methods are gone again.

Any clue what is going on there? So far now word from Expresso Store dev team on that issue and it is kind of serious stuck for me (shipping comes as 0 each time when customer follow checkout steps).

Thanks

# Answer
> 1 votes
Store can't calculate shipping costs without a shipping address specified. Exactly which fields are required depends on the shipping plugin, but with UPS for example generally you require at least a country and ZIP code.

You can set a default country/state under Store \> Settings \> Countries / States.

Then I suggest you put a `shipping_postcode` field on the first page of your checkout, so that customers can enter their ZIP and click Update to see the available shipping options.

Alternatively, you can ask the customer to choose a shipping option *after* they have entered their full address, which will ensure the correct shipping options are displayed to them.

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


# Question
Title: Expresso Store - UPS and FedEx shipping methods and free shipping after X amount
I have found that topic Expresso Store - Add free shipping when an order's subtotal is over an certain amount? but it looks like is not relevant to current Expresso Store and UPS or FedEx shipping method add-ons.

Is there any way to deactivate or force to do not count shipping on both methods?

Thanks

# Answer
> 2 votes
In Store 2, you can create a discount with a minimum "Purchase Total", then enable the "Free Shipping" option:

Alternatively, you could create a hidden "Free Shipping" option, then use conditionals in the checkout to automatically submit the free shipping method when the order total is over a certain amount.

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


# Question
Title: database problem checkboxes? Profile:edit form, checkbox error
Spending several hours to tackle this, completely exhausted and see no solution any more. Do hope for some help here. Code 1 no problem. Code 2 throws error Field niveau has three items. all throw error.

```
The form you submitted contained the following errors

Invalid Selection
Invalid Selection
Invalid Selection

```

In a form this code:

**Code 1**

```
<ul class="forms-inline-list">
                 {options:gender_{language_code}}
            <li>
        <input type="radio" id="gender_{language_code}" name="gender_{language_code}[]" value="{option_value}"{checked}>
        <label for="checkbox">{option_value}</label>
            </li>
                {/options:gender_{language_code}}
               </ul>

```

**code 2**

```
<ul class="forms-inline-list">
                 {options:niveau_{language_code}}
            <li>
        <input type="radio" id="niveau_{language_code}" name="niveau_{language_code}[]" value="{option_value}"{checked}>
        <label for="checkbox">{option_value}</label>
            </li>
                {/options:niveau_{language_code}}
               </ul>

```

I swear, the two fields are the same, except for the name.

What is going on here?

Thanks a lot for saving may days.

# Answer
> 0 votes
Related to feel stupid, but, how code checkbox in form?

Chris Barret from Mightybigrobot (makers of Cartthrob abd Profile:edit) helped me out. The brackets have to go in a checkbox or radio select field. Working code is

```
<ul class="forms-inline-list">
                 {options:gender}
            <li>
        <input type="radio" id="gender" name="gender" value="{option_value}"{checked}>
        <label for="checkbox">{option_value}</label>
            </li>
                {/options:gender}
               </ul>

```

---
Tags: channel-form, profile-edit, checkbox
---


title: Expresso Store and iPhone 4

text:
# Question
Title: Expresso Store and iPhone 4
I have tested Expresso Store on an iPhone 4 (version 6.1.3) and it looks like add to cart is not working at all.

UPDATE: I have tested Expresso Store on an iPhone 4 (version 7.0.3) and it works fine. Also tested on iPad 1 Gen (5.1.1) and OSX (10.6.8) os it looks like it is related to Safari from particular iOS version.

Any thoughts?

Thanks

# Answer
> 3 votes
Given that Store is a server-side product, there are no differences between browsers.

Add to cart only requires that you submit a form to the server, which should work with even the most basic web browser.

I suspect if add to cart is not working on some devices, it's most likely related to the login status or stock level of that product, or possibly some client-side JS that you have implemented yourself.

---
Tags: expresso-store
---


title: Need help on custom gateway

text:
# Question
Title: Need help on custom gateway
To start off, please forgive me if i sound like an idiot as i have limited coding capabilities. Having said that, i've been having trouble setting up a custom payment gateway.

The payment gateway requires that i specify a redirection URL for each transaction status: success, fail and cancelled.

The issue is that i have no idea what URL to specify for successful transactions so that the order is successfully processed and recorded into the database.

I've basically just adapted from one of the existing merchant files and came up with the following:

```
class Merchant_enets extends Merchant_driver
{
    const PROCESS_URL = 'https://www.enets.sg/enets2/enps.do';

    public function default_settings()
    {
        return array(
            'user_id' => '',
            'test_mode' => FALSE,
        );
    }

    public function purchase()
    {
        $request = $this->_build_purchase();
        $this->post_redirect($this->_process_url(), $request);
    }

    private function _build_purchase()
    {
        $request = array();
        $request['mid'] = $this->setting('user_id');
        $request['amount'] = $this->param('amount');
        $request['txnRef'] = $this->param('transaction_id');
        $request['umapiType'] = 'lite';
        return $request;
    }

    public function purchase_return()
    {
        $result = $this->CI->input->get_post('result');
        if (empty($result))
        {
            return new Merchant_response(Merchant_response::FAILED, lang('merchant_invalid_response'));
        }

        // validate response
        $request = new SimpleXMLElement('');
        $request->Response = $result;

        $response = $this->post_request(self::PROCESS_URL, $request->asXML());
        $xml = simplexml_load_string($response);

        if ((string)$xml->Success == '1')
        {
            if ((string)$xml->status == 'succ')
            {
                return new Merchant_response(Merchant_response::AUTHORIZED, (string)$xml->ResponseText, (string)$xml->txnRef);
            }
        }

        return new Merchant_response(Merchant_response::FAILED, (string)$xml->ResponseText, (string)$xml->txnRef);
    }

    protected function _process_url()
    {
        return $this->setting('test_mode') ? self::PROCESS_URL_TEST : self::PROCESS_URL;
    }
}

```

Please help!

I'm using EE 2.7 and Store 1.6.5

# Answer
You need to specify the return and cancel URLs on a per-request basis. In Store v1 you can get these URLs with:

```
$this->param('return_url'); // use this for success and error
$this->param('cancel_url'); // use this for cancel

```

You can see how this is done in other gateways such as PayPal Express:

https://github.com/expressodev/ci-merchant/blob/master/libraries/merchant/merchant\_paypal\_express.php
> 2 votes

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


# Question
Title: Expresso Store: Pre-populate a cart with a members last order
Basically I'm looking for a way to allow logged in users to re-order their last order. Has anyone ever tried this before in Expresso Store?

# Answer
> 1 votes
There's no built in way to do it. There are lots of possible complexities, like the fact products ordered in the past may no longer even exist!

If you want to do this, two possible ways come to mind.

You could use the standard add to cart tag along with the orders tag, to add multiple products from a previous order to the cart, all at once. This would require some clever templating, especially if your products have complex modifiers.

Alternatively, you could use PHP and create a simple plugin, which loads a previous order and adds products to the current cart. This would probably be cleaner, but requires some knowledge of PHP.

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


# Question
Title: Deleting order does not re-adjust inventory
I have my products set to 'Limit Stock' and have entered stock amounts. I have processed a few test orders and then deleted them. After doing so, I noticed that the stock counts do not re-adjust accordingly -- i.e. they do not return to their previous counts.

Does deleting an order not re-adjust the inventory accordingly? I really hope this is not the case.

# Answer
No, deleting orders does not return the stock. You will need to adjust the stock manually in the case of a canceled/returned order.

In general you probably shouldn't delete orders anyway. For accounting purposes it is better to make a status "returned" or "canceled" to keep track of how many orders were not successful.
> 3 votes

---
Tags: expresso-store
---


# Question
Title: Total no of row returned for exp:channel:entries?
```
{exp:channel:entries channel="channel_1"}
//how do i find the total no of entries retuned without exp:query?
{/exp/channel:entries}

```

I want to find the count first and then loop?Any idea

# Answer
> 0 votes
To find the total number of entries returned from your exp:channel:entries tag use the variable {total\_results}.

```
{exp:channel:entries channel="channel_1"}
{total_results}
{/exp/channel:entries}

```

http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#total-results

But I'm not sure I understand why you "want to find the count first and then loop?"

The exp:channel:entries tag *is* a loop. It will loop through the code within the tag for every entry returned by it. That's what it is for.

---
Tags: ee2, query, count
---


title: Add/Edit Channel Form

text:
# Question
Title: Add/Edit Channel Form
I've come across this problems enough times now that I'm curious if anyone has sort of a best practice for it that might be helpful.

I have a channel form page that needs to know if the user has already started the application, and there for allow them to edit it, or if if they haven't create a new one.

A simple enough problem it would seem but one I'm constantly tripped up on

Using Stash I've come up with something that "kindof" works but not really

Basically at the top of the page i look for an existing application by that author, something like this

```
{exp:stash:set name="app_id" parse_tags="yes" type = "snippet"}
{exp:channel:entries channel="applications" author_id="{logged_in_member_id}" limit="1" status="not Closed"}
   {entry_id}
{/exp:channel:entries}
{/exp:stash:set}

```

Which will get the entry id of an application if there is one, and return nothing if there isnt.

then for the application itself do something like this

```
{if {exp:stash:not_empty name="app_id"}}
 {exp:channel:form channel="applications" entry_id="{app_id}" return="step2" }
...
  {/exp:channel:form}
{if:else}
   {exp:channel:form channel="applications" return="step2" }
    ...
   {/exp:channel:form}
{/if}

```

Currently there are two issues:

1. i can get the app\_id to render in the page but parse order seems to be an issue as the channel form tag is parsing first and gets an "invalid entry" error, even if its a simple conditional, its always returning false?

`{if {exp:stash:not_empty name="app_id"}}{/if}`
2. This method means i have to maintain two copies of the form and just feels messy?

Is there an easier way to do this?

# Answer
> 2 votes
One option would be to continue with setting the Stash app\_id variable like you are and then embed the form (either Stash embed or EE), then use the app\_id variable in the channel:form parameters in the embed. That keeps you from duplicate forms.

Another option would depend on your url setup, but you could redirect to the current form page with the found entry id as an additional url segment. Something like:

```
{exp:channel:entries channel="CHANNEL" author_id="{logged_in_member_id}" limit="1" status="not Closed" dynamic="no"}
    {if segment_3 == "" AND entry_id != ""}{redirect="TEMPLATE_GROUP/TEMPLATE/{entry_id}"}{/if}
{/exp:channel:entries}

{exp:channel:form
    channel="CHANNEL"
    entry_id="{segment_3}"
    author_only="yes"
    return="TEMPLATE_GROUP/TEMPLATE/ENTRY_ID/success"
}
     etc….

```

# Answer
> 1 votes
Think I might be missing something regarding the maintaining of two copies of the form but as for the parsing issue. If the channel:form tag is parsing first and you need it to parse it after why not put it in an embeded template call. embeded templates are parsed after the rest of the regular template.

# Answer
> 0 votes
I had a similar issue with the following code:

```
{exp:channel:form
 channel="CHANNEL"
 entry_id="{exp:stash:b_entry_id}"
}

```

Simply adding `parse="inward"` to the `{exp:channel:form}` tag sorted it all out. so now I have:

```
{exp:channel:form
 channel="CHANNEL"
 entry_id="{exp:stash:b_entry_id}"
 parse="inward"
}

```

The idea came from this post by Mark Croxton on the Stash support forum.

If you want to know more about parsing order, or parse="inward" check out the EE Docs.

---
Tags: stash, channel-form
---


# Question
Title: Notification emails not sent to admin or customer if customer not logged in
Thi seems really odd, as all other notifications are sent successfully, but no emails are sent when a guest makes a purchase (via SagePay), and from my testing it seems the basket is not cleared. I turned on email logging to verify this.

Is it a CT bug or is it just me?!

# Answer
This one wasn't a CartThrob bug - there was a problem with a third-party payment module which was breaking guest checkout.
> 0 votes

---
Tags: cartthrob
---


# Question
Title: setting stash snippet as author_id does not parse
I try to store member\_id/author\_id for session during visit of other users. Goal: show content of a certain user without showing the id in a URL.

My **testing** template has the author\_id in segment\_2. I can get this segment\_2 with stash, this outputs in the template allright. Like this:

```
{exp:stash:set name="sn_author" scope="user" save="yes" type="snippet"}{segment_2}{/exp:stash:set}

{if sn_author == segment_2}success{/if}

```

But I cannot make this work inside a regular EE entrees tag.

The EE tag outputs correct when hardcoding the desired author\_id. But when I use stash get, it does not work. I understand this is a parsing order. I tried process="end" no luck.

My EE entrees tag

```
{exp:channel:entries channel="member_profiles" dynamic="off" author_id="{exp:stash:sn_author process="end"}"}{member_first_name} {member_last_name} {/exp:channel:entries}

```

I am rather new to stash, cannot get around this, and do hope for an answer here, thank you very much.

# Answer
When you pass a tag as a parameter (any tag, not just Stash) you need to add `parse="inward"` to the parent tag to tell EE to parse the parameters.

```
{exp:stash:set name="sn_author" scope="user" save="yes"}{segment_2}{/exp:stash:set}

{exp:channel:entries channel="member_profiles" dynamic="no" author_id="{exp:stash:sn_author}" parse="inward"}
   {member_first_name} {member_last_name}
{/exp:channel:entries}

```
> 0 votes

---
Tags: stash, entry, author
---


# Question
Title: 'Add file'/'Remove file' in channel entry not working, console errors
All of a sudden, I'm unable to add/remove files (using a vanilla file field) from channel entries. No dialog appears, no error in the page.

The console does show errors - but I'm not sure how to address them:

```
> Found third party scripts in <head> tag.
  Please use cp->add_to_foot() to add scripts. jQuery and the EE global will be moved down in a future release.
  [Inline Script]
x Uncaught TypeError: Object [object Object] has no method 'uniform' admin.php?S=41030c226a249b2e59509a17309f7282&D=cp&C=content_publish&M=entry_form&channel_id=6&entry…:2005
x Uncaught ReferenceError: _EE_uploader_attached is not defined

```

Thanks.

# Answer
> 1 votes
I was able to solve this problem by comparing my current EE installation with a previous installation. The `<head>` of my 'admin.php' file was missing references to js files that my previous installation had:

```
<script type="text/javascript" src="http://www.example.com/themes/javascript/compressed/jquery/jquery.uniform.js"></script>

<script type="text/javascript" src="http://www.example.com/themes/javascript/compressed/jquery/jquery.dropkick-1.0.0.js"></script>

```

I made sure these files existed, added these references to `admin.php`, and uploads are working.

---
Tags: file-uploads
---


# Question
Title: Insert Link dialog hangs using wygwam in Internet Explorer - not other browsers
When editing an entry ... highlight text, click ‘Link’ icon \> the wrong dialog appears with ‘Select an Anchor’ and ‘E-mail Address’ (see image).

There are similar problems in inserting an image

* Under the ‘Upload’ tab it displays a progress bar in place of the ‘Browse’ button.
* The OK and Cancel buttons do nothing and the only way to remove it is to crash the browser using Task Manager

The problem has appeared within the past month (November 2013) and has affected all three people using IE. It does not occur with FF, Chrome or Safari.

* Windows 7
* IE 11
* EE 2.7.2 (but also occurred with 2.5.2)
* Wygwam 3.2.2 (but also occurred with 2.6.3)

This seems to be an IE issue but is there anything I can do to prevent it?

Kip!

# Answer
This is bug with ckeditor upon which WYGWAM is built. Pixel and Tonic have said fix is coming soon in new release of WYGWAM.
> 3 votes

# Answer
We just released Wygwam 3.3 which fixes compatibility issues with Internet Explorer 11.
> 1 votes

---
Tags: wygwam, file-uploads, links, internetexplorer
---


# Question
Title: Wygwam - adding link cannot close window
EE 2.7.3 WYGWAM 3.2.2

When using Internet Explorer I try to add a link using WYGWAM and after I enter the URL i click OK and the pop up window will not close. Is there a fix for this?

# Answer
We just released Wygwam 3.3 which fixes compatibility issues with Internet Explorer 11.
> 2 votes

# Answer
This is bug with ckeditor upon which WYGWAM is built. Pixel and Tonic have said fix is coming soon in new release of WYGWAM.
> 1 votes

---
Tags: pixelandtonic, wygwam
---


title: Category Question

text:
# Question
Title: Category Question
Got a bit of a tricky situation, I need to get some categories, that have a product assigned to itself and another category.

Sort of like sub-categories would work but this other category can't be sub-category.

For example,

I've got a category group with the following categories, `Menu 1`, `Menu 2`, `Menu 3`. There is also another category group with the following categories `Drinks`, `Food`.

The second category group is relevant to all the first group categories. So for each `Menu` category, I need to be able to show the `Drinks` or `Food` category as long as there is a product associated with both the category group categories.

Hope that made sense, I can't really think of a way EE could do this. So any help would be appreciated.

# Answer
> 1 votes
If you assign both category groups to your channel (Menu, Food Type) you should be able to use the categories as you want and display which items are part of the menu category regardless of their food or drink classification.

If you'd like more flexibility, however, you might consider making your Menu a channel with entries themselves and using Playa to relate your various food options to them.

# Answer
> 0 votes
I'm not really sure what you want to attemp but I think I will try to attemp this with Relationship. - Francois

# Answer
> 0 votes
So your "categories " would go...

```
Menu 1
- Drink
- Food
Menu 2
- Drink
- Food
Menu 3
- Drink
- Food

```

You could use categories and sub categories, though you would have to make each subcategory url title unique, eg menu-1-drink, menu2-drink, menu3-drink.

You could also hard code the Drink/Food links for each Menu x category then use /segment\_x values to pull in relevant content.

...and like Jessica suggested use relationships.

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


# Question
Title: If custom channel field entry exists display content else display alternate content
I am trying to set up a slider in ExpressionEngine which will display a video if the video embed code exists, otherwise it will display an image slider. Currently, I am not able to hide the image slider if the video code exists(but the video does get placed on the page).

Here is my code:

```
{slider}
    {if video}
            {video}
    {if:else}
        {if total_rows > "1" && row_count == "1"}
            <div id='news_slider'>
        {/if}
            <img title="{img_title}" src="{img}" />
        {if total_rows > "1" && row_count == total_rows}
            </div>
        {/if}
    {/if}
{/slider}

```

Any ideas? Thanks!

# Answer
> 2 votes
Have you tried this? The difference is on Line 2. It does mean you're running the conditional against the entire embed string rather than the variable but it may work.

```
{slider}
    {if "{video}"!=""}
            {video}
    {if:else}
        {if total_rows > "1" && row_count == "1"}
            <div id='news_slider'>
        {/if}
            <img title="{img_title}" src="{img}" />
        {if total_rows > "1" && row_count == total_rows}
            </div>
        {/if}
    {/if}
{/slider}

```

I also found out from the OP that this is running EE 2.5.5 and Pixel and Tonic Matrix. I wrote a prototype alternative in Grid and advised he upgrades to that.

---
Tags: conditionals, ifelse
---


# Question
Title: Parent Relationship Conditional -- if not empty
I have had no luck in trying to sort a conditional that will only show the following if the category is not empty for the parent relationship.

```
<h3>ARTICLES</h3>
{parents orderby="date" sort="desc" channel="articles" category="1" status="not closed"}
  <h4><a href="{parents:title_permalink="articles/view"}">{parents:title}</a></h4>
  <h5>{parents:article_author}</h5>
{/parents}

```

This is an online magazine table of contents. The parent relationship is the issue number. So I want to only displays articles in the TOC if there are any for that issue.

# Answer
> 2 votes
you can use:

```
{parents orderby="date" sort="desc" channel="articles" category="1" status="not closed"}
  {if parents:count == "1"}<h3>ARTICLES</h3>{/if}
  <h4><a href="{parents:title_permalink=">{parents:title}</a></h4>
  <h5>{parents:article_author}</h5>
  {if parents:no_results}{/if}
{/parents}

```

Regard's.

---
Tags: relationships, conditionals, advanced-conditionals
---


title: Channel Entries - Author Id Parse order

text:
# Question
Title: Channel Entries - Author Id Parse order
I have this code here

```
{exp:channel:entries
        author_id="1|CURRENT_USER"
        channel="foo"
        disable="categories|category_fields|member_data|pagination"
        dynamic="no"
        orderby="entry_id"
        sort="asc"
        parse="inward"
}
    ...
{/exp:channel:entries}

```

This code is supposed to return all the `foo` entries which as authored by

* the admin (author\_id=1)
* the current logged in user (author\_id=45)

The problem that I am having is that it doesn't get the correct entries.

I tried 2 variations as listed below but they didn't work.

```
author_id="1|{member_id}"
author_id="1|{logged_in_member_id}"

```

However, when hardcoding the values

```
author_id="1|45"

```

It returned the correct entries.

How do I solve this problem since I can't use hardcoded values in the code?

# Answer
> 1 votes
it should be work , but it doesn't I think it is a bug.

anyway u can work around this problem with exp:member:custom\_profile\_data

```
{exp:member:custom_profile_data}
{exp:channel:entries
        author_id="1|{member_id}"
        channel="foo"
        disable="categories|category_fields|member_data|pagination"
        dynamic="no"
        orderby="entry_id"
        sort="asc"
        parse="inward"
}

.....

{/exp:channel:entries}
{/exp:member:custom_profile_data}

```

Currently CURRENT\_USER can use as alone value in channel loop but if u want to use CURRENT\_USER in the channel loop instead off custom\_profile\_data , u can hack the EE code.

go to system/expressionengine/modules/channel/mod.channel.php Line 1845

```
$sql .= ee()->functions->sql_andor_string($author_id, 'm.member_id');

```

To

```
$author_id = str_replace('CURRENT_USER',ee()->session->userdata('member_id'),$author_id);
$sql .= ee()->functions->sql_andor_string($author_id, 'm.member_id');

```

**Note: And you can aloes use embed templates to solve problem like this.**

Regard's.

---
Tags: channel-entries, parse-order, author
---


# Question
Title: Adding up (SUM) the values of a field in an entries loop
I have an ee entries loop returning a bunch of entries. Each entry has a custom field holding a numerical value. I would like to add together the values of that field at the end and output the total.

PHP equivalent would be:

```
for ($i = 0; $i < $total; $i++){
$total += $value[$i];
}

Total = echo $total

```

Even better would be to just have this run a SQL like command and return the value for me:

SELECT SUM(column) FROM table

Are there any plugins that can help me with this? I'd like to avoid PHP if possible but if I have to how would I make the PHP work with EE tags, I can't seem to get the value for the custom field into my PHP.

Is there an operator for Stash to achieve this?

# Answer
> 2 votes
u can use a plugin to do this.

I think http://devot-ee.com/add-ons/tally will do the trick.

I hope this will help u.

Regard's.

---
Tags: stash, math
---


# Question
Title: why do i get a blank screen switching between msm sites after upgrade?
Installed EE 2.8.x today with newest msm.

Now when I switch sites or edit sites, I get blank page.

URL is something like: http://subdomain.domain.com/admin.php?/cp/sites/manage\_sites?S=1b89ab94f128fbe5ee247f319cea09ca

Note: 1/3 msm sites is a subdomain of domain1. File paths seem okay. On server domain 2 is a sub-folder of domain 1.

I can log into separate CPs using subdomain or domain. Actual sites work fine to public users.

# Answer
There are a heap of errors with version 2.8 mostly to do with javascript.

https://support.ellislab.com/bugs/detail/20165

Also P&T add-ons seem to have been particularly affected, users reporting issues with Playa, Matrix etc.

There's no ETA on a fix right now just that one is coming with the 2.8.1 release. So I'm playing safe and sticking with 2.7.3
> 1 votes

---
Tags: multi-site-manager, blank-screen
---


# Question
Title: Can I use "contains" logic in categories?
Is there a way to say "If this entry *contains* category 5" rather than "If this entry's category is category 5"?

Consider this:

```
{categories}
{if category_id="5"}
Do something
{/if}
{/categories}

```

I believe the condition would only return true of the *only* category assigned is category 5. If an entry has categories 5 and 6 assigned, it would not be returned here, but that's what I'm looking for.

Possible?

# Answer
If u want to only DO Something for the entries belong to category(id=5) your code will do the trick but if u use "show" param the code will be better:

```
{categories show="5"}
Do something
{/categories}

```

but If u want to Do Something for the entries belong to category(id=5) and another Thing for the entries don't belong to category(id=5) try to use:

```
{categories show="5"}
Do something
{/categories}
{categories show="not 5"}
Do Another thing
{/categories}

```

I hope this will do the trick.

Regard's.
> 1 votes

# Answer
If I'm not mistaken your code should do exactly that.

It would find 5 in the loop and 'do something' and then loop again at 6 and do nothing because there's nothing to execute.

May not be especially efficient but should work.
> 0 votes

---
Tags: categories
---


# Question
Title: detect data is coming from which channel?
```
{exp:channel:entries channel="schedule_action | schedule_sports | schedule_hd" }
        //how do i detect channel here.I need to use a if condition.
{/exp:channel:entries}

```

Based on data is coming from which channel,I need to provide some condition.

How do i give a `{if channel=="ch_1"}{/if}`

# Answer
You're almost there, you have to use the channel short name like this:

```
{if channel == 'my_channel_name'}

```
> 1 votes

# Answer
yes you can use EE {if} or {switchee} plugin both will work with u

but u must use {channel\_short\_name} variable {channel} will give u the full channel name not the short one.

I read in the EE User guide comments here http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#10512

that {channel\_name} is not documented but it is a shorthand of {channel\_short\_name} , but I don't try it.

Regard's.
> 1 votes

# Answer
Use switchee.

{exp:channel:entries channel="schedule\_action | schedule\_sports | schedule\_hd" }

{!-- Choose appropriate based on source channel --}

{exp:switchee variable="{channel\_name}" parse="inward"}

{case value="schedule\_action"}

...

{/case}

{case value="schedule\_sports"}

...

{/case}

{case value="schedule\_hd"}

...

{/case}

{/exp:switchee}

{/exp:channel:entries}

Francois
> 0 votes

---
Tags: ee2, conditionals, ifelse
---


# Question
Title: EE Solspace Freeform Pro Conditionals Not Working
I'm trying to add a conditional for a multipage form. On page 1 there is a radio button and depending on what the user selects, will depend on what fields will be displayed on page 2. Below is the template code and if you would like to see the live page, here's the link (www.igsmeetings.com/portal2014/index.php/meeting-registration). The question field that is acting as the conditional is a radio button "Do you plan on attending this meeting", and I have no idea what value I should use to call that information in my conditional tag. Please let me know what I am doing wrong.

**EE Version:** 2.7.4 **Freeform Pro Version:** 4.1.3

Thanks so much for your help!

```
{exp:freeform:form
   form_id="4"
   return="registration/confirmation"
   multipage="yes"
   multi_page_names="rsvp|complete"
   multi_page="{segment_3}"
   notify_admin="yes"
   notify_user="yes"
   required="first_name|last_name|title|organization|email|phone_number|meeting_name|meeting_type|length_of_meeting|number_of_attendees|location|meeting_start_date_option_1|meeting_end_date_option_1"
   inline_errors="yes"
   inline_error_return="meeting-registration/{segment_3}#form"
   }

   {if freeform:error:first_name OR freeform:error:last_name OR freeform:error:title OR freeform:error:organization OR freeform:error:email OR freeform:error:phone_number OR freeform:error:meeting_name OR freeform:error:meeting_type OR freeform:error:length_of_meeting OR freeform:error:number_of_attendees OR freeform:error:location OR freeform:error:meeting_start_date_option_1 OR freeform:error:meeting_end_date_option_1}
                <div class="alert alert-danger">
                    <i class="icon-warning-sign"></i>   <strong>ALERT:</strong> There were error(s) in your form. Please correct the errors listed below.
                </div>
                {/if}
<!-- PAGE ONE -->
{freeform:page:1 required="rsvp"}
    <h4 class="color">Do you plan on attending this meeting?</h4><br />
     <div class="row">
        <div class="col-md-7">
            <div class="form-group">
                <label for="inputAdminAsst" class="sr-only">{freeform:label:rsvp}</label>
                <div class="col-sm-12">
                  {freeform:field:rsvp attr:class="radio"}
                  {if freeform:error:rsvp}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:rsvp}</p>
                  {/if}
                </div>
             </div>
         </div>
      </div><!-- End Row  -->
      <hr>
     <div class="row">
        <div class="col-md-2 col-md-offset10 pull-right">
            {freeform:submit attr:class="btn border-radius0 dark-gray-bg letters-white margin-top12" attr:value="Continue"}
        </div>
    </div>
{/freeform:page:1}

<!-------- PAGE TWO -------->
{freeform:page:2}
    <h4 class="color">Your Information</h4><br />
    {exp:user:stats}
    <form class="form-horizontal" role="form">

<!-- IF NO -->
{if freeform:mp_data:rsvp == "freeform_rsvp_2"}

        <div class="row">
            <div class="col-md-4">
                <div class="form-group">
                    <label for="inputFirstName" class="sr-only">{freeform:label:first_name}</label>
                    <div class="col-sm-12">
                      <input type="text" class="form-control" placeholder="First Name *" name="first_name" value="{first-name}">
                      {if freeform:error:first_name}
                         <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:first_name}</p>
                      {/if}
                    </div>
                 </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label for="inputLastName" class="sr-only">{freeform:label:last_name}</label>
                    <div class="col-sm-12">
                      <input type="text" class="form-control" placeholder="Last Name *" name="last_name" value="{last-name}">
                      {if freeform:error:last_name}
                         <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:last_name}</p>
                      {/if}
                    </div>
                 </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label for="inputEmail" class="sr-only">{freeform:label:email}</label>
                    <div class="col-sm-12">
                      <input type="email" class="form-control" placeholder="Email *" name="email" value="{email}">
                      {if freeform:error:email}
                         <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:email}</p>
                      {/if}
                    </div>
                 </div>
             </div>
         </div><!-- End Row 1 -->
 <!-- /END IF NO -->

<!-- IF YES -->
{if:else}

    <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputFirstName" class="sr-only">{freeform:label:first_name}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="First Name *" name="first_name" value="{first-name}">
                  {if freeform:error:first_name}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:first_name}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputLastName" class="sr-only">{freeform:label:last_name}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="Last Name *" name="last_name" value="{last-name}">
                  {if freeform:error:last_name}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:last_name}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputRankSalutation" class="sr-only">{freeform:label:rank_salutation}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="Rank/Salutation *" name="rank_salutation">
                  {if freeform:error:rank_salutation}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:rank_salutation}</p>
                  {/if}
                </div>
             </div>
        </div>
     </div><!-- End Row 1 -->
     <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputTitle" class="sr-only">{freeform:label:title}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="Title *" name="title" value="{user-title}">
                  {if freeform:error:title}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:title}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputOrganization" class="sr-only">{freeform:label:organization}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="Organization *" name="organization" value="{organization}">
                  {if freeform:error:organization}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:organization}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputEmail" class="sr-only">{freeform:label:email}</label>
                <div class="col-sm-12">
                  <input type="email" class="form-control" placeholder="Email *" name="email" value="{email}">
                  {if freeform:error:email}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:email}</p>
                  {/if}
                </div>
             </div>
        </div>
     </div><!-- End Row 2 -->
     <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputCity" class="sr-only">{freeform:label:city}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="City *" name="city" value="{city}">
                  {if freeform:error:city}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:city}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputState" class="sr-only">{freeform:label:state}</label>
                <div class="col-sm-12">
                  {freeform:field:state attr:class="form-control"}
                  {if freeform:error:state}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:state}</p>
                  {/if}
                </div>
             </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label for="inputTelephone" class="sr-only">{freeform:label:phone_number}</label>
                <div class="col-sm-12">
                  <input type="text" class="form-control" placeholder="Telephone *" name="phone_number" value="{telephone}">
                  {if freeform:error:phone_number}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:phone_number}</p>
                  {/if}
                </div>
             </div>
        </div>
     </div><!-- End Row 3 -->

     <hr>
     <h4 class="color">Administrative Assistant Information (if applicable)</h4><br />
     <div class="row">
        <div class="col-md-7">
            <div class="form-group">
                <label for="inputAdminAsst" class="sr-only">{freeform:label:administrative_assistant_email}</label>
                <div class="col-sm-12">
                  {freeform:field:administrative_assistant_email attr:class="form-control" attr:placeholder="Administrative Assistant's Email"}
                  {if freeform:error:administrative_assistant_email}
                     <p class="text-danger"><i class="icon-asterisk"></i> {freeform:error:administrative_assistant_email}</p>
                  {/if}
                </div>
             </div>
         </div>
      </div><!-- End Row 4 -->
<!-- END IF YES -->

     {/if}

<!-- END IF STATEMENT -->

     <hr>
     <div class="row">
        <div class="col-md-2 col-md-offset10 pull-right">
            {freeform:submit attr:class="btn border-radius0 dark-gray-bg letters-white margin-top12" attr:name="Submit"}
        </div>
    </div>
</form>
{/exp:user:stats}
{/freeform:page:2}
{/exp:freeform:form}

```

# Answer
> 1 votes
Instead of

```
{if freeform:mp_data:rsvp == "freeform_rsvp_2"}

```

...try:

```
{if '{freeform:mp_data:rsvp}' == "freeform_rsvp_2"}

```

Variables with `:` in them sometimes parse only when they have their brackets `{ }` present, which in turn often need to be wrapped in quotes when present in a conditional.

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


# Question
Title: date_range_start="today" shows events from yesterday
Is there something wrong with this `cal` tag, or is it Calendar's fault? It insists on showing events from yesterday!

```
{exp:calendar:cal date_range_start="today" show_months="12" calendar_name="events"  dynamic="on" category="{segment_4}"}
<a href="{path='events/booking'}/{event_url_title}/">{event_start_date format="%l  %j %F, %Y"}: {event_title}</a>
{/exp:calendar:cal}

```

# Answer
You're missing an important parameter in {exp:calendar:cal}: **`pad_short_weeks="n"`**

You'll likely need to have this parameter set to `n` in the event you're trying to display anything other than a typical calendar display. When set to `n`, weeks won't be "padded" to the nearest first day of the week and last day of the week, as Calendar does this by default for the sake of properly outputting and formatting a calendar.

So for example, using the `date_range_start=""` and `date_range_end=""` parameters, if your code looks like this:

```
date_range_start="2011-10-19" date_range_end="2011-10-21"

```

...with `pad_short_weeks=""` parameter NOT specified, Calendar will automatically display the entire week range (2011-10-16 - 2011-10-22). With `pad_short_weeks="n"`, Calendar will just display the selected range (2011-10-19 - 2011-10-21).
> 2 votes

---
Tags: solspace-calendar
---


title: Low Search Shortcuts 404 not found

text:
# Question
Title: Low Search Shortcuts 404 not found
Low Search Shortcuts look really neat, and I want one for Christmas, trouble is it keeps throwing 404s at me. I tried it on a couple of EE builds with no luck, so I can eliminate version compatibilities.

Looking out there I found some mention of mod\_security, I've only ever had this on new server setups, and not on MAMP PRO, plus when I deployed to the staging server I still get the problem.

I've run out of steam on this and I can easily use http://domain.com/home/search?keywords=hello as an alternative, but would be nice to know what's going on, so any tips on using Shortcuts will be most welcomed.

# Answer
In Low Search, Shortcuts are saved searches (or a set of parameters) that you can give a name. The search results are then triggered by using that name.

**Note: the shortcut is triggered by its name, not by a full URL** (like how the Pages module works).

Consider this simple example in the template `search/shortcuts`:

```
{exp:low_search:shortcuts group_id="1"}
  <a href="{path="search/shortcuts/{shortcut_name}"}">{shortcut_label}</a><br>
{/exp:low_search:shortcuts}

{if segment_3}
  {exp:low_search:results shortcut="{segment_3}"}
    <p>{entry_id}: {title}</p>
  {/exp:low_search:results}
{/if}

```

It loops through the shortcuts in group 1 and generates links to `search/shortcuts/SHORTCUT-NAME`. The Results tag then takes that shortcut name, applies the parameters to itself, thus generating the filtered search results.

**Regular EE routing rules still apply**, so if `search` isn't a valid template group and you have Strict URLs enabled, a 404 will be generated.

You say you have no `search` template group, so I'm guessing that's the case here. If you create a `search` template group, and add the Results tag to its `index` template, the 404s should go away.
> 1 votes

---
Tags: low-search
---


# Question
Title: conditional based on what channel the entry selected in a playa field is in?
I have a matrix field that has 1 column, which is a playa field.

The playa field is set up to allow the user to choose any open entry within 2 different channels. I need to display code in the template that has a conditional the chooses 2 options based on what channel the selected entry (chosen in the playa field) is from.

In other words: user selects an entry in the playa field. That entry can be from either channel A or channel B. I need conditional code that displays one thing if the selected entry is from channel A, and something different if the selected entry is from channel B.

How do I do that? Thanks!!!

here is my template: Note that I can't get ANY type of conditional statement to work where indicated in the comment, but the 2 conditionals outside the EE channel tag DO work.

```
<!-- news promos using Matrix & Playa fields -->
{exp:channel:entries channel="home_page" disable="categories|category_fields|member_data|pagination" limit="1" dynamic="off" show_future_entries="yes"}
            <!-- start matrix field -->
            {homepage_news_4items}
                    {!-- start playa field within the matrix --}
                    {hp_news_promo}
                    <li>
                        <em>{entry_date format="%M. %j, %Y"}</em>
                        <div class="text">
                            <!-- need to insert an EE conditional statement on this line to replace the xxxxxxx --><a href="{path='/xxxxxxxx/{url_title}'}">{exp:word_limit total="7"}{news_long_title}{/exp:word_limit}</a>
                        </div>
                    </li>
                    {/hp_news_promo}
                    {!-- end playa field within the matrix --}
            {/homepage_news_4items}
            <!-- end matrix field -->
{/exp:channel:entries}
<!-- /news promos using Matrix & Playa fields -->

```

{if username == 'rory'}Hi Rory!{/if}
{if segment\_2 == 'march14test'}this is the test template{if:else}wrong URL{/if}

----- END TEMPLATE

Here's what I want to insert as a conditional on the line indicated (to replace the whole line):

{if channel\_short\_name == "industry\_news"}{if:else}{/if}{exp:word\_limit total="7"}{news\_long\_title}{/exp:word\_limit}

---

Well, I have concluded that there is no way to use a conditional inside the matrix/playa code, which is a big disappointment. I even tried the trick with the variable prefix, and it didn't work.

# Answer
You can use {channel\_short\_name}:

```
{if channel_short_name == "channel_a"}
    ...
{if:else}
    ...
{/if}

```
> 2 votes

# Answer
What do you get if you output {channel} in your template for the related fields in your playa loop? Maybe try {playa-field-name:channel} I think you'll get the channel name that you're looking for which you can then use in a standard conditional.
> 0 votes

---
Tags: playa, conditionals
---


# Question
Title: Church Community Builder API Not Working In Template
I am using an api from a third party developer that I can get to work outside of EE with a simple PHP include, but I can't seem to get it to work within a template.

You will see that this page (outside of EE) works and lists the events: http://discoverycolorado.dreamhosters.com/public\_calendar\_listing/

Here is the page where it is not working: http://discoverycolorado.dreamhosters.com/events

I don't think this is an API, I think it may be an EE issue or something I am not doing correctly with the PHP include. I was wondering if someone might have an idea why this might not be working?

Here is the include on the page I am trying to get this events list to show:

```
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/public_calendar_listing/event_search_list.php";
                           include_once($path);
                        ?>

```

Here is the file I am including on the above page:

```
<?php $count = 0; ?>

   <table>
        <tbody>

<?php foreach ( $events as $event ) {

    // If there was a search, and nothing matched, return nothing
    if ($q && $event['search'] == '0') {
        } else {

    // Bring the recurring event dates back in to merge
    if (is_array($dup_events)) {
        foreach ($dup_events as $dup_event) {
            if ($event['id'] == $dup_event['id']) {
                if ($event['date'] !== $dup_event['date']) {
                    $event['end_date'] = $dup_event['date'];
                    }
                }
            }
        }

    ########################################
    #### Format the time and datestamps ####
    ########################################
    $start_stamp = strtotime($event['start_time']);
    $end_stamp = strtotime($event['end_time']);
    $date_stamp = strtotime($event['date']);
    if ($event['end_date']) $end_date_stamp = strtotime($event['end_date']);

    if (date('i', $start_stamp) !== '00' ) {
        $event['start_time'] = date($config['timeformat'], $start_stamp);
        } else {
            $event['start_time'] = date($config['timeformat_simplified'], $start_stamp);
            }

    if (date('i', $end_stamp) !== '00' ) {
        $event['end_time'] = date($config['timeformat'], $end_stamp);
        } else {
            $event['end_time'] = date($config['timeformat_simplified'], $end_stamp);
            }

    if ($event['end_date']) {
        if (date('F', $end_date_stamp) == date('F', $date_stamp)) {
            $event['end_date'] = date($config['dateformat_simplified'], $end_date_stamp);
        } else $event['end_date'] = date($config['dateformat'], $end_date_stamp);
        $event['date'] = date($config['dateformat'], $date_stamp);
    } else $event['date'] = date($config['dateformat_single'], $date_stamp);
    $event['occur'] = date('Ymd', $date_stamp);

    ?>

           <tr><td>
           <?php if ($config['display_ccblink']) { ?>
                <a href="https://<?php echo $config['url'] . '/event_detail.php?event_id=' . $event['id'] . '&occur=' . $event['occur']; ?>" target="_blank">
                <strong><?php echo $event['name']; ?></strong></a>
            <?php } else { ?>
                <strong><?php echo $event['name']; ?></strong>
            <?php } ?>
           </td></tr>

           <tr><td>Date: <?php echo $event['date'];
                    if ($event['end_date']) {
                        echo ' - ' . $event['end_date'];
                    } ?></td></tr>
            <?php if ( $event['start_time'] !== '12' ) { ?>
                    <tr><td>Time: <?php echo $event['start_time'] . ' - ' . $event['end_time']; ?>
                <?php if ( $event['location'] ) { ?>
                        <?php echo ' (' . $event['location'] . ')'; ?></td></tr>
                <?php } ?>
            <?php } else { ?>
                    <tr><td>Time: <?php echo $event['start_time']; ?>
                <?php if ( $event['location'] ) { ?>
                        <?php echo ' (' . $event['location'] . ')'; ?></td></tr>
                <?php } ?>

            <?php } ?>

            <?php if ( $event['description'] ) { ?>
            <tr><td style="white-space:pre-wrap;">Description: <?php echo $event['description']; ?></td></tr>
            <?php } ?>

            <?php if ($config['display_contact']) { ?>
            <tr><td>Contact: <a onclick="javascript:window.open('https://<?php echo $config['url']; ?>/app/easy_email.php?ax=create_new&individual_id=<?php echo $event['leader_id']; ?>&event_id=<?php echo $event['id']; ?>&individual_full_name=<?php echo $event['leader']; ?>','Email','scrollbars=1,width=520,height=710');return false;" href="javascript:void();" ><?php echo $event['leader']; ?></a> <?php echo $event['leader_phone']; ?></td></tr>
            <?php } ?>

        <?php // 2014/02/14 mjf include group name ?>
        <?php if ($event['group_name']) { ?>
                    <tr><td><i><?php echo $event['group_name'] ?></i></td></tr>
        <?php } ?>

            <tr><td> </td></tr>

    <?php $count++;
        }
    } // end foreach $event ?>

    </tbody>
</table>

<?php if ($count == 0) { ?>
        <p> No results found. </p>
<?php }
?>

```

Here is config file for the api:

```
  ##################################################
  #### CCB PUBLIC CALENDAR IN LIST FORMAT       ####
  #### Configuration Options                    ####
  ####                                          ####
  #### This CCB API example provided by:        ####
  #### Philip Cain <pcain@pantanochristian.org> ####
  ##################################################

  $config = array (

  #### CCB API CONFIG ####

  // Your church's CCB address (no "http://" or trailing "/")
  'url' => 'xxxxxxxx',

  // API username and password. You can create one by following the instructions here:
  // https://churchcommunity.fogbugz.com/default.asp?W490
  //
  // Make sure you enable the "public_calendar_listing" service
 'username' => 'xxxxxxxx',
 'password' => 'xxxxxxx',

  #### OPTIONS ####

  // Create a link to the event in CCB
  'display_ccblink' => true,

  // Display event contact information
  'display_contact' => true,

  // Display recurring or multi-day events as a single event?
  'combine_recurring' => true,

  // Set the range for how far into the future you'd like to look
  'range' => '+3 months',

  // 2014/02/14 mjf specify groups to include in calendar
  // group names must match ccb group names exactly
  // to provide no filtering, use:
  //    'groups' => array(),
  // to filter for Congregational Life Events and AWANA events, use:
  //    'groups' => array('Congregational Life Events', 'AWANA'),
  'groups' => array(),

  #### DATE/TIME FORMATS ####

  // Main time format (default looks like "6:30am")
  'timeformat' => 'g:ia',

  // Simplified time format, used when the time is at the top of the hour (default looks like "6am")
  'timeformat_simplified' => 'ga',

  // Main date format (default looks like "May 18")
  'dateformat' => 'F j',

  // Date format for one day events (default looks like "Wednesday, May 18")
  'dateformat_single' => 'l, F j',

  // Simplified date format, used for the end date of a multi-day event       (default looks like "18")
  'dateformat_simplified' => 'j',

      );

?>

```

# Answer
Well, I finally threw in the towel and went with the wimpy solution. I went to my main events page and used an iframe to pull in the working page. Not elegant, but it worked.
> 0 votes

# Answer
To answer with an aside which may indirectly help you...

Putting PHP code in templates isn't ideal. It muddies the water and can be prone to problems.

I can't help but think that you'd be better served integrating your PHP into a simple add-on.

You could quite easily take your code and wrap it in ExpressionEngine's API. http://ellislab.com/expressionengine/user-guide/development/plugins.html

A simple plugin might look like

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

class Event_Search {
public $return_data = "";
public function __construct()
{
  $path = $_SERVER['DOCUMENT_ROOT'];
  $path .= "/public_calendar_listing/event_search_list.php";
  $this->return_data = include_once($path);
  }
}

```

You would put that into `/system/expressionengine/third_party/event_search/pi.event_search.php` and call it with `{exp:event_search}`.

But if that works maybe look into developing it into a nicer add-on in which you return the data back into ExpressionEngine variables so you can build the template directly into EE.
> 0 votes

---
Tags: templates, php
---


# Question
Title: Outputting categories as checkboxes - exp:channel:form / safecracker
I want to output category groups as checkboxes, I've got them outputting correctly however when they are selected and the form is submitted they aren't actually being assigned to the chosen categories suggesting I haven't got them quite right.

here's the code:

```
{exp:channel:form channel="work" return="contribute/thanks"}
          <p>
            <label for="title">Title</label>
            <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();">
            <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50">
          </p>

          <h2>Formats</h2>
          {categories show_group="4"} {!-- formats --}
            <label class="checkbox">{category_name}
            <input type="checkbox" id="{category_id}" name="{category_id}[]" value="{category_id}">
            </label>
          {/categories}

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

{/exp:channel:form}

```

Any ideas on what i'm doing wrong?

# Answer
You're currently giving them all a different name, so they won't be recognised as the category field.

Try `name="category[]"` and if that doesn't work, try `name="category[data][]"`

Also, make sure you add in `{selected}` to keep the values if it returns in error.
> 1 votes

# Answer
I am agree wiht Jammooka u must use `name="category[]"` as u can see in the document here:

http://www.ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/index.html#categories

but in your code u must use `{checked}` instead off `{selected}` to make it work with your checkboxes .

Regard's.
> 2 votes

---
Tags: categories, channel-form
---


# Question
Title: Displaying entries based on selected category
I am sure this is possible but not sure how to do this..

My site contains three 'Product' channels: HAIR, NAILS, BEAUTY.

There is also three category groups, HAIR, NAILS, BEAUTY. (Each group relates to the relevant channel noted above.)
Within each group, there is a list of related categories (brands).

There are multiple entries (products) within the site, each product having a brand (category). (There can obviously be more than one product with the same brand).

I have three page templates:

Product Range Hair - being: site.com/product-range/hair
Product Range Nails - being: site.com/product-range/nails
Product Range Beauty - being: site.com/product-range/beauty

Each one of those pages displays ALL of the products (entries) from the related channel. Now down the side of each page, it displays the entire list of brands (categories) that relate to that channel.

What I want is to make each one of these brands a link, which when clicked will change the products displayed to only show those of that brand. (Layout remains the same.)

It would be great if the URL could also change, eg.
site.com/product-range/hair/brand1
site.com/product-range/hair/brand5

(however that is not really necessary, would just be nice.)

Code that displays all HAIR products (one after another)

```
{exp:channel:entries channel="hprod"}
<img src="{h_img}" />
<h3>{title}</h3>
{categories}<h4>{category_url_title}</h4>{/categories}
{h_desc}
{/exp:channel:entries}

```

My current code that displays all the related HAIR brands
(I am using the GWCODE add-on that displays the number of products in each brand.)

```
{exp:gwcode_categories channel="hprod" entry_count="yes" style="linear"}
<p><a href="hair/{cat_url_title}" title="{cat_name}">{cat_name}</a> ({entry_count})</p>
{/exp:gwcode_categories}

```

The href shown is how i would like it to work, but once again that does not matter. All I want is for the link to change the product entries displayed on the page, to change and only display those of the selected brand.

ANY HELP IS APPRECIATED!

# Answer
you can use this plugin http://gotolow.com/addons/low-seg2cat , so your code will be:

```
{exp:channel:entries channel="hprod" category="{last_segment_category_id}"}
<img src="{h_img}" />
<h3>{title}</h3>
{categories}<h4>{category_url_title}</h4>{/categories}
{h_desc}
{/exp:channel:entries}

```

Regard's.
> 0 votes

# Answer
Shouldn't *need* an addon here. Try this approach:

```
{exp:channel:entries channel="hprod"}
  <img src="{h_img}" />
  <h3>{title}</h3>
   {categories}
     <h4><a href="{path='product-range/hair'}">{category_name}</h4>
   {/categories}
  {h_desc}
{/exp:channel:entries}

```

I've a tutorial on working with EE categories on Train-ee: http://www.train-ee.com/courseware/free-tutorials/comments/working-with-categories/ \- but basically the path linking variable is smart, and knows to create category links when used inside a category loop.

The only reason I would use the Seg2Cat addon is if you don't want EE's native /category/ segment in the URL.
> 1 votes

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


# Question
Title: Using categories tag pair with related categories mode
I'm having issues trying to display a category name when using the related categories option. Two snippets below:

```
{exp:channel:entries channel="blog" limit="4" related_categories_mode="yes" custom_fields="yes"}

```

And inside of the above:

```
{categories limit="1" show="not 1"}{category_name}{/categories}

```

When I remove `related_categories_mode` the categories will display fine, but it's unfortunately necessary for this situation.

# Answer
> 2 votes
yes `{categories}` loop not working with `related_categories_mode`.

you can work around this problem using `{embed}` template and pass the entry\_id to it then call `{categories}` loop.

or you can use addons Like gwcode\_categories http://gwcode.com/add-ons/gwcode-categories/examples/example1

and get the categories info for the current entry.

Regard's.

---
Tags: categories
---


title: View system when offline issue

text:
# Question
Title: View system when offline issue
I have a development site that I've currently set as offline. I created a content administrator members group (which currently has one member) and gave the group permission to view the site when offline. When the one member logs in and attempts to view the site she sees the site offline page. However, when I log in as the same member (same UN, same pass) on my computer I am able to see the site. Thinking that some of my superAdmin privileges might be stored somewhere in my browser I tried logging on as her in a different browser, different computer, and my iPad. In each case I got the same result. I could log in with her credentials and see the site. We set up an Adobe Connect meeting so I can confirm the issue she's having. She's using Firefox in Windows 7, logging in correctly, trying to access the site from the upper right hand link on the CP....and nothing. Based on my tests it seems like the issue is isolated to her system. Can anyone provide some insight to what the problem may be?

Thanks!

# Answer
Sounds like a caching issue with the other user's device; advise them to attempt to login using a different device and/or browser, or have them clear their cache, whichever's easier.
> 1 votes

---
Tags: permissions, system, offline
---


title: Antenna plugin - bracket being inserted

text:
# Question
Title: Antenna plugin - bracket being inserted
I'm using the Antenna plugin to display a YouTube video on a website. The strange thing is that there's a close bracket ')' being inserted after the video.

I can't for the life of me figure out where it's coming from as there are no closing brackets in the template anywhere.

Here's a link to the page (click on the video on the right-hand side): http://dev.whelanservices.com/pest-prevention

Here's the code:

```
<div id="pest-prevention-video">
<div class="video-container">
    <div class="video-area">
        {exp:channel:entries channel="videos" dynamic="no" status="open" entry_id="57"}
            {exp:antenna url='{video_url}' max_width="900" max_height="" cache_minutes="120" youtube_rel="0"}
                {embed_code}
            {/exp:antenna}
        {/exp:channel:entries}
    </div>
</div>

```

Any help is appreciated.

# Answer
I had a client mention it a couple of days ago. That code is actually coming directly from Youtube's embed code. I reported it to Google yesterday but they don't seem to care. If you go to any Youtube video \> Share \> Embed you'll see it right after the closing iframe tag.
> 1 votes

---
Tags: plugin, debugging, video, antenna
---


# Question
Title: Can't edit entry created by another user after update to EE 2.7.3
After updating to ExpressionEngine 2.7.3 from ExpressionEngine 2.5.5 I get a "You are not authorized to perform this action" form error when attempting to update an entry created by another author. After turning on every option available in the member group that is attempting to make the edit I then get another error when attempting to edit the same entry "The selected author is invalid".

# Answer
Know solution in the EllisLab bug reports: https://support.ellislab.com/bugs/detail/20084

> Please make sure these seemingly unrelated settings are set:
>
> The original author’s group has to have “Include Members in PUBLISH page multi-author list?” set to “Yes”
>
> The person attempting to make the edit must have “Can change the author name when posting channel entries” set to “Yes”
> 0 votes

---
Tags: members, member-management, update
---


# Question
Title: Stop /index.php?ACT=8&id=G3UISGtdz attacks
Our server is being hit with spam requests related to new membership via a url query. The query looks like /index.php?ACT=8&id=G3UISGtdz, with the id changing. This is an older EE 1.6.8 site. I have disabled new membership, but the request keep coming.

Is there a way to stop this?

# Answer
Have a look at this question on StackOverflow: How to block bot requests to URLs that match a common pattern in Apache?

Drop this in your .htaccess file. It will match any variation of the querystring that you seem to be getting spammed on. With this mod\_rewrite rule, if a querystring tries to fire `ACT=8`, the Apache will simply respond with a 403 Forbidden.

```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^.*(ACT=8).* [NC]
RewriteRule ^.*$ - [F,L]
</IfModule>

```
> 1 votes

---
Tags: spam
---


# Question
Title: Exp-resso Store : Removing a Product/Item from Cart using products tag
I have a situation where I have a page of products and when you add a product to cart, it simply redirects you back to the page and using the `{if qty_in_cart}` conditional, we're telling the user that the item is in the cart.

However, the client has now asked if there's a way to toggle the item in the cart all on this page. So the user adds the product to the cart and then it will give them the option to 'remove from cart'.

Here's what I have at the moment:

```
{exp:store:product entry_id="{entry_id}" disable_javascript="yes"}
<input type="hidden" name="item_qty" value="1" />
{title}
{if qty_in_cart}
<button class="btn btn-danger btn-small" name="remove_items[{key}]" value="1">
<i class="icon-shopping-cart"></i> Remove from Cart
</button>
{if:else}
<button class="btn btn-primary btn-small">
<i class="icon-shopping-cart"></i> Add to Cart
</button>
{/if}
{/exp:store:product}

```

However, this is resulting in 'disallowed characters' error message when its posted.

Is there a way that I can remove a product using the product tag?

# Answer
I'm not sure if there's an officially supported way to do this, however I just ran a little experiment on a Store set I'm working on right now.

If you set the quantity to -1 and add the item to the cart again, it'll reduce the quantity in the cart.

So you could use some JavaScript to modify the value of your quantity hidden field and submit the same form and it should work.
> 2 votes

# Answer
As well as posting an `item_qty` of `-1` (as Jeremy mentioned), you are also able to override the quantity of an item in the cart.

Instead of submitting an `item_qty` field, use `update_qty`. So you could use a hidden field to explicitly set the quantity of a particular item to 0:

```
<input type="hidden" name="update_qty" value="0" />

```
> 2 votes

---
Tags: expresso-store, ecommerce
---


# Question
Title: Solspace Importer - Get generated password
So I have imported a couple hundred users into my site, and in the importer settings it is set to "Automatically Create" for passwords. How do I get those passwords for those new members so I can give it to them? Or explain exactly what this does.

Thanks!

# Answer
> 2 votes
Automatic creation of password is exactly that: it automatically creates passwords for your users. These are random passwords, which are immediately encoded during the member import. This means that you cannot retrieve these passwords to send to users. Also, you cannot import your own passwords. From the in-add-on instructions:

> For security reasons, the Password field cannot be imported. If a new member is being created, a random password will be created automatically.

However, after having their account imported/created, users can update their account with their own passwords by using EE's forgot password functionality.

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


# Question
Title: Solspace Primary Category returning the primary category id twice
I recently upgraded to Primary Category 2.2.1 The following code is returning the primary category id twice

Has anyone had a similar problem with duplication?

```
{exp:primary_category category_group="2"}
    {primary_category_id}
{/exp:primary_category}

```

regards, Ciaran

# Answer
> 1 votes
Try adding an `entry_id=""` parameter to `{exp:primary_category}`. By providing an entry\_id, you let Primary Category know which primary categories to display for that entry.

# Answer
> 1 votes
This turned out to be a database issue. I had duplicate entries in my exp\_primary\_category table. I think this may have been due to problems I had while upgrading Primary Category.

Solution: Using 'Sequel Pro' I connected to DB, and ran the following query to create a new database table containing only unique rows from exp\_primary\_category: "create table exp\_primary\_category2 as select distinct * from exp\_primary\_category;"

I then renamed 'exp\_primary\_category' to 'exp\_primary\_category-old' (just in case anything went wrong with new table) and named my new table 'exp\_primary\_category'.

Everything back to normal now! Thanks for the help

---
Tags: solspace, primary-category
---


# Question
Title: where are Server path to site's templates saved
I am working locally and occasionally have to push my files up to staging server,

The problem is when I replace the database a variable gets overwritten and breaks my layout.

Server path to site's templates (in Template ManagerGlobal \> Template Preferences)

This is not in the config.php file but if I could set it there good, either that or exclude the table when I export the database.

Thanks

# Answer
Not all configurable options are in the default config file. This is one of them.

But the good news is that you can set an override in your site's config file just by adding it the following:

```
$config['tmpl_file_basepath'] = '/path/to/your/templates';

```

It is possible to override many things in this way, to get the array key examine the ID of the input for that item in the control panel.

You should **definitely** look at using Focus Labs Master Config which allows you to specify different configurations (including database set ups, file paths, templates etc) for multiple domains from which a site might be served. It's a god-send for situations like this.
> 1 votes

# Answer
this will be saved in database (exp\_sites -\> site\_template\_preferences) column but u can't see it because the data encrypted.

any way u can over-ride it with $config\['tmpl\_file\_basepath'\] in your config file.

I think this link will be useful.

http://ellislab.com/expressionengine/user-guide/operations/moving.html

check it an let me know.

**Note: I always use http://devot-ee.com/add-ons/reelocate plugin when I move my sites it's very useful.**

Regard's.
> 0 votes

---
Tags: templates, config, path
---


# Question
Title: Passing specific search parameters into results page
Hey I am going to be using Super search and am wondering how easy it is to pass a parameter to the results page. For example I will have a site with realtors on it and I want to have a link at the bottom of each page to go to a results page that shows just that realtors listings. Can I easily set that up? I've looked through the Docs but nothing jumped out at me.

# Answer
> 2 votes
as I read in the document http://www.solspace.com/docs/super\_search/results/

> The Super\_Search:Results tag displays the entry results from a search query. And since search queries in the URI (and from POST searches) are human-readable (template\_group/template/search&keywords=bird&summary=is+the+word), users can bookmark result pages, along with many other benefits. Searches can be performed in a variety of ways:

I think you can do it easily by using {exp:super\_search:results} as mention in the document.

I hope this will help you , if you need more help tell me.

Regard's.

---
Tags: solspace, supersearch
---


# Question
Title: Channel Entries - Is it possible to search title field with starts with?
Based on the documentation, I can do "exact" and "contains" matching.

Is it possible to do a "starts with" search? For example, lets say I have this entries in the database

1. Web design
2. Web development
3. SEO and Web Marketing

when I search for `web`, I want to get the first and second entries but NOT the third.

# Answer
> 4 votes
The search-parameter for the Channel Entries tag does not allow you to target a Title field. So either get creative with the Query module, or try one of these options:

### 1. Low Search

Low Search's Field Search filter *can* target entry titles *and* allows you to match by 'starts with'. That would look something like this:

```
{exp:low_search:results channel="services" search:title="web" starts_with="search:title"}

```

Or, alternatively:

```
{exp:low_search:results channel="services" search:title="^web"}

```

### 2. Channel Query

Channel Query is like the Query module, but calls the native channel:entries module with its result. You should be able to use it like this (untested):

```
{exp:channel_query sql="SELECT entry_id FROM exp_channel_titles WHERE title LIKE 'web%' AND channel_id = 1"}

```

# Answer
> 1 votes
I don't think this can be done.

The only way I can think about is to write addons to do this.

I think this plugin will be useful https://github.com/croxton/Search\_fields

this plugin use the same way as EE but with some additional features.

u can hack it and add "starts with" feature.

Regard's.

---
Tags: channel-entries
---


# Question
Title: Simple conditional to compare expiration and entry date failing to evaluate
I'm trying to code more readable dates on posts which have been entered.

It will read "12 - 17 Jan" but if the month is across two months it will read "12 Jan - 2 Feb"

Spitting out my dates like so

```
<span>{entry_date format="%d %M"} -<br>{expiration_date format="%d %M"}</span>

```

Shows the dates are not evaluating to the same month... for instance the first entry is "21 JAN - 17 JUL"

If I run a conditional on this exact same entry...

```
{if {entry_date format="%M"}=={expiration_date format="%M"}}
SAME MONTH
{/if}

```

It's returning "SAME MONTH" am I overlooking something here? does the parse order mess with the conditional (I can't imagine it is in this instance) it may be worth mentioning that if I say "!=" does not equal... nothing is returned.

Any help would be appreciated. Thanks Chris

# Answer
just around them by `'`

```
{if '{entry_date format="%M"}'=='{expiration_date format="%M"}'}

```

Regard's.
> 0 votes

---
Tags: conditionals, date-format
---


# Question
Title: Entries list without know ID of Category - want to usw category_url_title
In my URL I have the category (segment\_2). And now I want a list with all entries from this category.

If I use category="8" its fine, but in my URL isn't a ID... it's the {category\_url\_title}.

{category\_url\_title} is my {segment\_2}

```
{exp:channel:entries channel="redner" dynamic="off" category="{segment_2}" status="open"}
    {title}
{/exp:channel:entries}

```

thanks for help Michel

# Answer
> 1 votes
if u want to use category\_url\_title in the title you must enable Use

> Category URL Titles In Links In Admin ‣ Channel Administration ‣ Global Channel Preferences

as mention on http://ellislab.com/expressionengine/user-guide/cp/admin/channels/global\_channel\_preferences.html

and you must add the

> Category URL Indicator (default: "category")

in your URL so if your URL is http://example.com/page\_name/your\_category\_url\_title

then you must change it to http://example.com/page\_name/category/your\_category\_url\_title

In the otherhand IF you want to keep your URL as it you must use addons

a good one is http://gotolow.com/addons/low-seg2cat , so your code will be:

```
{exp:channel:entries channel="redner" dynamic="off" category="{segment_2_category_id}" status="open"}
    {title}
{/exp:channel:entries}

```

Regard's.

---
Tags: channel-entries, entries, categories, segments
---


# Question
Title: Wygwam problem with Assets as file browser
Running EE 2.1.1 Wygwam 2.7.1 and Assets 2.1.3

In Wygwam modal settings, I select Assets as the File Browser and hit save.

Go into a Editor Configuration and the Upload Directory does not have a drop down, it just says **no\_upload\_prefs**

The file browser setting doesn't seem to do anything. If I add a directory to EE's file upload preferences, they show in the select list in the Editor Configuration, even though the file browser is set for Assets.

Anyone have an insight on this!!??

# Answer
It turns out that you must have at least one upload location (for that site, if MSM is enabled) present in order to set the upload location in Wygwam.

For instance, I just performed a migration of Wygwam (2.7.1) data from using the native EE uploads to using Assets (2.2.2). Initially, I moved all of the images from the native upload location to an assets external location. Aterwards I deleted the old upload locations and set Wygwam to use Assets for the browsing.

I noticed this led to the same issue reported here. However, when I went back and created a new upload location (didn't matter where) I was able to get into the editor configurations and simply save them as is (such that the upload preferences had "--" selected). That made the browse button reappear in the wygwam image editor modal.

Unfortunately, you will need to keep at least one upload location on the local filesystem to keep the browse button working.
> 2 votes

---
Tags: assets, pixelandtonic, wygwam
---


title: Blank Pages on Channel Field Edit

text:
# Question
Title: Blank Pages on Channel Field Edit
I just updated to EE 2.8 & MSM 2.1.6 and now when I try to edit a channel field, I get a blank page.

Any help is appreciated.

# Answer
> 1 votes
I had moved over safecracker\_file in the third\_party directory along with my other extensions when doing the upgrade. Removing safecracker\_file fixed the issue.

---
Tags: blank-screen
---


title: Display Avatar for solspace rating

text:
# Question
Title: Display Avatar for solspace rating
this may be a dumb question im slightly new to EE and have read the docs for Solspace rating plugin. Basically I have a ratings for trainers. But the avatar being displayed is of the user id that i am on the {name} is fine is displaying the right name for this rating just the avatar is the same for all..

here is my code

```
{exp:rating:entries
    entry_id="{entry_id}"
    limit="10"
}

    <p>{review}</p>

    <ul>
        <p>{stars}{rating}{/stars}</p>

    {if screen_name}
    <h6>{name}</h6>

    {if avatar}
    <img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}"  />
    {/if}
    </ul>

    {if rating_no_results}
        <p>Sorry, no ratings have been submitted for this entry yet.</p>
    {/if}

{/exp:rating:entries}

```

# Answer
What you have is correct (unless you're missing the closing {/if} for the screen name check like Ahmad pointed out). However, I am assuming you have this Rating:Entries tag placed inside a Channel:Entries loop, within the same template?

If so, what's happening is that variables between the 2 tags are colliding, and you'll need to use an embed instead:

Main template:

```
{exp:channel:entries ...stuff... }
    <h2>{title}</h2>
    <p>{body}</p>
    {embed="path_to/embed_template" entry_id="{entry_id}"}
{/exp:channel:entries}

```

Embedded template:

```
{exp:rating:entries
    entry_id="{embed:entry_id}"
    limit="10"
}
    <p>{review}</p>
    <p>{stars}{rating}{/stars}</p>
    <h6>{name}</h6>
    {if avatar}
    <img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}"  />
    {/if}
    </ul>
    {if rating_no_results}
        <p>Sorry, no ratings have been submitted for this entry yet.</p>
    {/if}
{/exp:rating:entries}

```
> 2 votes

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


# Question
Title: Problem with ee()->input->post in plugin
The following plugin code works fine for me locally running mamp and php 5.5.3, but returns nothing on our dev server running php 5.5.8:

```
$rating     = ee()->input->post('rating');
return $rating;

```

Both environments are running EE 2.7.3. The template code is as follows:

```
<form id="ratingform" action="/globals/process-save-and-rate/{last_segment}/10/" method="post">
    <input type="text" name="rating" id="rating" value="4">
    <input type="hidden" name="XID" value="{XID_HASH}">
    <button type="submit">Submit</button>
</form>

```

What is in 'process-save-and-rate' is as follows (and I know this should be a module to process the form):

```
{exp:switchee variable="{segment_4}" parse="inward"}
    {case value="1"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="1"}
    {/case}
    {case value="2"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="2"}
    {/case}
    {case value="3"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="3"}
    {/case}
    {case value="10"}
        {exp:pp_general:save_and_rate entry_id="{segment_3}"}
    {/case}
{/exp:switchee}

```

If anyone can shed any light on why this is not working, I'd be very grateful. As I say, I'm just getting a blank screen whereas it should be outputting the value of the $rating variable.

Secure forms is turned on in EE. Turning it off and removing the XID hash gives the same result.

I'm not seeing any php errors so am a bit stumped.

Jim

# Answer
> 2 votes
So this is now fixed. What I did was convert the plugin to a module and use EE's ACT action urls to handle the form posting.

I got some great tips from looking at Andrew Weaver's EE Addon Recipes site (http://ee-recipes.com) so thanks to Andrew for putting that out there.

---
Tags: plugin, 2.7.3
---


title: No payment methods visible in cart

text:
# Question
Title: No payment methods visible in cart
I have enabled Netaxept and Dummy in the settings, but {field:payment\_method} still just outputs an empty select list in the cart. What could be wrong?

Edit. Here is my code.

```
{exp:store:checkout
form_class="form default"
return="handlekurv/takk"
error_handling="inline"
error_delimiters='<span class="help-inline">|</span>'}

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

<section class="three-col">
    <div class="col">
        <h2>Faktureringsadresse</h2>
        <p>Navn: <strong>{billing_name}</strong></p>
        <p>Adresse: <strong>{billing_address1}</strong></p>
        <p>Sted: <strong>{billing_postcode}, {order_custom1}</strong></p>
        <p>Land: <strong>{billing_country_name}</strong></p>
        <p>Telefon: <strong>{billing_phone}</strong></p>
        <p>E-post: <strong>{order_email}</strong></p>
    </div>
    <div class="col">
        <h2>Leveringsadresse</h2>
        {if shipping_same_as_billing}
            <p>Samme som faktureringsadresse</p>
        {if:else}
            <p>Navn: <strong>{shipping_name}</strong></p>
            <p>Adresse: <strong>{shipping_address1}</strong></p>
            <p>Sted: <strong>{shipping_postcode}, {order_custom2}</strong></p>
            <p>Land: <strong>{shipping_country_name}</strong></p>
            <p>Telefon: <strong>{shipping_phone}</strong></p>
        {/if}
    </div>
    <div class="col">
        <h2>Betalingsmåte</h2>
        {field:payment_method}
    </div>
</section> <!-- .three-col -->
<input type="submit" class="btn-flat green submit-cart" name="submit" value="Fullfør ordre" class="btn gray">

```

{/exp:store:checkout}

# Answer
No caching, but strangely, when I change dthe code to this, it suddenly started working.

```
<select id="payment_method" name="payment_method">
{payment_method_options}
</select>

```
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Check if item is in cart using categories
Folks:

The client has a number of products that do not ship outside of North America (most ship anywhere). I am using the is\_in\_cart tag (http://cartthrob.com/docs/tags\_detail/is\_in\_cart/) to check if non-shippable items are in the cart. There are 18 items that don't ship outside North America.

Now, I have a long OR statement to deal with this ({exp:cartthrob:is\_in\_cart entry\_id="301"} OR {exp:cartthrob:is\_in\_cart entry\_id="302"} OR {exp:cartthrob:is\_in\_cart entry\_id="303"} etc.). This isn't too bad. Problem is, though, that the site is going multilingual. This means 18 more checks for every new language. With 6 languages total, that's a crazy number of OR statements and will be a big performance hit.

It would be great if I could just check against a single category. Is this possible?

# Answer
> 1 votes
First of all, if you use for example publisher for translations, you will keep the same ID's so that would not be an issue!

What I would do in your case is add a custom field to the product of the type checkbox and check the products that can't be shipped. Then in you loop through your cart to check if a product is in the cart you can do a conditional check on the custom check box field.

I don't know if it is possible with cartthrob to add custom fields, with expresso store you can since those product entries are based on channels.

---
Tags: cartthrob
---


# Question
Title: Coppee Pastee Fatal error when trying to install fieldtype
I receive this error when trying to install Coppee Pastee in ExpressionEngine 2.8.0

> Fatal error: Call to undefined method EE\_Fieldtype::EE\_Fieldtype() in /System/expressionengine/third\_party/copee\_pastee/ft.copee\_pastee.php on line 23

# Answer
Replace "parent::EE\_Fieldtype();" on line 23 of ft.copee\_pastee.php with "parent::\__construct();"
> 4 votes

---
Tags: ee2, fieldtype, update
---


# Question
Title: Problems with Safecracker updating Status after upgrade to EE2.6.1
I have a simple safecracker form to allow a member group change the status of an entry

```
{exp:safecracker
channel="{channel_name}"
return="/template/"
author_only="no"
include_jquery="no"
safecracker_head="no"
datepicker="no"
use_live_url="no"
entry_id="{segment_3}"
id="apply_status"}
     {status_menu}
    <select name="status" tabindex="1">
        {select_options}
    </select>
{/status_menu}
<input type="submit" name="submit" value="Submit" tabindex="2" id="apply_status">
{/exp:safecracker}

```

This was working fine until I upgraded to ee2.6.1. The issue is if the Entry author is in a different member\_group than the editor member\_group I am given the "you are not authorised to perform this action" error.

The editor member\_group has permission to: Post and edit entries in the channel Can edit entries authored by others

I thought the problem might be related to this bug in2.6 https://support.ellislab.com/bugs/detail/19335 But that seems to be corrected in 2.6.1

Super-Admins do not get this error.

Can anyone replicated this error or is there a setting I'm missing somewhere?

# Answer
> 3 votes
Bug fix mentioned here

http://support.ellislab.com/bugs/detail/20084

> Please make sure these seemingly unrelated settings are set:
>
> The original author’s group has to have “Include Members in PUBLISH page multi-author list?” set to “Yes”
>
> The person attempting to make the edit must have “Can change the author name when \> posting channel entries” set to “Yes”

---
Tags: safecracker, ee2-upgrades, status
---


# Question
Title: Conditionals or marker count on Google Maps for expression engine
I've got a channel in EE with a 'Google Maps for EE' fieldtype and what I'm trying to achieve is to not display the map in the template if the content editor has not added a marker to the map.

Is there a conditional or marker count available that could be used in the templates?

Running EE2.73 and Google Maps for EE 3.3.5

# Answer
> 0 votes
I think you can use this variable:

https://www.objectivehtml.com/google-maps/fieldtype#total\_markers

Regard's.

---
Tags: ee2, google-maps-for-ee, google-maps, objective-html
---


# Question
Title: Is it possible, and how to search in date fields
When working with custom date fields, are there any solutions for searching dates? e.g. channel:entries search:datefield=""

The only thing that seems to work, if you search for the litteral unix timestamp e.g. 1394967600

**Edit/clarfication**
I'm searching for a way to use `>` and `<` for custom date ranges based on custom fields. The start\_on and stop\_before parameters only work on the entry\_date.

Answer compilation:
\- **Query module** (however, you won't be able to use other channel:entries parameters)
\- SolSpace **Date Field Filter** (ads parameters to channel:entries tag)
\- **Low-Search** (allows ranges on custom fields)

# Answer
> 3 votes
With `entry_date` you can use a `start_on` and `stop_before` parameter in your channel loop but cannot do an equivalent for custom date fields.

You have two good options here. The first is to use the `{exp:query}` module in place of a channel entry loop, and the other is to use a third-party search module such as Low Search

If you opt for the query method you should start a loop such as the following...

```
<ul>
    {exp:query sql="SELECT * FROM exp_channel_data JOIN exp_channel_titles
 ON exp_channel_titles.entry_id = exp_channel_data.entry_id WHERE (exp_channel_data.channel_id = '7') AND (field_id_48 > '1194712120' AND field_id_48 < '1694712120')"}
        <li>{title} - {field_id_48}</li>

        {if no_results}
          <li>No results :-(</li>
        {/if}
    {/exp:query}
</ul>

```

Where `'7'` is your channel ID and `field_id_48` is the ID of your date field.

You can also change the second reference to `field_id_48` to a date field for "end date".

Change `1194712120` and `1694712120` to the correct UNIX time stamp for your date range.

The query module is free and built into ExpressionEngine, but you may need to enable it via the "Add-Ons \> Module" screen in the control panel. Low Search is a paid for third-party add-on.

# Answer
> 2 votes
GDmac

I think you can workaround this problem using a simple php code like

```
$timestamp = $this->EE->localize->string_to_timestamp("May 20th, 2007");

```

this will give you a timestamp value for your date which can by passed to {channel:entries} loop via embed variable.

or you can put it in a simple plugin if you don't want to use php.

you can use my plugin https://github.com/ahmad-saad/str\_to\_time

I hope this will help you

Regard's.

---
Tags: search
---


# Question
Title: Dynamic Return Based on Existing Checkboxes
This is on a client site running EE 2.6.1 and Freeform 4.0.12.

I have a Freeform-based contact form with dynamic recipients in place and working based on user's section of 10 different checkboxes. So far so good.

Now the client is asking that the return page URL be dictated by those same checkboxes - so they can track different things in Google Analytics.

What they want isn't just a 1:1 mapping of checkbox to URL - they want some different combinations (if user selects a & b, do this, if they select all checkboxes do that, etc).

I see Freeform Pro has a return field that allows different return URLs based on the field selection, but what I need is to leverage the existing checkboxes, and be able to insert different logic statements before the final return URL is chosen.

Any ideas?

# Answer
> 3 votes
The only thing come to my mind is adding input:hidden field to your form named(return)

then use some JavaScript/Jquery code to change this value depend on checkboxes values.

Regard's.

# Answer
> 3 votes
I've had to do similar things in the past.

Generally what I do is set the return to `template_group/template/%%entry_id%%`

Then, within that template, I use the `{exp:freeform:entries}` tag to pull up the new entry from the the URL.

Within the tag pair, I use conditionals on whatever fields, or something do a custom plugin to handle the logic, and redirect to the right place.

It's an additional redirect from using a dynamic value in the return parameter, but it lets you use the template engine to handle your logic for the redirect.

# Answer
> -4 votes
Yeah like above set the return template to do a redirect based on passed value...

---
Tags: solspace-freeform
---