|
前台展示
後台展示
1 修改admin\controller\module\latest.php
1.1 找到
- $this->data['entry_layout'] = $this->language->get('entry_layout');
複製代碼 底下新增
- $this->data['entry_category'] = $this->language->get('entry_category'); //module of latest with catagory by woff
複製代碼 1.2 找到
- $this->data['layouts'] = $this->model_design_layout->getLayouts();
複製代碼 底下新增
- //module of latest with catagory by woff
- $this->load->model('catalog/category');
- $this->data['categorys'] = $this->model_catalog_category->getCategories();
- //module of latest with catagory by woff
複製代碼
1.3 找到
上面新增
- //module of latest with catagory by woff
- if (isset($this->request->post['latest_module'])) {
- foreach ($this->request->post['latest_module'] as $key => $value) {
- if (!$value['category_id']) {
- $this->error['warning'][$key] = $this->language->get('error_category_id');
- }
- }
- }
- //module of latest with catagory by woff
複製代碼 (這裡是寫入設定到資料庫,並且若是產生error會顯示錯誤,但是我偷懶沒有加入錯誤訊息...各位可以自行加入)
2 修改admin\view\template\module\latest.tpl
2.1
- <td><?php echo $entry_layout; ?></td>
複製代碼 下面加入
- <td><?php echo $entry_category; ?></td> <!--module of latest with catagory by woff-->
複製代碼 2.2
- <option value="<?php echo $layout['layout_id']; ?>"><?php echo $layout['name']; ?></option>
- <?php } ?>
- <?php } ?>
- </select></td>
複製代碼
下面插入
- <!--module of latest with catagory by woff-->
- <td><select name="latest_module[<?php echo $module_row; ?>][category_id]">
- <?php foreach ($categorys as $categories) { ?>
- <?php if ($categories['category_id'] == $module['category_id']) { ?>
- <option value="<?php echo $categories['category_id']; ?>" selected="selected"><?php echo $categories['name']; ?></option>
- <?php } else { ?>
- <option value="<?php echo $categories['category_id']; ?>"><?php echo $categories['name']; ?></option>
- <?php } ?>
- <?php } ?>
- </select></td>
- <!--module of latest with catagory by woff-->
複製代碼 2.3
這裡把6改為7,因為td從6變成7了.......
2.4 找到
- html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
- <?php } ?>
- html += ' </select></td>';
複製代碼 下面新增- //module of latest with catagory by woff
- html += ' <td><select name="latest_module[' + module_row + '][category_id]">';
- <?php foreach ($categorys as $categories) { ?>
- html += ' <option value="<?php echo $categories['category_id']; ?>"><?php echo addslashes($categories['name']); ?></option>';
- <?php } ?>
- html += ' </select></td>';
- //module of latest with catagory by woff
複製代碼 3 在admin\language\zh-TW\module\latest.php 語系檔裡面新增
- $_['entry_category'] = '商品類別:'; //module of latest with catagory by woff
複製代碼 4 catalog\controller\module\atest.php
4.1 找到
- 'sort' => 'p.date_added',
- 'order' => 'DESC',
- 'start' => 0,
- 'limit' => $setting['limit']
複製代碼 上面插入
- 'filter_category_id' => $setting['category_id'], //module of latest with catagory by woff
複製代碼
|
|