Jump to content

CrayFlatline

Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Activity
    Project Owner

Recent Profile Visitors

2,197,876 profile views

CrayFlatline's Achievements

Newbie

Newbie (1/14)

2

Reputation

2

Community Answers

  1. Problem is solved I've placed all page logic to init() instead of initContent() I created initContent() method in my module's frontController method, moved all page output code there, and now everything works
  2. I'm creating custom module with page. I have created front controller and output page. Everything is fine. But now I have to change meta title of this page and no luck. I'm trying to make $this->context->smarty->assign(array('meta_title' => 'TEST')); But it doesn't work and on the page I see default website's meta title. I have tried to do $curr_meta_title = $this->context->smarty->getTemplateVars('meta_title'); var_dump($curr_meta_title); And it outputs NULL. I think my module is processed before processing of the default meta title setting. Please help me! What I have to do to change it's behaviour and set $meta_title?
  3. Weill, I have solved it little bit another way. I have separate form on the admin order page just to change this value. Below is my overriden postProcess() public function postProcess() { parent::postProcess(); if (Tools::isSubmit('submitOrderSourceState')) { $orderId = (int)Tools::getValue('id_order'); $statusId = (int)Tools::getValue('id_order_source'); $query = "UPDATE " . _DB_PREFIX_ . "orders SET order_source = " . $statusId . " WHERE id_order=" . $orderId; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query); } } But if you need to change value from order save - just modify corresponding if() from original postProcess().
  4. Oh, thanks! Great idea! I think I need to check postProcess() and add value to this field from Tools:getValue() Thanks again! I will try and post solution if it helps
  5. I'm trying to add custom field to the orders. It should only be filled when admin adds order manually from backend form. Output for this field is need only in the orders list. I have made next changes: 1) added int field order_source to database 2) admin/themes/default/template/controllers/orders/form.tpl <div class="form-group"> <label class="control-label col-lg-3">Order Source</label> <div class="col-lg-9"> <select name="order_source" id="order_source"> <option value="1" {if isset($smarty.post.order_source) && $smarty.post.order_source == 1}selected="selected"{/if}>Internal</option> <option value="2" {if isset($smarty.post.order_source) && $smarty.post.order_source == 2}selected="selected"{/if}>External</option> <option value="3" {if isset($smarty.post.order_source) && $smarty.post.order_source == 3}selected="selected"{/if}>Distribution</option> </select> </div> </div> 3) override/controllers/admin/AdminOrdersController.php class AdminOrdersController extends AdminOrdersControllerCore { public function __construct() { parent::__construct(); $pos = 3; $this->fields_list = array_slice($this->fields_list, 0, $pos, true) + array( 'order_source' => array( 'title' => $this->l('Order Source'), 'align' => 'text-center', 'callback' => 'orderSourceCallback', 'type' => 'select', 'list' => array(1 => 'Internal', 2 => 'External', 3 => 'Distribution'), 'filter_key' => 'order_source', 'filter_type' => 'int', 'orderby' => false ) ) + array_slice($this->fields_list, $pos, count($this->fields_list)-$pos, true); } } 4) override/classes/order/Order.php class Order extends OrderCore { /** @var integer Order Source */ public $order_source; public function __construct($id = null, $id_lang = null) { self::$definition['fields']['order_source'] = array('type' => self::TYPE_INT); parent::__construct($id, $id_lang); } } 5) I have deleted cache_index.php Everything works great, It shows in order list. But when I create new order it doesn't save new field. I have tried to find any suggestions and find some but nothing help. When I manually change field value in the database - it shows in the list and I even can filter this column. But still can't save field value. Please help me
×
×
  • Create New...