Post by vaslobas » Fri Sep 18, 2015 3:29 am

I want to add the new custom field in admin >> catalog >> category >> "category_name"

Here under Generak section i need to add the custom field similar to Description
Is there any possibility in opencart to add the custom field in admin?

And then to show data from that field on category's page.

Newbie

Posts

Joined
Fri Sep 18, 2015 3:01 am

Post by opencartboost » Fri Sep 18, 2015 4:36 pm

Yes that is possible. But you must change some file below and add field/column at database (table category_description).

admin/controller/catalog/category.php
admin/language/your_language/catalog/category.php
admin/model/catalog/category.php
admin/view/template/catalog/category_form.tpl
catalog/controller/product/category.php
catalog/language/your_language/product/category.php
catalog/model/catalog/category.php
catalog/view/theme/your_theme/template/product/category.tpl

Try find code for name from that file and add your code after that.

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by vaslobas » Fri Sep 18, 2015 8:30 pm

I did it, but with no success.
I got error inside textarea on category page in admin's panel
Notice: Undefined index: description1 in /home/c/cw31022/public_html/admin/view/template/catalog/category_form.tpl on line 67

Code: Select all

<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['description1'] : ''; ?></textarea>
And error at category page too
Notice: Undefined variable: description1 in /home/c/cw31022/public_html/catalog/view/theme/franchesco/template/product/category.tpl on line 153

Code: Select all

	<div class="well">
	    <?php if ($description1) { ?>
        <?php echo $description1; ?>
        <?php } ?>
    </div>

Newbie

Posts

Joined
Fri Sep 18, 2015 3:01 am

Post by opencartboost » Sat Sep 19, 2015 3:25 pm

The error mean you not put description1 in array.
Of course you get error at front because you failed to insert description1.

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by straightlight » Sat Sep 19, 2015 7:52 pm

By default, Opencart does not provide custom fields over categories. In order to do that, at this current time, an extension may be required or to use alternative methods to add custom fields on the categories array and to the database.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot] and 9 guests