[SOLVED] Exclude items before pagination, count, etc.

More
7 years 11 months ago - 7 years 11 months ago #62453 by Natwork
Hi,

I'm trying to exlude items in category_items view.
I can't use category filtering option because i have a single value field (id 40), and i need to display every items with field value different from 0.
This is for a catalogue, i'm trying to hide items that are no more in stock.
My field is a simple text field with quantity value in it.

So I tried using PHP for that, here is what I wrote:
Code:
foreach ($this->items as $i => $item) : if ($this->items[$i]->fieldvalues[40][0] == 0{ unset($this->items[$i]); } endforeach;

It works fine, but pagination isn't good. It load 6 items, then create page with 6 item, then page render only X items and display 'items 1-6'.

Where can I unset items[$i] before category_items.php or category.php ?
Or maybe i load 1 more items each time I unset one?

If I'm totally wrong, how can I do to display only items where field 40 is different from 0, with a good pagination?

Thanks for your help
Last edit: 7 years 11 months ago by ggppdk.

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

More
7 years 11 months ago #62454 by ggppdk
Hello

i guess quantity is integer ?

1. edit the field 40 and
- mark it as filter
- set its display to be "text fields range"

2. edit the parent category of the categories that you want to behave like this
or edit the top-level category(-ies)

A. Find the "locked filter values" parameters and set the field 40 (i assume field ID is 40) to be 1 or greater .... like this:
40##1---

the above means
1 <= value_of_field_40 <= infinite

B. Select filters that you need but DO NOT select the quantity field as "displayed" filter, this should be hidden as it is locked ... and you probably don't want to show it


-- 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...

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

More
7 years 11 months ago - 7 years 11 months ago #62465 by Natwork
Hi,

Quantity is integer, but I had not set parameter to format it as Integer.

So now :
1. Params of Field40
A. In tab Search, filtering, my field is marked as a filter (in basic and advanced search index - I re-inxeded both)
B. In tab FIELD TYPE specific configuration, in Values > Custom Output, Format as is set as Integer
C. I don't find where to set display to be "text fields range" :(

2. Top level category is
A. 40##1--- is in locked filter values
B. I set no custom filters in showed filters - And Show filters is on NO (and yes, you're wright I don't want to show this filter)

For the moment, I have this error message but it's probably due to the 1.C :
Unhandled case for filter: in 'FlexicontentModelCategory::getFiltered()', query variable not set

Where can I set field's display to be "text fields range"?
Last edit: 7 years 11 months ago by Natwork.

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

More
7 years 11 months ago #62476 by ggppdk
Hello

about not marking "integer" since begining, you don't need to worry, in this case

an yes a "range" locked value, will not work
- unless you configure the filter display of the field to be a range
(new version displays a warning next to locked values parameter)

edit the field
- and go to the top right TAB that holds the "filter" configuration
find the display in 2 places (category-based view and search view) and mark them both to be range


-- 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...
The following user(s) said Thank You: Natwork

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

More
7 years 11 months ago #62490 by Natwork
Thanks a lot, it works !

Once again your great support made my day, FC is by far the best CCK for Joomla !

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.618 seconds
Save
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