Code Monkey home page Code Monkey logo

cp-filters-craft-cms's People

Contributors

benjaminkohl avatar brandonkelly avatar frankkepler avatar ryanmasuga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cp-filters-craft-cms's Issues

Integration with Craft Commerce

Is your feature request related to a problem? Please describe.
Commerce store managers frequently request the ability to export orders with associated line items, shipping rules and tax rates. Craft's export lacks the key order information needed for store managers. However, if store managers could filter orders with this plugin it could help hugely with dispatch.

Describe the solution you'd like
Enable a filter on Craft Commerce orders by customer, date, products purchased, order status, shipping category, vat category, etc.

Describe alternatives you've considered
Shipstation is a third party solution for order fulfilment which works well.
I have also built simple .csv templates which store managers can download using twig templates.

SuperTable Support

Hi there,

wonderful plugin and clients love it. They have quite a few SuperTable fields though

Craft: 3.5.19.1
CPFilters : 1.1.1

I've added Supertable as a test to see if compatible with my cpfilters.php

'additionalFieldTypes' => [
		'verbb\supertable\fields\SuperTableField' => ['contains']
	],

While it displays the fields in the filters it does not return results. Fields have search turned on.

Has anybody succeeded in doing this yet? have you tried it yourself?

Related Field Filter Dropdown Select is Limited to Only ~100 Entries

When filtering by a Related Entries Field and choosing "is assigned" the resulting Select Dropdown only shows the first 100 entries.

Expected behavior
Currently have about 600 entries and I should see all of them.

Craft Version & Installed Plugin Version
Craft: 3.6.11.2
Plugin: CP filters
Mac: Chrome and Firefox

Filter entries by author

Is your feature request related to a problem? Please describe.
I'm using CP Filters to help academics manage a database of submitted papers. They want to be able to easily pull up papers by a specific author.

Describe the solution you'd like
Allow me to filter entries by the Craft native Author metadata.

Describe alternatives you've considered
Using Searchit; sorting by author instead.

Additional context
Would like Author as an option in addition to id, Title, Slug and other native fields. I assume it's harder to implement or you would have already done it. 😅

Screen Shot 2020-12-15 at 5 18 40 PM

Ability to set Filters for Commerce Products

Is your feature request related to a problem? Please describe.
I know it's already in your Roadmap, but I'd love to have these filters for Commerce Products. I have a site with over 6000 products and these filters would really help with the management of them.

Describe alternatives you've considered
If you can let me know a rough timeline for when you'll be looking to add products? If it's not soon are you happy for me to add the feature and do a PR for you?

Clicking next page on users or assets tab reverts active tab to entries

Describe the bug
Clicking next page on users or assets tab reverts active tab to entries. Seems like its just not preserving the active tab.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'the assets tab'
  2. Click on 'the next page buttons'
  3. Scroll down to 'results and see the second page of entries, not assets'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

should show second page of assets!

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Unpublished entries?

Hi!
Is it possible to filter unpublished entries (so they have only drafts) as well?

PS: sorry, I deleted the formalities. It's such a general question

Lighswitch fields aren't showing

We have some custom fields with type lightswitch, but in the filter they aren't popping up. Seems to limited to other field types only.

[Suggestion] Filters based on count of relational fields

We created something similar internally. We found that it can be very helpful for content managers to filter entries based on the count of a specific relational field.

E.g.

  • Which product entries have no upsells?
  • Which entries only have 2 images?
  • Which products have less than 4 properties (defined as a category section in Craft)

Good luck with the release!

Allow users to filter by first and last name

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Right now we cant pull list of folks by name

Describe the solution you'd like
A clear and concise description of what you want to happen.

Would love to add first and last name to the list of available filters

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Right now the only alternative we could come up with is creating custom fields for name which we dont love

Additional context
Add any other context or screenshots about the feature request here.

Postgres compatibility?

Describe the bug
Just installed on a site using Postgres and these are the screens we see. Wondering if the plugin is compatible with Postgres or if it's a different issue?

image

image

Craft Version & Installed Plugin Version
Craft: 3.5.16
Plugin: 1.0.1.1

To Reproduce
Steps to reproduce the behavior:

  1. Install on a site using Postgres and visit the two admin views for the plugin.

Expected behavior
Expected to settings on the settings view and no errors on the plugin view.

Question: Filter over multisites?

Just a short question: Is it possible to filter across multisites? The current search in Craft is limited to the active multisite, but we want to be able to search over multiple (=all) multisites, ignoring the restriction of the normal search field. Thanks!

MySQL error when filtering by related elements

Describe the bug

When filtering by any field that contains a relation to other elements (Assets field, Entries field, Categories field etc) I'm getting a MySQL error. Here's the full exception message (the site's table prefix is bl_):

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bl_elements.id' in 'field list'
The SQL being executed was: SELECT `bl_elements`.`id`, `bl_content`.`title`, `bl_entries`.`typeId`, `bl_entries`.`sectionId`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId`, `structureelements`.`structureId`
FROM `bl_elements` `elements`
INNER JOIN `bl_entries` `entries` ON `entries`.`id` = `elements`.`id`
INNER JOIN `bl_elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
INNER JOIN `bl_content` `content` ON `content`.`elementId` = `elements`.`id`
LEFT JOIN `bl_structureelements` `structureelements` ON (`structureelements`.`elementId` = `elements`.`id`) AND (EXISTS (SELECT *
FROM `bl_structures`
WHERE (`id` = `structureelements`.`structureId`) AND (`dateDeleted` IS NULL)))
WHERE (`entries`.`sectionId`='9') AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`elements`.`draftId` IS NULL) AND (`elements`.`revisionId` IS NULL)
ORDER BY `title`) `subquery`
INNER JOIN `bl_entries` `entries` ON `entries`.`id` = `subquery`.`elementsId`
INNER JOIN `bl_elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `bl_elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
INNER JOIN `bl_content` `content` ON `content`.`id` = `subquery`.`contentId`
LEFT JOIN `bl_structureelements` `structureelements` ON (`structureelements`.`elementId` = `subquery`.`elementsId`) AND (`structureelements`.`structureId` = `subquery`.`structureId`)
ORDER BY `title`

Not sure what exectly is causing this issue. I checked the database, the bl_elements table is there as expected, as is the id column.

Craft Version & Installed Plugin Version

Craft: 3.7.10
Plugin: 1.1.2

To Reproduce

  1. Install Craft 3.7.10 and the CP Filters plugin (1.1.2)
  2. Go to the plugin's entries view and select an entry type to filter by.
  3. Filter by any field containing a relation to another element, select 'is assigned' and input any value in the text field.
  4. Click "Refresh results". The error quotes above (or a variation of it) appears.

Expected behavior

Filtering by fields with element relations should not result in an error.

Additional context

Note sure if there's anything wrong with my installation – everything else is working fine. So I'm not sure if the steps to reproduce are complete, but I don't think I have any special plugins or modules that would mess with the database structure or the element queries, so I don't think it's just an issue with my installation.

Issue when filtering between 2 dates.

Describe the bug
Whenever I try to filter between 2 dates, the results are not correct it seems as if the relation between the 2 dates has an OR relation.

Example:
2 different fields and dates returns the correct data.
image

2 same fields with different dates returns pretty much everything
image

EDIT: The order of the greater than and less than also makes a difference,
image
image

Even when changing the dates returns the same data:
image

Craft Version & Installed Plugin Version
Craft: Craft CMS 3.5.15.1
Plugin: 1.1.1

To Reproduce
Steps to reproduce the behavior:

  1. Add 2 rows with the same 'date' field (post date, date created, etc.)
  2. enter 2 dates to show a list of items between the 2 dates
  3. See wrong data

Expected behavior
It should show a correct list between the 2 dates.

Create a "saved filter" custom field

I'm trying to extend the saved filters with custom fields. One approach is to create a custom field extending the craft\fields\BaseRelationField class (similar to how Assets, Categories, Entries, Tags and Users fields do) so that you can add a saved filter as a field of a section along with the rest of the fields I need (in my case an image to show a "preview" to the user, and other fields).

I've managed to create the field after doing the following modifications to the Masuga\CpFilters\elements\SavedFilter element:

This methods need to be defined in order to show the results in a table

	protected static function defineTableAttributes(): array
	{
		return [
			'title' => \Craft::t('app', 'Title'),
			'filterElementType' => \Craft::t('cpfilters', 'Type')
		];
	}

This method need to return an array

	protected static function defineSources(string $context = null): array
	{
		$sources = [
			[
				'key'      => '*',
				'label'    => Craft::t('cpfilters', 'Saved Filters'),
				'defaultSort' => ['elements.dateCreated', 'desc']
			],
		];

		return $sources;
	}

There was a typo in the i18n key

	protected static function defineSortOptions(): array
	{
		return [
			'elements.dateCreated' => Craft::t('app', 'Date Created'),
			'title' => Craft::t('cpfilters', 'Title')
		];
	}

I'm happy to create a PR if you find it useful.

After doing these changes I could create the custom field and use it in my entries without any problem. This is an example of a CP filter called "Artwork" being used in one of my entries
image

Throws error on /admin/cpfilters

After a fresh install of the plugin, first click on CPFilters menu item throws an exception.

My setup:

PHP version | 7.4.6
Linux 4.19.76-linuxkit
PostgreSQL 11.6
Craft Pro 3.5.8

PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: integer ~~ unknown
LINE 3: WHERE "id" LIKE $1
                   ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts. in /var/www/html/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT "id"\nFRO...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Command.php(444): yii\db\Command->queryInternal('fetchAll', 7)
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(318): yii\db\Command->queryColumn()
#4 /var/www/html/vendor/craftcms/cms/src/db/Query.php(202): yii\db\Query->column(NULL)
#5 /var/www/html/vendor/craftcms/cms/src/elements/db/EntryQuery.php(926): craft\db\Query->column()
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/EntryQuery.php(806): craft\elements\db\EntryQuery->_normalizeTypeId()
#7 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1326): craft\elements\db\EntryQuery->beforePrepare()
#8 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\pgsql\QueryBuilder))
#9 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\EntryQuery))
#10 /var/www/html/vendor/yiisoft/yii2/db/Query.php(478): yii\db\Query->createCommand(Object(craft\db\Connection))
#11 /var/www/html/vendor/craftcms/cms/src/db/Query.php(259): yii\db\Query->queryScalar('COUNT(*)', NULL)
#12 /var/www/html/vendor/yiisoft/yii2/db/Query.php(366): craft\db\Query->queryScalar('COUNT(*)', NULL)
#13 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1466): yii\db\Query->count('*', NULL)
#14 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1499): craft\elements\db\ElementQuery->count()
#15 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(92): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\db\EntryQuery), 'count', Array, 'method', false, false)
#16 /var/www/html/storage/runtime/compiled_templates/04/04ede9db1361d6b79415374e08c63cc513b671983a5ca346f6f44e4481d807c2.php(85): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\db\EntryQuery), 'count', Array, 'method')
#17 /var/www/html/vendor/twig/twig/src/Template.php(407): __TwigTemplate_6b8171c384834fa91853229df8c25051ad821c05b1972327e47111707557d4a7->doDisplay(Array, Array)
#18 /var/www/html/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#19 /var/www/html/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#20 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#21 /var/www/html/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#22 /var/www/html/vendor/craftcms/cms/src/web/View.php(392): Twig\Environment->render('cpfilters/_inde...', Array)
#23 /var/www/html/vendor/craftcms/cms/src/web/View.php(453): craft\web\View->renderTemplate('cpfilters/_inde...', Array)
#24 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(251): craft\web\View->renderPageTemplate('cpfilters/_inde...', Array, 'cp')
#25 /var/www/html/vendor/masugadesign/cpfilters/src/controllers/CpController.php(52): craft\web\Controller->renderTemplate('cpfilters/_inde...')
#26 [internal function]: Masuga\CpFilters\controllers\CpController->actionFilters()
#27 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#28 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#29 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(189): yii\base\Controller->runAction('filters', Array)
#30 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('filters', Array)
#31 /var/www/html/vendor/craftcms/cms/src/web/Application.php(280): yii\base\Module->runAction('cpfilters/cp/fi...', Array)
#32 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('cpfilters/cp/fi...', Array)
#33 /var/www/html/vendor/craftcms/cms/src/web/Application.php(265): yii\web\Application->handleRequest(Object(craft\web\Request))
#34 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#35 /var/www/html/web/index.php(21): yii\base\Application->run()
#36 {main}

Next yii\db\Exception: SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: integer ~~ unknown
LINE 3: WHERE "id" LIKE $1
                   ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
The SQL being executed was: SELECT "id"
FROM "craft_entrytypes"
WHERE "id" LIKE '%' in /var/www/html/vendor/yiisoft/yii2/db/Schema.php:677
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'SELECT "id"\nFRO...')
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT "id"\nFRO...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Command.php(444): yii\db\Command->queryInternal('fetchAll', 7)
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(318): yii\db\Command->queryColumn()
#4 /var/www/html/vendor/craftcms/cms/src/db/Query.php(202): yii\db\Query->column(NULL)
#5 /var/www/html/vendor/craftcms/cms/src/elements/db/EntryQuery.php(926): craft\db\Query->column()
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/EntryQuery.php(806): craft\elements\db\EntryQuery->_normalizeTypeId()
#7 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1326): craft\elements\db\EntryQuery->beforePrepare()
#8 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\pgsql\QueryBuilder))
#9 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\EntryQuery))
#10 /var/www/html/vendor/yiisoft/yii2/db/Query.php(478): yii\db\Query->createCommand(Object(craft\db\Connection))
#11 /var/www/html/vendor/craftcms/cms/src/db/Query.php(259): yii\db\Query->queryScalar('COUNT(*)', NULL)
#12 /var/www/html/vendor/yiisoft/yii2/db/Query.php(366): craft\db\Query->queryScalar('COUNT(*)', NULL)
#13 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1466): yii\db\Query->count('*', NULL)
#14 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1499): craft\elements\db\ElementQuery->count()
#15 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(92): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\db\EntryQuery), 'count', Array, 'method', false, false)
#16 /var/www/html/storage/runtime/compiled_templates/04/04ede9db1361d6b79415374e08c63cc513b671983a5ca346f6f44e4481d807c2.php(85): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\db\EntryQuery), 'count', Array, 'method')
#17 /var/www/html/vendor/twig/twig/src/Template.php(407): __TwigTemplate_6b8171c384834fa91853229df8c25051ad821c05b1972327e47111707557d4a7->doDisplay(Array, Array)
#18 /var/www/html/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#19 /var/www/html/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#20 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#21 /var/www/html/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#22 /var/www/html/vendor/craftcms/cms/src/web/View.php(392): Twig\Environment->render('cpfilters/_inde...', Array)
#23 /var/www/html/vendor/craftcms/cms/src/web/View.php(453): craft\web\View->renderTemplate('cpfilters/_inde...', Array)
#24 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(251): craft\web\View->renderPageTemplate('cpfilters/_inde...', Array, 'cp')
#25 /var/www/html/vendor/masugadesign/cpfilters/src/controllers/CpController.php(52): craft\web\Controller->renderTemplate('cpfilters/_inde...')
#26 [internal function]: Masuga\CpFilters\controllers\CpController->actionFilters()
#27 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#28 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#29 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(189): yii\base\Controller->runAction('filters', Array)
#30 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('filters', Array)
#31 /var/www/html/vendor/craftcms/cms/src/web/Application.php(280): yii\base\Module->runAction('cpfilters/cp/fi...', Array)
#32 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('cpfilters/cp/fi...', Array)
#33 /var/www/html/vendor/craftcms/cms/src/web/Application.php(265): yii\web\Application->handleRequest(Object(craft\web\Request))
#34 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#35 /var/www/html/web/index.php(21): yii\base\Application->run()
#36 {main}
Additional Information:
Array
(
    [0] => 42883
    [1] => 7
    [2] => ERROR:  operator does not exist: integer ~~ unknown
LINE 3: WHERE "id" LIKE $1
                   ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
)

Multi-site support

Just installed on a multi-site but I can only see entries from the default site. Is this something that you guys plan to add anytime soon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.