Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#226 2008-09-29 21:37:02

coopersita
Member
Registered: 2005-09-28
Posts: 68
Website

Re: glz_custom_fields

Sorry for being dense, but I just don’t get how to get ranges showing…

I have a field called “Price” where a number is entered (eg. “12.00”), and I want to show it as ranges in the search dropdown (eg. $0-$4.99, $5-$9.99, etc.), instead of a list of prices that have been entered (eg, “4.00, 12.99, 14.25, etc.). How do I do that?

I read the help, but I just don’t get it. Where am I supposed to put “Price range $”? Is it in the Extenstions tab where you enter the field name? or is it in the glz_custom_fields_search_form tag? Or is it somewhere else?

I’ve been trying different ways, but it doesn’t work…

Sorry if it’s too basic, but I can’t figure it out.

PD: I also get a 200 error when there is no search results… People have to click in the link to be redirected.

Last edited by coopersita (2008-09-29 21:49:47)

Offline

#227 2008-09-30 05:25:37

azw
Member
Registered: 2007-01-29
Posts: 279

Re: glz_custom_fields

Hi, Coopersita,

I don’t think the plug-in will do what you want. But, just in case this might be helpful, I’ll try to explain how I think it works.

I’ve never used ranges, but I think I understand the instructions. The instructions aren’t crystal clear, so it’s not a surprise that you’re having trouble.

1. Go to the Extensions tab, then choose the Custom Fields sub tab.

When you set up a range, you do it by creating a new custom field or editing an existing custom field. The field itself will have several selects. The value of each will be a range.

2. Choose an empty custom field (or an existing custom field that you want to reuse) and click on Edit.

3. Type a Name for your custom field, if it’s a new one. Here’s where the instructions are particularly difficult because it’s not a typical custom field name. The instructions say the name must be:

Price range £(after)

I think yours will be:

Price range $

That’s a guess. I don’t think you need “(after)” because your unit name comes before. And you need $ rather than &pound. I don’t think if there is a entity symbol code for “$” like there is for euro, pound, yen, and cent. I’m also not sure that you’d put “after”. I’m guessing that “&cent” would require “(after”), but $ would not. This will require experimenting.

4. Then you choose “Select” as the Type.

5. Then next to Value you have to type in the values for each of the selects. In this case, you’ll be typing in a range of values. The instructions say to type in:

Ranges are defined 10-20, 21-30 etc. (no measuring units - they get pulled from the custom set name).

I interpret that to mean you have to type things like:

0-4.99
5-9.99
10-14.99

Use no units in your ranges. I’m not sure if the cents will work, but I assume so.

Each separate line in the value textbox will create a separate select value.

This scheme doesn’t allow you to enter a specific price (such as $12.32) for this custom field “Price” when you’re filling in the data for an article. Your only option will be to choose from the fixed selects you’ve just added in the “Custom Fields” tab. In the current implementation, I think, searching by ranges is possible only because the actual data is stored as ranges.

If this doesn’t work for you (and I doubt it will), you may want to use a type of “Text Input” and then write some php code that will organize results.

Offline

#228 2008-09-30 15:23:57

coopersita
Member
Registered: 2005-09-28
Posts: 68
Website

Re: glz_custom_fields

Thanks azw,

I actually already had something like that. I did have a Price Range field already set up (I guess I can just add the $ at the end and see what happens). I just find it repetitive to have a Price field for the exact price, and a Price Range for the search dropdown… But if you name your field “Price range $”, won’t it say “Select Price range $” in the dropdown? That doesn’t seem right…

In any case, I’ll just keep it the way it is (Price and Price Range). Did you find out the problem with the no_results page? I get that 200 error with the link to redirect too…

Offline

#229 2008-09-30 16:11:21

azw
Member
Registered: 2007-01-29
Posts: 279

Re: glz_custom_fields

I suppose you’re right about what it’ll say in the select box. That’s ugly. And it would appear not just in the administrative side but also the search bar, wouldn’t it?

No, I’ve not yet figured out a solution for the 200 Error. That’s an awful problem because it makes us look terribly incompetent. I haven’t any experience tweaking plug-ins, so I’m hoping that Gerhard will come out with the new version soon.

There must be a way to automate setting the price range. I can imagine that it would be possible to create a field for the price range, but only input the exact price. Then you could run a script that would calculate the range and write it to the DB whenever you update any products/items in your catalog or add a new item.

Or it could be done when you access the data on the site. So on any page that accesses price data, there could be a routine that verifies the price range data to be sure it exists and is correct.

I don’t like that either of those methods would use more resources than necessary. I suppose the ultimate solution would be a plug-in that allowed us to create calculated custom fields. Whenever one of the source fields (your price field, in this case) was changed, the plug-in would calculate the associated calculated field. I could use that plug-in!

Last edited by azw (2008-09-30 16:15:05)

Offline

#230 2008-09-30 16:42:07

coopersita
Member
Registered: 2005-09-28
Posts: 68
Website

Re: glz_custom_fields

I wish that instead of redirecting to a page, it would simply insert a text instead. So no_results would be something like no_results=“Sorry, no products matched your criteria.”

As for the price range, I can live with having to enter the price twice (for price and for range)…

Thanks for the help, azw

Offline

#231 2008-11-11 22:09:10

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: glz_custom_fields

coopersita wrote:

no_results would be something like no_results=“Sorry, no products matched your criteria.”

yeah…I’d like that too

Offline

#232 2008-12-07 17:19:41

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: glz_custom_fields

Hi guyz and galz,

This glz_custom_fields plugin seems to be what i have been looking for but want to make sure before i buy it.

I am building an Image Gallery.
What i want to do is create a custom field with a pulldown-select button that shows me ALL the available images categories. Obviously i want this custom field to automatically retrieve all the possible image categories and get updated if extra categories are added.

I see TRIGGER WORDS have been added e.g. |Image Categories| (select with all existing image categories)

But not quite sure what they are and how they work? Do I enter such a trigger word(s) |Image Categories| somewhere in the plugin and it will pull all the available image categories.? Please excuse my ignorance.

Last edited by Timid&friendly (2008-12-07 17:20:55)


I think, therefore I AM, … … er … I think :-?

Offline

#233 2008-12-07 17:47:19

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: glz_custom_fields

Trigger Words are a planned feature for version 1.3. We’re currently at 1.1.3 and this plugin hasn’t seen any update for a while.

I wonder if Gerhard is still working on it?

Offline

#234 2008-12-08 06:08:56

azw
Member
Registered: 2007-01-29
Posts: 279

Re: glz_custom_fields

Yeah, at this point you’ll have to add the image category select options manually. But having that select is very helpful.

There are several issues with the plugin. It has some problems with it’s built-in search function. In particular, if someone does a search and it doesn’t find anything, it takes you to a different section, a miserable solution.

But overall, I’d recommend it. It adds valuable functionality and if Gerhard continues to upgrade it, it’ll eventually be utterly fantastic.

Last edited by azw (2008-12-08 06:12:33)

Offline

#235 2009-01-02 20:40:25

jmart
Member
Registered: 2008-08-25
Posts: 68

Re: glz_custom_fields

The documentation says that the <txp:glz_custom_field /> tag uses the same attributes from the <txp:custom_field /> tag.

So I tried using the escape attribute but it doesn’t work. Here is how the tag looked; <txp:glz_custom_field name=“fieldname” escape=“html” />

EDIT: Never mind. I found a solution to the problem. There was some confusion and miscommunication.

Last edited by jmart (2009-01-02 21:11:39)

Offline

#236 2009-01-03 02:28:55

azw
Member
Registered: 2007-01-29
Posts: 279

Re: glz_custom_fields

Hi, Jmart. Can you tell us what your solution was? It might help others.

Offline

#237 2009-01-11 17:57:58

abacabb
New Member
Registered: 2008-12-10
Posts: 7

Re: glz_custom_fields

Hey guys, I’m having a weird issue with glz_if_custom_field on my 4.0.6 build..

It appears when I use it in a code block, it will partially work, but it won’t exclude everything inside the tag, just the part that pertains to the actual call to glz_custom_field.

For example, I’m writing a form that will contain all the markup for any addresses that I have displayed on my site. I want to exclude a block of code if the extended-address field is not filled in. So my form markup looks like this:

                  <txp:glz_if_custom_field name="street-address">
				<div class="adr">
					<span class="street-address"><txp:glz_custom_field name="street-address" /></span><br/>
					<txp:glz_if_custom_field name="extended-address">
						<span class="extended-address"><txp:glz_custom_field name="extended-address" /></span><br />
					</txp:glz_if_custom_field>
					<span class="locality"><txp:glz_custom_field name="city" /></span>, 
					<span class="region"><txp:glz_custom_field name="state" /></span> 
					<span class="postal-code"><txp:glz_custom_field name="zipcode" /></span>
				</div>
			</txp:glz_if_custom_field>

If I don’t have any value for extended-address, that <br/> tag (and anything else I would add after it) inside the conditional is still showing up. Anybody run into anything similar before, or is it an error on my end?

Thanks!

Offline

#238 2009-01-12 02:40:06

azw
Member
Registered: 2007-01-29
Posts: 279

Re: glz_custom_fields

Yes, it’s on your end, but it’s easily fixed.

You can’t use nested conditions that use the same type of conditional with 4.0.6. Fortunately, that is possible with the latest version, 4.0.7. We owe the developers a lot for that one!

Unlimited nested template tags, and tags as attributes to other tags have made it into the Textpattern core as part of the new tag parser.

So you should upgrade to the newest version so you can put if_custom_field name=“extended-address” inside the if_custom_field name=“street-address”.

Also, you may be able to use the standard code

<txp:if_custom_field name="street-address">

in place of the glz:

<txp:glz_if_custom_field name="street-address">

I think that unless you’re using a special feature of glz_custom_fields, you would probably be better off using the standard custom_fields. (I don’t know what happens if you have more than 10 custom fields.)

Offline

#239 2009-02-01 02:32:57

garbo
Member
From: Montreal, Canada
Registered: 2007-01-02
Posts: 28
Website

Re: glz_custom_fields

I’m having some major issues with this plug-in and TXP 4.0.8. Anyone else having trouble suddenly after the upgrade?

It seems like a many custom fields just don’t show up in the rendered web page at all. There are even some custom fields that don’t appear in the Write tab window for some but not all articles.

Should I downgrade to TXP 4.0.7 in the meantime? Is that even possible?

Offline

#240 2009-02-01 03:04:20

garbo
Member
From: Montreal, Canada
Registered: 2007-01-02
Posts: 28
Website

Re: glz_custom_fields

I think I may have found the solution. I didn’t read through the entire topic, but it seems that there is a patch that constantly needs to be installed with every TXP update.

First, go here:
http://gist.github.com/49131

There is some PHP code on that page. Either download it or copy the code to your clipboard.

Launch your FTP client and log into the Textpattern directory of your website. Locate the publish.php file. Use your FTP client to edit the file or transfer it to your computer and open it in a text editing program like Notepad or TextEdit.

Find the chunk of code that has the getCustomFields() function. It’s near the end and is bordered by horizontal rules that are commented into the code.

Replace the entire function between the rules with the code you just copied from the web link above. Save the file, either as an edited file within your FTP client or onto your computer (make sure it’s still named publish.php). Transfer the newly edited file back into your textpattern directly to replace the old one.

Check to make sure everything’s running perfectly.

I think it has to do with getting Textpattern to look up custom fields beyond the originally allotted ten.

Just answered my own question (unless this was already stated elsewhere earlier, in which case, oops). Now at least I’m able to explain this to myself and any other non-engineering type.

Offline

Board footer

Powered by FluxBB