Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion upload/admin/controller/design/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ protected function validateDelete() {
$this->load->model('catalog/category');
$this->load->model('catalog/information');
$this->load->model('catalog/manufacturer');
$this->load->model('blog/category');
$this->load->model('blog/article');

foreach ($this->request->post['selected'] as $layout_id) {
if ($this->config->get('config_layout_id') == $layout_id) {
Expand Down Expand Up @@ -457,8 +459,20 @@ protected function validateDelete() {
if ($information_total) {
$this->error['warning'] = sprintf($this->language->get('error_information'), $information_total);
}

$blog_category_total = $this->model_blog_category->getTotalCategoriesByLayoutId($layout_id);

if ($blog_category_total) {
$this->error['warning'] = sprintf($this->language->get('error_blog_category'), $blog_category_total);
}

$blog_article_total = $this->model_blog_article->getTotalArticlesByLayoutId($layout_id);

if ($blog_article_total) {
$this->error['warning'] = sprintf($this->language->get('error_blog_article'), $blog_article_total);
}
}

return !$this->error;
}
}
}
4 changes: 3 additions & 1 deletion upload/admin/language/en-gb/design/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@
$_['error_product'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s products!';
$_['error_category'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s categories!';
$_['error_manufacturer'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s manufacturers!';
$_['error_information'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s information pages!';
$_['error_information'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s information pages!';
$_['error_blog_article'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s blog articles!';
$_['error_blog_category'] = 'Warning: This layout cannot be deleted as it is currently assigned to %s blog categories!';
2 changes: 2 additions & 0 deletions upload/admin/model/design/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function deleteLayout($layout_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "information_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "blog_category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "article_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
}

public function getLayout($layout_id) {
Expand Down