[SOLVED] Templating : modify $this->items

More
10 years 11 months ago #52991 by juansolos
Yes but my group field is mutli valued.
so each article has several value for the group field (let set a thrid field in this group field : product) so the group field is a product description (size, type of product, color) and items the owner

Item1
big blue shoes
big white pen


item2
big red pen
big white hat
small black pen


filter on small white pen will return all item with small and white and pen so item 1 and 2.
But i would like to return all items that have white small pen for a field group value. (in my exemple no result)

Maybe have i done a wrong test?

That why i creat 2 item types.
Do you anderstand my problem?

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #52993 by ggppdk
Hello

yes,
it will not work in the case of a multi-value field group

the filtering needs to be updated, in the case of a "field group" we should also match the same "value_order" column in the field values table
-- although it is not obvious on how to do this

we will probably need
-- find which filters are in same field and add them in an extra subquery or join


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #52994 by juansolos

ggppdk wrote: -- find which filters are in same field and add them in an extra subquery or join

This could be perfect to filter inside field group value and not in a value of a field in the field group value.

That why i am tring to play with 2 content type.
Each product type are in relation (field relation) with only one owner (owner type).
And i play with the "$this->items" in the category view to display only one item per unique value of the relation field.
But i get problem with the pagination that is created above in the main query.

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #52995 by ggppdk
hhhmm

the way to do this create a 1 subquery for all fields in group,
-- each field will add a JOIN on values that will require that "value_order" is the same

this will need some work, maybe in v3.1


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #53012 by juansolos
Hello,

Ok,
thanks.
I will follow it.

Regards

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #53017 by ggppdk
Hello

i have opened this issue:
github.com/FLEXIcontent/flexico ... issues/153


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago - 10 years 8 months ago #55096 by ggppdk
Hello

recent work (4 performance changes) also make easier to implement this, but still it is not exactly trivial

i have your PM,
please subscribe and GitHub issue and you may post reminder any time after v3.0 final is pubished


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 10 years 8 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago #55104 by juansolos
Hello,
thanks.
Regards

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #57890 by juansolos
Hello,
i try to optimise this condition to display only item with distinct value for the fieldX.
This code is called in the top of the category_item.php
Code:
$items = & $this->items; $newitems = array(); $fieldvaluearray = array(); for ($i=0; $i<count($items); $i++){ $item = $items[$i]; if(!in_array($item->fields['fieldX']->value[0], $fieldvaluearray)) { array_push($newitems , $items[$i]); array_push($fieldvaluearray , $item->fields['fieldX']->value[0]); } } $items = $newitems;
Any idea?

Regards

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago - 10 years 3 months ago #57907 by ggppdk
Hello

i do not understand you ask to make this faster ?

anyway the number of items is small e.g. <200
so this loop is rather very small

to optimize use HASHing and not in_array
Code:
$items = & $this->items; $newitems = array(); $fieldvaluearray = array(); foreach ($items as $item) { if ( !isset( $fieldvaluearray[ $item->fields['fieldX']->value[0] ] ) ) { $newitems[] = $items[$i]; $fieldvaluearray[ $item->fields['fieldX']->value[0] ] = 1; } } $items = $newitems;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 10 years 3 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save