в админку добавли и вроде сохраняет значение чекбокса
Как теперь вывести в карточку товара?
так не выводит
$data['calc'] = $product_info['calc'];
<?php if($calc): ?>
тут содержимое
<?php endif; ?>
создавал так
1. добавил: $_['entry_calc'] = 'Показать калькулятор:';
2. добавил в /public_html/admin/controller/catalog/product.php
$data['entry_calc'] = $this->language->get('entry_calc');
if (isset($this->request->post['calc'])) {
$data['calc'] = $this->request->post['calc'];
} elseif (!empty($product_info)) {
$data['calc'] = $product_info['calc'];
} else {
$data['calc'] = 1;
}
3. добавил в /public_html/admin/model/catalog/product.php
public function addProduct($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "',calc = '" . (int)$data['calc'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', calc = '" . (int)$data['calc'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
4.добавил в /public_html/admin/view/template/catalog/product_form.php
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $entry_calc; ?></label>
<div class="col-sm-10">
<label class="radio-inline">
<?php if ($calc) { ?>
<input type="radio" name="calc" value="1" checked="checked" />
<?php echo $text_yes; ?>
<?php } else { ?>
<input type="radio" name="calc" value="1" />
<?php echo $text_yes; ?>
<?php } ?>
</label>
<label class="radio-inline">
<?php if (!$calc) { ?>
<input type="radio" name="calc" value="0" checked="checked" />
<?php echo $text_no; ?>
<?php } else { ?>
<input type="radio" name="calc" value="0" />
<?php echo $text_no; ?>
<?php } ?>
</label>
</div>
</div>