Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [merge]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

Ordering merged entries

I have a requirement where I need to display entries from one channel, but entries get might show up 5 days after post date, show up if externalListingOnly or show up immediately if ...
1
vote
1answer
68 views

Pagination and “if” condition

Some of my entries have the same entry.title. At the frontend, I would like to display these entries only once. This works with the following code: {% set entries = craft.entries().section('produkte')...
1
vote
1answer
27 views

Merge trashed element with existing one

Is there any way to merge trashed elements with an existing element? I'm creating a custom restore action so you can merge a trashed (commerce) Product with an existing one. The mergeElementsByIds ...
1
vote
1answer
17 views

Merging params PostDate limits errors

I'm attempting to merge in postDate restrictions based on the url segment. However I get twig errors with my code. So for a link of domain.com/news/archive/2016 I want to see all entries with a ...
1
vote
2answers
50 views

Paginating Merged Element Queries

I really want something like this to work but the merge function turns Elements into Arrays. I've managed to work around it other times but what's the best practice to combine two entry sets and then ...
1
vote
2answers
26 views

Merging Assets Fields

I've got this working but it seems terribly verbose to do something, that in my opinion should be easier. Is there a better way to get the assets from 2 different fields, merge them and output them ...
1
vote
1answer
60 views

How to merge SEOmatic object in Craft 3?

I'm using SEOmatic plugin in craft cms 3 and I need to set the seoTitle in my template but can't figure out how to do it... I know that in Craft 2, it was possible to merge the seomatic variable. I ...
0
votes
1answer
29 views

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 = [...
1
vote
0answers
85 views

Merging Entries - Craft 2 worked but not Craft 3

I have this code which merged entries when in Craft 2 {% set entriesOne = craft.entries.section('publications').search('nonMembers:0').ids() %} {% set entriesTwo = craft.entries.section('...
1
vote
1answer
59 views

filter matrix blocks by multiple light switch value, and then merge them

I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page. I need to be able to test whether any ...
3
votes
1answer
818 views

Merging 2 Entries Array's

I have these to arrays that I need to merge into one array, but can't figure it out. Please advise {% set entries = craft.entries.section('publications').search('nonMembers:0') %} {% set entries = ...
2
votes
1answer
50 views

What is the correct syntax for using merge to create an array of field values from an element query?

I grab some values via an element query: {% set events = craft.entries.section('events').status('live,pending').order('postDate asc') %} But I need to put them into an array for use in a Craft-...
1
vote
1answer
127 views

Merging Multiple Relations as params

I have the following code where I'm pulling entries related to another entry which works fine. However I also want to limit the entries returned on a category page and thus am merging in a relatedTo: ...
1
vote
1answer
472 views

Search Multiple Fields Same Parameter

I'm building a search form with filters. This is one of the filters. I would like to use the parameter "agent" and have it search a text field called "listingAgent" and "coListingAgent" to check for a ...
1
vote
2answers
166 views

Using Merge filter

I am trying to use some Twig code to sort entries by a date field that is contained within a Venti field. Here is the code: {% set allWorkshops = [] %} {% for entry in craft.entries.section('workshop'...
2
votes
1answer
2k views

Merge a multidimensional array

I am creating a calendar for displaying films and their screening times. I already have a quite convoluted mechanism of retrieving data from the "films" channel, where I have a supertable for "...
5
votes
3answers
8k views

Overwrite value in object in array

I'm strangely having trouble with this simple Twig merge problem and can't find anything online. Simplified, let's say you had: {% set users = [ {name: 'Bill', age: 25}, {name: 'Tim', age: 30}...
0
votes
1answer
64 views

Merge related entries from several matrix blocks while maintaining other matrix field data

I have a matrix that essentially creates categorized lists of other entries. The fields in my matrix block are "categoryName", a plain text field and "member", a entry relationship field. I know i ...
1
vote
1answer
434 views

Merge two queries of entries ordered by publication date

I got a section called news which contain 2 types of entries: news and press. Those entries are linked with 2 different categories : news entries have category newsType and press entries have ...
2
votes
1answer
1k views

Possible to merge and sum the values of an array?

I have a super table that has 4 columns. I'm trying to create an array based off one column (contentType) and merges to get only the unique values while taking the sum of a different column (points). ...
2
votes
1answer
137 views

Query two sections filtered by different custom fields, then order them

Two channels: 1) exhibitions, which have a startDate and EndDate 2) events, which have a date I need to grab the current exhibitions, future exhibitions and future events, which I do using this: {% ...
1
vote
1answer
198 views

If merging two sections from different locales how do I then sort them by a shared criteria?

I've got a site with multiple locales and I want to merge together content from across these locales, eg News. The two sections share the same fields so should theoretically be able to be sorted by a ...
2
votes
1answer
2k views

Create an object of objects with merge

I'm trying to create an object of objects, can anyone suggest why object would only contain the last iteration of "itemObject"? {% set object = {} %} {% for entry in craft.entries.section("...
1
vote
1answer
103 views

Merge Entries but only after X amount of entries

I'm trying to get entries from two sections and merge them together which is pretty straight forward using the merge filter. For example, my sections are: News Promoted News But, my main issue is I ...
3
votes
1answer
88 views

How to merge/combine/transfer-entries-between two categories in the CP?

I’ve got 2 categories each with lots of entries. The client wants to delete one category, and transfer it’s entries into the other one. If I delete the category, it just disappears, but I somehow ...
0
votes
2answers
268 views

Merging Hash Error

I'm having issues trying to merge a nested hash to get unique values. I'm getting this error which points to the last line of for the loop: A hash key must be followed by a colon (:). Unexpected ...
0
votes
1answer
206 views

Order merged query by shared field

I’m trying to merge two query sources (some entries and some categories) but have them ordered by a shared field that is a date field. Here’s what I have so far: set classesLocations = craft.entries....
1
vote
1answer
421 views

Correct way to merge craft.user field arrays and use outside the loop?

I'm using preparse field plugin to limit the amount of tags a user can add to his account. I've modified the code slightly so the tags are processed as a comma, separated, list. The plan is to ...
5
votes
2answers
18k views

Using Twig to merge an array and remove duplicates

Problem I'm building a .json file for a search component of a used cars website. The file needs to be built from the output of two sections within CraftCMS, Used Cars and Vans & Trucks. It ...
2
votes
2answers
4k views

Adding entries to an array, one at a time

I'm trying to loop through some entries and if they fulfil a certain condition push them into another array of entries. {% set todaysEvents = [] {# GET TODAY'S ONE-OFF EVENTS #} {% set ...
2
votes
1answer
674 views

Shouldn't this merge be working?

Can anyone help me work out why the following returns the error "The merge filter only works with arrays or hashes."? {# CREATE ARRAY TO HOLD ALL OF TODAY'S EVENTS #} {% set todaysEvents = [] %} {# ...