GetSimple Support Forum
Item Manager Extended (Beta) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Item Manager Extended (Beta) (/showthread.php?tid=4779)

Pages: 1 2 3 4 5 6


Item Manager Extended (Beta) - Bigin - 2013-06-15


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
THIS IS AN OLD VERSION. Get the new one at the URL: http://get-simple.info/extend/plugin/itemmanager/936/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



Item Manager Extended is a remake of the original Items Manager created by Pyc to simple manage articles, products, services, and other related items.

Source is available now on GitHub at: iManager

REQUIREMENTS:
  • GetSimple CMS up to version 3.x and higher.
  • GD Library

CHANGES / FEATURES:
  • Complete separation of design and logic
  • Assigning of customfields to categories
  • Pagination of item lists incduded
  • Back-end Management has been redesigned and updated
  • The custom fields part of Mvlcek Custom Fields plugin has been integrated into the Item Manager environment
  • Upload functionality has been changed or added
  • Some JavaScript functions removed temporarily

SETUP:
  1. Make sure to save an older version of Items Manager for the case that you decide to stay with it!
    -> Just save a copy of the files to a different location.
    -> After that, delete old version data to prevent naming collisions.
  2. Download 'Item Manager Extended' and unzip its files to the /plugins folder
  3. While logged in to GS, go to Plugins and activate Item Manager, join to the plugin menu at the top of the 'Item Manager' tab and go through the setup process:
    -> It will creates some directories and files.
  4. After set up you will be told which files have been created. In case of failure of the setup all these files must be added manually to the project.

CONFIGURATIONS MENU:
  • Item Manager -> CATEGORIES. Allows you to define new categories for optimizing your item management.
  • Item Manager -> CONFIGURE. This menu provides custom fields that you can use to organize your items.
  • Item Manager -> ADD NEW. This menu point enables to generate new Items.
  • Item Manager -> VIEW ALL. This list contains all the Items that are available at the moment.

To read or output data on front-end you shall to use the appropriate API calls of the Item Manager. Item Manager provides some methods that allow you to save, process and display your own item categories. The implementation are based on the object-oriented approach, which allows the arbitrary combination of this methods. This feature gives Item Manager a great deal of flexibility in how it can be used.

HOW TO USE TEMPLATES:
The Item Manager plugin uses templates to produce all it's front-end and back-end output, therefor it is possible to manipulate the look without knowing PHP at all. Manager templates are bits of static text contained placeholders and stored in '.tpl' files or (at your option) inserted as a string in the source code.  You can move any of these pieces around, change their parameters, and adjust their placing. The existing default templates are solely a base structure - if you want your placeholders at the bottom, for instance, move them there! Item Manager doesn't restrict you from doing that. All these templates are located in the 'plugins/imanager/tpl' directory. You can create your own templates or use these standard templates.


USAGE EXAMPLE:
Ok, I'll try to give you an example of how you could use Item Manager to create a simple product catalog that might then look like this: sample.
See also a further example how to use Item Manager as substitute of Fancybox.
One thing before we start, Item Manager is modular, and your product catalog can function in any scope you like. If you don't need any specific part of methods, just skip that.

First off, you'll want to open the CATEGORIES menu,  and create a new category, we call it 'rings'.

categories
[Image: cat001.png]


Next, click the CONFIGURE menu, in this area  you will want to customize your category structures by adding custom fields precisely to your specific requirements. So, let us start by creating:

  • One textarea for our item description
  • 4 upload fields for our thumbnails
  • 4 fields for the main images
  • A single field 'sequence' to determine the order of products displayed in the catalog
 

configure 
[Image: configure.jpg]


After you have made all of your custom fields, your next step is to add new items to an existing category using the ADD NEW menu point. To see the items you have created, go to the VIEW ALL menu. Your items list will appear as follows.

view all
[Image: view.png]


CREATING CONTROLLER COMPONENTS:
You don't currently have the possibility to specify the item output from the back-end area. For this reason your next step should be creating a suitable front-end snippets that includes several methods for setting and manipulating the output. In our example case, you could use two different viewing modes 'List' and 'Details' view. The easiest way of getting a Manager output on the front-end of your website is just to create two components 'im_list_page_generator' and 'im_details_page_generator'. Include these components in your website template, better still, embed these directly in your GS pages by using DynPages plugin. The 'DynPages' plugin allows you to use a placeholder to include the components on the page by specifying their name: {% im_list_page_generator %}

Sample im_list_page_generator:
PHP Code:
<?php
// create controller instance
$manager = new ImController();
// setup category
ImCategory::setCategory('rings');
// 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'))));
?>

Sample im_details_page_generator:
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)
);
?>

NOTE: This plugin is in Beta phase, meaning it is incomplete, please tell me describing any bugs or feature requests.


RE: Item Manager Extended (Beta) - evan70 - 2013-06-16

___:O


RE: Пункт Manager Extended (Бета) - Oleg06 - 2013-06-17

immediately after installation
Code:
Warning: preg_replace() [function.preg-replace]: Parameter mismatch, pattern is a string while replacement is an array in D:\home\0ogma.ru\www\plugins\imanager\class\im.output.class.php on line 85

Warning: strpos() [function.strpos]: Empty delimiter in D:\home\0ogma.ru\www\plugins\imanager\class\im.output.class.php on line 84

Warning: strpos() [function.strpos]: Empty delimiter in D:\home\0ogma.ru\www\plugins\imanager\class\im.output.class.php on line 84

Warning: strpos() [function.strpos]: Empty delimiter in D:\home\0ogma.ru\www\plugins\imanager\class\im.output.class.php on line 84



RE: Item Manager Extended (Beta) - evan70 - 2013-06-17

errorlog.txt >>> [16-Jun-2013 16:59:21 UTC] PHP Fatal error: Cannot redeclare to7bits() in fullpath/plugins/imanager/class/im.model.class.php on line 1041


RE: Item Manager Extended (Beta) - Bigin - 2013-06-17

@evan you have to remove old installation "Items Manager", as I have described see SETUP part.

@Oleg06 I see you are running on a Windows host, please tell me what is your PHP version?


RE: Item Manager Extended (Beta) - Oleg06 - 2013-06-17

5.3.1 and 5.2.17


RE: Item Manager Extended (Beta) - Bigin - 2013-06-17

So, I currently used it on a Windows XP host (XAMPP 1.8.1, Apache 2.4 php 5.4.x) - but it seems to be working. A little later I'll try on a different system. It would seem that this problem is a misconfiguration on your webserver, let us wait if anybody else have the same issue.


RE: Item Manager Extended (Beta) - evan70 - 2013-06-25

Many Thanks Bigin, no problem with your latest version 0.6 updated: june 23, 2013 Smile


RE: Item Manager Extended (Beta) - evan70 - 2013-06-25

(2013-06-25, 18:01:09)evan70 Wrote: Many Thanks Bigin, no problem with your latest version 0.6 updated: june 23, 2013 Smile

When i try to upload photos to item, i'll get this error window > Forbidden

You don't have permission to access .... /plugins/imanager/uploadscript/uploadwindow.php on this server.


RE: Item Manager Extended (Beta) - Bigin - 2013-06-25

@evan thank you for your report!

Please check file/directory permissions and .htaccess configuration if you are able to do this:
First off, make sure that your uploadwindow.php is owned by 'your username' (chmod) and that the permissions on it are set to 644
Check your 'uploadscript' directory for a .htaccess file and make sure you can write it.


RE: Item Manager Extended (Beta) - evan70 - 2013-06-25

Thanks for quick reply Bigin Wink

i was changed permissions for imanager directory to 755 recursively @localhost and i got same error Sad


RE: Item Manager Extended (Beta) - Bigin - 2013-06-26

What about the .htaccess file question? Check '... /plugins/imanager/uploadscript/' directory on your server if there is a file named .htaccess try to insert this in it:

Allow From All


RE: Item Manager Extended (Beta) - evan70 - 2013-06-26

.htacces in .../plugins/imanager/uploadscript/ >

#LoadModule headers_module modules/mod_headers.so
#ForceType application/octet-stream
#Header set Content-Disposition attachment
Allow from all


RE: Item Manager Extended (Beta) - Bigin - 2013-06-26

Hmm ... strange, seemed to be Ok.

Do you have access to the configuration (http.conf) of Apache on your server? If yes, add the following line:

AllowOverride All

After that you could try to delete the .htaccess file and put a new one with following line:

Allow From All


RE: Item Manager Extended (Beta) - evan70 - 2013-06-26

I have no acces to server http.conf Apache file,
i tried to copy new .htacces file with one line :
Allow From All
but still no luck


RE: Item Manager Extended (Beta) - evan70 - 2013-06-26

i tried to copy whole fileset from remote server to my localhost and everything OK here ...


RE: Item Manager Extended (Beta) - Rene - 2013-06-26

Thx Bigin for this very nice addition.

Can there be an option to select an item image directly from GS upload directory? I (and maybe others?) like to work with Imagizer plugin which is a perfect image uploader and also makes thumbnails.

Furthermore I've attached a Dutch language file.


RE: Item Manager Extended (Beta) - evan70 - 2013-06-26

GREAT iDea Rene Smile ThX


RE: Item Manager Extended (Beta) - Bigin - 2013-06-27

@evan Normally it's quite simple:
All you need to know is make sure that your files inside '../plugins/imanager/uploadscript/' should have permissions of 644 and the folders must always be 755.
If the parent directory's .htaccess contains 'Deny from all' you can place, for example, another .htaccess file in '../plugins/imanager/uploadscript/' with content: Allow from all
This will override earlier configuration directives. This is necessary because the 'uploadwindow.php' is an external script.

@Rene Wow, big thx for translation! I'll append the language file at a next Beta version. Thanks.

However, that is not really possible to select an image from GS upload directory, for a simple reason: Manager provides a simple administrative and archiving functions for internally-uploaded images ONLY. This means that when you delete an Item, Manager will find and remove all its related images. If you want to delete an image, just simply delete the path value and leave the field empty - Manager carries out the rest. Or you can simple replace your images by entering another one as field value.
I don't know what do you intend to do, but if you can live without that features, so you can use a regular text field for your purpose.(no images would be displayed in admin panel).

Rene, I'll note this idea for the future, since it shows some originality.

I'll try to upload the source to Github this week, once I get the time.
Source is available now on GitHub at: iManager


RE: Item Manager Extended (Beta) - morvy - 2013-06-27

Is it possible to use it as simple eshop ? with some kind of shopping cart and email ordering ? Or it's meant to be only as a product catalog ?


RE: Item Manager Extended (Beta) - Bigin - 2013-06-27

(2013-06-27, 05:04:08)morvy Wrote: Is it possible to use it as simple eshop ? with some kind of shopping cart and email ordering ? Or it's meant to be only as a product catalog ?

Not directly. But it's quite possible, when used in conjunction with other scripts like jCart.
I had to make something similar to this a while ago as well myCart. However, at the time, that plugin isn't longer available.


RE: Item Manager Extended (Beta) - Rene - 2013-06-27

(2013-06-27, 04:23:52)Bigin Wrote: ... I don't know what do you intend to do ...

I'm helping a friend with a site and I don't want him to upload 4MB image files each, so I installed Imagizer. Your plugin looked very much like an easy to install mini-shop therefore I was trying it.
Having the same function as with I18N Gallery would be nice, when you choose 'Add images' then a popup window appears with the uploaded files and directories from /uploads/.


RE: Item Manager Extended (Beta) - amnesiac - 2013-08-15

Thanks for plugin, and thanks for examples of components to output a list of items and detailed page of item.

But I have a question: how can I make component to output a list of categories?

(2013-06-17, 02:17:37)Oleg06 Wrote: immediately after installation
Code:
Warning: preg_replace() [function.preg-replace]: Parameter mismatch, pattern is a string while replacement is an array in D:\home\0ogma.ru\www\plugins\imanager\class\im.output.class.php on line 85

Do you use Russian translation of GS? Try to switch to English.


RE: Item Manager Extended (Beta) - Bigin - 2013-08-16

(2013-08-15, 22:28:56)amnesiac Wrote: But I have a question: how can I make component to output a list of categories?

Yep, you can use something like this:

PHP Code:
$preferences = (imModel::getPref());
foreach(
$preferences->categories->category as $cat)
    echo 
$cat .'<br />'



RE: Item Manager Extended (Beta) - D.O. - 2013-08-18

Hi Bigin, why ur plugin myCart is not more avaible?