我正在寻找一种在管理员中为我的信息页面添加字段的方法。我只是在管理员中需要它,而不是在前端显示来自该字段的任何数据。
为了更好地解释我的信息页面的列表页面设置如下:
Information Title | Sort Order | Action
我想添加一个标识模糊,它将在管理员标题之前显示,因此我可以一目了然地看到哪个商店(我正在运行多商店)分配了信息页面。我猜测实际字段需要添加到添加/编辑表单中,然后以某种方式告诉在列表页面上显示该字段输入。
我确实安装了vQmod并查看了文档,但我无法解决这个问题。
我真的很感激任何帮助。
这是来自information.php。
的代码<?php
class ModelCatalogInformation extends Model {
public function getInformation($information_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE i.information_id = '" . (int)$information_id . "' AND id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1'");
//return $query->row;
$r = $query->row;
$r['title'] = preg_replace('/ ## .+/','',$r['title']);
return $r;
}
public function getInformations() {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' ORDER BY i.sort_order, LCASE(id.title) ASC");
//return $query->rows;
$result = $query->rows;
foreach ($result as $key => $r){
$result[$key] = preg_replace('/ ## .+/','',$r['title']);
}
return $result;
}
public function getInformationLayoutId($information_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_to_layout WHERE information_id = '" . (int)$information_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return $this->config->get('config_layout_information');
}
}
}
?>
当你提到检查vQmod缓存时,我突然意识到我正在使用一个mod,它通过使用-1排序顺序隐藏菜单中的信息页面。这是缓存文件夹中的information.php。
<?php
class ModelCatalogInformation extends Model {
public function getInformation($information_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE i.information_id = '" . (int)$information_id . "' AND id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1'");
return $query->row;
}
public function getInformations() {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' AND i.sort_order <> '-1' ORDER BY i.sort_order, LCASE(id.title) ASC");
return $query->rows;
}
public function getInformationLayoutId($information_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_to_layout WHERE information_id = '" . (int)$information_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return $this->config->get('config_layout_information');
}
}
}
?>
答案 0 :(得分:1)
如果我理解您的目的,我会为您提供更简单的解决方案。
在标题字段中添加您的描述,使用一些唯一标记来指示此描述的开头,它不会在前端呈现,例如:
我在这里使用##
作为令牌。
我的标题##此页面适用于商店1
然后在功能catalog/model/catalog/information
中修改getInformation()
找到行:
return $query->row;
替换为:
//return $query->row;
$r = $query->row;
$r['title'] = preg_replace('/ ## .+/','',$r['title']);
return $r;
在函数getInformations()
中找到行:
return $query->rows;
替换为:
//return $query->rows;
$result = $query->rows;
foreach ($result as $key => $r){
$result[$key] = preg_replace('/ ## .+/','',$r['title']);
}
return $result;
你已经完成了。
答案 1 :(得分:0)
这适用于侧箱信息显示,但是如果您使用带有列的主题并拉入信息链接以在那里显示,则只会拉入每个链接标题的第一个字母。
以下是页脚的代码。我在相同的购物车版本中使用相同的设置作为flightoffancy:
这是来自目录/ controller / common / footer:
$this->load->model('catalog/information');
$this->data['informations'] = array();
foreach ($this->model_catalog_information->getInformations() as $result) {
if ($result['bottom']) {
$this->data['informations'][] = array(
'title' => $result['title'],
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}
}
$this->data['contact'] = $this->url->link('information/contact');
$this->data['return'] = $this->url->link('account/return/insert', '', 'SSL');
$this->data['sitemap'] = $this->url->link('information/sitemap');
$this->data['manufacturer'] = $this->url->link('product/manufacturer');
$this->data['voucher'] = $this->url->link('account/voucher', '', 'SSL');
$this->data['affiliate'] = $this->url->link('affiliate/account', '', 'SSL');
$this->data['special'] = $this->url->link('product/special');
$this->data['account'] = $this->url->link('account/account', '', 'SSL');
$this->data['order'] = $this->url->link('account/order', '', 'SSL');
$this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL');
$this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');