Page 1 of 1

Admin > Catalogue > Products > Categories problem

Posted: Wed Jul 01, 2015 9:34 pm
by kokozimar
I have a problem with my OpenCart Version 2.0.2.0

When I enter in admin panel and choose to Create product in links when I click on Category I have a drop-down menu with my categories and sub-categories but in this menu I have only one category and four sub-categories. In my site I have 8 categories and 24 sub-categories. What is the problem and how can I resolve it.

Thanks in advance.
Sorry for my bad English.

Re: Admin > Catalogue > Products > Categories problem

Posted: Wed Jul 01, 2015 11:44 pm
by chulcha
It's not problem.

Continue entering name category and you get next list with autocomplete

or
find the next code in admin\controller\catalog\product.php

Code: Select all

			if (isset($this->request->get['limit'])) {
				$limit = $this->request->get['limit'];
			} else {
				$limit = 5;
			}
and change limit


or
find the next code in admin\view\template\catalog\product_form.tpl

Code: Select all

url: 'index.php?route=catalog/option/autocomplete&token=<?php echo $token; ?>&filter_name=' +  encodeURIComponent(request),
and replace it with

Code: Select all

url: 'index.php?route=catalog/option/autocomplete&limit=10token=<?php echo $token; ?>&filter_name=' +  encodeURIComponent(request),

Re: Admin > Catalogue > Products > Categories problem

Posted: Mon Jul 06, 2015 6:42 pm
by kokozimar
Hello,

I tried this but it not working still.

Re: Admin > Catalogue > Products > Categories problem

Posted: Mon Jul 06, 2015 7:00 pm
by kokozimar
It's product

Re: Admin > Catalogue > Products > Categories problem

Posted: Mon Jul 06, 2015 7:01 pm
by kokozimar
Categories list

Re: Admin > Catalogue > Products > Categories problem

Posted: Mon Jul 06, 2015 9:47 pm
by chulcha
sorry

Code: Select all

// Category
$('input[name=\'category\']').autocomplete({
	'source': function(request, response) {
		$.ajax({
			url: 'index.php?route=catalog/category/autocomplete&limit=10&token=<?php echo $token; ?>&filter_name=' +  encodeURIComponent(request),
			dataType: 'json',			
			success: function(json) {
				response($.map(json, function(item) {
					return {
						label: item['name'],
						value: item['category_id']
					}
				}));
			}
		});
	},
	'select': function(item) {
		$('input[name=\'category\']').val('');
		
		$('#product-category' + item['value']).remove();
		
		$('#product-category').append('<div id="product-category' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="product_category[]" value="' + item['value'] + '" /></div>');	
	}
});
note!!! &limit=10

Re: Admin > Catalogue > Products > Categories problem

Posted: Mon Jul 06, 2015 9:53 pm
by chulcha
sorry No2 ;)

admin\controller\catalog\category.php

Code: Select all

	public function autocomplete() {

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'sort'        => 'name',
				'order'       => 'ASC',
				'start'       => 0,
				'limit'       => 5
			);



May be

Code: Select all

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'sort'        => 'name',
				'order'       => 'ASC',
				'start'       => 0,
				'limit'       => 10
			);

or

Code: Select all

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'sort'        => 'name',
				'order'       => 'ASC',
				'start'       => 0,
				'limit'       => isset($this->request->get['limit'])?$this->request->get['limit']:5
			);

Re: Admin > Catalogue > Products > Categories problem

Posted: Tue Jul 07, 2015 12:53 am
by kokozimar
It's working.

Thank you very much, bro.