Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Item Manager Extended (Beta)
#76
polish language for this plugin by me ;-):
http://get-simple.info/extend/plugin-lan...-beta/831/
user plugin: scroll to top
Reply
#77
sort_array_cat is a sorting comparison function, you need to use it with a sort function.

have you tried using subval_sort in core ?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#78
nope... i'm not trying to do it... now its a 00:15 am in poland... tommorow i will try do it... and i write how is a progress in my case. Thank You shawn_a!
user plugin: scroll to top
Reply
#79
(2014-06-24, 08:00:53)shawn_a Wrote: sort_array_cat is a sorting comparison function, you need to use it with a sort function.

have you tried using subval_sort in core ?

Or you can try to use strcmp. If the first argument to strcmp is lexographically smaller to the second, then the value returned will be negative. If both are equal, then it will return 0.And if the first is lexograpically greater than the second then a positive number will be returned. Or use strcasecmp() which ignores case.

your sorting function
PHP Code:
function sort_cat($a$b)
{
    
$a $a['category'];
    
$b $b['category'];
    return 
strcasecmp($a$b);



then try follows
PHP Code:
$manager = new ImController();
$preferences imModel::getPref();

$output_arr = array();
foreach(
$preferences->categories->category as $cat)
{
    
ImCategory::setCategory($cat);
    
$manager->runModelMethod('gen_register');
    
$items array_reverse($manager->getModelValue('items_ordered_struct'));  
    
$strcat = (string) $cat;
    
$output_arr[] = array( 'category' => $strcat,
         
'value' => '<a class=" my_class" title="' $strcat '" 
         href="nasza-oferta?kategoria=' 
$strcat '">' $strcat ' (' count($items) . ')</a><br />'
    
);
}

// There function call
usort($output_arr'sort_cat');

foreach(
$output_arr as $output)
{
    echo 
$output['value'];

Reply
#80
you should use a natcasesort sort so that your mix of alpha and numerics sort properly.
1 before 10 etc, subval in core has this as default.

PHP Code:
/**
 * Sub-Array Sort
 *
 * Sorts the passed array by a subkey
 *
 * @since 1.0
 *
 * @param array $a
 * @param string $subkey Key within the array passed you want to sort by
 * @param string $order - order 'asc' ascending or 'desc' descending
 * @param bool $natural - sort using a "natural order" algorithm
 * @return array
 */
function subval_sort($a,$subkey$order='asc',$natural true) {
    if (
count($a) != || (!empty($a))) { 
        foreach(
$a as $k=>$v) {
            if(isset(
$v[$subkey])) $b[$k] = lowercase($v[$subkey]);
        }

        if(!isset(
$b)) return $a;

        if(
$natural){
            
natsort($b);
            if(
$order=='desc'$b array_reverse($b,true);    
        } 
        else {
            (
$order=='asc')? asort($b) : arsort($b);
        }
        
        foreach(
$b as $key=>$val) {
            
$c[] = $a[$key];
        }

        return 
$c;
    }


Tthis does not preserve keys however unless you edit
$c[] = $a[$key]; to $c[$key] = $a[$key]
which will be fixed in 3.4
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#81
Brick 
Hi people. I'm using a 3.3.2 of GS. Today I installed IM from the pugins on the site. There was a 0.5 version, but site writes that version is 0.6. Also It's not important.

When I activated IM and went to Item manager tab it created some files - ok. But after page reloading it writes me:

PHP Code:
Warningsort() expects parameter 1 to be array, boolean given in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 502

Warning
array_reverse() [function.array-reverse]: The argument should be an array in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 503

Warning
Invalid argument supplied for foreach() in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 255 
It's about View all tab.

And second, when I opened Categories tab, I got errors too:
PHP Code:
Warningsort() expects parameter 1 to be array, boolean given in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 502

Warning
array_reverse() [function.array-reverse]: The argument should be an array in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 503

Warning
Invalid argument supplied for foreach() in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 255

Warning
sort() expects parameter 1 to be array, boolean given in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 502

Warning
array_reverse() [function.array-reverse]: The argument should be an array in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 503 


Please, men, say me how I can fix the errors?

I forgot to add, I got same errors when I deleted 0.5 version from gs site and installed master version from github
Reply
#82
Which PHP version are you runnig? Are you sure that config file have been created and is writable?
… /imanager/data/other/imanager.xml

(2014-07-10, 01:20:09)ak40u Wrote:
PHP Code:
Warningsort() expects parameter 1 to be array, boolean given in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 502

Warning
array_reverse() [function.array-reverse]: The argument should be an array in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 503

Warning
Invalid argument supplied for foreach() in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 255 

The method item_files() is never executed automatically after IM setup! It seems that something has gone wrong during installation/upgrade. If you upgrade or reinstall from a previous installation of IM, please delete your old installation files before installing the new one.

…/data/other/imanager.xml
…/data/uploads/imanager/
…/data/imanager/
and all of …/data/other/*.im.fields.xml files
Reply
#83
warnings are not errors. Just saying, you can ignore them.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#84
(2014-07-10, 05:44:41)Bigin Wrote: Which PHP version are you runnig? Are you sure that config file have been created and is writable?
… /imanager/data/other/imanager.xml

(2014-07-10, 01:20:09)ak40u Wrote:
PHP Code:
Warningsort() expects parameter 1 to be array, boolean given in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 502

Warning
array_reverse() [function.array-reverse]: The argument should be an array in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 503

Warning
Invalid argument supplied for foreach() in /home/ppiczosn/public_html/ihrashky/plugins/imanager/class/im.model.class.php on line 255 

The method item_files() is never executed automatically after IM setup! It seems that something has gone wrong during installation/upgrade. If you upgrade or reinstall from a previous installation of IM, please delete your old installation files before installing the new one.

…/data/other/imanager.xml
…/data/uploads/imanager/
…/data/imanager/
and all of …/data/other/*.im.fields.xml files

Hi, Bigin. Thank you for fast answer.
I have used PHP 5.2, and after your answer I set it as 5.5 and plugin errors disappeared.

Also, you wrote the best uninstall instruction, I recommend to add it to your plugin manuals, because there is no detailed instruction how to delete plugin clearly.

And tomorrow I'm going to try install emubox - so see you soon Wink
Reply
#85
Hello.
Where I have to place a controller components, which described in main install manual?

I created two components in theme in admin panel, but it seems that it was wrong place. And then I put a {% im_list_page_generator %} into theme page template. So, it gives me only blank page with h1 and {% im_list_page_generator %}
Reply
#86
Hi ak40u,

if you are using your components within theme, then you should always use standard PHP tags
Code:
<?php get_component('your_component'); ?>
Reply
#87
(2014-07-10, 19:23:53)Bigin Wrote: Hi ak40u,

if you are using your components within theme, then you should always use standard PHP tags
Code:
<?php get_component('your_component'); ?>

Hi, Bigin.

Yes, I created "im_details_page_generator" and "im_list_page_generator" within theme. Then I paste php code that you write for plugin description. Then I put <?php get_component('im_details_page_generator'); ?> and <?php get_component('im_list_page_generator'); ?> into theme template. Then I created a new page from the template. But when I opened the page, I look only title and footer. When I saw an html code, I didn't find any code about plugin's items.

Could you write a detailed instruction how to make items available for showing?
Reply
#88
Describe for me your project, what are you plan to do and what you have already tried? What are your custom fields and categories and what sort of fields you want to display?

It should also be noted that I can only provide indications, no halfe day courses for php beginners.
Reply
#89
(2014-07-11, 16:35:49)Bigin Wrote: Describe for me your project, what are you plan to do and what you have already tried? What are your custom fields and categories and what sort of fields you want to display?

It should also be noted that I can only provide indications, no halfe day courses for php beginners.

It will be a grid of icons, which goes to item's page.
Grid like this http://cs620519.vk.me/v620519381/dddd/PYOPrmxQ_es.jpg
Item's page will be a simply with only one editable wisywyg field in the IM panel.

I have already created 2 components with your code http://cs620519.vk.me/v620519381/dde6/f8x82wPFhJs.jpg
I put "<?php get_component('im_list_page_generator'); ?>" into a template.
I created a category in the Item Manager.
I created fields for the category http://cs620519.vk.me/v620519381/ddf7/p8086eM1Mac.jpg
I created items
I created a page from the template.
I opened the page
I didn't see items.
Reply
#90
Today I made a details page and a list of items. It works well, but pictures are not shown. As you see bellow, image src is empty. I checked it in itemName.xml file and in Item Manager interface and image src have to be.

Code:
<div id="manager"><div class="im-resultwrap"><a class="im-itempic" href="item-manager-details-page?item=test-shop"><img alt="" class="im-pic" src=""><span class="im-hidden"></span></a></div>...<div class="paginator-wrapper"></div>
</div>

The path of image is "/home/ppiczosn/public_html/ihrashky/data/uploads/imanager/pokupat-detskie-veschi-v-magazine-prosto.jpg" (I took this path from Item Manager => Edit Item => File select Field.


Here is my php components:
PHP Code:
<?php
// create controller instance
$manager = new ImController();
// setup category
ImCategory::setCategory('Stores');
// limiting items per page
ImModel::setPref('itemsperpage'10);
// setup sort by field
ImModel::setPref('sortby''sequence');
// setup details page
ImModel::setPref('page''item-manager-details-page');
/* Run action: generates item register calculated out of all the mentioned parameters.
   For this example's purpose, we'll need two custom fields in our List view: a 'thumb' to 
   display as a link to our Details page and 'sequence' to determine the order of products
   displayed. */
$manager->runModelMethod('gen_register', array('loop-thumb-1''sequence'));
/* This method returns an array which contains multiple item data specified by gen_register and   
   depending on the settings made. */ 
$items $manager->getModelValue('items_ordered_struct');
// Returns a page data array based on the settings made
$pagedata $manager->getModelValue('pagedata');
// templates as strings, just for demonstration
if(!$manager->tplRegister(array('loop' => 
    
'<div class="im-resultwrap">'
        
.'<a class="im-itempic" href="[[page]]?item=[[ slug ]]"><img alt="" class="im-pic" src="[[loop-thumb-1]]" /><span class="im-hidden"></span></a>'
    
.'</div>''frontendlist' => '<div id="manager">[[ loop ]][[ paginator ]]</div>')))
{
    return;
}
// string append
$loop '';
foreach(
$pagedata['itemkeys'] as $key)
{
    
// Renders the 'loop' template to string concatenation by replacing placeholders
   
$loop .= $manager->paint('loop', array('loop-thumb-1' => $items[$key]['loop-thumb-1'], 
                
'page' => $pagedata['viewpage'], 'slug' => $items[$key]['slug']));
}
/* If we want to split our item data across several pages, for instance, with 'Previous/Next' 
   links, for this, we can use already existing default templates. We then call the paginator()
   method in a controller action. This method gets passed the default paginator templates by
   calling the getTplKit('paginator') before paint() renders the template to output */
echo $manager->paint('frontendlist', array('loop' => $loop
        
'paginator' => $manager->paginator(ImModel::getTplKit('paginator'))));
?>

PHP Code:
<?php
$manager 
= new ImController();
$id = isset($_GET['item']) ? $_GET['item'] : '';
/* This method returns an array which contains detailed data of a single item 
   specified by item ID */
if(!$itemdata $manager->runModelMethod('get_item_data'$id))
{
    return;
}
$path ImModel::getProp('paths''siteurl').ITEMUPLOADDIR;
// templates as files for demonstration
if(!$manager->tplRegister(array('details' =>
    
GSPLUGINPATH.'imanager/tpl/frontend/page.details.tpl'
    
'detailsloop' =>  GSPLUGINPATH.'imanager/tpl/frontend/page.details.loop.tpl')))
{
    return;
}
$loop '';
$preload = array();
for(
$i=1$i 6$i++) {
    if(!empty(
$itemdata->{'loop-thumb-'.$i})) {
        
$loop .= $manager->paint('detailsloop', array('count' => $i));
    }
    if(!empty(
$itemdata->{'image-'.$i})) {
        
$preload[]= '"[[image-'.$i.']]"';
    }
}
$preload implode(','$preload);
$manager->tplRegister(array('currloop' => $loop));
$loop $manager->paint('currloop', array(
    
'image-1' => $path.basename($itemdata->{'image-1'}),
    
'image-2' => $path.basename($itemdata->{'image-2'}),
    
'image-3' => $path.basename($itemdata->{'image-3'}),
    
'image-4' => $path.basename($itemdata->{'image-4'}),
    
'image-5' => $path.basename($itemdata->{'image-5'}),
    
'image-6' => $path.basename($itemdata->{'image-6'}),
    
'loop-thumb-1' => $path.basename($itemdata->{'loop-thumb-1'}),
    
'loop-thumb-2' => $path.basename($itemdata->{'loop-thumb-2'}),
    
'loop-thumb-3' => $path.basename($itemdata->{'loop-thumb-3'}),
    
'loop-thumb-4' => $path.basename($itemdata->{'loop-thumb-4'}),
    
'loop-thumb-5' => $path.basename($itemdata->{'loop-thumb-5'}),
    
'loop-thumb-6' => $path.basename($itemdata->{'loop-thumb-6'}))
);
echo 
$manager->paint('details', array(
    
'preload' => $preload,
    
'image-1' => $path.basename($itemdata->{'image-1'}),
    
'image-2' => $path.basename($itemdata->{'image-2'}),
    
'image-3' => $path.basename($itemdata->{'image-3'}),
    
'image-4' => $path.basename($itemdata->{'image-4'}),
    
'image-5' => $path.basename($itemdata->{'image-5'}),
    
'image-6' => $path.basename($itemdata->{'image-6'}),
    
'title' => stripslashes(html_entity_decode($itemdata->{'title'}, ENT_QUOTES'UTF-8')),
    
'description' => stripslashes(html_entity_decode($itemdata->{'description'}, ENT_QUOTES'UTF-8')),
    
'loop-tpl' => $loop)
);
?>
Reply
#91
Check your image field name in register. I could see that your field name is just image, why do you use loop-thumb-1 in register?

(2014-07-12, 16:48:49)ak40u Wrote:
PHP Code:
$manager->runModelMethod('gen_register', array('loop-thumb-1''sequence')); 


You cannot simply copy my components and paste them into your project. The component parameter need to be adjusted first.

Here is a simple usage example:

I see that you are using 3 custom fields: description, image and sequence.
Your list_page_generator component could then look like this, for example (step by step):

Create controller instance:
PHP Code:
$manager = new ImController(); 


Register category:
PHP Code:
ImCategory::setCategory('Stores'); 


Define any number of elements per page:
PHP Code:
ImModel::setPref('itemsperpage'10); 


This is the sort field, how items are displayed on the list page (1, 2, 3, ...):
PHP Code:
ImModel::setPref('sortby''sequence'); 


You can put a slug for details page here, for example:
PHP Code:
// ImModel::setPref('page', 'item-manager-details-page'); 


Your custom fields (description, image, sequence) are registered here:
PHP Code:
$manager->runModelMethod('gen_register', array('description''image''sequence')); 


The method returns the item data object. For example, you could use var_dump($items) PHP-function to display what it contains:
PHP Code:
$items $manager->getModelValue('items_ordered_struct'); 


The method returns the page data array to generate your pages:
PHP Code:
$pagedata $manager->getModelValue('pagedata'); 


Next, you should create your templates HTML structure. There are two options: Either you create a template file and pass the path as parameter to register script, or script gets a template as a string. I use the second option for my example.
Template containing the HTML for the regular row items (image and title are placeholder for your custom fields):
PHP Code:
$rowTpl '
        <div class="itemrow">
        <p><img alt="" class="mypic" src="[[ image ]]" /></p>
        <p>[[ title ]]</p>
    </div>
'



Wrapper template containing your row template above and pagination:
PHP Code:
$wrapperTpl '<div id="my_wrapper">[[ row_tpl ]][[ paginator ]]</div>'


Register your templates now:
PHP Code:
$manager->tplRegister(array('row_tpl' => $rowTpl'wrapper_tpl' => $wrapperTpl)); 


You must loop through the items now and replace the template placeholders with the current item values:
PHP Code:
$rows '';
foreach(
$pagedata['itemkeys'] as $key)
{
    
// Renders placeholders in row template
    
$rows .= $manager->paint('row_tpl'
        array(
'image' => $items[$key]['image'],
                
'title' => $items[$key]['title']
        )
    );


If you want to split items across several pages, for instance, with 'Previous/Next' links:
PHP Code:
echo $manager->paint('wrapper_tpl', array('row_tpl' => $rows,
        
'paginator' => $manager->paginator(ImModel::getTplKit('paginator')))); 
Reply
#92
(2014-07-12, 19:07:40)Bigin Wrote: Check your image field name in reg...

Thank you! You're the best of the best!
Can you write the same manual for details page?
Reply
#93
Hello,

Any reason this isn't outputting nothing?

template.php
PHP Code:
<?php 
    $manager 
= new ImController();   
    
ImCategory::setCategory('Corpo Jurídico');
    
ImModel::setPref('itemsperpage'6); 
    
ImModel::setPref('sortby''sequence');
    
$manager->runModelMethod('gen_register', array('foto''especialidade''minicurriculo'));
    
$foto $manager->getModelValue('foto'); 
    
$especialidade $manager->getModelValue('especialidade');
    
$minicurriculo $manager->getModelValue('minicurriculo');
    echo 
$foto;
    echo 
$especialidade;
    echo 
$minicurriculo;
?>

Or this also:

some_component
PHP Code:
<?php
$manager 
= new ImController(); 
ImCategory::setCategory('Corpo Jurídico');
ImModel::setPref('itemsperpage'6);
ImModel::setPref('sortby''sequence');   
$manager->runModelMethod('gen_register', array('foto''especialidade''minicurriculo''sequence'));
$items $manager->getModelValue('items_ordered_struct'); 
$pagedata $manager->getModelValue('pagedata'); 
$rowTpl '
        <div class="itemrow">
        <p><img alt="" class="mypic" src="[[ foto ]]" /></p>
        <p>[[ title ]]</p>
        <p>[[ especialidade ]]</p>
        <p>[[ minicurriculo ]]</p>
    </div>
'
;  
$wrapperTpl '<div id="my_wrapper">[[ row_tpl ]][[ paginator ]]</div>'
$manager->tplRegister(array('row_tpl' => $rowTpl'wrapper_tpl' => $wrapperTpl)); 
$rows '';
foreach(
$pagedata['itemkeys'] as $key)
{
    
// Renders placeholders in row template
    
$rows .= $manager->paint('row_tpl'
        array(
'foto' => $items[$key]['foto'],
                
'title' => $items[$key]['title'],
                
'especialidade' => $items[$key]['especialidade'],
                
'minicurriculo' => $items[$key]['minicurriculo'],
        )
    );

?>

template.php
PHP Code:
<?php get_component('some_component'); ?>

This plugin is great, but to output the result is a pain....

-- Edit --

I've copied the exact same example you demonstrated on the first page, and still I get partial results. Using the "im_list_page_generator" component it outputs only the ring image. When I click it it leads to 404, because of lack of config.

While using "im_details_page_generator" component, nothing shows up.

I'm not using DynPages, I'm a newbie theme developer trying to embed some functions directly to my theme...

------ Edit 3 -------

Nevermind... Got it....!!

Well, after a whole afternoon got it working, my final code looks something like this (not styled or anything yet, but works):

template.php
PHP Code:
<?php
                    $manager 
= new ImController();
                    
ImCategory::setCategory('Corpo Jurídico');
                    
ImModel::setPref('itemsperpage'10);
                    
ImModel::setPref('sortby''sequence');
                    
ImModel::setPref('page''item-manager-details-page');
                    
$manager->runModelMethod('gen_register', array('foto''especialidade''minicurriculo'));
                    
$items $manager->getModelValue('items_ordered_struct');
                    
$pagedata $manager->getModelValue('pagedata');
                    if(!
$manager->tplRegister(array('loop' => 
                        
'<div class="im-resultwrap">'
                            
.'<img alt="" src="[[ foto ]]" /> [[title]] [[especialidade]] [[minicurriculo]]'
                        
.'</div>''frontendlist' => '<div id="manager">[[ loop ]][[ paginator ]]</div>')))
                    {
                        return;
                    }
                    
$loop '';
                    foreach(
$pagedata['itemkeys'] as $key)
                    {
                       
$loop .= $manager->paint('loop', array(
                           
'foto' => $items[$key]['foto'], 
                           
'especialidade' => $items[$key]['especialidade'],
                           
'minicurriculo' => $items[$key]['minicurriculo'],
                           
'title' => $items[$key]['title']
                       ));
                    }
                    echo 
$manager->paint('frontendlist', array('loop' => $loop
                            
'paginator' => $manager->paginator(ImModel::getTplKit('paginator'))));
                
?>

I'm calling the PHP directly in template.php, not using components.
Reply
#94
Also, the image upload script is really, really bad...

You can access it without even being logged as admin... I will leave the image upload form as a text input, and ask the user to upload it using Get-Simple built in uploader....

-- Edit --

Adding this code to plugins/imanager/uploadscript/upload.ini.php seems to solve the problem stated above:

PHP Code:
include('../../../admin/inc/common.php');
login_cookie_check();

/* I strongly advice to search for this line and replace it like this. The original code uses $_SERVER['DOCUMENT_ROOT'], that's insecure and wans't configured to work with HTTPS  */

'upload_script_url'        => GSPLUGINPATH.'imanager/uploadscript/uploadwindow.php'
Reply
#95
I am glad that you have worked it out. But you are right the „upload script“ was a poor quick solution and not really fit into the Item Manager concept, feel free to modify or change its settings.
Reply
#96
it's possible to add a some fields/options to better and easier configure this plugin?
i write about:
- change name of category (maybe add a unique id for this...)
- when creating a new category / it should have a custom select list from "what category it should get a default field list...example: different fields / number of fields for jeverly... different fields for cars, different for bicycles
- categories sort options to custom, asc, dsc, last added,
- products list sort options to custom, asc, dsc, last added,
- delete category or item.... have own backup's... and easy system to restore.
- image upload from the default image uploader get simple.. or something else.. maybe better than this what is now used.. (example: pgrfilemanager)
user plugin: scroll to top
Reply
#97
Hi xxdex,

(2014-08-06, 09:07:00)xxdex Wrote: - change name of category (maybe add a unique id for this...)

Category name is a unique ID! – For your own purposes you can use a hidden field with label „my_custom_category_to_rename“ and as the default value „my_category_name“. So you can rename it as much as you like.


(2014-08-06, 09:07:00)xxdex Wrote: - when creating a new category / it should have a custom select list from "what category it should get a default field list...example: different fields / number of fields for jeverly... different fields for cars, different for bicycles

I fail to understand that.


(2014-08-06, 09:07:00)xxdex Wrote: - categories sort options to custom, asc, dsc, last added,
- products list sort options to custom, asc, dsc, last added,

I believed we have already been found a solution:

(2014-06-24, 09:01:45)Bigin Wrote:
(2014-06-24, 08:00:53)shawn_a Wrote: sort_array_cat is a sorting comparison function, you need to use it with a sort function.

have you tried using subval_sort in core ?

Or you can try to use strcmp. If the first argument to strcmp is lexographically smaller to the second, then the value returned will be negative. If both are equal, then it will return 0.And if the first is lexograpically greater than the second then a positive number will be returned. Or use strcasecmp() which ignores case.

your sorting function
PHP Code:
function sort_cat($a$b)
{
    
$a $a['category'];
    
$b $b['category'];
    return 
strcasecmp($a$b);



then try follows
PHP Code:
$manager = new ImController();
$preferences imModel::getPref();

$output_arr = array();
foreach(
$preferences->categories->category as $cat)
{
    
ImCategory::setCategory($cat);
    
$manager->runModelMethod('gen_register');
    
$items array_reverse($manager->getModelValue('items_ordered_struct'));  
    
$strcat = (string) $cat;
    
$output_arr[] = array( 'category' => $strcat,
         
'value' => '<a class=" my_class" title="' $strcat '" 
         href="nasza-oferta?kategoria=' 
$strcat '">' $strcat ' (' count($items) . ')</a><br />'
    
);
}

// There function call
usort($output_arr'sort_cat');

foreach(
$output_arr as $output)
{
    echo 
$output['value'];



(2014-08-06, 09:07:00)xxdex Wrote: - delete category or item.... have own backup's... and easy system to restore.

I will consider it and may develop it in a future version


(2014-08-06, 09:07:00)xxdex Wrote: - image upload from the default image uploader get simple.. or something else.. maybe better than this what is now used.. (example: pgrfilemanager)

Just let me know what exactly you don't like about current file upload?
Reply
#98
Bigin thank You for Your answer.. I hope you do not answer it wrong. plugin is great ... but I have a few comments .. comments that may help in its development. Plugin is great!

1.................
Category name is a unique ID! – For your own purposes you can use a hidden field with label „my_custom_category_to_rename“ and as the default value „my_category_name“. So you can rename it as much as you like.

ok.. i will test it.. but what when a products is allready inserted in this category?

it should be a easier:
get a url: localhost/offer?category=name&id=29
then a category name can be a ignore, and use for only a fancy urls..... and a real category get from unique id..
what when i want to change a category name from "name one" to "name two" then all items what is in this category will be not see in new one.


2.................
- when creating a new category / it should have a custom select list from "what category it should get a default field list...example: different fields / number of fields for jeverly... different fields for cars, different for bicycles

i'm was try to tell.. that all of another new category must have create always a new custom fields for it.. why it can't be used one template for all catalog system ?

3.................
- categories sort options to custom, asc, dsc, last added,
- products list sort options to custom, asc, dsc, last added,

i will test it
i'm so sorry, because the plugin is really great .. I want to contribute to its development..
user plugin: scroll to top
Reply
#99
Hello, when I make a new item and click on the "visible" button I get the following error:

Code:
FATAL ERROR: CLASS 'SELEF' NOT FOUND IN C:\UWAMP\WWW\PLUGINS\IMANAGER\CLASS\IM.MODEL.CLASS.PHP ON LINE 444

Btw. this is the first time I use this plugin.
Reply
Hi datiswous,

(2014-08-21, 03:09:21)datiswous Wrote:
Code:
FATAL ERROR: CLASS 'SELEF' NOT FOUND IN C:\UWAMP\WWW\PLUGINS\IMANAGER\CLASS\IM.MODEL.CLASS.PHP ON LINE 444

You're right, I've made a litle mistake with the last update. Please download the newest version of IM from extend, or simple change "selef" to "self" line 444 in "im.model.class.php" file.

Thank you for your error reporting!
Reply




Users browsing this thread: 2 Guest(s)