Skip to content

Instantly share code, notes, and snippets.

@davehewy
Created January 7, 2014 22:43
Show Gist options
  • Save davehewy/8308315 to your computer and use it in GitHub Desktop.
Save davehewy/8308315 to your computer and use it in GitHub Desktop.
<?
class DevodoCredit_AddCredits extends Backend_Controller
{
public $implement = 'Db_ListBehavior, Db_FormBehavior';
public function __construct(){
parent::__construct();
}
public function index(){
$this->app_page_title = 'Orders';
}
}
<?php
class DevodoCredit_AddCredit extends Db_ActiveRecord
{
public $table_name = 'shop_customers';
public static function create(){
return new self();
}
public function define_columns($context = null){
$this->define_column('registered_customer', 'registered_customer', 'Customer', db_varchar, "concat(@first_name, ' ', @last_name, ' (', @email, ')')")->invisible();
}
public function define_form_fields($context = null){
$this->add_form_field('registered_customer')->tab('Customer')->
renderAs(frm_record_finder, array(
'sorting'=>'first_name, last_name, email',
'list_columns'=>'first_name,last_name,email,guest,created_at',
'search_columns'=>'shop_customers.first_name,shop_customers.last_name,shop_customers.email,shop_customers.guest,shop_customers.created_at',
'search_prompt'=>'Find customer by name or email',
'form_title'=>'Find Customer',
'display_name_field'=>'full_name',
'display_description_field'=>'email',
'prompt'=>'Click the Find button to find a customer'))->
comment('Please select a customer or check "Create new customer".', 'above');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment