# Question
Title: Cartthrob checkout form with different billing and member information
Hoping to get a bit of Cartthrob insight.

I'm wondering if it's possible to have a CT form which has different fields for Member information - for new member creation - and Billing information which is used for credit card processing.

For example if the new member's information being created during checkout is different from say the business credit card and billing information etc.

Same form inputs in my case just different functions (and therefore probably different input names)

I'm using Profile:edit. The P:E fields are mapped to CT (CT Member Settings) in the CP.

I know I can use inputs like the following where `profile_website` in custom\_data array is a custom text field in the P:E profile channel that gets passed the value to the profile channel during checkout. This example would pass the website to the newly created member profile:

`<input type="text" name="custom_data[profile_website]" value="" />`

Some ideas I've thought about though, not totally sure what their outcomes would be:

* Turn off CT Member drop down field mapping and use custom\_data\[\] array on the Member Info section of the form to fill the profile channel entry for each profile field.
* Use custom\_data\[\] array on the Member Info section of the form and hope it overwrites the CT member drop down P:E field mapping after it hits in-turn changing all the details of the new member to that from the member inputs.
* Use shipping address somehow for the member creation fields which I can map in the CT Member settings somehow.

I'm a bit surprised this isn't documented somewhere though, admittedly I'm a little tired and my google-foo is coming up short as is my brain for that matter.

Appreciate any thoughts!

# Answer
> 2 votes
Here's how we did this type of thing. The site uses the following checkout sequence, but using EE custom member fields and freemember rather than Profile Edit.

*View Basket \> Add customer details \> Checkout confirm \> Payment Gateway \> Confirmation - with option to register*

We've setup the member fields, giving them the same short names as the customer fields we've used in the orders channel. So our *customer-details* page looks like this:

```
{exp:cartthrob:save_customer_info_form
        id="customer-details-form"
        name="customer-details"
        class="form-stacked"
        required="first_name|last_name|address|city|state|zip|phone"
        return="checkout/confirmation"
        }
        <input type="hidden" name="country_code" value="GBR">
        <input type="hidden" name="currency_code" value="GBP">

        <div class="billing-details-fields">

            <fieldset class="customer-details">
            <h3>Your details</h3>
            <p class="form-left-left">
                <label for="first_name">First name</label><br>
                <input type="text" name="first_name" id="first_name" placeholder="eg. John" {if logged_in}value="{first_name}"{/if}>
            </p>
            <p class="form-left-right">
                <label for="last_name">Last name</label><br>
                <input type="text" name="last_name" id="last_name" placeholder="eg. Smith" {if logged_in}value="{last_name}"{/if}>
            </p>
[...]
{/exp:cartthrob:save_customer_info_form}

```

The confirmation page literally outputs the cart table again with final totals for shipping, tax etc. The customer then goes off to pay off-site and returns to a success/fail page with the result of the transaction. Having collected all the customer details, we then ask them if they want to register (assuming they're not registered/logged out) - all they need to do is choose a password. We then use freemember to add their details into the member fields using hidden form fields with the values from the values saved to Cart Throb's cookies in the previous page.

```
{if logged_out}
{exp:low_variables:parse var="lv_create_account"}
<h2>{register_title}</h2>
{content}
{/exp:low_variables:parse}

{exp:freemember:register return="checkout/complete" error_handling="inline" error_delimiters='<span class="error">|</span>'}
<input type="hidden" name="country_code" value="GBR">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="first_name" id="first_name" value="{first_name}">
<input type="hidden" name="last_name" id="last_name" value="{last_name}">
<input type="hidden" name="address" id="address" value="{address}">
<input type="hidden" name="company" id="company" value="{company}">
<input type="hidden" name="address2" id="address2" value="{address2}">
<input type="hidden" name="city" id="city" value="{city}">
<input type="hidden" name="state" id="state" value="{state}">
<input type="hidden" name="zip" id="zip" value="{zip}">
<input type="hidden" name="shipping_company" id="shipping_company" value="{shipping_company}">
<input type="hidden" name="phone" id="phone" value="{phone}">
<input type="hidden" name="order_customer_mobile" id="order_customer_mobile" value="{custom_data:order_customer_mobile}">
<input type="hidden" name="email" id="email" value="{email_address}">
<input type="hidden" name="use_billing_info" value="{use_billing_info}">
<input type="hidden" name="shipping_first_name" id="shipping_first_name" value="{shipping_first_name}">
<input type="hidden" name="shipping_last_name" id="shipping_last_name" value="{shipping_last_name}">
<input type="hidden" name="shipping_address" id="shipping_address" value="{shipping_address}">
<input type="hidden" name="shipping_address2" id="shipping_address2" value="{shipping_address2}">
<input type="hidden" name="shipping_city" id="shipping_city" value="{shipping_city}">
<input type="hidden" name="shipping_state" id="shipping_state" value="{shipping_state}">
<input type="hidden" name="shipping_zip" id="shipping_zip" value="{shipping_zip}">
<input type="hidden" name="shipping_phone" id="shipping_phone" value="{custom_data:shipping_phone}">
<input type="hidden" name="shipping_customer_mobile" id="shipping_customer_mobile" value="{custom_data:shipping_customer_mobile}">

    <p>Choose a password to create your account.</p>
    <p>
        <label for="password">Password</label><br />
        {field:password}<br />
        {error:password}
    </p>
    <p>
        <label for="password_confirm">Confirm Password</label><br />
        {field:password_confirm}<br />
        {error:password_confirm}
    </p>

    <p>
        <input type="submit" value="Submit" class="big-btn">
    </p>

{/exp:freemember:register}
{/if}

```

I liked this approach because it took away the registration question from the checkout process, and invited it once the transaction was complete.

Hope this helps!

---
Tags: cartthrob, forms, profile-edit, checkout, custom-data
---


# Question
Title: No images in Assets file manager and no Update Indexes option
Just got handed over ExpressionEngine from previous developer so we migrated it to our new server. There are no images in the frontend and backend admin panel. 777 permission were given to \_assets, cache folders. No Update Indexes option in Addon-\>Modules-\>Assets. Assets running 1.1.3 and ExpressionEngine is on 2.3.1. When I try to upload a new image in the "empty" file manager, I get "Your upload directory isn’t writable". I suspect its temp folder and where do I set the permission for it? Thanks

# Answer
Sounds like your actual upload directory isn't writable. You can check where this is located in the file structure on the **File Upload Preferences page of the CP**. Permissions should be set to 777. "\_assets" probably isn't the actual upload directory but is inside it.
> 1 votes

# Answer
You cannot use underscores in the name of your Assets-folder anymore. Look at this question and the comments.
> 0 votes

---
Tags: assets, server-migration
---


title: How to download Assets files as ZIP

text:
# Question
Title: How to download Assets files as ZIP
I could really use some help here. Might have promised something that cannot be done.

I am creating a simple doc repository for a client. The idea is for each of their "jobs", they create a unique asset folder. They upload a bunch of assets to it and then create a "review" entry that shows particular assets to be reviewed by their client. Sometimes these are html emails, or banner images, or even videos they create.

Anyway, each asset needs a "view" link {url} and then a "download link". The download is always a zip file which might contain more files than just the {url} file. My current code is:

```
{asset_files}
<h2 class="tableHeads">{title}</h2>
<p class="tablecity">
{if desc}{desc}<br />{/if}
<a href="{url}" target="_blank">view</a> | <a href="{url}">download</a>
</p>
{/asset_files}

```

How would you go about making the download link point to the zip asset without actually making a new entire asset entry out of it?

I am at a loss here and could really use some ideas.

Thanks

Mike

Hi again,

I changed the links to:

```
<a href="{url}" target="_blank">view</a> | <a href="{url}.zip">download</a>

```

But this requires the zip file be named exactly the same as the asset and also, I am not including the zip files in the entry itself. It works but is really funky and not really an ideal solution.

# Answer
> 1 votes
Have a look at either MX Zip, or to get more advanced, Link Vault and Link Vault Zipper. These add-ons create ZIP files on the fly for you from a list of file URLs you feed to them.

---
Tags: assets
---


# Question
Title: Relationship Field Author Restriction in EE Backend
When creating/editing a relationship field, there is an option where you can restrict the entries returned, based on authors.

However, is there a way to set this so that you only return the entries that is authored by the **current user** logged in the Control panel?

# Answer
There doesn't appear to be a way to do this in the field type settings. There is a hook setup for modifying the entries retrieved relationships\_display\_field however the best that I can tell it is only called on edit. You could modify the ft.relationship.php file yourself and modify the results shown based on user permissions

**ft.relationship.php at line 400 (approximately) add:**

```
$can_view = ee()->session->userdata('can_view_other_entries');
$can_edit = ee()->session->userdata('can_edit_other_entries');
if ($can_view == 'n' || $can_edit == 'n') {
  ee()->db->where('author_id',ee()->session->userdata('member_id'));
}

```
> 1 votes

---
Tags: relationships
---


# Question
Title: Focuslab Multi Environment Config upload preferences issue
I'm having an issue with my upload directories. I converted an existing site to use the FocusLab config set up and everything is working fine. However I've just noticed that in the CP thumbnails are missing from all entries and on the front end new images are not being displayed.

I ftp'd into the server and in my directories I can see the images but they've all been renamed so that they are directorynamefilenam.jpg

i.e. house.jpg inside directory general is now named generalhouse.jpg.

Not sure why this is happening or how to fix it.

The relevant code from config.master.php is below

```
/**
 * Custom upload directory paths
 *
 * The array keys must match the ID from exp_upload_prefs
 */
 $env_config['upload_preferences'] = array(
     1 => array(
         'name'        => 'Home Page Slideshow',
         'server_path' => $images_path . '/home_slideshow',
         'url'         => $images_url  . '/home_slideshow/'
     ),
     2 => array(
         'name'        => 'Portfolio Logos',
         'server_path' => $images_path . '/portfolio',
         'url'         => $images_url  . '/portfolio/'
     ),
     3 => array(
         'name'        => 'Team Photos',
         'server_path' => $images_path . '/team',
         'url'         => $images_url  . '/team/'
     ),
     4 => array(
         'name'        => 'News Images',
         'server_path' => $images_path . '/news',
         'url'         => $images_url  . '/news/'
     ),
     4 => array(
         'name'        => 'General',
         'server_path' => $images_path . '/general',
         'url'         => $images_url  . '/general/'
     )
 );

```

If I synchronize a directory I get the following errors:

> generalColor\_Block\_Icon\_with\_i.jpg: invalid\_filename
>
> generalPetArmor-Dog.png: invalid\_filename

This is error is on all images on all directories.

# Answer
Add the trailing slash for the 'server\_path' also.

```
/**
 * Custom upload directory paths
 *
 * The array keys must match the ID from exp_upload_prefs
 */
 $env_config['upload_preferences'] = array(
     1 => array(
         'name'        => 'Home Page Slideshow',
         'server_path' => $images_path . '/home_slideshow/',
         'url'         => $images_url  . '/home_slideshow/'
     ),
     2 => array(
         'name'        => 'Portfolio Logos',
         'server_path' => $images_path . '/portfolio/',
         'url'         => $images_url  . '/portfolio/'
     ),
     3 => array(
         'name'        => 'Team Photos',
         'server_path' => $images_path . '/team/',
         'url'         => $images_url  . '/team/'
     ),
     4 => array(
         'name'        => 'News Images',
         'server_path' => $images_path . '/news/',
         'url'         => $images_url  . '/news/'
     ),
     4 => array(
         'name'        => 'General',
         'server_path' => $images_path . '/general/',
         'url'         => $images_url  . '/general/'
     )

```
> 5 votes

# Answer
I just had this same problem. I was able to fix it by updating the EE install from 2.3.1 (I think) to 2.8.1.
> 0 votes

---
Tags: file-uploads, focus-lab-master-config
---


title: Create a perfect table using Matrix?

text:
# Question
Title: Create a perfect table using Matrix?
Is it possible to create a perfect table so i can add as many cells and rows as i want?

Any help will be much appreciated, expression engine version 2.7.3 and latest matrix.

Thanks,

Wes.

# Answer
> 2 votes
No - you can create as many rows as you want, but not as many columns as you want. Columns must be defined beforehand.

# Answer
> 1 votes
As Derek has mention with Matrix you can not create as many columns as you want on the fly when you are publishing/editing an entry with Matrix.

You might take a look at something like Content Elements which allows the user to create predefined elements on the fly including creating tables.

Also most of the WYSIWYG editors available today have the ability for you to build tables on the fly by hitting a table button and defining the fields their.

---
Tags: matrix
---


# Question
Title: Improve on these methods for displaying only the country name using Google Maps for EE
How would you display only the country name from an entry that has been geocoded with the fieldtype from the excellent Google Maps for ExpressionEngine (GMEE)?

# Answer
I have discovered two ways of doing this which I thought might be helpful to someone, and am **looking for improvements or better ideas** if people have them.

**Method 1.**

Use a javascript plugin, as suggested by Justin Kimbrell, author of Google Maps for ExpressionEngine.

**Method 2.**

Use the extremely versatile 'Low Replace' ExpressionEngine plugin by Lodewijk Schutte:

```
{exp:channel:entries etc}
  {geolocation parse="markers"}
    {markers}
      {exp:low_replace find="(.*,\s)(.*)" replace="$2" regex="yes"}
        {marker:formatted_address}
      {/exp:low_replace}
    {/markers}
  {/geolocation}
{/exp:channel:entries}

```

Notes:

* Non-essential code has been removed for brevity.
* 'geolocation' is the name of a GMEE fieldtype custom field
* The regex accounts for multiple place names in the format provided by Google Maps (e.g. "city, state, country" will be replaced by "country").
* Tested on EE v2.5.5 and GMEE v3.1.0
> 1 votes

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


# Question
Title: CartThrob tax being calculated incorrectly
I have a single tax rate of 10% set up for CartThrob (including shipping which is a flat rate up to $400 then free after that) but the value being output in the cart is incorrect, it's coming out at about 10.6%.

I thought as a stop-gap measure, I could reduce the tax rate a bit so that when CT incorrectly adds a bit more, it would come out at 10%, but no matter what rate I enter, it always comes out wrong and I can never get it to equal 10%.

I've tried using both tax by location – percentage and with standalone tax database, but the results are the same for both.

# Answer
> 0 votes
Turns out the answer to my problem was having the decimal places setting set to 2 when I needed 3 for my situation.

---
Tags: cartthrob, tax
---


title: Problem with Stash nested lists

text:
# Question
Title: Problem with Stash nested lists
I'm working on an XML template for a site and need to output a series of listings where URLs look like:

/store/#type#/#brand#/#collection#/

My entries are set up so that there's an entry for each brand with a matrix row for each collection (type is a category of the entry).

So I need to loop through the entries in the channel and then loop through the matrix rows for each entry and output a `<url>` pair for all of them.

With the code below I get output if I don't have the `exp:stash:get_list:nested` tag (but with incorrect URLs), but with it, I get nothing.

```
{exp:stash:set_list
    name="collections"
    parse_depth="2"
    parse_tags="yes"
}
    {exp:channel:entries
        channel="brands"
        disable="member_data|pagination|trackbacks"
        dynamic="no"
    }
        {stash:collection_url_title}{url_title}{/stash:collection_url_title}

        {stash:collection_entry_id}{entry_id}{/stash:collection_entry_id}

        {stash:collection_type}{categories}{category_url_title}{/categories}{/stash:collection_type}

        {exp:stash:set_list:nested name="collection_{collection_entry_id}" parse_tags="yes"}
            {cat_images}
                {stash:collection_cat}{exp:cat2:url_title category_id='{cat}'}{/stash:collection_cat}
            {/cat_images}
        {/exp:stash:set_list:nested}

    {/exp:channel:entries}

{/exp:stash:set_list}

{exp:stash:get_list name="collections"}

    {exp:stash:get_list:nested name="collection_{collection_entry_id}"}
        <url>
            <loc>http://www.domain.com.au/store/{collection_type}/{collection_url_title}/{collection_cat}/</loc>
        </url>
    {/exp:stash:get_list:nested}

{/exp:stash:get_list}

```

Anyone see where I'm going wrong?

# Answer
You need to use the context parameter and a unique identifier in your nested list. Generally using entry\_id is the easiest way to create a relationship between your two lists.

1. Stash `{entry_id}` in your outer list (used for retrieval wit get\_list)
2. Set the `context` parameter in your nested list and feed it `{entry_id}` from your outer list
3. when getting your nested list, use the `context` parameter again and feed it the stashed `{stash_entry_id}` from step one.

Here is a detailed explanation and example on the Stash wiki.
> 3 votes

---
Tags: stash, nested-list
---


# Question
Title: Creating links to Tagger tags with Zoo Triggers
I'm trying to figure out something I thought would be fairly easy and straight forward, but I'm having a difficult time trying to figure this out.

Zoo Triggers says: "Filter tags from the url support DevDeamon Tagger" - I appear to have everything in place and installed correctly.

* Zoo Triggers 1.2.2
* Tagger 3.2.1
* EE 2.7.2

I've tried a number of different things, I can get the tags to output, but I try to use the same syntax with Zoo Triggers Tags as I have with Archives and I get thrown and error: Error

The following tag cannot be processed: {exp:zoo\_triggers:tag} Please check that the ‘zoo\_triggers’ module is installed and that ‘tag’ is an available method of the module.

Basically I'm trying to do exactly what devot-ee is doing at the bottom of the left column when looking at an add-on.

Any insight on how to do this would be invaluable. Thanks all!

# Answer
If you take a closer look at the documentation (http://ee-zoo.com/docs/triggers/tags/index.html) you will see that there is no 'tag' tag available. Just because the Tagger add-on has really good tags available (http://www.devdemon.com/docs/tagger/tags/index.html) for printing out the tags you want.

If you want to filter these tags, just make sure you use the tag filter by pointing the URL to `http://example.com/news/tags/testtag`.

To filter on multiple tags you can do the following: `http://example.com/news/tags/testtag/anothertag/test`
> 1 votes

---
Tags: devdemon, zoo-triggers
---


title: Limit characters in Title field?

text:
# Question
Title: Limit characters in Title field?
Just like on a custom text field you can limit characters, I'd like to be able to limit characters in a Title field for a few channels. It's easy to do this in templates, but I don't want to end up truncating titles; I'd like the user to see their limit and work with it.

Any ideas? Thank you.

# Answer
Title Master will do the job. Among other benefits such as being able to pre-populate or hide the Title field altogether you also have the option to reduce the default 100 character limit.
> 2 votes

# Answer
You may try the free add-on MD Character Count from Ryan Masuga. This will perfectly suite your needs.
> 0 votes

---
Tags: title
---


# Question
Title: Specify PDF filename using Shine PDF plugin
I'm using Shine PDFto convert an EE template to pdf, and I need to figure out how to specify the file name when the pdf is downloaded (it defaults to mpdf.pdf). The docs seem to imply that the tag is used, but that doesn't seem to be the case.

I've tried contacting Shine about it via email and twitter and gotten no response. Has anyone who has used Shine PDF successfully specified the document title? Or is anyone familiar enough with the mpdf library to suggest how it can be done?

# Answer
> 1 votes
You should be able to specify the title by using a regular HTML tag pair:

```
{exp:shine_pdf:make channel="my_channel"}
    <title>My PDF Title</title>
    ...
{/exp:shine_pdf:make}

```

---
Tags: add-on
---


# Question
Title: How do I customize the Control Panel login window?
Is it possible to edit the EE Control Panel login window? A client would like to customize it with their company logo?

# Answer
I have follwed these instructions for a couple of sites and found it to be pretty good to work with.

I like the idea that you don't have to alter EE (PHP) core files (you just change the stylesheet). Nevertheless after upgrading EE you have to reapply those changes to the stylesheet again. I guess you could also work with an import rule but the stylessheet is only about 120 lines and so easy enough to handle your custom changes.
> 1 votes

---
Tags: control-panel
---


# Question
Title: If statements using OR and Matrix fields
I have a Matrix field that includes three options. The aim is to output a `<select>` element if one or more of these options is selected. (These fields are Pixel & Tonic Field Pack checkboxes.)

This syntax used to work:

```
{if "{gold}" OR "{silver}" OR "{wood}"}
    <input type="hidden" name="on0" value="Frame Type">
    <select name="os0">
        {if gold}<option value="Gold">Gold Frame</option>{/if}
        {if silver}<option value="Silver">Silver Frame</option>{/if}
        {if wood}<option value="Rosewood">Rosewood Frame</option>{/if}
    </select>
{/if}

```

Now that I've upgraded to EE 2.8.1 (from a much earlier version—E 2.2) the code isn't working and I'm getting the following error:

```
A PHP Error was encountered
Severity: User Warning
Message: Invalid EE Conditional Variable: {if ""y"}
Filename: libraries/Functions.php
Line Number: 2640

```

I've tried all sorts of syntax combinations, such as removing the quotes and braces etc. The only solution I could find was pretty inefficient:

```
{if gold}
    <input type="hidden" name="on0" value="Frame Type">
    <select name="os0">
        {if gold}<option value="Gold">Gold Frame</option>{/if}
        {if silver}<option value="Silver">Silver Frame</option>{/if}
        {if wood}<option value="Rosewood">Rosewood Frame</option>{/if}
    </select>
{if:elseif silver}
    <input type="hidden" name="on0" value="Frame Type">
    <select name="os0">
        {if gold}<option value="Gold">Gold Frame</option>{/if}
        {if silver}<option value="Silver">Silver Frame</option>{/if}
        {if wood}<option value="Rosewood">Rosewood Frame</option>{/if}
    </select>
{if:elseif wood}
    <input type="hidden" name="on0" value="Frame Type">
    <select name="os0">
        {if gold}<option value="Gold">Gold Frame</option>{/if}
        {if silver}<option value="Silver">Silver Frame</option>{/if}
        {if wood}<option value="Rosewood">Rosewood Frame</option>{/if}
    </select>
{if:else}
{/if}

```

At least it works, but it's pretty darned ugly and inefficient. I had to put that ugly `if:else` at the end, too, as each of the options is optional, so to speak.

Can anyone suggest a better way to construct this?

# Answer
> 1 votes
Not knowing what you are testing i'm assuming you are testing if the field has a value in it. So I would do this.

```
{if "{gold}" != "" || "{silver}" != "" || "{wood}" != ""}
      <input type="hidden" name="on0" value="Frame Type">
      <select name="os0">
          {if gold}<option value="Gold">Gold Frame</option>{/if}
          {if silver}<option value="Silver">Silver Frame</option>{/if}
          {if wood}<option value="Rosewood">Rosewood Frame</option>{/if}
       </select>
{/if}

```

---
Tags: matrix, conditionals
---


# Question
Title: CkEditor in Wygwam strips out <i> tags used in Font Awesome
When using Wygwam and trying to use an empty `<i>` tag like Font Awesome requires the tags get stripped every time a user goes back in to edit the entry.

A temporary fix is to do something like `<i class="icon-play"> </i>`, but that's pretty messy. Is there a way to either have Wygwam automatically add the ` ` code like it does for `<p>` tags or a way to make it stop stripping `<i>` tags that are "empty"?

# Answer
Alright - once I understood what was happening (comments on original post) I did some research. This is a CKEditor issue, below is a Git repo that includes a way to address this. I haven't tested this with Wygwam and can't endorse it, but it may help you toward a solution:

https://github.com/blueriver/MuraCMS/pull/685

The common easy solution is to inclue ` ` so there is content between the tags.

Unfortunately I don't have another solution at this time, this is a change that needs to be made to CKEditor to handle.
> 2 votes

# Answer
According to WYGWAM's Changelog, this was implemented in 2.6:

"Leading/trailing whitespace and empty tags are now stripped out from the content when saving"

There is the nbsp method, but also when editing in Source view, if you save -without- toggling Source, it won't strip your tags. When WYGWAM compiles the source it removes the tags.

This is something that's bugging me, too, so I hope somebody comes up with a setting to undo this "feature".
> 0 votes

# Answer
This sounds like a similar problem: https://drupal.org/node/1908696

In a nutshell, add this to your ckeditor config (themes/third\_party/wygwam/lib/ckeditor/config.js):

```
config.protectedSource.push( /<i[^>]*><\/i>/g );

```

That didn't work for me, but it seems like it worked for some people. What worked for me was adding this:

```
CKEDITOR.dtd.$removeEmpty['i'] = false;

```
> 0 votes

---
Tags: ee2, wygwam, pixelandtonic
---


title: A multi-sized image gallery grid

text:
# Question
Title: A multi-sized image gallery grid
One thing I've noticed when working with Expression Engine, is that when image galleries are created, with images being loaded dynamically from a channel, the images tend to be the same size dimension and so the end result is an equal grid.

There's absolutely nothing wrong with this, but having used this method/layout for so long site after site, I thought I would venture out a bit and see if anyone out there with a bit more know-how could explain **1.** If it's possible and **2.** how I could go about creating a dynamic gallery with a similar layout to the following example;

I'm unsure how possible it would be to replicate this effect from say, an Assets field full of multiple images. I suppose multiple images being pulled through this way would have a uniformed formatting, such as height and width etc, therefore creating an equal grid layout

I'm aware of plugins such as isotope and masonry which achieve this kind of desired effect. But are those sorts of plugins the only way around?, besides hard coding the images with set widths and heights (which could impact a responsive site).

My gut tells me that it would be tricky to pull through multiple images dynamically from a channel and arrange them in this way. But hey, maybe I'm missing something obvious. That's why I'm asking I guess.

Any advice, as always, is much appreciated.

# Answer
> 3 votes
I've had great experience with masonry very simple to implement and is responsive as well.

If you are wanting categorized photos i would set up a single channel for each image. That way you could categorize the images and display different ones depending on the filter that is activated on the site. I wouldn't put a set hight and width to the images with css set the img property to width:100%; and it will fit the to the parent element horizontally. Then with masonry it will fit the parent elements into a mortar style layout like you have above.

I have done a few times and it works great not only with photo galleries but blogs as well.

---
Tags: image, thumbnails, image-galleries
---


# Question
Title: freeform:entries to display "File Upload" field
I'm using this basic code to output form results:

```
{exp:freeform:entries form_name="{segment_3}"}
 {freeform:all_form_fields}
  <p>
   <label>{freeform:field_label}:</label>
   {freeform:field_output}
  </p>
 {/freeform:all_form_fields}
{/exp:freeform:entries}

```

It works great for all of my forms, except for when I encounter a File Upload field: it just outputs the filename (without a link to the file). Is there a better way write this code for possible File fields?

# Answer
Yes, there is.

When looping through your {freeform:all\_form\_fields} you will need to test the {freeform:field\_output} and alter the html markup you dump your field data into.

IE:

```
{exp:freeform:entries form_name="{segment_3}"}
    {freeform:all_form_fields}
    <p>
        <label>{freeform:field_label}</label>
        {if freeform:field_type == 'text'}
            {freeform:field_output}
        {/if}
        {if freeform:field_type == 'file'}
            <img src="{freeform:field_output}">
        {/if}
    </p>
    {/freeform:all_form_fields}
{/exp:freeform:entries}

```

Not sure if the field\_type is actually named file for a file upload you will need to find out.

Here is the documentation area of freeform i pulled this syntax from.

http://www.solspace.com/docs/freeform/entries/#variable\_pairs
> 1 votes

# Answer
Thanks, mattidjohn. I just had to change field\_type to "file\_upload" and manually type in the URL to the file, since field\_output only produces a filename. Since you can choose Upload Destination per File Upload field, I don't exactly like hard-coding it to one upload location, but I don't see any variable to reference to find the Upload Destination. (If so, that would make the code scalable and better.)

```
{if freeform:field_type == 'file_upload'}
  <a href="{site_url}docs/{freeform:field_output}">{freeform:field_output}</a>
{/if}

```
> 0 votes

---
Tags: solspace-freeform, solspace, file-uploads
---


# Question
Title: Focuslab Master Config not working with MAMP
I have recently set up an ExpressionEngine 'Sandbox' test site locally via MAMP (On Mac OSX), and have integrated the Focus Lab LLC’s EE Master Config for when I push the local Sandbox site code to a staging server (using version control via Git/Tower/Beanstalk etc).

I have set up all the configurations as required using the documentation for Focus Lab LLC’s EE Master Config.

The issue:

When I naivgate to the local MAMP Sandbox site URL: ie. `http://localhost:8888/sandbox/`

I get the following server error message(s):

```
Warning: require(/Users/karlbowers/Sites/../config/config.master.php): failed to open stream: No such file or directory in /Users/karlbowers/Sites/Sandbox/system/expressionengine/config/config.php on line 410

Fatal error: require(): Failed opening required '/Users/karlbowers/Sites/../config/config.master.php' (include_path='.:/Applications/MAMP/bin/php/php5.5.10/lib/php') in /Users/karlbowers/Sites/Sandbox/system/expressionengine/config/config.php on line 410

```

I have placed the new 'config' folder at the same level as the 'system' folder.

ie.

```
public_html

  config
  system
  themes

```

etc.

I have added the following into my master config file:

```
if ( ! defined('ENV'))
{
    switch (strtolower($_SERVER['HTTP_HOST'])) {

        case 'sandbox.domainname.co.uk' :
            define('ENV', 'stage');
            define('ENV_FULL', 'Staging');
            define('ENV_DEBUG', FALSE);
        break;

        case 'localhost:8888/sandbox' :
            define('ENV', 'dev');
            define('ENV_FULL', 'Development');
            define('ENV_DEBUG', TRUE);
        break;

        default :
            define('ENV', 'local');
            define('ENV_FULL', 'Local');
            define('ENV_DEBUG', TRUE);
        break;
    }
}

```

I'm not sure why I am getting the errors stated above? It's like the URL paths are incorrect?

Anyone have any ideas on this?

Many thanks in advance.

Regards

Karl

# Answer
> 3 votes
It looks like you're running the system below webroot, which is not how the FocusLab master config is setup to run by default. From the readme:

> The instructions above are for setting up the config above webroot (your "public\_html, "htdocs", etc directory).

So it assumes this structure:

```
/config
/httpdocs
/system

```

If you really need to run your system folder below webroot, see this answer \- specifically, you need to change the include paths in /config/config.master.php and /system/expressionegine/config.php.

# Answer
> 0 votes
Your switch/case statement is checking against `$_SERVER['HTTP_HOST']` \- so for your localhost, this would be `localhost`, not `localhost/folder-name`.

Typically, with this kind of setup, "development" and/or "staging" would be referring to a remote server - your localhost should instead fall under the final default case for local environments. This allows you to use either "localhost" or a named vhost (eg, "http://project.dev").

---
Tags: focus-lab-master-config
---


# Question
Title: Modifying Focus Labs Config to allow setting site on or off from environment cases
I'm using Focus Labs Config and trying to give the is\_system\_on setting the same treatment as the debugging preference.

So far, in config.master.php I have added;

```
$env_config['is_system_on']         = (ENV_SYSTEM_ON) ? 'y' : 'n' ;

```

Then within config.env.php, in the appropriate CASE I have (for example);

```
case 'staging.domain.com' :
    define('ENV', 'stage');
    define('ENV_FULL', 'Staging');
    define('ENV_DEBUG', FALSE);
    define('ENV_SYSTEM_ON', FALSE);
break;

```

However the system on/off setting in config.env.php seems to be ignored and the only way to turn the site on or off is to do so within the CP.

Everything else is working perfectly across local, dev, staging and production servers with different settings being used for each. It's just this extra one I can't get to work.

Does anyone have any idea why this may be and how I could overcome it so I could set the on/off status within my environment cases?

# Answer
Not sure why that's not working but I tend to just override the default value of 'is\_system\_on' in the specific environment's config. E.g. for your staging environment add this to `config.stage.php`:

```
$env_config['is_system_on'] = 'n';

```
> 4 votes

# Answer
Forgive me if this is patronising, but are you sure you're not logged in as a superadmin? If so, this setting won't apply to you and you'll be able to see the site even when it's switched off.
> 1 votes

# Answer
I also don't want to be patronizing but, you said you "added" the new config override though, EE Master Config already includes it here \- is there a chance you are adding the config override twice? I'm assuming you meant to say you "updated" the current config override accordingly vs adding it twice.
> 1 votes

---
Tags: focus-lab-master-config
---


title: Alternatives to Membrr add-on?

text:
# Question
Title: Alternatives to Membrr add-on?
We have been users of Membrr and OpenGateway for a few years now and been generally happy with it. Today I ran into an issue and went to access the http://www.membrr.com site and got a notice that the domain has expired. There have recently been reports that Electric Function has been unresponsive to emails and support. Concerned I started to do some Googling and found this blog post from Brock made back in March. Looks like the new owners of Electric Function might be simply dropping the company and products and walking away? As a customer I was not warned or notified at all and I find this very disturbing to say the least. Is anyone else who is using Membrr concerned? What path(s) are you planning on taking moving forward?

For anyone who was a Membrr user and migrated to something else what do you recommend and do you have any advice to make transitioning easier?

# Answer
> 4 votes
I'm the developer of Charge so this is obviously biased.

Charge works great for member subscriptions. The focus with Charge is to keep it as simple and rock solid for the developer and customer as possible. To that end - it's tied directly to using Stripe as the payment gateway. Understandably that's not going to be perfect for every project.

I'm in the process of adding lots of new subscription features, and it's in constant development. I've helped quite a few devs move their client sites off Membrr to Charge, and keeping the whole thing invisible to the customers. If you need a hand, or see any missing features, just drop me a line, and I'd be happy to help.

# Answer
> 2 votes
Currently there are only 2 subscription modules that I know that you could transition to now that it looks like Membrr/OpenGateway are no longer going to be supported. Both options require a fair bit of work from you to handle the migration of content and subscriptions over but are probably better options then keeping a dead piece of software running your e-commerce site.

The first option would be to use Charge by Joel Bradbury which is a great little piece of software. Charge relies on Stripe to be used as your payment gateway which can be a problem for some people but if you are able to use Stripe then Charge would be my recommendation. (I am currently in the process of moving a Membrr site over to charge myself.)

The other option would be to use CartThrob and CartThrob Subscriptions. CartThrob has a ton of additional gateways that you can use if you are not able to use Stripe and is a very full featured e-commerce solution.

Both options have their advantages and disadvantages so it is best to take a look at each and decide which is best for you project.

---
Tags: add-on, payment-gateway, subscriptions, membrr
---


title: Show Parent & Sibling Categories

text:
# Question
Title: Show Parent & Sibling Categories
My category group looks like this:

* car seats
* strollers
    + travel systems
* gear
    + walkers
    + swings
* nursery

When I'm on the URL `/products/category/gear`, I want to display:

* gear (here)
    + walkers
    + swings

When I'm on the URL `/products/category/walkers`, I *still* want to display:

* gear
    + walkers (here)
    + swings

I don't want to display the entire category group, just the current category's parent and/or children and/or siblings.

# Answer
> 0 votes
Here's how I ended up doing it:

I used an embedded template and passed the current category ID as a variable:

`{embed='_products/category_breadcrumb' cat_id='{if triggers:parent_cat_id_1}{triggers:parent_cat_id_1}{if:else}{triggers:cat_id_1}{/if}'}`

The Zoo Triggers variable returns blank if the current category has no parent (meaning it's a top-level category), so I had to use a conditional to output the category ID if the current category is top-level.

Then in my embedded template:

```
{exp:gwcode_categories
  cat_id='{embed:cat_id}'
  style='linear'
}
  {if results_total > 1}
    {if cat_count == 1}
      <p class="category-filter">
        View:
    {/if}

    {if cat_url_title == triggers:segment_3}
      <span class="here">{if depth == 1}All{/if}{if depth == 2}{cat_name}{/if}</span>
    {/if}

    {if cat_url_title != triggers:segment_3}
      <span><a href="{path='products/category/{cat_url_title}'}">{if depth == 1}All{/if}{if depth == 2}{cat_name}{/if}</a></span>
    {/if}

    {if cat_count == results_total}
      </p>
    {/if}
  {/if}
{/exp:gwcode_categories}

```

The caveat is that it only works with a 2-level category tree, but that's all I need for my specific situation.

I'm using the Zoo Triggers `{triggers:parent_cat_id_1}` and `{triggers:cat_id_1}` variables, but you could do the same thing with Low Seg2Cat `{segment_1_category_parent_id}` and `{segment_1_category_id}` variables.

I also used an embedded template to get the parse order right, but I imagine you could use Stash for this too.

# Answer
> 1 votes
I think NSM Categories, with its target\_category param and {category\_is\_target} tag, could help. Also, Seg2Cat is useful for grabbing an ID from the category name in the URI.

---
Tags: categories
---


# Question
Title: Disqus error: Fatal error: Call to undefined method Cp::set_variable()
trying to load the Disqus module and get this error: Fatal error: Call to undefined method Cp::set\_variable()

anyone else experiencing this issue?

# Answer
> 1 votes
Yes. CP::set\_variable was deprecated in EE 2.6.

I'm submitting a fix to the addon's github repository

---
Tags: comments
---


# Question
Title: Managing user session length in EE 2.8 +?
Recently upgraded to EE 2.8.1 and was worried about some things discussed in this thread.

Prior to EE 2.8 we were able to use the `user_session_ttl` config to set the user's session to whatever duration we pleased. But that config no longer exists, instead the user's session is now hardcoded to 2 hours (different if remember me is checked) (and cp sessions are 1 hour by default).

Are there any options out there asides from editing core for managing session lengths?

Or perhaps I am missing something?

# Answer
> 0 votes
I wound up reverting the method `_setup_session_length` in Session.php to what it was before EE 2.8 so I can keep using the config variables -- though I still get the new javascript prompt on the CP end.

For convenience sake I'll leave the code here (if this is a problem, please by all means edit/let me know). The `*_session_ttl` config variables are in seconds, you would throw those in your config.php or bootstrap e.g. as `$config['user_session_ttl'] = 9001;`.

```
protected function _setup_session_length()
{
    $u_item = ee()->config->item('user_session_ttl');
    $cp_item = ee()->config->item('cp_session_ttl');

    $this->cpan_session_len = ($cp_item !== FALSE) ? $cp_item : $this->cpan_session_len;
    $this->user_session_len = ($u_item !== FALSE) ? $u_item : $this->user_session_len;

    return (REQ == 'CP') ? $this->cpan_session_len : $this->user_session_len;
}

```

---
Tags: sessions, 2.8
---


# Question
Title: ExpressionEngine 2.8.1 always gives 403 Forbidden error when using ajax
ExpressionEngine 2.8.1 always gives 403 Forbidden error when using ajax. Every ajax call given "This form has expired. Please refresh and try again." response.

I have also tried to pass hidden XID

```
<input type="hidden" name="XID" value="{XID_HASH}" />

```

and made secure form's value 'n' in config file.

Anybody have solution, how can i fix it

Thanks

# Answer
ExpressionEngine has a protection against Cross-site Request Forgery - CSRF and a documentation available here. You just have to add that line to your form:

```
<input type="hidden" name="csrf_token" value="{csrf_token}">

```

And send the data in your AJAX request. I had the same problem today and that fixed it for me.
> 4 votes

# Answer
I wouldn't recommend this but in cases where you have no choice, e.g. you cannot tweak the code in an app in time or something to that effect, you can opt to conditionally disable secure forms in your config.php or bootstrap.

E.g.

```
// Make an exception to make AJAX forms app-compatible
// EE 2.7.x introduced mandatory XIDs even for AJAX, but an app won't have an initial valid XID to begin with
if (substr($_SERVER['REQUEST_URI'], 0, 13) == '/app/post/url')
{
  //$config['secure_forms'] = 'n'; // Deprecated and obsolete in EE 2.8
  $config['disable_csrf_protection'] = 'y'; // Introduced in EE 2.8, XID replaced by csrf_token
}

```
> 3 votes

---
Tags: error, ajax, xid
---


title: problem updating EE2.7.3 to 2.8.1

text:
# Question
Title: problem updating EE2.7.3 to 2.8.1
I don't know what is the problem, I'm updating EE2.7.3 using the EE documentation upgrading, and when I go in the admin panel do update: admin.php i got a blank page with this url:

```
http://myurl.com/admin.php?C=wizard&M=license&language=english

```

config.php and database.php are setted to 666, tried with 777 to.

when i did the update on the wamp local installation, no problems occured.

thanks,

Stéphane

# Answer
Personally I've been using a custom bootstrap which in the past caused a lot of issues when updating. I fixed this by keeping a copy of the config.php and database.php that EE itself generates upon install/upgrades and using those when upgrading. But before that I would get different types of errors including a blank page after trying to update.

What I did to troubleshoot that was go through the update files and see what EE was trying to do, e.g. add or alter tables in the database, and see which of those were completed.

It generally got stuck in between versions so I would manually update the version in the config and it would pick up from there.

You could probably try those same steps, look at what the upgrade is trying to accomplish and see where it succeeded, where it hung up, etc.
> 0 votes

---
Tags: update
---


# Question
Title: Expresso Store not saving {order_email} to database
I'm having an issue with Store not saving {order\_email} to the database.

This is the only field not saving to orders. The checkout process fully completes. Order confirmation emails are not sending due to the field being blank.

```
{exp:store:checkout
form_class="form-horizontal"
next="store/checkout3"
error_handling="inline"
error_delimiters='<span class="help-inline">|</span>'
require="name|address1|city|country|state|order_email"
secure="yes"
}

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

<div class="col five first payForm">

<fieldset id="billing_details">
    <h3>Billing Details</h3>

    <div class="control-group {if error:billing_name}error{/if}">
        <label class="control-label" for="billing_name">Name</label>
        <div class="controls">
            {field:billing_name} {error:billing_name}
        </div>
    </div>

    <div class="control-group {if error:billing_address1}error{/if}">
        <label class="control-label" for="billing_address1">Address</label>
        <div class="controls">
            {field:billing_address1} {error:billing_address1}
        </div>
    </div>

    <div class="control-group {if error:billing_address2}error{/if}">
        <div class="controls">
            {field:billing_address2} {error:billing_address2}
        </div>
    </div>

    <div class="control-group {if error:billing_city}error{/if}">
        <label class="control-label" for="billing_city">City</label>
        <div class="controls">
            {field:billing_city} {error:billing_city}
        </div>
    </div>

    <div class="control-group {if error:billing_state}error{/if}">
        <label class="control-label" for="billing_state">State</label>
        <div class="controls">
            {field:billing_state} {error:billing_state}
        </div>
    </div>

    <div class="control-group {if error:billing_postcode}error{/if}">
        <label class="control-label" for="billing_postcode">Postcode</label>
        <div class="controls">
            {field:billing_postcode} {error:billing_postcode}
        </div>
    </div>

    <div class="control-group {if error:billing_country}error{/if}">
        <label class="control-label" for="billing_country">Country</label>
        <div class="controls">
            {field:billing_country} {error:billing_country}
        </div>
    </div>

    <div class="control-group {if error:billing_phone}error{/if}">
        <label class="control-label" for="billing_phone">Phone</label>
        <div class="controls">
            {field:billing_phone} {error:billing_phone}
        </div>
    </div>

    <div class="control-group {if error:order_email}error{/if}">
        <label class="control-label" for="order_email">Email</label>
        <div class="controls">
            {field:order_email} {error:order_email}
        </div>
    </div>

</fieldset>

</div><!-- end five -->

<div class="col five">

<fieldset>
    <h3>Shipping Details</h3>

    <div class="control-group">
        <div class="controls">
            <label for="shipping_same_as_billing" class="checkbox">
                {field:shipping_same_as_billing} Same as Billing Details
            </label>
        </div>
    </div>

    <div id="shipping_details_drawer">

        <div class="control-group {if error:shipping_name}error{/if}">
            <label class="control-label" for="shipping_name">Name</label>
            <div class="controls">
                {field:shipping_name} {error:shipping_name}
            </div>
        </div>

        <div class="control-group {if error:shipping_address1}error{/if}">
            <label class="control-label" for="shipping_address1">Address</label>
            <div class="controls">
                {field:shipping_address1} {error:shipping_address1}
            </div>
        </div>

        <div class="control-group {if error:shipping_address2}error{/if}">
            <div class="controls">
                {field:shipping_address2} {error:shipping_address2}
            </div>
        </div>

        <div class="control-group {if error:shipping_city}error{/if}">
            <label class="control-label" for="shipping_city">City</label>
            <div class="controls">
                {field:shipping_city} {error:shipping_city}
            </div>
        </div>

        <div class="control-group {if error:shipping_postcode}error{/if}">
            <label class="control-label" for="shipping_postcode">Postcode</label>
            <div class="controls">
                {field:shipping_postcode} {error:shipping_postcode}
            </div>
        </div>

        <div class="control-group {if error:shipping_state}error{/if}">
            <label class="control-label" for="shipping_state">State</label>
            <div class="controls">
                {field:shipping_state} {error:shipping_state}
            </div>
        </div>

        <div class="control-group {if error:shipping_country}error{/if}">
            <label class="control-label" for="shipping_country">Country</label>
            <div class="controls">
                {field:shipping_country} {error:shipping_country}
            </div>
        </div>

        <div class="control-group {if error:shipping_phone}error{/if}">
            <label class="control-label" for="shipping_phone">Phone</label>
            <div class="controls">
                {field:shipping_phone} {error:shipping_phone}
            </div>
        </div>

    </div>

</fieldset>
</div><!-- end five -->

```

Back

{/exp:store:checkout}

# Answer
> 1 votes
The reason was because I had a blank input field for order\_email in the form, but hidden from view. This field is only used for those paying with Paypal, not with a CC.

Even though the form contained order\_email at the top of the page, it wasn't passing through to the database because this was blank.

I solved it by passing the value as

```
value="{order_email}"

```

Another option here, as Adrian pointed out below: Remove this email field all together since the email is remembered from the previous page. I added it because I thought this email field was required for paypal to process the order and had to be the users paypal account email address (I was light on the coffee this day).

Order email, is order email, the email associated with the order - and has nothing to do with the users paypal account email address. Paypal handles that. The "order\_email" field is required for all gateways... It just tells store this field is valid and to process the order with the configured gateway. With the Paypal Express gateway, I simply thought the order\_email had to be the email associated with Paypal - and gave the user the option to add a different email when they chose paypal as a payment method. Completely unnecessary. I opted for removing the second email field, and now display a simple "pay with paypal" button on the page.

# Answer
> 0 votes
Can you post your checkout template code? Do you have something like this in checkout2.html?

```
<div class="infield {if error:order_email}error{/if}">
    <label for="order_email">Email</label>
    {field:order_email} {error:order_email}
</div>

```

# Answer
> 0 votes
You might try removing order\_email from your `require` parameter: the checkout docs imply it's already run through validation and maybe requirement too.

---
Tags: expresso-store
---


# Question
Title: Image manipulation in Select Files in Low Variables
I've just updated to Low Variables 2.4.2 to take advantage of image manipulations, but how do I use the tag?

I can see in the changelog:

> Image Manipulations are now processed for new file uploads by the Select Files variable type

Does this mean that images can only be manipulated on upload? What about for existing files? Can I use existing EE manipulations?

I've used the code:

```
{lv_sponsor_logo:thumb-150-width}

```

but this doesn't get parsed. Using:

```
{lv_sponsor_logo}

```

just outputs the full URL to the original image.

I've also tried:

```
{exp:low_variables:parse var='lv_sponsor_logo' multiple='yes'}{lv_sponsor_logo:thumb-150-width}{/exp:low_variables:parse}

```

and

```
    {exp:low_variables:parse var='lv_sponsor_logo' multiple='yes'}{lv_sponsor_logo:data:thumb-150-width}{/exp:low_variables:parse}

```

What have I missed?

# Answer
> 1 votes
For now, image manipulations are only applied on upload. Applying custom manipulations on the fly isn't possible at the moment.

---
Tags: low-variables
---


# Question
Title: Upgrade to EE 2.8.1 with services_json error
I just upgraded a site from EE 2.5.5 to 2.8.1 and I get this error after I try to login:

> Unable to load the requested class: services\_json

I have searched and found reference to Zoo Members and Field Editor, neither of which I have on this site.

I did some additional searching and found a file in Expressionengine/libraries/services\_json.php in the 2.5.5 install files that I backed up. However, I can't find anything that would reference this file. If I add the file I can log in but I get a white screen, without the file I get the error message. Either way I am toast.

Insight are most welcome.

Thanks.

# Answer
> 2 votes
I know this one was very obscure and thereby avoided by most readers, but in the event that anyone out there has the same experience, here is the solution.

There were several add-ons that reference /expressionengine/libraries/services\_json.php in EE 2.5.5, including Freeform and devot:ee monitor. I had to update these modules to the latest releases BEFORE updating Expression Engine to 2.8.1, otherwise they were searching in vain for the services\_json.php file.

After updating the modules, the upgrade went without a hitch.

---
Tags: error, ee2-upgrades, 2.8
---


# Question
Title: Expresso Store with Stripe final checkout page reloads instead of submitting
I'm having a problem getting Stripe to successfully submit orders. I had it working at one point, but when we switched to live mode it stopped submitting and orders won't complete even if I switch back to test mode. The form just recycles and nothing gets posted to Stripe or EE. Things I've checked:

* I don't have inline error handling on.
* Token gets set correctly.
* JSON formats and appears to be submitted in network tab of webkit inspector
* Running Store 2.1 and EE 2.7.1
* Submit button name is "submit"
* If I switch to "manual" for my payment gateway it works great, so it's gotta be something in between Store & Stripe

Here's the checkout code:

```
{exp:store:checkout return="shop/thanks"}
<input type="hidden" name="payment_method" value="stripe">
<input type="hidden" id="payment_token" name="payment[token]" value="" />

<p>Card Number
<input type="text" value="" data-stripe="number" /></p>
<p>Your Name
<input type="text" value="" data-stripe="name" /></p>
<select data-stripe="exp-month">
    <option value=""></option>
    {exp_month_options}
</select>
<select data-stripe="exp-year">
    <option value=""></option>
    {exp_year_options}
</select>
<p>CVC<input type="text" size="4" value="" data-stripe="cvc" /></p>
    <input type="submit" name="submit" id="checkout_submit" value="Place Order" class="button" />
{/exp:store:checkout}

```

And the JS:

```
<script>
 $(function() {
    $.getScript('https://js.stripe.com/v2/', function() {
        Stripe.setPublishableKey('pk_test_HTxzad5AIjx1ABhIBigZYtIG');
    });

    /* Ensure your checkout submit button has id="checkout_submit" */
    $checkout_submit = $("#checkout_submit").click(function() {

        /* Only handle requests for Stripe gateway */
        if (this.form.elements["payment_method"].value == "stripe") {

            /* Temporarily disable the checkout submit button */
            $checkout_submit.attr('disabled', true);

            /* Create a Stripe card token */
            Stripe.card.createToken($(this.form), stripeResponseHandler);

            /* We don't want to submit the form yet */
            return false;
        }
    });

    /* This function is triggered once Stripe has generated the token */
    function stripeResponseHandler(status, response) {
        /* Re-enable the checkout submit button */
        $checkout_submit.attr('disabled', false);

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

```

What am I missing?

# Answer
Per the comments, in this case Stripe was working fine. The token was correctly submitted to Store. However, the wrong private API key was specified in the Store settings.

> I had the wrong private key in the Store settings. I had assumed the JS would alert for key errors, and didn't think to try that.

For future reference, always try putting `{error:payment_method}` in your template. Even if you don't have `error_handling="inline"` in your template, sometimes payment errors must be displayed inline on the next page load.
> 2 votes

# Answer
Just for anyone that runs into this. The actual submit button must have name="submit" in it.

For example doesn't work:

\<input type="submit" class="button checkout\_button" id="checkout\_submit" value="Checkout"\>

This does work:

\<input type="submit" name="submit" class="button checkout\_button" id="checkout\_submit" value="Checkout"\>

The first one will just loop the page.

Brad
> 1 votes

# Answer
Quite often this line can be a problem:

```
if (this.form.elements["payment_method"].value == "stripe") {

```

If you have more than one payment option (for example, a hidden field, or radio buttons), then `this.form.elements["payment_method"]` will return an array instead of a single element.

In that case, you need to change the line to:

```
if (this.form.elements["payment_method"][0].value == "stripe") {

```

Alternatively, if you are using jQuery:

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

```

Or if Stripe is your only payment method, simply remove the conditional altogether:

```
/* Ensure your checkout submit button has id="checkout_submit" */
$checkout_submit = $("#checkout_submit").click(function() {

    /* Temporarily disable the checkout submit button */
    $checkout_submit.attr('disabled', true);

    /* Create a Stripe card token */
    Stripe.card.createToken($(this.form), stripeResponseHandler);

    /* We don't want to submit the form yet */
    return false;
});

```
> 0 votes

# Answer
I had a similar problem and it turned out there was a space before my secret key, so watch out for that. Maybe Store could strip spaces from API keys as a precaution?
> 0 votes

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


# Question
Title: Channel Form - Control errors on where they should be displayed, inline or not
I am trying to find a way to be able to control where errors show.

The native EE Channel Form feature of using `error_handling="inline"` is good for most cases but not for all.

For example, when I try to register a username/email that already exists, an error at the top displays

```
The username you chose is not available

```

or

```
The email you chose is not available

```

However, I would want these errors to be displayed inline, next to the username/email field.

Is there a way to do this?

# Answer
> 1 votes
Although I haven't used the add-on Freemember, I am pretty sure this would do the job. Bonus it's free and has a great company behind it!

---
Tags: channel-form
---


# Question
Title: Wygwam CKeditor images not working in Multi-Site
I have Wygwam 2.7.1 / EE 2.5.5 - When trying to add an image in the CkEditor - the 'Browse Server' button has disappeared on all multi-sites but is present and working in the main site.

I am using the CP inside the main site and switching between sites, but as above, can't browse server or upload through the file manager on any multi-sites.

File Browser is working fine across sites.

Any similar experiences? Fixes?

# Answer
> 2 votes
I figured it out. The `Browse Server` button only appears when the upload directory belongs to the current site.

In the Wygwam settings you can create different configurations. By default there are the `Basic` and `Full` configuration.

You can use the clone function to duplicate the configuration you're using now. For me this is `Basic`. After you clone it you can rename it to `Basic {site_name}` and change the \`Upload Directory to a directory that belongs to the matching site.

Now you can go to the channel field and change `Editor Configuration` to your newly made configuration.

---
Tags: wygwam, multi-site-manager, image, uploads
---


title: Looking for an a icon dropdown add-on?

text:
# Question
Title: Looking for an a icon dropdown add-on?
Did anybody ever make an add-on that has a icon dropdown (select dropdown)?

Something like this: http://www.marghoobsuleman.com/jquery-image-dropdown Where you can add icons. Preferrably svg with a png fallback. But since it's only Backend, it can be png only.

I am also open to found this!

cheers stefan

# Answer
No. Create your own using Grid or Matrix fieldtype. Define the values in a select dropdown, then in your template code have each value correlate to a specific icon with conditionals.
> 2 votes

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


title: WYGWAM copy paste is not working

text:
# Question
Title: WYGWAM copy paste is not working
I'm using WYGWAM version 2.5 and I was able to copy paste into the field. Now nothing gets pasted except an empty paragraph.

I had set forcePasteAsPlainTExt set to yes.

Any suggestions?

# Answer
> 2 votes
This is bug with ckeditor upon which WYGWAM is built. You have to update to at least WYGWAM 3.3 which fixes all IE11 issues per this comment: https://expressionengine.stackexchange.com/a/20227/69

---
Tags: wygwam
---


# Question
Title: Expresso Store changed column name in database
We've built a custom report-system for a client, fetching data from the "exp\_store\_orders"-table and displaying them to admins.

Yesterday I updated the site to EE 2.8.1 and Store 2.3.1. After ironing out some wrinkles everything seemed fine. Except the PHP-script generating the report. We got a PHP-error: `Message: Invalid argument supplied for foreach()`.

What gives?

# Answer
I'll tell you what gives: the first column in the database-table had been renamed. Used to be "order\_id", now it's called plain "id". Changed the query and everything worked again.

But I couldn't find any information on this from Exp-resso, isn't renaming stuff in the database a big deal?

I should also mention that this is one of the few times we've gone outside of native EE- and addon-functionality, and we seldom look closely at the database...
> 1 votes

---
Tags: expresso-store, database, updating
---


# Question
Title: Use embedded template in Expresso's email template
Is there any way to use embedded templates in Expresso's email templates? When I try it seems to create a blank email...

Thanks, Frank

# Answer
> 0 votes
I don't believe so. It's not a normal EE template.

---
Tags: expresso-store
---


# Question
Title: Best content management approach to multi page articles in ExpressionEngine
We're working on a site where we need to present a multi page article within the front end of the site. Currently this is composed of a number of entries which are set as 'Structure Entries' inside a node.

It's likely that there will be many more articles like this so I'm not comfortable using Structure as a means of 'organising the entries' and beyond the association with each other by nature of their position in the structure tree there is nothing else to 'hold them together' or 'denote an order'.

Articles will vary in length so the native EE approach of a custom field per page isn't going to cut it.

I had thought of perhaps using a Pixel & Tonic Matrix field or Krea Content Elements field, maybe creating a 'custom content element fieldtype' which is a 'Page Break'?

Would love to hear how others have tackled such a challenge?

# Answer
> 2 votes
I think your idea of using Matrix rows or Krea Content Elements to set up separate pages is a good one.

In the past, I've just used a single Wygwam field in conjunction with **Simple Pagination.**

> The Simple Pagination plugin makes it possible to split up an entry into an unlimited number of pages by simply entering {pagebreak}

I suppose the nice thing about Simple Pagination compared to a Matrix or Content Elements approach is that the editor could very quickly and easily change the position of page breaks. With a Matrix or Content Elements handling separate pages you'd have to shuffle content between rows in order to change where breaks in your content occur. On the other hand, the Matrix or Content Elements approach is probably a little more client-proof (no chance for typos in entering the page break trigger).

Whatever route you take, since you are using the Structure module you'll inevitably need to use something like Freebie to prevent the pagination URLs from returning a 404 (ie, use Freebie to set the pagination keyword to an "ignored" and "breaking" segment).

---
Tags: matrix, pages, content-elements
---


title: Content Elements + Wygwam not working

text:
# Question
Title: Content Elements + Wygwam not working
I'm using EE v2.8.1, Content Elements 1.6.9 and Wygwam 3.3. On my entry page, I'm receiving a blank area where the wygwam is supposed to be. Am I missing something?

https://www.dropbox.com/s/ogs877ovbszipp5/Screenshot%202014-04-23%2016.48.34.png

# Answer
The issue was (even though it wasn't being used), I had another wysiwyg available to use alongside the wygwam. Per P&T docs, this causes an issue. I simply removed the wysiwyg from the field type options and this fixed the issue:

http://pixelandtonic.com/blog/wygwam-3
> 1 votes

---
Tags: wygwam, content-elements
---


# Question
Title: Categories of a category_group won’t show
I have a strange thing in EE 2.8.1. I want to show a list of all categories in category\_group=“1” but nothing won’t show up.

I have 3 category groups

* ID 1 - with 105 categories, top & sub level, Channel = "Producten"
* ID 2 - with 2 categories, Channel = "Nieuws"
* ID 3 - with 1 categorie, Channel = "Producten"

When i use for example:

```
{exp:channel:categories channel="producten" dynamic="no"}
{category_name}
{/exp:channel:categories}

{exp:channel:categories category_group="2" dynamic="no"}
{category_name}
{/exp:channel:categories}

{exp:channel:categories category_group="1" dynamic="no"}
{category_name}
{/exp:channel:categories}

```
* Example One: I just get the one category from ID 3 and nothing from ID 1
* Example Two: Just works great, nothing special
* Example Three: Nothing happend, but why?

So i don’t see what can be the problem, anybody else have a idea? Looks like EE does not see Group 1.

# Answer
> 2 votes
You need to specify the channel parameter, and you can leave out dynamic="no" because that's not a parameter for this tag.

If specifying the channel parameter does not work,try adding the following parameters: status="not closed" show\_future\_entries="yes" show\_expired="yes"

```
{exp:channel:categories category_group="1" status="not closed" show_future_entries="yes" show_expired="yes"}
{category_name}
{/exp:channel:categories}

```

If the tag then outputs your categories, the reason they were not showing up is because the entries with those categories did not meet the default conditions i.e. entries with a status of open with an entry date in the past which have not expired. So you can then adjust the parameters to suit your particular entries e.g. omit the show\_expired parameter if you don't want categories with only expired entries included.

You can review all the parameters for the channel categories tag at http://ellislab.com/expressionengine/user-guide/add-ons/channel/categories.html#parameters

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


title: How to deal with empty stash lists?

text:
# Question
Title: How to deal with empty stash lists?
I have an empty stash list, as expected. I need to output some alternative content if the list is empty. I've tried using conditionals and {count} but to no prevail.

Any ideas how I can do this. I am using Stash and Expresso Store. I need to allow users to seamlessly switch between purchased and purchased products.

Any help, greatly appreciated

Here is my list

```
{exp:store:orders member_id='CURRENT_USER' order_by='order_date' sort='desc'}
  {items}
    {exp:channel:entries entry_id="{entry_id}" channel="series"}
        {exp:stash:set_list name="series_list" parse_tags="yes" parse_depth="3" context="{url_title}"}
           {stash:item_entry_id}{entry_id}{/stash:item_entry_id}
              {stash:item_title}{title}{/stash:item_title}
                {exp:stash:set_list:nested name="series_list_episodes" parse_tags="yes" context="{entry_id}"}
                        {series_episodes}
                           {stash:episode_title}{series_episodes:title}{/stash:episode_title}
                           {stash:episode_number}{series_episodes:episode_number}{/stash:episode_number}
                           {stash:episode_teaser}{series_episodes:series_episodes:episode_teaser}{/stash:episode_teaser}
                           {stash:episode_duration}{series_episodes:episode_duration}{/stash:episode_duration}
                           {series_episodes:episode}
                              {stash:desktop_url}{episode:desktop_url}{/stash:desktop_url}
                              {stash:mobile_url}{episode:mobile_url}{/stash:mobile_url}
                              {stash:placeholder_image}{episode:placeholder_image}{/stash:placeholder_image}
                            {/series_episodes:episode}
                        {/series_episodes}
               {/exp:stash:set_list:nested}
            {/exp:stash:set_list}
        {/exp:channel:entries}
  {/items}
{/exp:store:orders}

```

And here is the output:

```
{exp:stash:get_list name="series_list" context="{segment_3}"}
    {!-- if no results/list empty load another product --}
    {!-- chuff removed --}
  {item_title}
    {exp:stash:get_list:nested name="series_list_episodes" context="{item_entry_id}" prefix="nested" }
                {!-- bla bla this all works nicely, just stash variables used in the embed --}
    {/exp:stash:get_list:nested}
    </ul>
{/exp:stash:get_list}

```

**UPDATE**

A little background to my issue.

I am building a ecommerce site that gives users access to some streaming video content.

From within one template I need to be able to list products which have been purchased and products which haven't been purchased.

With the list above, I was hoping to return some content based on the {segment\_3} value, if there is no content, so rather than using the exp:store:orders loop, I'd use the standard channel entries loop with the url\_title set to {segment\_3} (i've not coded this part yet, Just at the stage where I need to return 'something' if the list returns nothing.

# Answer
> 4 votes
If your `{exp:stash:get_list}` tag is wrapped by another tag pair, then commonly used template variables like `no_results` are parsed for the parent tag by EE.

Add the `prefix="my_prefix"` parameter to provide a namespace, and use the prefix like this:

```
{if my_prefix:no_results}...{/if}

```

There are a few other ways to check that a list exists (or is empty):

**With a conditional using `{exp:stash:list_count}`:**

```
{if {exp:stash:list_count name="my_list"} > 0}
...
{/if}

```

**With a conditional using `{exp:stash:is_empty}` or `{exp:stash:not_empty}`:**

```
{if {exp:stash:not_empty name="my_list"}}
...
{/if}

```

**Or with Switchee:**

```
{exp:switchee variable="stash:my_list" parse="inward"}
  {case value="#^\S+#"}
     List exists
  {/case}
  {case default="yes"}
     Doesn't exist
  {/case}
{/exp:switchee}

```

Use either the `{if my_prefix:no_results}` or the Switchee methods if you intend to process another tag when the list is empty.

---
Tags: expresso-store, stash, 2.8
---


title: Freeform Pro 4.1.3 install question

text:
# Question
Title: Freeform Pro 4.1.3 install question
I installed Freeform Pro 4.1.3 but it does not appear in the "modules" area of the control panel. I copied the files twice and checked their location but still no change appeared in the "modules" area of the control panel.

I'm running EE2.6.1, PHP 5.4.7 and MySQL Server 5.5

Any idea what may cause the module not to appear?

Thanks

# Answer
> 1 votes
If the module doesn't show up in the list, it's most definitely not in the right place. Are you sure the third\_party config override isn't in place, pointing EE to another directory for add-ons? This is a fairly common scenario.

---
Tags: solspace-freeform
---


# Question
Title: Can site members add products to Carthrob store?
If we wanted to allow members to list products for sale similarly to Amazon and take a transaction fee, would that be possible with Carthrob?

# Answer
> 0 votes
Essentially yes.

Cartthrob is flexible enough to allow you to create custom plugins that add functionality - you might need this to automate any kind of transaction fee collection and for reporting purposes (assuming your sellers would want to be able to view reports - this might also be possible via front end templates).

But Cartthrob is really just the shopping cart and checkout bit of the site with some back-end reporting tools thrown in. What you're describing is more basic EE functionality with Cartthrob bolted on to handle the transactions bit for customers.

You could build a seller control panel sitting alongside the public facing site on the front end using EE and use regular templates to pull information for each sellers reports from EE and Cartthrob's data.

---
Tags: cartthrob, members
---


# Question
Title: Autoplay videos using Fancybox to open video served from Vimeo via Channel Videos
I am using Channel Videos from DevDemon to pop up videos in a Fancybox modal. The videos are hosted on Vimeo. Does anyone know how to make the videos autoplay?

I am looping through the relational entries like so:

```
<ul class="portfolio recent-work clearfix">
    {exp:channel:entries
        disable="category_fields|member_data|pagination"
        category="1"
        channel="program_module"
        status="open"
        show_future_entries="no"
        show_expired="no"
    }
        {video_groups_to_include}
            {exp:channel_videos:videos
                status="open"
                entry_id="{video_groups_to_include:entry_id}"
            }
                <li data-id='id-{video:id}' class='{video_groups_to_include:categories}{category_url_title}{/video_groups_to_include:categories}'>
                    <a href="{site_url}_video/{video:id}" data-html="{site_url}_video/{video:id}" class="fancybox-lesson player" data-rel="fancybox-lesson" title="{video:title}">
                        <em class="overflow-hidden"><img src="{video:img_url_hd}" alt="{video:title}" /></em>
                        <span>
                            <strong>{video:title}</strong>
                            <i>{video:description}</i>
                        </span>
                    </a>
                </li>
            {/exp:channel_videos:videos}
        {/video_groups_to_include}
    {/exp:channel:entries}
</ul>

```

Then the video embed is done here:

```
{if logged_out}
    {redirect="{site_url}"}
{/if}
{if logged_in}
    {exp:channel_videos:videos
        status="open"
        video_id="{segment_2}"
        embed_width="630"
        embed_height="354"
    }
        {video:embed_code_hd}
    {/exp:channel_videos:videos}
{/if}

```

The js to kick off the modal is here:

```
jQuery(".fancybox-lesson").fancybox({
    'padding'       : 0,
    'autoScale'     : false,
    'transitionIn'  : 'none',
    'transitionOut' : 'none',
    'title'         : this.title,
    'width'         : 630,
    'height'        : 354,
    'href'          : this.href,
    'type'          : 'ajax'
});

```

I don't care at which stage I accomplish this as long as it occurs once the video is loaded.

# Answer
Try adding '?autoplay=1' to the end of your video link URL after the video id.
> 1 votes

---
Tags: ee2, channel-videos, vimeo, modal
---


# Question
Title: Why font size box was removed from WYGWAM
I have posted my problem under some other thread too. Just want help in restoring the ditto content within a WYGWAM field type after an EE upgrade and WYGWAM version upgrade. The versions upper than 2.6 are not showing font size drop down. Is this explicitly removed? Can we get this option back? Is this really worthy to remove this kind of option?

# Answer
> 3 votes
The font size button added inline CSS, which is bad practice for modern web development.

The better method is to add a custom style set with semantic, re-usable classes like `.important` or `.featured` that the user can apply to their content.

If you have existing content that used the font size button, you can preserve those styles by setting the "Restrict allowed HTML?" option to "no" in the editor configuration. This will prevent Wygwam from stripping out inline styles.

---
Tags: wygwam
---


# Question
Title: show cartthrob packages product in front end
I want to show cartthrob packages in front-end after login when i login i am not able to see product which are used to add in packages shown in below image

Its work when we have logged in from back-end

When i try to debug i found i am not getting EE.base so i have add below think to use for dynamic user

"http://stores.example.com/system/index.php?S=$fingerprint&D=cp";

?S=$fingerprint is same as below which i am getting when i am logged in back-end

In backend the url is some think link this http://stores.example.com/system/index.php?S=d880f2cb5dd6db612d0603c2b95272e3&D=cp&XID=ba318af777c8317b9a5e4ee803f72ea8dbbc223a&C=addons\_modules&M=show\_module\_cp&module=cartthrob&method=package\_filter&filter\_id=1&keywords=&channel\_id=null&date\_range=&cat\_id=&search\_in=title

I have tried to debug once again print\_r($this-\>EE-\>session-\>userdata);

i found all the values same except \[admin\_sess\] it will be 1 when i login from backend and 0 else

so please help me how to show cartthrob packages product in front end

# Answer
> 0 votes
When i call to support they said packages feature was never meant to show on the front end.

The problem was in **"EE.BASE"** on line no 166 =\> $.getJSON(EE.BASE, filter, function(data) and need to set **"admin\_sess"**

When the front-end user login we need to set admin\_sess to 1 and need to set EE.BASE

You can set EE.BASE as $this-\>EE-\>session-\>userdata\['fingerprint'\]; or user session Need to add update query to set admin session to 1

---
Tags: cartthrob, sessions
---


# Question
Title: How to move all Playa relationship to EE relationships
I need to move all playa relationships to EE relationships.

What is the best way to do this? I have not been able to find anything online explaining a process or how to approach this.

All I know is I don't want to just change the field type.

# Answer
It's a pretty simple operation, since they are stored very similarly.

First, backup your database. Then, run this code in a PHP-enabled template:

```
<?php

$playa = ee()->db->query("SELECT * FROM exp_playa_relationships");
foreach($playa->result_array() as $rel)
{
    $data = array(
        'parent_id' => $rel['parent_entry_id'],
        'child_id' => $rel['child_entry_id'],
        'field_id' => $rel['parent_field_id'],
        'order' => $rel['rel_order']
    );
    ee()->db->query(
        ee()->db->insert_string('exp_relationships', $data)
    );
}

?>

```

Then, change your Playa fields to Relationships fields. Done.
> 5 votes

---
Tags: playa, relationships
---


# Question
Title: Save one form data in two different channel
I have a form in one page which need to save in two different channel how it can be possible? using channel form

# Answer
I don't believe you can submit to multiple channels at the same time with Channel Form at this time. One option would be to use something like External Entries to create a sql database update. You could then submit your form via ajax to the template with your sql insert/update. (Also see docs for External Entries, subheading "As an Ajax Form", for an example)
> 1 votes

---
Tags: channel-form
---


title: matrix - no rows exist please add one

text:
# Question
Title: matrix - no rows exist please add one
Is is possible to change this message so it is more user friendly?

I would like to do it per-field rather than globally.

# Answer
> 1 votes
It is possible to override these messages in `system/expressionengine/third_party/matrix/language/english/lang.matrix.php`.

In this file you can edit the bits of text between quotes (after the arrow).

Note that these changes will be lost after an update of Matrix.

---
Tags: matrix, pixelandtonic
---


title: Can't Download File in Expresso Store

text:
# Question
Title: Can't Download File in Expresso Store
I'm developing a store that allows a client to download custom scripts. I've set up the download folder and the Store and my configuration seems to be correct.

```
            {exp:channel:entries entry_id="{entry_id}"}
                <li>{exp:store:download order_id="{order_id}" url="{file_for_sale}"}
                  Download
                {/exp:store:download}</li>
            {/exp:channel:entries}

```

What happens is I get an error like this:

What is even more confusing is that my original folder path isn't

/homepages/9/d201932266/htdocs/frameexpert/

My original file path is:

/kruden/homepages/9/d201932266/htdocs/frameexpert/

I'm not sure where this file path is coming from. I've scoured all the config files to see if this is one of the directories, but it isn't.

Any insights would be great!

Thanks.

# Answer
> 1 votes
Here is the bug I discovered. Whether or not this is just a problem specific to the server I'm using or just a downright mistake in the Expresso Store 2.2.0 code I'm yet to be determined.

My settings: -Server Path to Upload Directory: /homepages/9/d201932266/htdocs/frameexpert/images/page\_images/

I Edited this file: store/src/store/service/StoreService.php

```
public function get_file_path($file_id)
{
    $path = ee()->db->where('file_id', $file_id)
        ->get('files')->row('rel_path');

    if (empty($path)) return FALSE;

    // is this a relative path?
    if (strpos($path, '/') !== 0) {

        //Note: Detected Bug in Expresso Store. The '../' doesn't bring us far enough
        //back. APPPATH returns '/direct_path_to_ee/frameexpert/expressionengine/system/'
        //What this line of code returns is
        //'/direct_path_to_ee/frameexpert/expressionengine/system/../frameexpert/images/page_images/file.zip'

        $path = APPPATH.'../'.$path;
    }

    return $path;
}

```

What is happening here is that the 'get\_file\_path()' function returns an incorrect path. All I did to fix this was:

```
    // is this a relative path?
    if (strpos($path, '/') !== 0) {

        //Note: Changed '../' to '../../../'
        $path = APPPATH.'../../../'.$path;
    }

```

This resolved my issue.

---
Tags: expresso-store
---


# Question
Title: Expresso Store -Trigger payment Gatway from backend or method
Is there a way that I can trigger a payment gateway to process an order that has already been processed already.

i.e. A user selected to pay for an order using the manual payment method and process their order as such. The user then decides to contact the site admin because they instead wish to for this order via another payment gateway.

Is there a way using php that I can allow this to happen and if so where do I look to find the correct methods that will achieve this.

Thanks

# Answer
In that scenario, no. If the user has selected a payment method and completed the checkout using that payment method then the easiest thing would be to cancel that order and run through another one with the change of payment method.

In other circumstances when you don't want to take payment immediately you can set the *Credit Card Payment* Method to *Authorize Only* in Store \> Settings \> General. This will allow you to take the payment manually at a later date.

You will need to check with your payment gateway how long you can keep an authorised payment open before needing claim. This can vary between payment gateways and you will usually need to manually capture within a matter of days or the order will be dropped.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Simple Commerce for Downloadable Products
I am just wondering if anyone has ever used EE's Simple Commerce for a store that requires items to be downloaded (music songs and albums in my case)? And if so is there anything I should watch out for.

I'm using ee 2.7.1, Structure and Transcribe.

Thanks. Stephen.

# Answer
> 1 votes
The biggest issue you're going to run into is that Simple Commerce doesn't have any tags for displaying purchase information, so you'll have no way to verify if the user has purchased the content, thus allowing them to download the product.

If you have any knowledge of SQL queries, you could possibly use the Active Record module to directly grab purchase info from the database. If you don't know any SQL, this is an excellent tutorial.

---
Tags: structure, transcribe, simple-commerce
---


title: Category as field value?

text:
# Question
Title: Category as field value?
Is it possible to populate an entry field with categories? When publishing a Structure page, I'd like to be able to select what category of products to display.

# Answer
> 1 votes
Yes. **WB Category Select** is a fieldtype that does just that.

When you create a custom field of this type you can set the category group(s) and whether or not the user is allowed to select multiple categories.

It's a very handy add-on and works great!

---
Tags: categories, structure, fields
---


title: Solspace Super Serach Matrix Date Range

text:
# Question
Title: Solspace Super Serach Matrix Date Range
I need to implement the following search on my ee site

I have a matrix field with the following columns

```
start date
end date

```

For example, I have an entry with 2 rows in my matrix column where the values listed are dates that are not available

Entry Title: Entry 1
Matrix values
Start Date - End Date
01/01/2014 - 15/01/2014
01/02/2014 - 20/02/2014

On my search form I have a search form with start date and end date

The user searches with the the following details
**Start Date - End Date
02/01/2014 - 10/01/2014**
When the users searches no results are displayed as the dates the user selected are in the matrix field as not available

The user searches with the the following details
**Start Date - End Date
16/01/2014 - 20/01/2014**
Entry 1 is returned as the dates selected are not in the unavailable list for that entry

**Is this possible with low search and is there an example?**
Thanks

# Answer
> 1 votes
First of all, Matrix data columns need to be set to "searchable" for its data to be stored, **as a concatenated string**, in `exp_channel_data`. Once that is set up, searching in this Matrix field using Super Search is limited since Super Search will only look for a string match between your search and what is stored in `exp_channel_data`. In other words, there are no date-based calculations being made. Further, for date columns, it might be possible that this data is saved as a unix timestamp, so you would have to make your search match an exact unix timestamp stored in `exp_channel_data`.

---
Tags: matrix, low-search, supersearch
---


# Question
Title: Solspace Rating: how can I display the most recent ratings?
I have Solspace Rating 3.2.4 installed; and while I'm seeing examples to show the most popular/highest ratings, I want to show the ten most recent ratings (that is, the ten most recent ratings that have received at least one vote.) The output and formatting in the linked example is fine; it's just the sorting of which ratings are displayed, that is different from what I want. Am I looking at the wrong tag, to generate a list of the ten most recent ratings?

# Answer
Use the `{exp:rating:entries}` tag and sort by date. I'm not sure how you'd filter out those that don't have at least one vote though.
> 1 votes

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


title: Status Permissions / workflow

text:
# Question
Title: Status Permissions / workflow
I am using ExpressionEngine 2.8.1. I have a set of basic permissions for my EE posts.

* Draft
* Awaiting Approval
* Rejected
* Open

I have 2 key types of user: -

* Contributor
* Editor

I have limited the Contributor to only be able to set the status to :-

* Draft
* Awaiting Approval

The Editor can set the status to: -

* Draft
* Awaiting Approval
* Rejected
* Open

The problem is that I want to prevent the Contributor from being able to see / edit posts that are in the 'Awaiting approval' status. The should be able to set a post to this status but after doing so be unable to make further changes to the content unless the status is change by and editor to 'rejected' or 'draft'.

I would also like to prevent them from being able to editing posts in the 'open' status as this effectively sets the status to 'draft' as the don't have permission to submit to the 'open' status.

As a secondary consideration it would be ideal if a contributor could edit a post that was set to 'open' but that it would not be made live until approved by an editor.

How can I achieve this in expression engine? This is such a standard workflow for content that I'm sure I must be missing something. Any and all help appreciated.

# Answer
For the control panel there are probably add-ons for this, like better workflow or maybe draftEE.

For the front-end you can do some conditional checking in the template before showing the channel-form (safecracker).
> 1 votes

# Answer
Have you tried Better Workflow: http://devot-ee.com/add-ons/better-workflow
> 0 votes

---
Tags: status, permissions, groups, workflow
---


# Question
Title: Correct way to share functions/methods between Module and Extension
I'm just getting acquainted with Add-on development beyond basic plugins and I'm not exactly sure the proper way to organize my files.

I have a base Module file, mod.xxxx.php that has a handful of methods within. I am now realizing I need an extension as well to hook into a few base EE hooks. Within the extension, I want to use a few helper methods from my module but I'm not sure the proper way to share them between the Module and Extension.

I tried

```
if (class_exists('Modulename') === false)
{
    require_once PATH_THIRD.'modulename/mod.modulename.php';
}
$modulename = new Modulename();

```

And then called

```
$modulename->modulemethod($variable);

```

In the extension, but it's not returning the right type, rather an empty array.

Should these "helper" functions really be moved into a helper file and then loaded into both the extension and the module using the load-\>helper function of CI?

# Answer
You should create a *library*, which is just a PHP class stored in `system/expressionengine/third_party/your_addon_name/libraries/`.

```
<?php

class Your_library {
  public function do_something()
  {
     return 'foo';
  }
}

```

Then in your module / extension, you'd be able to do this:

```
ee()->load->library('your_library');

// prints out foo
echo ee()->your_library->do_something();

```

This is the preferred way to share code between the various add-on types.
> 4 votes

---
Tags: module, extension
---


# Question
Title: Cannot sent SMTP email after updating to EE 2.7.3 from 2.5.5
So i have EE sending SMTP mail via a remote server which was all working fine in EE 2.5.5 but now i have upgraded to 2.7.3 it's not having it at all!

The error i get is:

An Error Was Encountered Unable to send email at this time.

```
220 brightmail.redacted.local ESMTP Symantec Messaging Gateway

hello: 250-brightmail.redacted.local says EHLO to 111.111.111.111:41353
250-ENHANCEDSTATUSCODES
250-SIZE 15728640
250-8BITMIME
250 PIPELINING
Failed to send AUTH LOGIN command. Error: 500 5.5.2 unrecognized command
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

```

I have got this stuff already configured:

```
$config['email_newline']    = "\r\n";
$config['email_crlf']       = "\r\n";

```

And nothing else i try has any effect.

Any help would be grand!

# Answer
> 2 votes
Instead of using SMTP with EE, I'd recommend using Escort (http://devot-ee.com/add-ons/escort) with a third-party 'transactional' email service like Mandrill (http://mandrill.com). We've also had issues with SMTP and PHP mail in EE (particularly Gmail deliverability), which the third-party system solved. Escort is super-easy to set up, and you get the benefits of the third-party system (better deliverability, batch sending, reporting, etc.).

Someone else may be able to specifically address your issues with SMTP, but I still think it's worth considering the third-party route.

---
Tags: email, smtp
---


title: Unsubscribing from follow up comments

text:
# Question
Title: Unsubscribing from follow up comments
In the comment form, I can have a checkbox that allows me to tell EE to notify me of follow up comments

```
{exp:comment:form channel="news" preview="channel/preview"}
    ...
    <textarea name="comment" cols="70" rows="10">{comment}</textarea>
    ...
    <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label><br />
    ...
{/exp:comment:form}

```

I want the users to be able to toggle this feature since some of them want this feature disabled.

So I tried a solution. I unchecked the checkbox and submit with a blank comment textarea field.

However, when doing that I am shown an EE error that tells me that the comment field should not be blank.

My question is, how do I unsubscribe?

# Answer
With the **Comment Notification Links Tag**
http://ellislab.com/expressionengine/user-guide/add-ons/comment/#comment-notification-links-tag

The `{exp:comment:notification_links}` tag can be \[used\] to allow members to subscribe to an entry without commenting via a simple link. This tag may only be used on a single entry page.
(edit: or provide parameters for entry\_id or url\_title to help the tag find the entry)

```
{exp:comment:notification_links entry_id="x"}
        {if subscribed}
                <h5><a href="{unsubscribe_link}">Unsubscribe to comment notification for this entry.</a></h5>
        {if:else}
                <h5><a href="{subscribe_link}">Subscribe to comment notification for this entry.</a></h5>
        {/if}
{/exp:comment:notification_links}

```

**edit:** if you want authors to be able to unsubscribe, make sure that
"notification of authors" in channel settings for a channel is set to OFF.
Authors then need to subscribe themselves (or with a custom extension)
via: https://expressionengine.stackexchange.com/a/6393/155
> 1 votes

---
Tags: comment-form, subscriptions
---


# Question
Title: php error Filename: helpers/form_helper.php
Got an error

```
A PHP Error was encountered
Severity: Notice

Message: Array to string conversion

Filename: helpers/form_helper.php

Line Number: 345

```

I do not have a helpers folder in my main directory but I have one in my codeigniter \> system and the file form\_helper.php exists there.

Is the path to CI needing updated?

# Answer
Can you provide a bit more information to what you are doing?

e.g. are you creating an add-on and calling form open? Or are you using a template tag that shows a form? The issue is (if you look at line 345 form\_helper) that you/it is trying to pass an array in a $key or $val to output a form\_select option="" html tag.
> 1 votes

---
Tags: php-errors, codeigniter, files
---