Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Почему возвращает пустой массив?


Recommended Posts

Здравствуйте, подскажите пожалуйста, что тут не так, почему возвращает пустой массив  ? 

Файл настройки темы
 

$this->load->model('catalog/category');
 
		if (isset($this->request->post['theme_zaprosto_category'])) {
			$data['theme_zaprosto_category'] = $this->request->post['theme_zaprosto_category'];
		} elseif (isset($setting_info['theme_zaprosto_category'])) {
			$data['theme_zaprosto_category'] = $setting_info['theme_zaprosto_category'];
		}  else {
			$data['theme_zaprosto_category'] = array();
		}

		foreach ($data['theme_zaprosto_category'] as $category_id) {
			$category_info = $this->model_catalog_category->getcategory($category_id);
 
			if ($category_info) {
				$data['theme_zaprosto_category'][] = array(
					'category_id' => $category_info['category_id'],
					'name'       => ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name']
				);
			}
		}

 

В виде 
 

<div class="form-group">
			<label class="col-sm-2 control-label" for="input-category">{{ entry_category }}</label>
			<div class="col-sm-10">
			  <input type="text" name="theme_zaprosto_category" value="" placeholder="{{ entry_category }}" id="input-category" class="form-control" />
			  <div id="featured_categories-category" class="well well-sm" style="height: 150px; overflow: auto;">
				{% for category in theme_zaprosto_category %}
				<div id="featured_categories-category{{ category.category_id }}"><i class="fa fa-minus-circle"></i> {{ category.name }}
				  <input type="hidden" name="category[]" value="{{ category.category_id }}" />
				</div>
				{% endfor %}
			  </div>
			</div>
		  </div>
		  <script>
 
  $('input[name=\'theme_zaprosto_category\']').autocomplete({
	source: function(request, response) {
		$.ajax({
			url: 'index.php?route=catalog/category/autocomplete&user_token={{ user_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('');
		
		$('#featured_categories-category' + item['value']).remove();
		
		$('#featured_categories-category').append('<div id="featured_categories-category' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="category[]" value="' + item['value'] + '" /></div>');	
	}
});
	
$('#featured_categories-category').delegate('.fa-minus-circle', 'click', function() {
	$(this).parent().remove();
});
 
</script>

 

Edited by MaJIon
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.