I can't display Category custom fields in Products module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

I can't display Category custom fields in Products module

Post by Simon66 »

So I have a page that is displaying a product summary as a list.

On the same page I have a Category dropdown.

I want to display the details of the chosen Category on the page each time a different Category is selected.

I'm using this code to get the Category ID from the URL. Then 'products_getcategory' smarty plugin pulls in the Category details.

Code: Select all

{if !empty($smarty.get.catid)}
<a class="list-group-item active bg-yellow" href="#">
{products_getcategory categoryid=$smarty.get.catid assign='caty'}
<span class="catyname">{$caty->name}</span> is sponsored by {$caty->fields.sponsored.field_value}
</a>
{/if}
This works perfectly to display the name of the Category - {$caty->name} but it doesn't work to display Category custom fields.
They are also missing when I use {$caty|print_r}.

I'm sure I'm missing something. If you've got this to work please let me know how.

Thanks
Simon66
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: I can't display Category custom fields in Products modul

Post by Jeff »

I didn't know that Categories in the Products modules had custom fields?

Are you thinking of the individual product custom fields?
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

Re: I can't display Category custom fields in Products modul

Post by Simon66 »

Hi Jeff
Yes, the products module allows you to add additional 'Category Fields' to each separate category.

They should be accessible via the products module smarty plugin:
{products_getcategory categoryid=1 assign='tmp'}

The help for this smarty plugin says " The returned is an object containing all of the information about a category, including its field values."

But I am stumped as to how the field values are displayed. I can only display the basic category name and id info.

I've uploaded an image of the 'Category Fields'.

Simon66
Attachments
products.png
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: I can't display Category custom fields in Products modul

Post by Dr.CSS »

I think those fields are only available in the category template which I think is used with action=....
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: I can't display Category custom fields in Products modul

Post by velden »

I thinks it's broken. Had a look at the source and think it's a bug.

BTW: you should post system information when posting questions like this. http://docs.cmsmadesimple.org/troublesh ... nformation
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

Re: I can't display Category custom fields in Products modul

Post by Simon66 »

Thanks Velden.
Yeah, sorry about the info:
----------------------------------------------

Cms Version: 1.11.11

Installed Modules:

CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.5
MenuManager: 1.8.6
MicroTiny: 1.2.7
ModuleManager: 1.5.8
News: 2.14.4
Search: 1.7.11
ThemeManager: 1.1.8
AceEditor: 1.0
CGExtensions: 1.42.2
CGSimpleSmarty: 1.7.4
CGSmartImage: 1.17
Captcha: 0.4.6
FormBuilder: 0.7.4
Gallery: 2.0.1
ListIt2: 1.4.1
ListIt2XDefs: 1.2
ListIt2SummaryKit: 0.2
JQueryTools: 1.2.6
Products: 2.21
CGEcommerceBase: 1.5.2
Cart2: 1.1.3
CustomGS: 2.1
FrontEndUsers: 1.24.1
SelfRegistration: 1.8.2
CustomContent: 1.10
ListIt2CustomerVenues: 1.4.1
ListIt2frontboxes: 1.4.1
ListIt2XLink: 1.01
ToolBox: 1.3.8
ECB: 1.6
ListIt2XIUtilities: 1.0
ListIt2MegaUpload: 0.3
CGPaymentGatewayBase: 1.3.1
Orders: 1.16.5
ListIt2FAQ: 1.4.1
TemplateExternalizer: 2.1.5
CGUserDirectory: 1.4.5
CGMyOrders: 1.2.1
ListIt2FEEdit: 1.3
ListIt2Specials: 1.4.1
ListIt2SupplierAds: 1.4.1


Config Information:

php_memory_limit:
process_whole_template:
max_upload_size: 20000000
url_rewriting: mod_rewrite
page_extension: .htm
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.3.28-pl3-gentoo
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 0
memory_limit: 128M
max_execution_time: 30
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 20M
upload_max_filesize: 20M
session_save_path: No check because OS path
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.1.70
Server Db Grants: Could not find a suitable "GRANT ALL" permission. This may mean you could have problems installing or removing modules. Or even adding and deleting items, including pages
Server Time Diff: No filesystem time difference found


----------------------------------------------
janvl
Power Poster
Power Poster
Posts: 985
Joined: Wed Aug 13, 2008 10:57 am

Re: I can't display Category custom fields in Products modul

Post by janvl »

You have
phpversion: 5.3.28-pl3-gentoo

the newer CG-Modules need at least PHP 5.4

talk with your hoster.

Kind regards,
Jan
Post Reply

Return to “Modules/Add-Ons”