Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ItemManager 2.0
Hello smsHH,

many thanks, I've fixed that!
Please download version 2.3.9 from extend, or just replace your file "/plugins/imanager/lib/Allocator.php" with the new version from GitHub.
Reply
Will do. Thank you for the quick update.
Reply
Hello! Thanks for this great plugin!
I have one question.
I make a request with the conditions. If conditions only 2 or less ($imanager->getItems("slug=$slug", "active=1 && condition1=$condition1")) - all ok. But if I add conditions - ($imanager->getItems("slug=$slug", "active=1 && condition1=$condition1 && condition2=$condition2")) - It gives false or no results.
Whether it is possible to do more than 2 terms?

P.S. I am sorry for my poor English Smile
Reply
Hi ChronosMe1,

yes, just let your result pass through the filter again ;-) look:

PHP Code:
$imanager imanager();
$itemMapper $imanager->getItemMapper();
$category $imanager->getCategoryMapper()->getCategory('slug=car');
$itemMapper->init($category->id);

$results $itemMapper->getItems('active=1 && sporty=1');
if(
$results) {
    
$results $itemMapper->getItems('efficient=1'00$results);
    if(
$results) {
        foreach(
$results as $result) {
            echo 
$result->name .'<br>';
        }
    }

Reply
If you need it often, you can also create a simple function for these purposes, something like:

PHP Code:
function filterResults(array $selectors$slug) {
    
$imanager imanager();
    
$itemMapper $imanager->getItemMapper();
    
$category $imanager->getCategoryMapper()->getCategory("slug=$slug");
    
$itemMapper->init($category->id);

    
$results = array();
    foreach(
$selectors as $selector) {
        if(!empty(
$results)) {
            
$results $itemMapper->getItems($selector02000$results);
        } else {
            
$results $itemMapper->getItems($selector);
        }
        if(!
$results) break;
    }
    if(!empty(
$results)) return $results;
    return 
false;



And your function call could be:

PHP Code:
if($results filterResults(array('active=1''sporty=1''comfortable=1''efficient=1'), 'car')) {
    foreach(
$results as $result) {
        echo 
$result->name .'<br>';
    }
} else {
    echo 
'Nothing was found!';

Reply
Thank you very much! Everything is working!!  Smile
Reply
Hello Bigin,

just a question: is it possible to change the CKEditor config file for the ItemManager? I've looked through your files but I haven't found anything.

Thank you very much.
Reply
Hi smsHH,

Im not sure what do you mean when you say CKEditor config, ItemManager uses the default GS setting for editor. You can configure ItemManager's CKEditor the same way this is done for GS editor:  http://get-simple.info/wiki/how_to:edito...re_options

Hmmm, while looking through the code I have discovered a little issue there, with a comma. Thus, it might be that you get an js error, if you'll try to change GS default settings for CKEditor. To avoid this, you'll need to apply the patch to your IM installation:

/plugins/imanager/lib/processors/fields/FieldEditor.php
/plugins/imanager/tpl/editor.field.im.tpl


Replace these two files by:
FieldEditor.php
editor.field.im.tpl

I will fix the bug for the next release in extend.
Reply
Hello Bigin,

thank you! I've tried already a custom config for CKE but at the first time (will check that again) the WYSIWYG field in the ItemManager completely disappeared, so I decided to change this file

\admin\template\js\ckeditor\config.js

and after that the definitions changed for the pages but not for the IM WYSIWYG fields.

So this is why I asked where I can change the default definitions to something like this

Code:
$toolbar = "
    [['Bold', 'Italic', 'Underline', 'NumberedList', 'BulletedList', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', 'Table', 'TextColor', 'Link', 'Unlink', 'Image', 'RemoveFormat', 'Source'],
    '/',
    ['HorizontalRule', 'Format']],
";

but now I see where I can do it - thanks to you :-)
Reply
(2017-02-25, 19:03:24)smsHH Wrote: thank you! I've tried already a custom config for CKE but at the first time (will check that again) the WYSIWYG field in the ItemManager completely disappeared, so I decided to change this file

Hi, yes, that's the reason why you need the patch i posted before ;-)
Reply
Hello! There is a small problem. Smile

On the localhost all works. But on the real server when you try to save the page - error 500:

Fatal error: Call to a member function get() on boolean in /home/....../plugins/imanager/lib/CategoryProcessor.php on line 28
Reply
Hi, what page are trying to save?
I see no problem there, I think something went wrong during installation or transfer to your host. Check all IM directories are correct transferred,  and do not forget: /data/imanager/* and /data/uploads/imanager/*
Reply
(2017-04-05, 00:14:08)Bigin Wrote: Hi, what page are trying to save?
I see no problem there, I think something went wrong during installation or transfer to your host. Check all IM directories are correct transferred,  and do not forget: /data/imanager/* and /data/uploads/imanager/*

I use the plug-in IM Extra Fields and create a Getsimple page. Then I select the IM-category and click save - error 500. To get around this error, I select the IM menu and create a new element there. After that, everything works.
Reply
Ok maybe IM Extra Fields has a bug, I'll check that, thx.
Reply
Hmm…I can't reproduce the issue here, need more information and detailed description.
Reply
(2017-04-05, 02:55:30)Bigin Wrote: Hmm…I can't reproduce the issue here, need more information and detailed description.

This situation appears on two sites. And in the localhost (openserver) this error is not present.

Here videos:
1. I create a page, save it, get an error (https://www.youtube.com/watch?v=diKWBpK4_ss)
2. I create a new IM element, save it. The error disappears (https://www.youtube.com/watch?v=Cpixbft1PyQ)
Reply
thx. But the first video shows that Auto-open Page Options plugin is causing this error and not IM Extra Fields!
Reply
(2017-04-05, 03:49:08)Bigin Wrote: thx. But the first video shows that Auto-open Page Options plugin is causing this error and not IM Extra Fields!

It's just a warning. If I turn off Auto-open Page Options plugin, the error remains.
Reply
(2017-04-05, 03:57:53)ChronosMe1 Wrote: It's just a warning. If I turn off Auto-open Page Options plugin, the error remains.

Yes, but the message outputs before session is set, so that just does not work.
Make a video with disabled Auto-open Page Options plugin pls
Reply
(2017-04-05, 04:06:15)Bigin Wrote:
(2017-04-05, 03:57:53)ChronosMe1 Wrote: It's just a warning. If I turn off Auto-open Page Options plugin, the error remains.

Yes, but the message outputs before session is set, so that just does not work.
Make a video with disabled Auto-open Page Options plugin pls

https://www.youtube.com/watch?v=311wUOqr2TE
The first half of the video - with the debug mode turned off.
Reply
Ok, thanks a lot! I'll check this
Reply
I have tried everything, I can't reproduce the issue on my environment... It seems as if your SESSION['cat'] isn't set, so that isCategoryValid() returns the value FALSE.

Question: It happens only when you try to save the page, if there is no items for this category, right?

You might check your console, maybe there is a Javascript error? Another option would be to disable other plugins, then try again.

Then, you can look at the SESSION and POST variable on its values within the saveItem() function in /plugins/im_extra_fields/controller/processor.php file. Just put the following lines on the top of the function. After that, you can find the log file under /data/other/logs/imlog_2017xx.txt


Code:
Util::dataLog('$_POST[imcat] = ' . (int)$_POST['imcat']);
Util::dataLog('$_SESSION[cat] = ' . (int)$_SESSION['cat']);
Reply
Yes, I think it's in the SESSIONS.

Here's the log after the error:
[ 05.04.2017 - 08:17:12 ] $_POST[imcat] = -1
[ 05.04.2017 - 08:17:12 ] $_SESSION[cat] = 0

Here is the log after creating the IM-item and the disappearance of the error:
[ 05.04.2017 - 08:18:50 ] $_POST[imcat] = -1
[ 05.04.2017 - 08:18:50 ] $_SESSION[cat] = 1
Reply
Hello,

excellent, I'm sure we'll manage that soon.

Let's try following, open /plugins/imanager/lib/CategoryProcessor.php file and comment out the __construct() function. Then, copy and paste
this code instead:

Code:
public function __construct(CategoryMapper &$category)
{
    // initialise categories
    $this->category = $category;
    if(self::isCategoryValid())
    {
        $this->is_cat_exist = true;
    } else
    {
        $count = $this->category->countCategories();
        Util::dataLog('Category count: '.$count);
        Util::dataLog('CategoryMapper: '.print_r($this->category, true));
        if($count > 0)
        {
            $this->is_cat_exist = true;
            $cur = current($this->category->categories);
            Util::dataLog('Current category: '.print_r($cur, true));
            $this->setCategory($cur->id);
        } else
        {
            $this->is_cat_exist = false;
        }
    }
}

After that, create a new page and show me your log file. Many thanks again!
Reply
(2017-04-05, 16:36:58)Bigin Wrote: After that, create a new page and show me your log file. Many thanks again!

Yes! It is working! Here's the log-file

Thank you for the wonderful plug-in and support!  Smile
Reply




Users browsing this thread: 1 Guest(s)