Post by kokozimar » Wed Jul 01, 2015 9:34 pm

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.

Newbie

Posts

Joined
Wed Jul 01, 2015 9:32 pm

Post by chulcha » Wed Jul 01, 2015 11:44 pm

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),

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by kokozimar » Mon Jul 06, 2015 6:42 pm

Hello,

I tried this but it not working still.

Newbie

Posts

Joined
Wed Jul 01, 2015 9:32 pm

Post by kokozimar » Mon Jul 06, 2015 7:00 pm

It's product

Attachments

products.png

The problem in products - products.png (17.65 KiB) Viewed 25002 times


Newbie

Posts

Joined
Wed Jul 01, 2015 9:32 pm

Post by kokozimar » Mon Jul 06, 2015 7:01 pm

Categories list

Attachments

categories.png

All cats are 55 - categories.png (53.28 KiB) Viewed 25001 times


Newbie

Posts

Joined
Wed Jul 01, 2015 9:32 pm

Post by chulcha » Mon Jul 06, 2015 9:47 pm

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

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by chulcha » Mon Jul 06, 2015 9:53 pm

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
			);

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by kokozimar » Tue Jul 07, 2015 12:53 am

It's working.

Thank you very much, bro.

Newbie

Posts

Joined
Wed Jul 01, 2015 9:32 pm
Who is online

Users browsing this forum: Amazon [Bot] and 23 guests