# Question
Title: Show Low Search results with Low Alphabet
I'm wanting to use Low Search to do a simple keyword search on a single channel, but then show the results using Low Alphabet.

I can't quite figure out if this is something you can do 'out of the box' (ie they just integrate because they are super awesome), or if it's something I can 'hack' together in some way.

Has anyone else tackled this?

Cheers.

# Answer
The way you're doing it now -- getting the entry IDs from the search and passing them to the `low_alphabet:entries` tag -- would be the way to do it. There isn't some secret way to seamlessly integrate the two at the moment.

I realise that Low Search could do with a single `:entry_ids` tag to make this easier, but sadly that's not possible at the moment due to the way it combines native and its own filters, and the lack of a proper channel entries API for generating entries.
> 4 votes

---
Tags: low-search, low-alphabet
---


# Question
Title: Error Number: 1062 Duplicate entry '465628' for key 'PRIMARY'
Running into some serious issues with CartThrob. All of a sudden I am getting this error when I add an item to the cart and try to view cart or checkout:

It was working last night and sometime over night it all fell apart. Running EE 2.7.1 and CT 2.4

```
Error Number: 1062
Duplicate entry '465628' for key 'PRIMARY'

INSERT INTO `exp_cartthrob_cart` (`cart`, `timestamp`, `url`) VALUES ('K6gFe9V1QJccK0fvGNVsRc4QcUIo5mUg0bI7289zYbY/N0ro47KwIXg6Y/DjZd3cvPIUwv5Ddy5jqgR+tBmK92NivQ9Mdf9gs94x2hqxGlcv3qv1uE3haM2cJrF8POUPRjZRWaKB2tVkAo7ItGfaYep5TMlyLAMToDfoxnF6tK5Zx+zp+xJR/nzoxiDZqVF97XESOODptuToYVcP1TDJcKGXhWxlXEw0div/hGHrIHLkN/6txq2saXOqK6QomFXPK9+d5f1orLFXVvLOoRT/m4Nf9A+43zww872nhYgsgHFbMSwZRDYGIb3iGiQzTxPl2eawxfM/pf+dWO4sZ4Wq0v2InbCDQAjX4BHDlXDidr5TsgR45SKmAatklSKhs9IR8/zfENwD8ZRnm2cEyOWBpHh6JKf7DOu4tvzL3Qq3wdu2KetrB5Pha77NF+jYp8kgn6e4WwlGcUf/MQDxbcaG/zt9AF+1DJc4+Z++hAeTORu8rv/t5EZKvRIADeUeoPyPZH1C7OGR7Jt73iN2i8dET58v4pHNpeEeBsU6d2v5WoGYWUu+ZrSvbhneo7dSBZR/NgmoVTf4ev3OR27JfMV7Tlaxe4+W0lgerm/BsDpQaYW6jOGINudI6/T1AHzQspCzmbshIay8LZV/5gDEboPQTTDaquNbvESxSR3v32MD76fI5XS2uvMkOvdApoRHAGEmLGj0Zaku1ImAyQlW5iu9NydyyFyTlZk9ArNQNk6Yn9cY9KaWYrvQ7E5tDKi0owzrNJNgocTK4x8YyyCeXT/EBpXXxDh5PUOy+yrtGnY7xVpjjuRVNPz+7b3f7Tsh0MoAFXPWvG07ULTqrj2FjnvZGP01Uqz5jmIP0BIsNP8pr8mVtEuJCWXcWpH4jkylOWLZDN6qF9qnVVrb25yM4M+avpDzOt6Bjcat9h+FpWi4+M4rG/uMoYClXWerdDXRKwfUKZU3/spr2nkSWYqR0sPbF5lCS14mynHircac+PfG8MEQ9zurVkD9VAKXlBMDzpFZQhihktK9E+97hnF7hdU0qYgom0vbUpXTzwZjwXDfGWFc3i6IlvB0fH/tAjoFbE600T2K5y+iN5JUS8wcTFWmdwXYRtbZrTl09JKE7GmOeZi9c8/aXXxAUvTvqiVfMh9i1YZu+6X1TwPHlwcJwctuGz9s7gu3DMEJbtKy95lbqeU1IPACsowqBUVIbyry9OYGPGAnsux5jrZIo5m42j6WXYbuu89WY+E2D9WCy+MJPa5+dNGAqs+dBAyjrEUM/TRyy5xXChKRDmBey86ti/AeEFKHUS0/ObjeyeRvxP6sCkL6uB9SO6L1ofoK2lkFNIVfjSMnlC4qZAMOpxDdHPyw3RyccmGqXyefsB09oE5bzjHAQs5fXGVX39X37HtPZ4iQDZEXjdWCKoorHrZ66NCJAFwZO9Atz0jZ5gaOH1kZAKL8C7XKK6Q7zOlZ6Y/+WwTMaAPBrGflGtI3Rqw6v2lTbSxLYArEI7quy9L34+DdR9DsQRfhlZsOx2zolKuUcHJvXkqArSdOI2zzWGE7vUIL23UFBxPOMT+0yJlZK16pf1XaljJhtxlwtSopKWrne9ESp+5HesGQ3waqSfJcWw28AXuJ4dFhN4hsQlZWacdmRtO9JuNCSzU98Q6Pehhx60GSd8KzZc4S+3vejSQ+n4V5I08e1YvhMAz7Kha70Zrsg8M0W78sW92jrB1NzOisQx3LrlLT4/2c1J1uVlt0h8MbB0Zsjs1QwAvSQexbMucqXSc672rjyqig6GEm9FEkkkWiZpvAA3bQw8Pf5GEUTKa6OVrvHjXbZLXxo4wXtchWoUJB9yzHE85RTnqFV3XUtBn7r6tONS7AmQQUPKl9PqrHtijIqg4w06VUCfyU6vI/NneG4DQXX5mg0H5guD1hXKfRAAGWBLzDBubIWKW5ylBymeM7iBop3r4cb4gFJA4x1xMnI9blHfKH7/230OyXLsD7a0UBT+rDJwLuFkRCFzoRUXuHmkyE+Wnx4YGAKI9MhG3IwAbYOeRC97o3BQjUymcPvN8dUeTgjSXJXMm3zB1bPGr1yWl8aZ+J3m46E+lnAInJECM9yJUicoYR/u31py4Wnuq0vXgXTLi/XSkO3BPU/MFyAK9g6h/FwcG2Tfg/3JMtmMJDC+E8sETCNW560hx21duSNW7GQ3t2zZhEyEInHNxzya7tIyRAwZBy/7D93ongcsR3p4hgtCHjcVpIl7y0t8IDMlipgncTmBKor3rBTJjVDRGF7kzOJ26r/QjfiEvJxCiZmaITNDWb7hued5S1uhJNi3YrrgI2HxoAp/rVogdPETYUzQL6ZfR+v5/FFhR7SrAY2b/I96B8xhY+6LoEN8ToiY+oyPdBn8I1TT/F+B7LTCbwt5N4OmrUTcoBFF7d2FgJJGoZsUzE1UUl4ScFM0OLVjP2NZwF42WWuM56u/hpZweSBLCdED8wD4n49fC5i3zCa8K536e9DbmHP88QcFWlfxH2aYyRjtaf2EFebuTT/10sXkSc+rnYKakLjGzlmAwj73SWByeZWwT3kA4uA/sM6gR+jEqG748o/MJUVYte/7TPq5nDR4Ez7jlAUu4L2PGeeLVEWaTAINeVyt7GUjJhNx6plsskGbwPPDlt1QZKjwQLXU59W3VnnK92n+ciMowI2uu1nBb43apXpU1RW6kyZ8EIm/KqYtMF26ewKtGt47phvoSTG/b9oaMJeGVgu9wYgB0phmZpOA8zXN1HvDGGIb+srpjB82yXNV+S9jwbTLUFjSfLtIUsCdiN4sVNOCAW90f3+6vmdXUzkqkRyS/vhq1QggVyZ1pombPhyKmhixkXuzBk7fK3TOmPjIouE78V+/hIK3stdHiXC6cnGw8R7qCLNn4dSap5zkhUIY+SRs4bTokeZhjmQtQtcIzEzBMLHdIs0VOE+iTUUze9lXhwmt/9qCx3/yVTM0WOaaLpAAhLSidB31+4vz8LBU+C1po8DfgIVc958VHJVyZKSb8bdpJXUNdFWlAo4i7Bxb4rG4v0Hz9wm1mZtrkNUkqgInQkhmM9XaS6iliA7Mm7LAerMx0Z7sHN07X8De8OnJeFpEwyZQisjk9h1NRpeIvnr1tccyYRme5Q2O5HhVTzIpijw2srtFzyJsY8mQiv04N85mYMC6cZnvfb6A5HJfXiVIpLdGubRTHcA+O7BKgc4Mx1huufsidr3XiJeSCGcEXpR6i+1GdlL1H3U5yFfFjZdUgwrCWa1xkh00SF0BeAIkmH3OaX6VsLiNWZJxeD5K30HxPZvdXXbMYQoMEu3j3ebNcknD5pPXXtchvyEiMdFXvB3/DlAz8pQQ2rW+q7wVmWlL+/RIAd3SvvOLIxKhY=', 1384949211, 'http://domain.com/checkout/checkout')

Filename: third_party/cartthrob/models/cart_model.php

Line Number: 79

```

# Answer
I found this blogs.vinuthomas.com/2008/06/18/… changed the field from int to unsigned bigint which fixed the problem for them For me, it didn;t seem to work but once I changed it back to INT the error seemed to go away. (Hopefully for good)
> 0 votes

---
Tags: cartthrob, error, mysql, database-error, duplicate
---


title: a case for Stash or another approach?

text:
# Question
Title: a case for Stash or another approach?
With multiple blog listing templates: index, category, tag, archive, search-results etc - the markup for those listings never really changes between templates.

However, if we need to add something to the li for example, we need to change each template. It would be much more efficient if that li was stored once and reusable throughout our blog templates.

Is that something Stash could do and more importantly would it work where we're using Low Search.

# Answer
> 4 votes
Couldn't you just use a Snippet for this? It would contain the markup and code used inside a tag, which you could re-use with multiple tags. For example:

```
{exp:low_search:results ... }
   {sn_entry_list}
{/exp:low_search:results}

{exp:channel:entries ... }
   {sn_entry_list}
{/exp:channel:entries}

```

An so on.

# Answer
> 1 votes
Snippet would work, but personally I prefer a Stash approach since you can keep the list item markup in the same place as the data fetching logic. This is how I'm doing almost exactly the same thing, also using Low Search: https://gist.github.com/thisisjamessmith/6892683

---
Tags: templates, stash, low-search, dry
---


# Question
Title: Cartthrob Sagepay (offsite) 3037 notification URL error for MSM sites
I've taken on two ee cartthrob sites running off an msm installation. I just moved them to a Nexcess server and updated EE from 2.2.1 to 2.7.2 (and CT from 2.051 to 2.4). Everything is working fine until I try to post data through to sagepay (using the europe offsite option, so no ssl). Every single time I try to proceed to payment, I get this error on the payment confirmation page (without going out to sagepay):

> Failed: sage\_invalid3037 : The NotificationURL is too long.

I've investigated this thoroughly and have found that some people have solved it by correctly configuring a file called 'extload.php' that handles external payment gateways. However, I've edited this file with correct absolute server paths and msm site id's in both theme folders and I'm still getting the error. I can't get a call scheduled with the cartthrob guys for another two days (and that's the paid for option!) so I'm hoping there may be someone else in the community that has experienced and fixed this issue...?

I'm using cloudflare as a CDN, I don't know if this will have any implications?

I've also tried watching the http headers as I click the 'proceed to payment' button, but can't see anything interesting in there (except Cloudflare giving me a Temporary 302 on the confirmation page that delivers the error).

# Answer
> 2 votes
Take a look in your system folder \expressionengine\third\_party\cartthrob\payment\_gateways\Cartthrob\_sage\_s.php file

Somewhere at around line 172 you will see that the $post\_array includes the NotificationURL.

Look for this line:

`'NotificationURL' => $this->response_script(ucfirst(get_class($this))),`

if you add a die statement like this:

`die($post_array['NotificationURL']);`

You can see what the URL is and that should give you an idea of what is going wrong. The Notification URL should be to your extload.php file in your /themes/third\_party/cartthrob/lib/ folder

I hope that this helps. Dorothy

---
Tags: cartthrob, multi-site-manager, sagepay
---


title: Output unique categories of entries

text:
# Question
Title: Output unique categories of entries
I have a page where I'm outputting news entries. And these all are assigned to categories. And based on these, I have a jQuery plugin that sorts the entries visible based on the categories.

So my markup basically looks like this:

```
<ul id="news_categories">
    <li><a class="filter" data-filter="mix-all">All</a></li>
    {exp:channel:entries channel="News" dynamic="no" show_empty="no"}
        {categories}
            <li><a class="filter" data-filter="{category_name}">{category_name}</a></li>
        {/categories}
    {/exp:channel:entries}
</ul>

```

Now, this outputs the categories, but I only want unique ones. Right now, this outputs the following:

* All
* Photo
* Courses
* Arrangements
* Photo
* School
* Arrangements
* School

You probably get the idea. How can I output only unique categories?

# Answer
> 4 votes
You should be using the `{exp:channel:categories}` tag instead since you're only grabbing the category names. View the user guide.

```
<ul id="news_categories">
    <li><a class="filter" data-filter="mix-all">All</a></li>
    {exp:channel:categories channel="News" show_empty="no" style="linear"}
        <li><a class="filter" data-filter="{category_name}">{category_name}</a></li>
    {/exp:channel:categories}
</ul>

```

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


title: Embedding depending on URL

text:
# Question
Title: Embedding depending on URL
I am trying to do something that seems as if it should be simple but it's baffling me!

I have a template page that needs to embed something different depending on the URL.

There are three possible cases.

Case one is that segment\_2 is blank. In this case I need to embed option A. Simple enough I think.

In Case two, segment\_2 is not blank and contains the url\_title of one of the products in this channel. I know the channel. I need to embed option B.

In case three, segment\_2 is not blank and contains something else that is NOT the url\_title of one of my products in this channel. Again I know the channel. I need to embed option A - the same as in the first case.

I have tried putting an if inside the exp:channel:entries tag pair, comparing {url\_title and {segment\_2) - that doesn't seem to work.

Rather than having anyone try to debug my code, how would anyone advise doing this? I am aware that I could be arranging my site in a different way, but I am where I am!

# Answer
Here's a no add-on way of doing this. I'm assuming you're not trying to get pagination going. That would change things.

```
{if segment_2 == ""}option A embed or direct code{/if}
{if segment_2 != ""}
  {exp:channel:entries channel="products" url_title="{segment_2}" require_entry="yes" ... }
     option B embed passing all variables necessary - or just put code here directly
     {if no_results}option C embed{/if}
  {/exp:channel:entries}
{/if}

```
> 7 votes

---
Tags: ee2
---


# Question
Title: How can I tell if Cartthrob's extload.php is being invoked (and what it outputs)?
I'm having terrible trouble getting an updated EE2.7.2 / CartThrob 2.4 MSM site to integrate with Sagepay (Europe Offsite). Every time I try to go out to sagepay from the checkout page, I'm returned to my order\_complete template with an error:

> 3011 : The NotificationURL format is incorrect

I *think* I've configured extload.php correctly (when I request it in the browser, I don't get any errors, and I've set the system path absolutely).

I really need to see what notification url is being generated (if any) so that I can debug from there, but I don't know if the payment gateway plugin is invoking even extload.php or not. The payment notification function references it (`function extload($post)`), so I was working on the assumption that it was using it, but I don't know how to confirm.

I've tried using LiveHTTPHeaders to watch what goes out, but it's not very helpful. I can't see any mention of notificationurl.

So my question is in the title - how can I tell if extload is being invoked or not (is it simply that I'm getting an error from sage and so it must be?) and if it is being invoked, why is my notificationURL malformed/incorrect?

In my cartthrob form I have return="customer/checkout/order\_complete" - which is where I'm taken to straight after submitting my checkout form. This is where the error is displayed - so I must be sending something out to sage?

**EDIT! One MSM site (site\_id 1) is going through to sage** The primary site goes through to the sage server, the second site gives the error. They both use the same payment gateway plugin, the checkout and extload.php code is identical for both (aside from the msm settings in each extload.php, which is all good). Even the POST data that goes out is the same (as far as I can see - it's all structured in the same way and all of the fields are present). So now I'm really wondering what it can be! It's got to be something simple that I've missed, but everything looks right...

# Answer
> 2 votes
Dorothy dorothy has answered my question in another post:

> Take a look in your system folder \expressionengine\third\_party\cartthrob\payment\_gateways\Cartthrob\_sage\_s.php file
>
> Somewhere at around line 172 you will see that the $post\_array includes the NotificationURL.
>
> Look for this line:
>
> 'NotificationURL' =\> $this-\>response\_script(ucfirst(get\_class($this))),
>
> if you add a die statement like this:
>
> die($post\_array\['NotificationURL'\]);
>
> You can see what the URL is and that should give you an idea of what is going wrong. The Notification URL should be to your extload.php file in your /themes/third\_party/cartthrob/lib/ folder

# Answer
> 0 votes
I know that using another payment gateway (Realex) you have to tell them the URL to return to after a transaction - this is the full url of the Extload script which will be something like http://yourdomain.com/themes/third\_party/cartthrob/lib/extload.php/realex\_redirect

This tells the gateway where to post its response so your system can update orders etc.

The return urls set in your Cartthrob form handle the redirect for the user after a transaction but don't impact where the gateway response gets sent.

From the error you're showing, my best guess is that SagePay is getting either no response, or not the expected response when it tries to notify your system of the transaction.

You may find that you would need to set that up within your SagePay account - it's normal for it to be done this way rather than specify it in your post data for security reasons.

---
Tags: cartthrob, sagepay
---


# Question
Title: P&T Switch throws an error with EE 2.7.2
I just upgraded to EE 2.7.2 and P&T Switch is throwing an error in the Developer Log. Everything still seems to work at the moment but it looks like P&T Switch needs to be updated:

```
Deprecated function EE_Fieldtype() called in system/expressionengine/third_party/pt_switch/ft.pt_switch.php on line 26. Deprecated since 2.6. Use EE_Fieldtype::__construct() instead.

```

# Answer
> 4 votes
P&T switch has moved into a new bundle of old dive bar addons called Field Pack as of August 2013. You should update to that and everything will be working fine. Updating is simple, but do read the docs.

http://docs.pixelandtonic.com/fieldpack/installation.html#updating-from-the-old-dive-bar-fieldtypes

---
Tags: pixelandtonic
---


# Question
Title: Can I use a visual editor on Template Manager?
I have an ExpressionEngine website built for a client, and the entire content is built inside a template.

I need to allow the client to make modifications, but I don't want the source to be visible by default.

All plugins only work with channel content, not with the Template Manager.

**EDIT #1:** Found this, but it's for EE 1.x, and it needs to be updated for 2.x - http://ellislab.com/forums/viewthread/56223/

*The ideal solution would be injecting a RTE editor to convert the Template Manager textarea into a visual editor.*

# Answer
If it's static content within a template and you don't want to give the client access to the template then you have a couple of options;

1. Use a global variable or snippet, the client can edit this without touching the full template... though you won't have WYSIWYG editing.
2. Create a channel entry and replace the content in the template with the tags for to output that entry. This would seem the "best" way to me as it will give you the most flexibility and is still pretty quick to set up in EE. It probably won't take more than 20 minutes and will give you exactly what you need.

> "The ideal solution would be injecting a RTE editor to convert the Template Manager textarea into a visual editor."

This "solution" makes no sense within the context you are working. In all honesty it would take longer and be more problematic than *any* of the other options presented in this thread. If you approach the problem from a more appropriate angle, you'll find it much easier. Regardless of your personal like or dislike of a given system it's in your interests to work with the tool, not against it.
> 3 votes

# Answer
You could use Low Variables to manage the template content; that would abstract the maintenance to an interface and leave the template out of the process entirely.

Your question is not very clear though; how is the content getting into the template? Presumably you have channels; can your client not edit the channel entries to update the site?

Or do you want them to edit from the front-end (and so never actually log in to the CP?) In which case you'd probably need to use channel\_form tags and build a front-end editing template separately.
> 3 votes

---
Tags: rte, editor
---


# Question
Title: How can I require two different sets of categories?
I have Multi site manager running a few sites, and I use categories to set which site to show each entry on as well as topics.

ie categories: site (1), site (2), all (3), games (4), movies (5)

On the site templates, I use

To call all games for site 1 I use category="1&4"

all games for site 2 I use category="2&4"

But how can I show "all games in category site 1 OR category all"

this doesn't work, but makes the point:

{exp:channel:entries category="1&4 OR 3&4"}

Any ideas?

Thx!

# Answer
> 3 votes
Unfortunately, you can't do this using the default `exp:channel:entries`. You gonna have to use `JOIN`s in the query module. Or Dandy Cat.

---
Tags: categories
---


# Question
Title: Removing index file from template group?
I am having an issue where if users try to access a page that doesn't exist within a template group, it displays a blank page instead of the 404. I believe this is due to the fact that the template groups have an index file in them that has no code. I would like to have a 404 page appear any time someone accesses a URL that doesn't exist within my site but I believe I have to remove the index files from my template groups for this to happen.

Does anyone know how I can accomplish this or a different solution to getting my 404 page to display instead of the blank white page?

# Answer
You can't delete index templates, so you'll have to include `{redirect='404'}` on those templates to force them to 404.
> 5 votes

# Answer
Check out the EE docs on 404 pages, to get a understanding on how they work and how to set it up. Also I would remove the index files, that is just personal preference for me. You can do this by going into the Template Manager(Design -\> Templates -\> Template Manager). And delete each index file you don't want.
> 0 votes

---
Tags: templates, 404
---


# Question
Title: Expresso Store - Total sales in template
I am running a ticket sales setup with store for an online event and would like to display the total number of products sold via a template to feed a live display of total tickets sold, is there any way for me to display the total number of products sold?

Currently I could display ALL products sold and not just a set of products, but in the future dates spans as well as specific products would be nice to define.

# Answer
> 1 votes
If you just want the total number of a certain product sold, you can do that using EE's built in query module and a bit of SQL:

```
select sum(item_qty) as qty_sold
from exp_store_order_items
join exp_store_orders on exp_store_order_items.order_id = exp_store_orders.id
where order_completed_date > 0
  and entry_id = 123

```

**Note:** if you are using Store 1.6 you will need to replace `exp_store_orders.id` above with `exp_store_orders.order_id`.

---
Tags: expresso-store
---


# Question
Title: Expresso Store: Creating orders on behalf of other members
My client needs to be able to invoice customers, have them pay online, and then see payment history. I was planning on having the client enter an unpaid order and assign it to the right member. Then the member could login in, see unpaid orders, and pay them. I'm not very familiar with store. Do you see any major problems with this approach? Is this even doable out of the box? Thanks.

# Answer
> 1 votes
That would be possible with Store, there are a couple of ways to achieve it.

The easiest way is if your client just logs in as the member in question to place the order. This would be possible using EE's "login as member" function in the control panel.

The other approach would be if they create the order under their own account, then assign the order to the other member. Store doesn't have the ability to create new orders from within the control panel, but this would be easy for them to do on the front end of your website. You can use the "Manual" payment gateway to allow the order to be completed without payment. Then, to assign the order to the new member you would just need to write a simple plugin/extension which changes the `member_id` in the `exp_store_orders` database table to the correct customer.

Finally, you can allow the customer to log in and view their orders, then use the payment tag to let them pay for the existing order.

---
Tags: expresso-store
---


# Question
Title: Change Product Price based on Membership?
I am using Exp:resso Store 1.6.4. We developed stuff so that when a user purchases a product they will, as Zoo Visitor members, acquire the categories associated with that product. We now want to apply a discount to a product provided they have a certain category. Right now I'm looking for the simplest way to do this that remains secure, i.e. the user cannot change anything around.

Currently our purchase process is a price/description page with a register button (this is the Product Tag/form with a specified entry\_id and empty\_cart (is there any way to lock empty\_cart, i.e. prevent it from being changed?)). Clicking the register button takes them to the checkout page which shows their member registration (if a guest) details, billing details, order details, and payment method.

If I create a product modifier that affects the price, anyone can add that modifier to the Product Tag's form. If I create another product anyone can change the hidden input's entry id to that of the new product. How can we securely lock down a price? Is there a way to, e.g. enable/use Sale Price while it's not enabled?

actually while writing this I realized at least for now I can attempt to check the details on the membership details on the Checkout page for this one specific product... but that's not really going to be feasible down the line.

Anyone have ideas for a quick fix? Don't have time to build add-ons for this kind of feature at the moment (and won't have time probably up until next year). But if you have an idea how to take that route I'm all ears, too.

# Answer
Your question is a little hard to follow, but if I've understood it right, you want to discount products based on the Zoo Visitor entry category of the member purchasing them?

I can't think of any easy way to do this which would be secure from request tampering, without writing an extension. It would be fairly trivial to write an extension though which used the store\_order\_item\_recalculate\_end hook (called store\_cart\_item\_update\_end in Store 1.6) and change the price based on the current member's details.

Another approach which might work is that Store 2.0 has native support for discounting products based on the currently logged in member's group. It won't work with Zoo Visitor member categories, but if you have the ability to change the main EE group of the member then this could be useful.
> 1 votes

---
Tags: expresso-store
---


title: displaying content by screen_name

text:
# Question
Title: displaying content by screen_name
We have a system of creating a client entry when someone registers for our site. We can add more information to the client entry from the Content \> Edit forms. The problem I am having is limiting channel entry results by screen name. The title of every client entry is screen\_name, but I am not able to narrow entry data by screen\_name.

We also have Matrix fields so organizing those is difficult. Below is an example of the code I have been working with:

```
 {exp:channel:entries channel="clients" member_="CURRENT_USER"}
                                {client_project}<tr>
                                        <td>{title}</td>
                                        <td>{entry_date format="%m/%d/%y"}</td>
                                        <td><a href="/client/client_project/{entry_id}" class="view">View</a></td>
                                </tr>{/client_project}
                            {/exp:channel:entries}

```

This code produces no resutls. Also:

```
 {exp:channel:entries channel="clients" orderby="logged_in_screen_name" limit="1"}
                                {client_project}<tr>
                                        <td>{title}</td>
                                        <td>{entry_date format="%m/%d/%y"}</td>
                                        <td><a href="/client/client_project/{entry_id}" class="view">View</a></td>
                                </tr>{/client_project}
                            {/exp:channel:entries}

```

This returns a result, but not the correct one.

Thanks!

# Answer
The code examples you posted will never work.

First, member\_="" is not a **parameter** accepted by the exp:channel:entries tag.

Second, "logged\_in\_screen\_name" is not a value accepted be the **orderby=""** parameter.

The **EE docs** detail all the usable parameters.

---

This will work:

```
{exp:channel:entries channel="clients" author_id="CURRENT_USER"}

```

This method requires that the author of the entry be set to the member who should have access to edit the entry. So when you create the entry, set them as the author.

In order to show a list of members in the author list you'll need to enable this setting for the specific member group: **Include Members in PUBLISH page multi-author list?**

After enabling the setting, go to your edit form in the CP and you will see the Author list. If you don't see the author list, you may need to edit your Publish Layout to make it visible.
> 1 votes

# Answer
I did something which sounds fairly similar on an ExpressionEngine 1.x site a few years ago. The route that worked the best was to have the member as the author of that entry and then use the author\_id parameter to only grab content authored by that entry.

The scope of that project was to display member created content (profile, examples of their work, etc) and so it might not apply in your case.
> 1 votes

# Answer
If you don't want to limit by author\_id (because that isn't the same as screen\_name), I would try a solution that uses the search parameter: http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#search-field-name

You might have to do something like this:

Have the template URL something like this: http://example.com/group/template/screen\_name

then in the channel entries tag add the parameter like this: `search:title="{segment_3}"`

I would make a new channel field for your entries that records screen\_name and make the titles unique.
> 1 votes

---
Tags: member-management
---


# Question
Title: Getting 500 error when trying to convert textile field to Wygwam field
I am trying to convert a field type from a textarea with textile formatting to use Wygwam. I am getting a long hang time and then a 500 server error. The amount of articles using this field is over 1200, but if I change the field to wygwam without converting the textile the formatting is all messed up. Any help is appreciated, thanks!

# Answer
> 1 votes
Check your php and apache logs. Sounds like the change is running out of resources... either memory, CPU or time? Increasing the problem resource/setting should help.

---
Tags: wygwam
---


# Question
Title: Non-existant subdirectory URLs display a blank white page instead of redirecting to homepage
Currently, I have Strict URLs disabled in my global preferences so that if somebody tries to access a page that doesn't exist, it will just bring them to the homepage. However, this only works on pages that are in the root of the folder structure. For instance if I go to http://mysite.com/nonexistant it will reroute me to the homepage as it should, but if I go to http://mysite.com/about/nonexistant it presents a blank white page.

I tried enabling Strict URLs and specifying a 404 page(because this will be what I do eventually) and the same issue occurred. http://mysite.com/nonexistant shows me my 404 page, but http://mysite.com/about/nonexistant displays a blank white page.

Any ideas on how to fix this?

Thanks in advance!

# Answer
`http://mysite.com/about/non-existent` will load the `http://mysite.com/about` template.

This is because EE looks at that second segment automatically for a number of things... if there isn't a template name there it will try to load an entry with that url\_title into the /about template.

To stop this behavior, add this into the /about template:

```
{if segment_2 != ""}
    {redirect="404"}
{/if}

```
> 2 votes

---
Tags: url, 404
---


# Question
Title: How do I create a select on a frontend template from custom member data?
So, in a member profile, I have created a custom field for company\_state as a select and its populated with the US States. I cannot for the life of me figure out how to render out a select with those options for selection in a frontend form (I am using Solspace User's user:edit if it matters.)

Anybody know how to do this? Would be much appreciated.

# Answer
> 1 votes
```
{exp:user:edit}
     <select name="company_state">
            {select_company_state}
                <option value="{value}" {selected}>{value}</option>
            {/select_company_state}
      </select>
     <p><input type="submit" value="Submit" /></p>
{/exp:user:edit}

```

> This variable pair is a flexible method for creating pull-down menus, radio button arrays, etc. In the variable pair, you precede the short\_name of the member field with select\_. Providing your member field is a Select field with multiple values, it will automatically generate those values for you. Within this variable pair, the following variables become available:
>
> **value** \- the values stored as options for the member field.
> **selected** \- parses to selected="selected" if the option is the current value for the users' profile.
> **option\_index** \- behaves like a count variable and displays the display order of each value.

**http://www.solspace.com/docs/user/edit/#select\_custom\_member\_field**

---
Tags: members, forms, solspace-user
---


title: Dynamically pull news articles by year?

text:
# Question
Title: Dynamically pull news articles by year?
I have a news section which is functioning like a blog. Currently in the navigation I am statically listing the years for which content was published. I would like to change this so that ExpressionEngine will automatically generate links to different years only if there are articles that were published that year.

Here is the code I am currently using:

```
<div class="content-tile">
  <div class="grid_4_desktop grid_4_tablet grid_1_mobile" id="archive-menu">
    <h2 class="title">News</h2>
    <ul>
      <li><a href='{path=news/article/?latest=true}'   <?php if(isset($_GET['latest'])){echo 'class="active"';};?> >Latest Post</a></li>
      <li><a <?php if($year == '2013'){echo 'class="active"';}; ?> href="{path=news/?year=2013}">2013</a></li>
      <li><a <?php if($year == '2012'){echo 'class="active"';}; ?> href="{path=news/?year=2012}">2012</a></li>
      <li><a <?php if($year == '2011'){echo 'class="active"';}; ?> href="{path=news/?year=2011}">2011</a></li>
    </ul>
  </div>

```

Can anyone tell me how I would change this code so that the years are automatically populated based on when articles were published?

Thanks in advance!

# Answer
Have you taken a look at the Yearlist Add-on?

Then I would think it should be possible to do something like this:

```
<div class="content-tile">
<div class="grid_4_desktop grid_4_tablet grid_1_mobile" id="archive-menu">
    <h2 class="title">News</h2>
    <ul>
      {exp:yearlist channel="yourchannel" category="1"}
          <li><a href="{path=news/?year={years}}">{years}</a></li>
      {/exp:yearlist}
    </ul>
</div>

```
> 3 votes

# Answer
Get yourself Zoo Triggers and you will love yourself!

```
{exp:zoo_triggers:archive channel="news" status="open" show_counter="no" type="year"}

```

Just make sure you give the settings docs a once over to get it set up like you want.
> 2 votes

---
Tags: navigation, dynamic
---


# Question
Title: Status parameter in native EE Relationship field
I have a test tag where it's pulling data from a Native Relationship here:

http://staging.sewcratic.com/export/test

Here's the code under the "Data" header:

```
{exp:channel:entries channel="patterns" limit="1" status="Open|Closed"}
    <p>{title}<p>
    <p>designer_label: {designer_label}{designer_label:entry_id}{/designer_label}</p>
    <p>design_label2: {design_label2 status="Open|Closed|Draft|Edited|Proofread"}{design_label2:title}{/design_label2}</p>
    <p>pattern_groups2: {pattern_groups2 backspace="1"}{pattern_groups2:entry_id},{/pattern_groups2}</p>
    <p>pattern_company2: {pattern_company2}{pattern_company2:entry_id}{/pattern_company2}</p>
{/exp:channel:entries}

```

The fields {designer\_label} and {pattern\_groups2} are pulling, while {design\_label2} does not. I've added all statuses to the {design\_label2} tag, but does not seem to be working. Am I missing something?

# Answer
> 5 votes
Have you tried labeling the statuses without the initial caps? I believe the default categories are open and closed not Open and Closed, is it possible that that is causing the issue for you? Additionally if you are trying to show all entries except a certain one consider using not. For example I have a status like `status="not closed|open|under_development"` in one of my relationship tags.

If you are trying to explicitly tell it to display all entries regardless of status, you can try `status="not nonexistant"` where nonexistant would be a status that has not been created so no entry will have it.

# Answer
> 0 votes
Case sensitivity apparently is (well, *can be*) different between the parameters for channel entries and those for relationship fields. It's not a black-and-white difference, though, and is to do with one being governed by MySQL and the other being governed by PHP. See https://support.ellislab.com/bugs/detail/19913 for more info.

---
Tags: relationships
---


# Question
Title: Solspace User password reset not working
The link that gets email when someone forgets their password does not work. YOu get a page not found error.

EE 2.7.1 and User 3.4.5

User is up to date so not sure why this is not working. Anyone out there running in to the same issues?

# Answer
> 1 votes
solved. the member profile theme was incorrectly set

# Answer
> 0 votes
Starting with EE 2.6, the reset password routine works differently compared to pre-2.6 version. Instead of being sent a password reset link after filling out a "**forgot password**" form, followed by an automatically generated new password by email, users receive a link by email to visit a page on EE with a "**password reset**" form to reset their password themselves.

As of this writing, User doesn't have a "password reset" form available, and is therefore not involved after submitting the "forgot password" form. In consequence, the password reset notification email is generated by native EE, and the link's URL points to a native EE member template.

If you have issues with the emailed URL, this would an EE issue to resolve. Check your EE settings, .htaccess file, and member trigger word (member preferences), as potential places places for EE not being able to read its own member templates.

---
Tags: solspace, solspace-user, forgot-password
---


# Question
Title: Enable "Login as Member" for Additional Member Groups
I'm trying to enable the "Login as Member" functionality for a non-Super Admin member group. Here's what I've done so far:

In `/system/expressionengine/controllers/cp/members.php`, line 534, I changed to:

```
if ($this->session->userdata('group_id') != 1 || $this->session->userdata('group_id') != 6)
        {
            show_error(lang('unauthorized_access'));
        }

```

In `/system/expressionengine/controllers/cp/members.php`, line 594, I changed to:

```
if ($this->session->userdata['group_id'] != 1 || $this->session->userdata['group_id'] != 6)
        {
            show_error(lang('unauthorized_access'));
        }

```

And in `/system/expressionengine/controllers/cp/myaccount.php`, line 167, I changed to:

```
if( ($this->session->userdata('group_id') == 1 || $this->session->userdata('group_id') == 6) && $this->id != $this->session->userdata('member_id') )
            {
                $vars['login_as_member'] = TRUE;
            } else {
                $vars['login_as_member'] = FALSE;
            }

```

However, after doing this, when I click the "Login as Member" link while logged in to either member group, I get this error:

> You are not authorized to access this page

Any suggestions on what else I can do to get this working?

EE 2.6.1

P.S. Yes, I'm documenting this! :)

# Answer
it is happend because of logic error in lines 534 & 594 - you need replace it to AND logic not OR

```
        if ($this->session->userdata('group_id') != 1 && $this->session->userdata('group_id') != 6)
        {
            show_error(lang('unauthorized_access'));
        }

```
> 5 votes

---
Tags: core-hacks
---


# Question
Title: Add on development. Database class not executing correct queries
i'm developing an addon. While developing i'm encountering a strange problem that I don't know how to solve. It's like EE is executing the wrong queries or something.

For example, when I call this function:

```
$channel_info = ee()->api_channel_structure->get_channel_info(2);

```

The result is completely off:

```
echo '<pre>';
echo 'CHANNEL INFO:';
print_r($channel_info->result());
echo '</pre>';

```

Giving me this information:

```
CHANNEL INFO:Array
(
    [0] => stdClass Object
        (
            [child_id] => 11
            [order] => 3
        )

    [1] => stdClass Object
        (
            [child_id] => 4
            [order] => 2
        )

    [2] => stdClass Object
        (
            [child_id] => 2
            [order] => 1
        )

    [3] => stdClass Object
        (
            [child_id] => 10
            [order] => 4
        )

)

```

This is a result from a former executed query like this:

```
$result = ee()->db->query($sql);
$this->_result_array = $result->result_array();

```

Do I need to clear the db class or something? I'm not sure what's causing this. Hopefully someone can give me a push in the right direction here? :)

EDIT: Ok, I have solved the problem by adding this line:

```
ee()->db->_reset_select();

```

Before calling:

```
$channel_info = ee()->api_channel_structure->get_channel_info(2);

```

Still, I'm not sure why I have to call this manually...

# Answer
> 3 votes
If you are in an extension, it's possible that the db class is in the midst of a query. I'll show an example. Let's say this was the core EE code:

```
ee()->db->select('some_column');

ee()->db->where('some_column', 1);

// your code gets called here, while the active record methods have already been invoked
ee()->extensions->call('some_hook');

$query = ee()->db->get('some_table');

```

I don't remember which hooks fall into this pattern, but I know I've been bitten by it once or twice. If you find yourself in a scenario like this, here is the solution. Make a copy of the db like this (gist):

```
$db = ee()->load->database(array(
  'dbdriver' => 'mysql',
  'conn_id' => ee()->db->conn_id,
  'database' => ee()->db->database,
  'dbprefix' => ee()->db->dbprefix,
), TRUE);

```

and make all your db calls using `$db` instead of `ee()->db`;

I might also add that the way you've solved it by doing `ee()->db->_reset_select()` could interfere with the original query and have unintended consequences. With this method you won't run any chance of interfering with other queries.

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


# Question
Title: How to control which links are automatically turned into links
I'm working on a site that has a template which shows a range of information.

Firstly the page shows a few paragraphs of text. These often contain email addresses within the text, meaning I'd like to have 'Automatically turn URL's into links' turned on.

Secondly, the page shows some contact information, including an email address, which I'd like to display as 'Email Address: Click here' rather than 'Email Address: Someone@abc.com' due to space restrictions. In this case, if I turn on 'Automatically turn URL's into links' I get a lot of strange code output on the front-end.

I'm trying to avoid splitting this information between two different channels, as it makes sense for the customer to be able to enter or edit both peices of content from the same screen.

Does anyone know a way to enable automatic links for the channel but stop the issue with the 'Email Address: Click here'?

# Answer
> 2 votes
Wrap the email address tag with the **No Formatting** plugin tags.

```
{exp:no_formatting}
    {email}
{/exp:no_formatting}

```

---
Tags: email, url, links
---


# Question
Title: Using Channel Images version 5.4.10 on Exp Eng 2.7 we have we lost all image sizes
We just moved to a new server and upgraded Exp Eng to version 2.7. I also installed version 5.4.10a of Channel Images on the server. Now when I go to the channel fields setup all of the previously defined image sizes are gone. Saving/updating the custom field deletes them entirely. Also, clicking on the Add new size button does nothing. Something appears broken somewhere. Also, when I click the test file upload location it gives me an error about Cloud settings. We aren't using a cloud service, the files are on the localhost. Any ideas/suggestions?

# Answer
> 1 votes
Apparently this had to do with moving from Exp Eng 2.5 to version 2.7. In the upgrade documentation they now recommend that you replace entirely the system folder by moving your current system folder to system\_old. My guess is that there was some old code in the system directory that was causing this problem.

The solution was to start with a fresh system folder directly from the 2.7 install files. Having already done the upgrade I replaced the files, re-uploaded all of my custom files (config and database), and my third party add-ons. Everything worked correctly after that.

---
Tags: channel-images
---


# Question
Title: Allow Access to Members-Only Content for Visitors Coming from Specific Referrers?
One of my clients, a membership-based education resources site, has asked if there is a way to allow non-members to see members-only content but only when following a link shared on Facebook or on Pinterest and, possibly, Twitter.

I know there are ways to reveal a referrer but I'm not sure how reliable those are? Or even if JS or PHP is the best or even the only way to handle this feature?

Any known / tested alternatives to doing this sort of thing?

# Answer
Preventing link sharing is dificult and indeed referrer is not 100% secure too.

You could include some code in the url that is posted to these websites. On the landing page for that url, you could fetch the code from the segment and get the entry with that code and serve the content without checking for membership.
> 2 votes

---
Tags: members, social
---


title: Error with addons_model being loaded

text:
# Question
Title: Error with addons_model being loaded
I have found that when using the sample templates that come with the Exp-resso Store and Zoo Visitor add-ons on EE 2.7.2, I get the following PHP error:

> A PHP Error was encountered
>
> Severity: Notice
>
> Message: Undefined property: EE::$typography
>
> Filename: core/EE\_Output.php
>
> Line Number: 308
>
> Fatal error: Call to a member function parse\_type() on a non-object in \[MYPATH\_SYSTEM\_PATH\]/expressionengine/core/EE\_Output.php on line 308

Commenting out line 308 of *that* file:

```
$data['content'] = $EE->typography->parse_type(stripslashes($data['content']), array('text_format' => 'xhtml'));

```

Then produces a handled error:

> The model name you are loading is the name of a resource that is already being used: addons\_model

The error is thrown from CodeIgniter's Loader on line 194:

```
if (isset($CI->$name))
{
    show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
}

```

Commenting *that* line out makes everything run fine.

I've searched for uses of addons\_model and the only reference I can see to it are either in third party addons (neither of which are enabled and neither of which are Store or Visitor), or EE's core. Obviously I don't want to be hacking at the core of EE or CI but this seems like an EE bug to me.

Has anybody else seen this problem or have a resolution?

# Answer
> 1 votes
After some help from @Adrian Macneil, I tried installing Store and ZV again. No luck, so with Store installed, started removing all OTHER add-ons and tracked it down to version 1.0.6 of LibrarEE. An update to 1.0.7 sorted it.

---
Tags: expresso-store, zoo-visitor
---


# Question
Title: Expresso Store 2 not mapping Zoo Visitor fields on checkout
I'm running Expresso Store 2.0.6, Zoo Visitor 1.3.30, and EE 2.7.2, and having an issue with Expresso Store checkout not displaying the Zoo Visitor details of the logged in user.

I've mapped all Zoo Visitor fields in Expresso Store \> Settings \> Order Fields, but when a logged in user goes to the Checkout, their details are not being shown in the fields. I'm just using the built in {field:xxx) tag (ie {field:shipping\_address1} ) to show the field.

If I map these fields to the Member fields, then they DO show up. The issue with this is that Zoo Visitor doesn't save back to the normal Member custom fields (either in the CP or using the update Front-End tags) ... so I can't use them either.

Anyone else replicate this issue?

Cheers.

# Answer
> 2 votes
Visitor channel fields can be mapped to native EE member fields when you prefix them with "member\_" and the field\_name has to match http://ee-zoo.com/docs/visitor/tutorial/working-with-native-member-fields.html

# Answer
> 2 votes
I have answered this question asked previously

> I have recently completed a build using Store 2 and Zoo Visitor, I ran into this issue but came up with a working solution.

```
{exp:store:checkout
    next="cart/review"
    register_member="yes"
    disable_javascript="yes"
    require="name|order_email|address1|city|state|postcode|country"
    error_handling="inline" error_delimiters='<div>|</div>' }
    {if no_items}{redirect="cart"}{/if}

    {!-- Avoid issues with parse order --}
    {exp:ifelse parse="inward"}
        {if logged_in}
            {exp:zoo_visitor:details {global:disable_categories}}
        {/if}
    {/exp:ifelse}

    <h2>Billing Information</h2>

    <label for="billing_first_name">First Name</label>
    <input type="text" name="billing_first_name" value="{if billing_first_name}{billing_first_name}{if:elseif
logged_in}{visitor:member_first_name}{/if}">
    {error:billing_first_name}

    <label for="billing_last_name">Last Name</label>
    <input type="text" name="billing_last_name" value="{if billing_last_name}{billing_last_name}{if:elseif
logged_in}{visitor:member_last_name}{/if}">
    {error:billing_last_name}

    <label for="billing_address1">Street address</label>
    <input type="text" name="billing_address1" value="{if billing_address1}{billing_address1}{if:elseif
logged_in}{visitor:billing_address}{/if}">
    {error:billing_address1}

    <label for="billing_city">Suburb</label>
    <input type="text" name="billing_city" value="{if billing_city}{billing_city}{if:elseif
logged_in}{visitor:billing_city}{/if}">
    {error:billing_city}

    <label for="billing_state">State</label>
    <select name="billing_state">
        <option value="ACT" {if (billing_state AND billing_state == "ACT") OR visitor:billing_state == "ACT"}selected{/if}>Australian
Capital Territory</option>
        <option value="NSW" {if (billing_state AND billing_state == "NSW") OR visitor:billing_state == "NSW"}selected{/if}>New South
Wales</option>
        <option value="NT"  {if (billing_state AND billing_state == "NT" ) OR visitor:billing_state == "NT" }selected{/if}>Northern
Territory</option>
        <option value="QLD" {if (billing_state AND billing_state == "QLD") OR visitor:billing_state ==
"QLD"}selected{/if}>Queensland</option>
        <option value="SA"  {if (billing_state AND billing_state == "SA" ) OR visitor:billing_state == "SA" }selected{/if}>South
Australia</option>
        <option value="VIC" {if (billing_state AND billing_state == "VIC") OR visitor:billing_state ==
"VIC"}selected{/if}>Victoria</option>
        <option value="WA"  {if (billing_state AND billing_state == "WA" ) OR visitor:billing_state == "WA" }selected{/if}>Western
Australia</option>
    </select>
    {error:billing_state}

    <label for="billing_postcode">Postcode</label>
    <input type="text" name="billing_postcode" value="{if billing_postcode}{billing_postcode}{if:elseif
logged_in}{visitor:billing_postcode}{/if}">
    {error:billing_postcode}

    <input type="hidden" name="billing_country" value="AU">

    <label for="billing_phone">Contact Number</label>
    <input type="tel" name="billing_phone" value="{if billing_phone}{billing_phone}{if:elseif
logged_in}{visitor:billing_phone}{/if}">
    {error:billing_phone}

    {if logged_out}
        <label for="order_email">Email Address</label>
        <input type="email" name="order_email" value="{order_email}">
        {error:order_email}
    {/if}

    {!-- Avoid issues with parse order --}
    {exp:ifelse parse="inward"}
        {if logged_in}
            {/exp:zoo_visitor:details}
        {/if}
    {/exp:ifelse}

{/exp:store:checkout}
```

> Presentation HTML and Shipping Details removed for brevity.

---
Tags: expresso-store, zoo-visitor
---


title: fieldtype development advice

text:
# Question
Title: fieldtype development advice
I began building a channel field form to enter all the data (as seen in the attached image), the form seems cumbersome and lengthy.

Now I am thinking about creating my own fieldtype, so I have more control over the layout. It will basically be its own form since it will contain so many fields within it.

There will be other fields in this channel field group.

Do you see any shortcomings to building a fieldtype that is essentially a form within itself?

# Answer
> 3 votes
I built a fieldtype that may do what you want without your having to build one from scratch; it's called ALT Multifield. http://devot-ee.com/add-ons/alt-multifield You can create a custom block of inputs and it all gets stored in one column. Hit me up if you have questions.

(I've actually got some significant improvements coming to it soon, but I can't guarantee a timeframe.)

---
Tags: fieldtype
---


title: EE1 & SL Google Map

text:
# Question
Title: EE1 & SL Google Map
I've an EE1 site (I know, just..quiet) running SL Google Maps to geolocate posts. It just started not responding from the CP side of things and I suspect that it's related to Google discontinuing support for an older API.

Any options here besides upgrading it all to EE2? I just wasn't quite ready for that task yet.

# Answer
> 2 votes
Change Api2 to Api3 is almost the same as create new ft. From all exist geo add-ons for EE 1, you can try Geotagger (possible you need to speak with Mightybigrobot). I don't have last version, but I believe that they was able to which to API3.

If they have this version, you just will needed to split data from current SL Google Maps to Geotagger fields (they have separate field for lat & long). Something like

```
UPDATE exp_weblog_data SET you_new_field_lat =  SUBSTRING_INDEX(you_old_field,',', 1), you_new_field_lng =  SUBSTRING_INDEX(you_old_field,',', 2)

```

Plus you will need to make small change in frontend using any of exist gmaps jquery plugins.

# Answer
> 1 votes
There was another addon (free) called CoolLocation that worked for EE1 along these lines. http://devot-ee.com/add-ons/coollocation

I suspect you'll have the same issues with the changes to the Google API, but it might be worth a shot. I'm not sure you can find it online anymore -but holler if you need a copy - I've got one.

If you've already got all your coords and aren't creating new entries, you can also roll your own new map using Mabox/Leaflet.

---
Tags: google-maps-for-ee
---


# Question
Title: Passing entry_id to json to get Playa children
I need to be able to do pass the entry\_id of the page being viewed into a json file to build a query.

I currently have a page setup that has a Playa field. I need to have a JSON file that will get the IDs of all of the Playa children so that I can pass those values to a map on the same page.

In the page, I have the following;

```
{exp:stash:set_list name="trail" parse_tags="yes" parse_depth="3"}
    {exp:channel:entries channel="{channel}" status="open" limit="1" require_entry="yes"}

        {stash:trail_title}{title}{/stash:trail_title}

    {/exp:channel:entries}
{/exp:stash:set_list}

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

    <h2>About the {trail_title}</h2>

{/exp:stash:get_list}

<div class="mapwithborders">
    <div class="listing_map" data-api-url="trail-json"></div>
</div>

```

My 'trail-json.js' template has the following (but as you can see there is a hardcoded parent\_entry\_id;

```
{exp:query sql="SELECT child_entry_id AS entry_ids FROM exp_playa_relationships WHERE parent_entry_id = 2422"}
[
{exp:playa:children
    entry_id="{entry_ids}"
    field="trail_spots"
    channel="things-to-do"
    status="Open"
    backspace="1"
}
    {
        "entry_id": "{entry_id}",
        "title": "{title}",
        "latitude": "{thingtodo_latitude}",
        "longitude": "{thingtodo_longitude}"
    },{/exp:playa:children}
]
{/exp:query}

```

I would be grateful if someone could point me in the right direction to replace the hard-coded parent\_entry\_id.

Thank you.

# Answer
One easy way to solve this is to just use a segment variable. You can use segment\_2 to hold whatever value you want to use for your query. So assuming you wanted to find data for the parent entry #2422, you'd load your JSON template with a URL of `/trail-json/2422`.

In your page template where you're setting the URL for your JSON you'd do:

```
<div class="listing_map" data-api-url="trail-json/2422"></div>

```

(Replace "2422" with a variable as appropriate, if I understand your setup it would be `{entry_id}`).

Then in your trail-json.js template where have have hard-coded the parent\_entry\_id in your query you would instead do:

```
WHERE parent_entry_id = {segment_2}

```

**Important note:** the Query module isn't safe to use with segment variables. So you should switch to using the Active Record plugin instead of the Query module if you decide to use this approach.
> 1 votes

---
Tags: playa, query
---


title: Managing Category URLs

text:
# Question
Title: Managing Category URLs
I am developing a site where I need to manage the URLs like:

http://www.site.com/CATEGORY-URL-TITLE : To show the the entries of that category in segment 1

http://www.site.com/CATEGORY-URL-TITLE/ENTRY-URL-TITLE : To show the individual entry of category in segment 1.

http://www.site.com/MEMBER-USERNAME : To show all the entries of authored by member in segment 1.

http://www.site.com/MEMBER-USERNAME/ENTRY-URL-TITLE : Individual entry of that member.

Could you please anyone give me some guideline how can I manage the URL structure like that. Please let me know if there is any third party addon which can do it.

# **Updated:**

Actually, I wouldn't like to make any changes into home template for having so many conditions for checking categories or username. So looking for some technique if another template (not home template) can be rendered for such type of URLs. I think, it would be possible with sessions\_start hook but still couldn't find how to route or render a template for such type of URLs.

For example, for URI like /member\_username/xyz would route/render the template template\_group/template\_name. As with the hook sessions\_start, I would be able to check if first segment is any member's username.

I hope, it would give some more idea to share your solutions.

Thanks,

# Answer
To answer the first two questions, you'll want to use something like Seg2Cat to get the category id.

So, for http://example.com/planet/earth/, something like this will work:

```
{exp:channel:entries channel="content" category="{segment_1_category_id}" url_title="{segment_2}"}
   {title}
{/exp:channel:entries}

```

You might want to wrap it in an {if segment\_3 == ""}{/if} conditional, that way it will only run when you want to show an individual entry.

You can find more about {exp:channel:entries} and categories and pulling content by author in the EE documentation.
> 2 votes

# Answer
First, let me say that I don't think it's a good idea to use the `segment_1` to both `username` and `category_url_title`. What if both matches? If you want to keep the `URL` short, you can use a single character segment, like `c` or `m` for one of the cases.

I would show you how to do this using switchee and the homepage template, but you said, in your update, that you don't want to use this template.

So, my suggestion, is to map this conditions to the Template Routes add-on, by Rob Sanchez. Unfortunately, `username` isn't one of its wildcards.
> 1 votes

# Answer
Bear with me, I formulated this for a recent install, it might be overkill.

First up, grab a pipe delimited stash of all your categories

```
{exp:stash:set name="master_cat_list" parse_tags="yes"}
{exp:gwcode_categories backspace="1"}{cat_url_title}|{/exp:gwcode_categories}
{/exp:stash:get_list}

```

In you template, test the segments

```
 {exp:stash:parse parse_vars="yes"}
 {exp:switchee variable="{segment_2}" parse="inward"}
  {case value=""}
  // Nothing in segment 2
  // SO... test against stashed master list, to ensure valid cat_url
  {switchee variable="{segment_1}"}
    {case value="{stash:master_cat_list}"}
      {snippet:load:exp:channel:data}
    {/case}
    {case default="yes"}
      {redirect="404"}
    {/case}
  {/switchee}
  {/case}

  {case default="yes"}
  // Something in segment 2, spit out default
  {exp:channel:entries...}
  ...
  // Use {if no_results} to ensure segment_2 is valid entry
  {/exp:channel:entries}
  {/case}
  {case value=""}
  {/case}
{/exp:switchee}
{/exp:stash:parse}

```

That's it in a nutshell. It's not code perfect but may be of assistance.
> 0 votes

# Answer
Not easy but Switchee to the resque (and low seg2cat):
Basic idea:

```
{exp:switchee variable="{segment_1}/{segment_2}" parse="inward"}
  {case value="/|#P(\d+)/$#"}
    // index: empty or paginated list
  {/case}
  {case default="yes"}
    // other
  {/case}
{/exp:switchee}

```

See this older thread:
http://devot-ee.com/add-ons/support/switchee/viewthread/2919
> 0 votes

# Answer
I see you want specific URLs but here's something close.

for the first add http://www.site.com/CATEGORY-URL-TITLE/cat\_archive/

for the third add http://www.site.com/CATEGORY-URL-TITLE/author\_archive/

```
{if segment_2 == "cat_archive"}
{exp:channel:entries channel="..." category="{segment_1}"}

category results ...

{/exp:channel:entries}
{if:elseif segment_2 == "author_archive"}
{exp:channel:entries channel="..." author_id="{segment_1}"}

author results ...

{/exp:channel:entries}
{if:else}
{exp:channel:entries channel="..." url_title="{segment_2}"}

specific entry ...

{/exp:channel:entries}
{/if}

```

Other than that you might have to use some `embeds` and `no_results` tags.

**EDIT:**

Then you could do something like this where the embeds get your the results you want. It you have an author with the same id as a category name, the author template would come up:

```
{if segment_2}
  {exp:channel:entries channel="..." url_title="{segment_2}"}
    code for single article.
  {/exp:channel:entries}

{if:else}
  {exp:channel:entries channel="..." author_id="{segment_1}" limit="1"}
    {embed="group/author_results" author="{segment_1}"}

    {if no_results}
      {embed="group/category_results" cat="{segment_1}" limit="1"}
    {/if}
  {/exp:channel:entries}
{/if}

```
> -1 votes

---
Tags: url
---


title: Create a product-specific promo code

text:
# Question
Title: Create a product-specific promo code
Is it possible (likely through an extension) to create a promo code that only applies to a specific product? We would like to give a discount on a single product, but the discount, if applied to the entire cart, could render some items in the store completely free.

Has anyone done anything like this? If so, can you give us a sense of the logic/approach for the extension?

Thanks!

Greg

# Answer
Yes, this is possible in Store 2. You can create discounts with promo codes, which only apply to individual products or product categories.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Secure expressionengine file permissions after ssh upload
So I made the mistake of making everything 777 on my local machine. I then zipped everything, uploaded the file via FTP to my server, then used SSH to unzip it. Now everything is 777, which is obviously bad.

I figured I could do something like chmod 644 * -R, then 666 and 777 on the things that needed it. However doing 644 gives me permission denied (755 works, but I assume that is not very safe either, or?)

What should the file permissions of all files (except the 666/777 ones) be? And is there a fast way of setting them?

# Answer
> 3 votes
You can make batch file for this - ee\_permissions.sh

```
#!/bin/bash

# Find location of this script.
# This ensures that only files in the directory in
# which this script exists (recursively) are modified.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Set what the name of your expressionengine folders are.
SYSTEM="system"
IMAGES_DIR="public_html/images"
UPLOADS_DIR="public_html/files"

# Optionally ensure correct ownership on per environment basis.
#if [ "$DIR" = "/path/to/project/" ]; then
#   chown -R http.http "$DIR"
#fi

# Expressionengine specific permissions.
find "$DIR" -type d -print0 | xargs -0 chmod 0755
find "$DIR" -type f -print0 | xargs -0 chmod 0644
find "$DIR/$IMAGES_DIR/" -type d -print0 | xargs -0 chmod -R go+w
find "$DIR/$UPLOADS_DIR/" -type d -print0 | xargs -0 chmod -R go+w
chmod -R go+w "$DIR/templates"
chmod -R go+w "$DIR/$SYSTEM/expressionengine/cache"
chmod 0666 "$DIR/$SYSTEM/expressionengine/config/config.php"
chmod 0666 "$DIR/$SYSTEM/expressionengine/config/database.php"

# Permissions specific to the sitemap generator
# from http://www.xml-sitemaps.com/.
#chmod -R 0777 "$DIR/public_html/generator/data"
#chmod 0666 "$DIR/public_html/sitemap.xml"
#chmod 0666 "$DIR/public_html/ror.xml"

# If laxative is being used, preserve executability
if [ -e "$DIR/.db/lax" ]; then
    chmod 0700 "$DIR/.db/lax"
fi

# Make sure other shell scripts are executable too.
find "$DIR" -type f -name "*.sh" -print0 | xargs -0 chmod 700

```

another example of shell\_script for the same.

---
Tags: permissions
---


title: Using ExpressionEngine with CDN

text:
# Question
Title: Using ExpressionEngine with CDN
As the title says, looking for the best way to integrate a cdn with EE.

I currently have a cdn account with MaxCDN and my solutions was to change the site\_url within the configuration site to my cname address http://cdn.mysite.com.

From there I added a global variable and named it {root\_url} that was my sites original address http://www.mysite.com.

Then just went and changed all menu links and such to use the global variable instead of the {site\_url}.

This does work, however where I'm running into problems is the pagination. The pagination uses the site\_url, which is now the cdn.

How are other people using a cdn with their EE install? Is there a better solution? Although this works, it seems clunky to me. Would really like to get some others advice/perspective.

I've been able to relate previous and next entries as well when viewing a blog post for example using this:

```
<ul class="pager">
  {exp:channel:prev_entry channel="blog"}
  <li class="previous">
    <a href="{root_url}blog/view/{url_title}">← {title}</a></a>
  </li>
  {/exp:channel:prev_entry}
  {exp:channel:next_entry channel="blog"}
  <li class="next">
    <a href="{root_url}blog/view/{url_title}">{title} →</a>
  </li>
  {/exp:channel:next_entry}
</ul>

```

But I've not been able to figure out how to change the pagination links to use the same {root\_url} prefix. It seems you can completely customize the output and look of the pagination but not the links?

# Answer
> 2 votes
So I figured it out by "hacking" the Pagination library in the CodeIgnitor core.

Upside: it works

Downside: need to re-apply hack after EE updates

If someone knows of a better solution I'd love to know!! Especially being as I'm a novice in PHP I don't know if this is the preferred way to accomplish this. With that said, here's what I did to overwrite the pagination URL's when using a CDN address for the {site\_url}

Go to `system > codeignitor > system > libraries > Pagination.php`

Then on lines 242 - 254 (on version 2.4.0 of EE anyway) you would replace this:

```
if ($this->CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
    $this->base_url = rtrim($this->base_url).'&'.$this->query_string_segment.'=';
}
else
{
    $this->base_url = rtrim($this->base_url, '/') .'/';
}

// And here we go...
$link_array = array();

$first_url = ($this->first_url == '') ? $this->base_url : $this->first_url;

```

With this:

```
if ($this->CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
    $this->base_url = str_replace("cdn","www",(rtrim($this->base_url).'&'.$this->query_string_segment.'='));
}
else
{
    $this->base_url = str_replace("cdn","www",(rtrim($this->base_url, '/') .'/'));
}

// And here we go...
$link_array = array();

$first_url = str_replace("cdn","www",(($this->first_url == '') ? $this->base_url : $this->first_url));

```

# Answer
> 1 votes
Have you tried the `paginate_base` parameter? You should be able to override the URL through this.

---
Tags: ee2
---


# Question
Title: Expresso Store 2: not mapping to Zoo Visitors fields on checkout
I'm trying to get this situation working, but I'm not 100% it can actually be done.

I've build a custom checkout process where the customer fills in his shipping info, billing info (if different), chooses a payment method and registers an account or not. All on one single page.

Processing the order goes well - however no entry is added to the Zoo Visitor channel, only a native Member account is created.

**UPDATE 2013.12.16**

I tried a new setup begin this week. Unfortunately Store is still not mapping correctly to Visitor.

**Current setup:**
EE 2.7.3
Store 2.1.0
Visitor 1.3.30

One strange thing in the Store Order Fields setup;
The field-groups to choose the mapping-fields from are not rendered correctly (see attached screenshot). Instead of Zoo Visitor it says "optgroup\_zoo\_fields".
It was a brand new install.

Other insights which could help;

* Do I need to alter the checkout fields in templating?
* Do I also need to create Member Custom Fields for this to work?

I was assuming 'no' to both, maybe that's my faulty approach...

In short;
\- Visitor channel + custom fields are created
\- Order Fields are Mapped to Visitor fields
\- A normal member is created on order-complete / payment
\- No Visitor entry is created

# Answer
I have recently completed a build using Store 2 and Zoo Visitor, I ran into this issue but came up with a working solution.

```
{exp:store:checkout
    next="cart/review"
    register_member="yes"
    disable_javascript="yes"
    require="name|order_email|address1|city|state|postcode|country"
    error_handling="inline" error_delimiters='<div>|</div>'
}
    {if no_items}{redirect="cart"}{/if}

    {!-- Avoid issues with parse order --}
    {exp:ifelse parse="inward"}
        {if logged_in}
            {exp:zoo_visitor:details {global:disable_categories}}
        {/if}
    {/exp:ifelse}

    <h2>Billing Information</h2>

    <label for="billing_first_name">First Name</label>
    <input type="text" name="billing_first_name" value="{if billing_first_name}{billing_first_name}{if:elseif logged_in}{visitor:member_first_name}{/if}">
    {error:billing_first_name}

    <label for="billing_last_name">Last Name</label>
    <input type="text" name="billing_last_name" value="{if billing_last_name}{billing_last_name}{if:elseif logged_in}{visitor:member_last_name}{/if}">
    {error:billing_last_name}

    <label for="billing_address1">Street address</label>
    <input type="text" name="billing_address1" value="{if billing_address1}{billing_address1}{if:elseif logged_in}{visitor:billing_address}{/if}">
    {error:billing_address1}

    <label for="billing_city">Suburb</label>
    <input type="text" name="billing_city" value="{if billing_city}{billing_city}{if:elseif logged_in}{visitor:billing_city}{/if}">
    {error:billing_city}

    <label for="billing_state">State</label>
    <select name="billing_state">
        <option value="ACT" {if (billing_state AND billing_state == "ACT") OR visitor:billing_state == "ACT"}selected{/if}>Australian Capital Territory</option>
        <option value="NSW" {if (billing_state AND billing_state == "NSW") OR visitor:billing_state == "NSW"}selected{/if}>New South Wales</option>
        <option value="NT"  {if (billing_state AND billing_state == "NT" ) OR visitor:billing_state == "NT" }selected{/if}>Northern Territory</option>
        <option value="QLD" {if (billing_state AND billing_state == "QLD") OR visitor:billing_state == "QLD"}selected{/if}>Queensland</option>
        <option value="SA"  {if (billing_state AND billing_state == "SA" ) OR visitor:billing_state == "SA" }selected{/if}>South Australia</option>
        <option value="VIC" {if (billing_state AND billing_state == "VIC") OR visitor:billing_state == "VIC"}selected{/if}>Victoria</option>
        <option value="WA"  {if (billing_state AND billing_state == "WA" ) OR visitor:billing_state == "WA" }selected{/if}>Western Australia</option>
    </select>
    {error:billing_state}

    <label for="billing_postcode">Postcode</label>
    <input type="text" name="billing_postcode" value="{if billing_postcode}{billing_postcode}{if:elseif logged_in}{visitor:billing_postcode}{/if}">
    {error:billing_postcode}

    <input type="hidden" name="billing_country" value="AU">

    <label for="billing_phone">Contact Number</label>
    <input type="tel" name="billing_phone" value="{if billing_phone}{billing_phone}{if:elseif logged_in}{visitor:billing_phone}{/if}">
    {error:billing_phone}

    {if logged_out}
        <label for="order_email">Email Address</label>
        <input type="email" name="order_email" value="{order_email}">
        {error:order_email}
    {/if}

    {!-- Avoid issues with parse order --}
    {exp:ifelse parse="inward"}
        {if logged_in}
            {/exp:zoo_visitor:details}
        {/if}
    {/exp:ifelse}

{/exp:store:checkout}
```

Presentation HTML and Shipping Details removed for brevity.
> 4 votes

# Answer
I have nearly the same setup (Store 2.0.3, EE 2.7.2, Zoo Visitor 1.3.29) — and I'm still unable to get Store's billing info fields to become pre-filled with an already-registered, currently-logged-in member.

For the time being, I'm grabbing that data from ZV, like so:

```
<input type="text" name="billing_last_name" value="{if logged_in}{visitor:global:member_lastname}{/if}" />

```

…instead of using the {field:billing\_last\_name} tag.

It works fine for now, but the problem is that this won't work for select dropdowns, like State or Country. So the first option is selected by default.

I just recently upgraded to Store 2.0.3 from 1.6.4 and it was working fine before, so I'm assuming it's a 2.0.3 issue.
> 3 votes

# Answer
This was a bug in Store, where mapped Zoo Visitor member fields were correctly saved after placing an order, but they were not loaded for new carts.

This has been fixed in Store 2.1.0:

> Fixed mapped Zoo Visitor member fields not being loaded for new orders

https://exp-resso.com/docs/release\_notes.html#store\_210
> 3 votes

---
Tags: expresso-store, zoo-visitor, checkout
---


# Question
Title: Can you associate a member to another member?
For instance:

1. Parent is a member
2. Service provider is a member
3. Parents have multiple service providers.

So hopefully, I'm hoping to do a query that looks similar to:

```
get all service providers from that parent

```

Thanks!

# Answer
> 7 votes
You could use one of the add-ons that connect member registration to channel entries and then use a relationship field to connect a member to other members. (alternatively, you could use a fieldtype a la select member)

Several member add-ons that connect members to channel entries:

---
Tags: members
---


title: Editing an Entry does not update

text:
# Question
Title: Editing an Entry does not update
I'm trying to edit an entry and the page seems to simply refresh, not displaying the usual submitted page that shows made changes etc. I cannot figure out what could be causing this. Hopefully the community will, thanks in advance.

I'm running EE 2.2.2 hopefully I don't have to update

# Answer
> 3 votes
Sometimes this is caused by a validation on one of the other tabs on your publish page. You might not see them if you're on a different tab.

---
Tags: entry, saving
---


# Question
Title: How to let users control ANY and ALL for categories using dynamic parameters?
My site has many entries, each having several categories assigned to them. Using Dynamic Parameters, I'd like to allow users to filter the entries to show only those belonging to certain categories, perhaps by selecting checkboxes. That part I know how to do.

The categories parameter in the Channel Entries tag lets you indicate that you want to show entries with ANY of the selected categories (category="2|45|4|9") or ALL the selected categories (category="3&7&8").

Is there any way to let users make the selection of ANY or ALL when they interact with the Dynamic Parameters form? So effectively, they could say either "Show me entries belonging to ANY of the categories I've selected" or "Show me entries belonging to ALL of the categories I've selected"?

# Answer
> 3 votes
I would highly recommend using Low Search to provide the filtering you're talking about. http://gotolow.com/addons/low-search/docs/filters#categories

By default it would show all entries, and allow you to use your categories as filters to refine your results.

It can do some pretty remarkable stuff, highly recommended!

---
Tags: categories, dynamic, parameters
---


title: playa template tags being ignored

text:
# Question
Title: playa template tags being ignored
EE 2.7.2 Playa 4.4.5

I have two playa fields in my Recipes channel field group.

One is called similar\_recipes, which relates to other entries within the recipes (which happens to be the channel this form is posting to).

The other is related\_products.

```
{similar_recipes}
    {if count > 0}<h3>Similar Recipes</h3>{/if}
    <p>
        {recipe_image}
            <a href="/recipes/view/{url_title}" title="{title}"><img src="{image:url:small}" alt="{title}"></a>
        {/recipe_image}

        <a href="/recipes/view/{url_title}" title="{title}">{title}</a>
    </p>
{/similar_recipes}

{related_products}
    {if count > 0}<h3>Related Products</h3>{/if}
    <p>
        {product_image}
            <a href="/products/view/{url_title}" title="{title}"><img src="{image:url:small}" alt="{title}"></a>
        {/product_image}

        <a href="/products/view/{url_title}" title="{title}">{title}</a></p>
{/related_products}

```

I tried using the dynamic parameter, thinking it may be an issue with the fact I have a playa field that relates to its own entries, but I don't think thats the issue.

As you can see in the attached image, it acts like those fields do not exist in the channel field group.

# Answer
> 3 votes
Looks like a variable name conflict. You can use "var\_prefix" when this happens. Try something like this:

```
{exp:playa:children channel="recipe" entry_id="{entry_id}" field="similar_recipes" var_prefix="related" }
    {related:title}
{/exp:playa:children}

```

http://docs.pixelandtonic.com/playa/templating/module/children.html

---
Tags: playa, pixelandtonic
---


title: Upgrading from 2.7.1 to 2.7.2

text:
# Question
Title: Upgrading from 2.7.1 to 2.7.2
I'm have trouble upgrading versions. I was going from 2.5.5 to 2.7.2. It's added a table called exp\_upgrade\_log but now it's getting hung up between 2.7.1 and 2.7.2. This is what it says:

```
Preparing to update from 2.7.1 to 2.7.2. Awaiting acceptance of license terms.
Updating to 2.7.2

```

I've just got a blank page on the update wizard. There's nothing happening in this log table either. Any tips on fixing this upgrade process?

this is the url the wizard has left.

```
/admin.php?C=wizard&M=do_update&language=english&ajax_progress=yes

```

# Answer
As odd as this sounds, try the upgrade in another browser. It's possible something about that browser version is getting stuck on the ajax part of the upgrade.
> 1 votes

---
Tags: ee2-upgrades
---


title: EE, SSL, and insecure content

text:
# Question
Title: EE, SSL, and insecure content
I've installed an SSL on my server and I'm forcing https:// via htaccess. The entire site needs to be secured. Unfortunately, the browsers are complaining of insecure content.

For example:

```
<link rel="stylesheet" href="{stylesheet='assets/css.layout'}">
{site_url}

```

These evaluate to a URL that begin with `http://`.

I'm still exploring the problem, so there might be other issues.

What do I need to do in EE so that I don't get URLs that begin with `http://`?

# Answer
> 6 votes
In your EE config.php / site configuration, is your site URL set with http:// or https:// ? If it's not the latter, try that to see if it solves the issue. I think EE matches the site\_url to the exact URL (and protocol) that you set in this configuration variable.

The trickier thing is when you have a site that's partially under HTTP and partially HTTPS. In that case, you definitely need to use add-ons and/or link site URLs coded another way to properly traverse from one to the other. (I set global variables in the config for `{global:site_url}` and `{global:site_ssl_url}`, and use those in my templates.)

Finally, for your CSS URL, you can also reference it like:

```
<link rel="stylesheet" href="/assets/css.layout">

```

or

```
<link rel="stylesheet" href="//yoursite.com/assets/css.layout">

```

(Note that web browsers will resolve the // in the URL to either http or https, to match the protocol of the current page.)

Finally, if you have the option, move your CSS to a static file outside of EE--this will improve your site performance noticeably.

# Answer
> 5 votes
> It's because EE variables don't detect or utilise https by default, so you have to set them in code. The easiest way is to use an add-on:
>
> http://devot-ee.com/add-ons/https-support
>
> http://devot-ee.com/add-ons/dm-force-ssl
>
> http://devot-ee.com/add-ons/force-ssl (commercial)
>
> (In no particular order) I've not used any of these so can't recommend a specific one as I use my own plugin.
>
> *via: https://stackoverflow.com/a/12211420/25286*

Also, here is an older article, but with some useful tips: https://exp-resso.com/blog/post/2011/08/securing-your-expressionengine-website-with-https

---
Tags: security, secure
---


title: Site Rebuild / Moving existing data

text:
# Question
Title: Site Rebuild / Moving existing data
Any websites I have built before using Expression Engine have been from scratch.

One of my existing clients would like their site rebuilt as its 4 years old. I am planning on using another domain to copy the existing site over and upgrade it from 2.5.x to 2.7.x and then create a new design and edit a few custom fields.

The issue is, this is a high profile e-commerce site that is in 24 hour use. New members, new orders and new products are constantly being added.

If I build the new site on a copy of the site, after I finish the new design, and a few amendments to the system (perhaps a few custom field changes) I am wondering how I should go about getting the new data back into the new system.

Any advice on this matter would be greatly appreciated.

# Answer
There are two issues here to deal with.

**Exporting Data from the old site**

This can be done in a variety of ways. And it's arguably the easier task. I generally write custom PHP scripts, or sometimes a CodeIgniter app to connect to a copy of the original database and output XML files from it. It's just a matter of collecting all the needed fields. Since you're using EE for the original site, you could use an add-on like Export It, or simply use templates to help output the data.

**Importing into the new site** I almost always use Datagrab for this. It takes care of so much of the work for you. It's also easy to extend if it doesn't already support your fieldtypes.

Once you get both of those parts working, you can keep your data up to date on the new site during development. When it's ready for launch, you can just do one last data pull to grab any last minute content updates and pull them over into the new site.
> 4 votes

# Answer
It's tricky. I'm in a similar situation, though I'm migrating from a non-EE site. So, I've had to write a number of SQL and PHP scripts that "know" what data can change and what can be new, and can grab just the change and insert or update into the EE database in the right place.

But, take a look at this technique for capturing database queries on one EE site, and applying them to another:

http://krasimirtsonev.com/blog/article/Deploying-ExpressionEngine-based-site

It's definitely worth considering in your case. I haven't used this in a production situation, so that'd be something you'd have to test to feel confident is manageable.
> 3 votes

---
Tags: channel-entries, database
---


# Question
Title: Switchee with multiple stash variables only evaluates first variable
I have the following code:

```
    {exp:switchee variable="{exp:stash:get name='custom_sidebar_text'}/{exp:stash:get_list name='related_articles'}/{exp:stash:get_list name='related_events'}" parse="inward"}

      {case value="//"}{/case} {!-- Ignore no value --}

      {case default="Yes"}

        <aside class="{exp:stash:get name='sidebar_class'} {exp:stash:get name='sidebar_shifts_up'} {exp:stash:get name='page_color' random}">

        {!-- A bunch of markup here. --}

        </aside>

      {/case}
    {/exp:switchee}

```

If I understand correctly, the first case should only apply if all three of the variables are empty, while the second case should apply if any one, two or all three of the variables contain something. However, in practice, if the first variable is empty, no markup is rendered, and the fact that one or both of the second and third variables have information in them is ignored completely.

I tried using `value="''/''/''"` in the first case, but that did not work, as it resulted in the second (default) case always being rendered, even when all three variables are empty.

Maybe `exp:stash:get_list` isn’t the proper way to test whether a stash list is empty? I haven’t found an alternate way of testing it, though.

# Answer
> 2 votes
`exp:stash:get_list` is a variable pair.

So, try exp:stash:list\_count:

```
{exp:switchee variable="{exp:stash:get name='custom_sidebar_text'}/{exp:stash:list_count name='related_articles'}/{exp:stash:list_count name='related_events'}" parse="inward"}

  {case value="/0/0"}{/case} {!-- Ignore no value --}

  {case default="Yes"}

    <aside class="{exp:stash:get name='sidebar_class'} {exp:stash:get name='sidebar_shifts_up'} {exp:stash:get name='page_color' random}">

    {!-- A bunch of markup here. --}

    </aside>

  {/case}
{/exp:switchee}

```

I have to confess that I don't know if `exp:stash:list_count` returns "0" or "" and I can't test right now.

# Answer
> 0 votes
@Robson Sobral

I've just tested this - if the list is not set, list\_count returns "" so this pseudo code is works:

```
            {case value=""}
               <h4>No favourites yet!</h4>
            {/case}
            {case default="yes"}
            {/case}

```

---
Tags: stash, variable, switchee
---


title: Possible to do conditionals on embeds?

text:
# Question
Title: Possible to do conditionals on embeds?
Is it possible to do conditionals for embeds? For example,lets say I have this very simple template, `test/foo`

```
{if foo}
   yes
{if:else}
   no
{/if}

```

In other templates, I want to use this embed in a conditional.

{if '{embed="test/foo"}' == 'yes'} Output is yes {if:else} Output is no {/if}

Unfortunately, when I tried this approach, what I got was always a `no`, even if I set `test/foo` template to yes.

Am I doing something wrong? Or is this just not possible?

# Answer
> 4 votes
This way is not possible because of ExpressionEngine’s Parse Order

> 1. Parse advanced conditionals
> 2. Process embedded templates

With your code you don't have "yes" in conditionals when EE parses it, you have "{embed="test/foo"}"

# Answer
> 0 votes
You should be able to do what you're looking for with Stash, using stash:embed. With the Stash embed you should be able to manipulate the process and parse stage so that it will run before the advanced conditional (see Max's answer).

---
Tags: conditionals, embeds
---


# Question
Title: is there a way to put javascript and css in the wigwam editor in expression engine?
I'm trying to put this slider (scroll halfway down the page) into my site, which is built on expression engine using the wigwam editor.

i have the javascript saved here http://whitewashed.richiesiegel.com/slider.js but when i link to it under "source" in the editor the javascript doesn't load.

this is how i am linking it:

```
<script src="{path="http://whitewashed.richiesiegel.com/slider.js"}" type="text/javascript"></script>

```

and here is the Javascript (which works fine on non-ee sites)

```
$(document).ready(function(){
    $("header.image").hide();
    $("header.image").find("img").load(function(){
        $(this).closest("header.image").show(5000);
    });
});

```

any ideas?

# Answer
is not needs in path here

```
<script src="http://whitewashed.richiesiegel.com/slider.js" type="text/javascript"></script>

```

p.s. EE is not parsed tags in entries w/o special add-ons
> 2 votes

---
Tags: wygwam, javascript
---


# Question
Title: Display entries image files in grid field
I've got a grid field called 'images', it has 2 columns in it, a 'files' field, which I've called 'file' and a 'text input' field, which I've called 'caption'. I've got an entry with several images in the 'files' field, and some text in the 'caption' field, but I can't work out how to display these on the front-end, this is what I've got, which doesn't work:

```
{images}
    <img src="{file_url}" alt="{caption}" title="{caption}" />
{/images}

```

I've also tried {file} and {url} in the src but nothing seems to work. If I use the {exp:file:entries} tag that just outputs all my images, and doesn't output the caption anyway.

Any help would be very much appreciated.

# Answer
Your syntax is not following the user guide's instructions. http://ellislab.com/expressionengine/user-guide/modules/channel/grid.html#template-tags

You need to add the prefix for each column.

```
{images}
    <img src="{images:file_url}" alt="{images:caption}" title="{images:caption}" />
{/images}

```
> 3 votes

---
Tags: image, grid, files
---


title: Freeform and MSM

text:
# Question
Title: Freeform and MSM
I'm using EE 2.7.2 with Freeform 4.1.3 and Multiple Site Manager.

Works fine on the main site bit not on the second site. After completing the form takes me to mydomain.com/?ACT=35 and no submission in the CP or notification received.

# Answer
> 1 votes
From this Solspace thread:

> Do you have a www redirect in your .htaccess? If so, make sure your site configuration in ExpressionEngine has www in front of all of the links, otherwise any EE created links, like Freeform’s actions, will not have www and thus Apache will redirect, losing the post data.

---
Tags: solspace-freeform, multi-site-manager
---


title: Solspace FreeForm Error on Submit

text:
# Question
Title: Solspace FreeForm Error on Submit
Does anyone know what this means? I get this when I submit my form ... ?

# Answer
> 1 votes
Does this happen every time? You may of waited too long before submitting it and the xid expired. Try turning off "Process form data in secure mode" under Security and Preferences and see if the issue persists. What version of FF and EE are you running?

---
Tags: solspace
---


# Question
Title: How to Setup Redundant DB for ExpressionEngine?
Does anyone have an experience setting up ExpressionEngine with a redundant db architecture? Per corporate requirements, I must host the EE site within our corporate server structure.

What is the best method for setting up redundant data server? I've read other articles that say EE doesn't work in a Master -\> Master replication. I've read other articles that say you can use CI to connect to multiple DB but nothing that is tested for EE.

Any other options?

Thanks

# Answer
I have the same requirements in my location for a set of sites. Ours was for both redundancy and failover. I ended up with a customized version of Erik's master config for FocusLab here: https://github.com/focuslabllc/ee-master-config

Once I established the settings that worked for my needs, I built out a bootstrap install to make updates much easier too.
> 1 votes

---
Tags: database, settings
---


# Question
Title: Moving EE, including MSM, to a new server but can't figure out paths
EE v2.5.5 MSM

On the current host the main site and other sites each have their own directory, 'www.oursite.com' points to one directory, 'subdomain1.oursite.com' points to it's own directory etc.

This setup doesn't seem possible on our new host, so we have put the main site into the public\_html directory, and created subdomain directories in public\_html into which the other sites have been put.

I have followed the instructions for setting up the paths in MSM; in the subdomains directories both the admin.php and index.php $system\_path value points to the main sites system directory.

I thought I could reach the control panels via subdomain1.oursite.com/admin.php etc, but it's actually the main cp, requests for the subdomain frontends fail.

I don't think this is an open basedir issue is it? Any other ideas please?

Update, I've added my htaccess details here in reponse to the comment from Jeremy Gimbel: I have the following in my htaccess for the subsite1 directory:

--------------- htaccess rediect ----------

> ```
> RewriteEngine On
> RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-da
> RewriteRule ^(.*)$ /index.php?/$1 [L]
> RewriteCond %{HTTP_HOST} ^www.subsite1.domain.com
> RewriteRule ^(.*)$ subsite1.domain.com/$1 [R=301,L]
> RewriteCond %{HTTPS} !=on
> RewriteRule ^ http s://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
>
> ```

------------- end htaccess redirect ----------

I'm not sure if lines 6/7 are doing the right thing?

# Answer
> 1 votes
Who are you hosting with? Do you not have the option to create subdomains in the control panel? Once you create the appropriate subdomains and establish those folders through the CP, the rest should take care of itself like on your other/existing server.

I've run into some issues in the past when firewalls were involved with MSM setups and cookie/session issues due to CORS, but you should be able to just set relative paths in your index and admin files to point and go unless I am missing what is happening here.

**Example**: I have the following:

* system folder
    + behind root
* site.com
    + public html folder
        - admin.php
            * points to system folder
        - index.php
* sub1.site.com
    + public html folder (where my host placed it)
        - admin.php
            * points to system folder
        - index.php
* sub2.site.com
    + public html folder (where my host placed it)
        - admin.php
            * points to system folder
        - index.php
* sub3.site.com
    + public html folder (where my host placed it)
        - admin.php
            * points to system folder
        - index.php

---
Tags: multi-site-manager
---


# Question
Title: "Automatically turn URLs and email addresses into links" not working on Wygwam fields
I've got a channel using several kinds of fields (textarea, matrix, wygwam), and I need the "Automatically turn URLs and email addresses into links" functionality on the channel. I've set the option in the channel preferences, and it works as expected for the textarea field. The wygwam field, however, does't convert the same text into a link.

I'm on EE 2.7.2 and Wygwam 3.2.1

I've never had this problem before with other versions (of EE and Wygwam) - anyone else ever experience something similar?

# Answer
> 1 votes
You might look to see how your copy is being formatted on output. Sometimes I have had issues with this if I Restrict allowed HTML in the Wygwam field and have that automatic linking enabled.

Do you have any advanced settings enabled or custom CSS? This can effect it too.

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


# Question
Title: Entries appear to have vanished yet still show on the front end (sorta)?
I'm still using EE version 1.6.9 for one of my sites. On this page (http://www.logogala.com/designer/details/phil-heroux/) you can see a list of entries which are associated with this "designer" using the reverse\_related\_entries tag. There are three entries (global change leaders, red/blue barber shop, and blue atala) that still appear on this page yet when clicked, they take you to a 404 page. I've looked in my EE admin area and tried to find these entries and they are gone. No trace of these entries yet they still appear on this page using that reverse\_related\_entries tag. So... I'm at a loss; no idea what's going on or why these entries would have just vanished from the database yet still appear to show on this "designer profile page."

Any ideas?

# Answer
Sounds like the entries were deleted but still exist in the Relationship Cache... You can **clear the relationship cache** at this location in the control panel"

> Control Panel Location: Admin \> Utilities \> Clear Cached Data Files
> 1 votes

---
Tags: ee1
---


# Question
Title: CKfinder / CKeditor / Wygwam on a CMS in a subdomain
Due to high traffic, we had to spread our website over two servers and a load balancer on top.

The master and slave servers are synced one way, from master to slave.

We set a subdomain (cms.domain.com) to point to the master server just for CMS purposes.

All seems to work fine-ish, except CKfinder and CKeditor when uploading images as the frame that they open still points to www.domain.com and that throws the following error on Chrome:

> Unsafe JavaScript attempt to access frame with URL http://cms.domain.com/system/index.php?S=2cefbd42dfa263be59dd3f5a725939749a29de90&D=cp&C=content\_publish&M=entry\_form&channel\_id=4 from frame with URL http://www.domain.com/themes/third\_party/wygwam/lib/ckfinder/core/c…pload&type=Images&id=1&CKEditor=field\_id\_345&CKEditorFuncNum=4&langCode=en. Domains, protocols and ports must match.

Now, I read on the Wygwam changelog that on version 1.1.2 there was this fix:

> Fixed file browsing and uploading for EE installs with relative Fieldtype Folder URLs and/or varying CP subdomains

Has this anything to do with what I'm trying to do?

If not, is there any way I can make this work?

Thanks.

# Answer
> 1 votes
I ran into the same issue. Even though I was using the same primary domain, the subdomains were causing cross domain issues with what seemed to be the CK Editor functionality due to permissions. I found out later that the issue was due to, in my case, NSM Live Look using iframes. Since the iframe was still technically being viewed even thought the tab was not active, the functionality from wygwam appeared to break. I wasn't able to properly use embed images and/or media. Once I disabled NSM Live Look, everything was fine with wygwam.

My solution called for a use of both though. I ended up having to restructure my site a bit in order to circumvent the issues of cross domain calling and script resources. I did this by creating rules on the firewall that block outside traffic, per corporate security rules, to any admin file. This way, the admin files were not accessible outside the network. The trick was keeping the admin file on the same domain as the site so that the CP URL and site URL are the exact in regards to full domain and not just primary domain.

This allowed me to re-enable both addons and use them without issue. Of course, this will depend on your settings and equipment usage/availability.

---
Tags: pixelandtonic, wygwam, subdomain
---