Questions tagged [number]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer

Why are number fields actually text fields in Craft?

I am building a small price calculator in the Product type entry for Craft Commerce by building a custom plugin. This plugin executes my javascript file. The issue I am encountering is that I need to ...
Matthias's user avatar
  • 132
1 vote
1 answer

start ordered list with number 2

How do I start an ordered list inside a new text block with the number 2 (or any number not 1). I need this trick when a long ordered list is broken up by multiple image blocks. Thanks!
eslwriter's user avatar
1 vote
1 answer

Getting all images urls and help with numbers field

I have two problems with CraftCMS :( First one - I want to make images gallery and now using something like this: {% set image = entry.car_photos[0] %} {% if image %}<div class="...
Lukas Snarskis's user avatar
1 vote
2 answers

Getting an zero index and count for an entry list

I currently have an entries field which outputs a list of related entries on page. I'm trying to find a way to display two values for these entries. The first would be a zero index. I'm trying to ...
Adam's user avatar
  • 255
1 vote
1 answer

Feed Me import from CSV ignores decimal point

I use Feed Me to import values from a .csv file into my entries. Since a day i have an issue i can't explain. I didn't change anything. Precisely, the issue concerns a number field. In the .csv file, ...
TomS's user avatar
  • 213
1 vote
1 answer

Number field when empty and value=0

Is there a way to differentiate the number field value empty and 0? I would like to display this field only when there's a value in the field even though the value is 0. But when I input 0 into ...
user3210439's user avatar
3 votes
1 answer

Math with numeric values derived from a dropdown field

I had a dropdown field with a handle of hLevel, with only numeric values in it, anticipating that I could do math with the values in my template. But it seems I can't. {% set dif = subhead.hLevel - ...
Jonathan Schofield's user avatar
0 votes
1 answer

Replace quotes in an array

I'm trying to use a charting library within a Craft template. The chart expects an array of numbers that I'm building up from a table but I'm getting an array of strings instead. {% set donutData = [...
Steven Grant's user avatar
  • 1,855
1 vote
1 answer

Non-numeric characters in number field producing errors

Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry: number_format() expects parameter 1 to be float, string given Is there a way for it to ...
Chattervast's user avatar
0 votes
2 answers

Searching Number Field To See If It Falls In A Range

I'm building a property search form and searching by different types of fields in Craft. Here are my questions: How can I get a list of the unique cities in the entries section to declare my form ...
triplethreat23's user avatar
0 votes
1 answer

Display children's order numbers

I thought this was going to be easy; showing the order number of children against their parent, but the only answer I can find is in this thread and I'm unsure how to implement this into my code. {%...
Nutmeg's user avatar
  • 598
1 vote
2 answers

Sum up number fields in the loop

I don't understand what's going on in my code logic because I'm getting unexpected output. I'd like to sum up three number fields in entries loop for the given post date range. Output gets almost ...
Dominik Krulak's user avatar
3 votes
1 answer

Calculating a score based on a drop down field value

I am storing a value (number 1-5) in a drop down field and would like to do a calculation based on the numbers filled in. The only way I could get my calculation to work was to store the number (1-5) ...
Lori's user avatar
  • 866
1 vote
1 answer

Unable to sort large number of blocks in Matrix field in CP and template

I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save ...
terjeofnorway's user avatar
0 votes
1 answer

Can I create a number with decimal point in number field?

Could number for example 7.5 be created in number field?
Dominik Krulak's user avatar
5 votes
4 answers

Price Formatting

I'm outputting prices in a channel with a little formatting like so: &pound;{{ entry.priceFrom|number_format(2,'.',',') }} Gives me £1,000.00 or £99.99 etc... However client isn't a fan of the ...
Ian Ebden's user avatar
  • 894
1 vote
2 answers

How to check if number is prime?

How do I check if a given number is prime in twig?
nicael's user avatar
  • 2,382
12 votes
8 answers

How would I omit zero value decimals in a number format?

Say I have {{ item.width }} and {{ item.height }} which are number fields with 2 decimal places. In my template I have this: <p>Dimensions: {{ item.width }} x {{ item.height }} in.</p> ...
Steve Adams's user avatar
  • 1,671