Page 1 of 1

ListIt2 Categories Add Image Field

Posted: Wed Dec 11, 2013 11:32 am
by clj83
Does anyone know a simple way to add an image upload field within the ListIt2 add/edit categories type field definition?

Presently you have Category Name, Alias, Parent and Description.

I appreciate this would probably require a modification to the core of the module, i.e. an additional column in the categories table, however I just wondered if anyone had already done this?

Thanks


----------------------------------------------
Cms Version: 1.11.9
Installed Modules:
CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.3
MenuManager: 1.8.6
MicroTiny: 1.2.5
ModuleManager: 1.5.5
News: 2.14.1
Search: 1.7.11
ThemeManager: 1.1.8
CGExtensions: 1.38
CGSimpleSmarty: 1.7
JQueryTools: 1.2.5
CGContentUtils: 1.3.6
CMSDumper: 1.3
TemplateExternalizer: 2.1.3
FormBuilder: 0.7.4
FormBrowser: 0.4.2
CGFBApp: 1.0.7
Uploads: 1.16.15
ListIt2: 1.4
ListIt2XDefs: 1.2

Config Information:
php_memory_limit:
process_whole_template:
max_upload_size: 2000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:
phpversion: 5.4.19
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 0
memory_limit: 32M
max_execution_time: 30
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:
Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.32
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found

----------------------------------------------

Re: ListIt2 Categories Add Image Field

Posted: Wed Dec 11, 2013 12:05 pm
by Stikki
Nope there is no simple way doing this.

I have faced this problem several times already, so most likely there will be change to some direction.

But not any time soon.

Re: ListIt2 Categories Add Image Field

Posted: Wed Dec 11, 2013 5:10 pm
by clj83
Hi Stikki,

Thought as much, thanks for the reply though.

Chris

Re: ListIt2 Categories Add Image Field

Posted: Thu Dec 12, 2013 11:08 pm
by psy
Bit of a fudge but should work.

1. Create a new LI2 instance, eg MyCategories with all the fields you need including image, etc.
2. On the options tab, tick the "Display details inline (replaces module tag instead of {content}):" checkbox.
3. Add your items and ensure that each item alias is IDENTICAL to the corresponding category alias in your original LI2 module.
4. Change your template in the original LI2 module to, eg for the category list template:

Code: Select all

<!-- categories -->
<ul>
{foreach from=$categories item=category}
	<li class="category-{$category->alias}">
		<a class="category-name" href="{$category->url}">{$category->name} ({$category->items|count})</a>
			{ListIt2MyCategories item=$category->alias detailtemplate='mycategories'}
	</li>
{/foreach}
<ul>
<!-- categories //-->
Worth a try until/unless something better comes along.

Re: ListIt2 Categories Add Image Field

Posted: Fri Dec 13, 2013 12:06 am
by psy
TIP:

If you are using this method in a template that uses $item-> notation in both the original and the MyCategories instances, eg a summary list, first thing to do is assign the $items var in the original/calling template to a new var name, eg {$items=$firstitems} then {foreach from=firstitems item='oneitem'} and call the fields as {$oneitem->fieldname}.

This will avoid confusion in the templates.

Re: ListIt2 Categories Add Image Field

Posted: Thu Dec 19, 2013 7:55 am
by psy
There is a new module in the forge that may solve your problem, ListIt2XLink.

This is a new field definition type that takes the concept above one step further and makes it easy for you to grab data from other ListIt2 instances and include it in your current instance.

You can display data from a remote LI2 instance in your current LI2 instance or assign it in a var and use in it a new ListIt2 instance tag in your template.

In your case, you could create the 2 instances and in instance 2, create an XLink to the image in instance 1 (the catalogue items).

It works on Ids so there are no worries about identical aliases.

Would appreciate your thoughts and feedback.

Cheers psy

Re: ListIt2 Categories Add Image Field

Posted: Fri Dec 20, 2013 1:12 pm
by clj83
Hi psy. Thanks for the heads up about the new module. I am keen to get this working so will give it a go when I have a chance. I will let you know how I get on. Might be a while with Chrimbo celebrations and all!