Skip to content

Commit

Permalink
Merge pull request #15 from ravilrrr/master
Browse files Browse the repository at this point in the history
FIX главная категория и показывать в категориях.
  • Loading branch information
Oleksandr Rebrov committed Sep 13, 2013
2 parents e941f63 + 8117014 commit 7f1d60a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions admin/controller/catalog/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,15 @@ protected function getForm() {
$this->data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']);
} else {
$this->data['main_category_id'] = 0;
}
}

if (isset($this->request->post['product_category'])) {
$this->data['product_category'] = $this->request->post['product_category'];
} elseif (isset($this->request->get['product_id'])) {
$this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
} else {
$this->data['product_category'] = array();
}

if (isset($this->request->post['product_related'])) {
$products = $this->request->post['product_related'];
Expand Down Expand Up @@ -1694,4 +1702,4 @@ public function autocomplete() {
$this->response->setOutput(json_encode($json));
}
}
?>
?>
4 changes: 2 additions & 2 deletions admin/view/template/catalog/product_form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
<td><?php echo $entry_main_category; ?></td>
<td><select name="main_category_id">
<option value="0" selected="selected"><?php echo $text_none; ?></option>
<?php foreach ($product_categories as $product_categories) { ?>
<?php foreach ($categories as $product_categories) { ?>
<?php if ($product_categories['category_id'] == $main_category_id) { ?>
<option value="<?php echo $product_categories['category_id']; ?>" selected="selected"><?php echo $product_categories['name']; ?></option>
<?php } else { ?>
Expand All @@ -270,7 +270,7 @@
<?php $class = ($class == 'even' ? 'odd' : 'even'); ?>
<div class="<?php echo $class; ?>">
<?php if (in_array($category['category_id'], $product_categories)) { ?>
<?php if (in_array($category['category_id'], $product_category)) { ?>
<input type="checkbox" name="product_category[]" value="<?php echo $category['category_id']; ?>" checked="checked" />
<?php echo $category['name']; ?>
<?php } else { ?>
Expand Down

0 comments on commit 7f1d60a

Please sign in to comment.