$data['orders'][] = array(
'order_id' => $result['order_id'],
'name' => $result['firstname'] . ' ' . $result['lastname'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'products' => ($product_total + $voucher_total),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'view' => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], true),
);
$totals = $this->model_account_order->getOrderTotals($result['order_id']);
foreach ($totals as $total) {
if($total['code'] == 'shipping'){
$data['shipping'] = array(
'title' => $total['title'],
'value' => $total['value'],
);
}
}
catalog/controller/account/register.php
if (isset($this->request->post['password'])) {
$data['password'] = $this->request->post['password'];
} else {
$data['password'] = '';
}
$data['password'] = вами сгенерированный пароль
для продукта есть обязательное поле Артикул.
Смотрел в admin/controller но там ничего!
validateForm()
из контроллера admin/controller/catalog/product.php
закомментируйте эти строки:if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
$this->error['model'] = $this->language->get('error_model');
}
admin/view/template/catalog/recurring_form.twig
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-model">{{ entry_model }}</label>
<div class="col-sm-10">
<input type="text" name="model" value="{{ model }}" placeholder="{{ entry_model }}" id="input-model" class="form-control"/>
{% if error_model %}
<div class="text-danger">{{ error_model }}</div>
{% endif %}</div>
</div>
$data['categories'] = array();
$categories = $this->model_catalog_category->getCategories(0);
foreach ($categories as $category) {
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
$children2_data = array();
$children2 = $this->model_catalog_category->getCategories($child['category_id']);
foreach ($children2 as $child2) {
$children3_data = array();
$children3 = $this->model_catalog_category->getCategories($child2['category_id']);
foreach ($children3 as $child3) {
$filter_data3 = array(
'filter_category_id' => $child3['category_id'],
);
$children3_data[] = array(
'category_id' => $child3['category_id'],
'name' => $child3['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data3) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $child2['category_id']. '_' . $child3['category_id'])
);
}
$filter_data2 = array(
'filter_category_id' => $child2['category_id'],
);
$children2_data[] = array(
'category_id' => $child2['category_id'],
'name' => $child2['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data2) . ')' : ''),
'children3' => $children3_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $child2['category_id'])
);
}
$filter_data1 = array(
'filter_category_id' => $child['category_id'],
);
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data1) . ')' : ''),
'children2' => $children2_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
$filter_data = array(
'filter_category_id' => $category['category_id'],
);
$data['categories'][] = array(
'category_id' => $category['category_id'],
'name' => $category['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'children' => $children_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
<div class="list-group">
<?php foreach ($categories as $category) { ?>
<?php if ($category['category_id'] == $category_id) { ?>
<a href="<?php echo $category['href']; ?>" class="list-group-item active"><?php echo $category['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $category['href']; ?>" class="list-group-item"><?php echo $category['name']; ?></a>
<?php } ?>
<?php if (($category['children']) && ($category['category_id'] == $category_id)) { ?>
<?php foreach ($category['children'] as $child) { ?>
<?php if ($child['category_id'] == $child_id) { ?>
<a href="<?php echo $child['href']; ?>" class="list-group-item active"> - <?php echo $child['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $child['href']; ?>" class="list-group-item"> - <?php echo $child['name']; ?></a>
<?php } ?>
<?php if (($child['children2']) && ($category['category_id'] == $category_id)) { ?>
<?php foreach ($child['children2'] as $child2) { ?>
<?php if ($child2['category_id'] == $child_id2) { ?>
<a href="<?php echo $child2['href']; ?>" class="list-group-item active"> - <?php echo $child2['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $child2['href']; ?>" class="list-group-item"> - <?php echo $child2['name']; ?></a>
<?php } ?>
<?php if (($child2['children3']) && ($category['category_id'] == $category_id)) { ?>
<?php foreach ($child2['children3'] as $child3) { ?>
<?php if ($child3['category_id'] == $child_id3) { ?>
<a href="<?php echo $child3['href']; ?>" class="list-group-item active"> - <?php echo $child3['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $child3['href']; ?>" class="list-group-item"> - <?php echo $child3['name']; ?></a>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
$products = []; // ваш массив с товарами
/**
* Группирует любой массив массивов по любому полю $indexKey в качестве индекса
*/
function groupBy(array $input, string $indexKey): array
{
return array_reduce($input, function($res, $data) use ($indexKey){
if (!isset($data[$indexKey])) {
return $res;
}
$res[$data[$indexKey]][] = $data;
return $res;
}, []);
}
$groupedProducts = groupBy($products, 'catID');
// такое работает при условии, что категория с одним id будет иметь последнее название из найденных,
// то есть если id один, а название разные, то возможны не ожидаемые результаты
$categories = array_column($products, 'catName', 'catID');
foreach($groupedProducts as $catId => $catProducts) {
// тут доступно название категории $categories[$catId] и ее $catId
foreach($catProducts as $product) {
// тут выводим сами товары $product
}
}
Для PHP 5 нужно [] заменить на array(), предлагаю это сделать самому :)
public function action($action, $table, $where){
if (count($where) === 3){
$operators = ['=', '>', '<', '<=', '>='];
$field = $where[0];
$operator = $where[1];
$value = $where[2];
if (in_array($operator, $operators)){
$sql = "{$action} * FROM {$table} WHERE {$field} {$operator} ?";
if ( !$this->query($sql, [$value])->showError() ){
return $this->results;
}
}
}
}
$sql = "{$action} * FROM {$table} WHERE {$field} {$operator} ?";
DELETE * FROM ...
. Круто. Не знал, что так можно. Или всё-таки нельзя? // http://htmlbook.ru/html/form/enctype
<form enctype="application/x-www-form-urlencoded | multipart/form-data | text/plain">
...
</form>
// https://www.php.net/manual/ru/reserved.variables.files
// https://www.php.net/manual/en/features.file-upload.post-method.php
<input type="file" name="FILES[]">
UPDATE wp_options SET option_value = REPLACE(option_value, 'old_url_site', 'new_url_site') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE(guid, 'old_url_site', 'new_url_site');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'old_url_site', 'new_url_site')