function createTable() { $allCats = Module_EComm::getIndexes("ecomm_category", "id", "name", 0); $parentDropDown = array("0" => "- Top Level -"); foreach ($allCats as $key => $val) { $parentDropDown[$key] = $val; } $cols = array('id?', DBColumn::make('!text', 'name', 'Name'), DBColumn::make('!select', 'parent_category', 'Parent Category', $parentDropDown), DBColumn::make('//integer', 'image', 'Image'), DBColumn::make('timestamp', 'date_added', 'Date Added'), DBColumn::make('//text', 'last_modified', 'Last Modified'), DBColumn::make('select', 'status', 'Status', array('1' => 'Active', '0' => 'Inactive')), DBColumn::make('tinymce', 'details', 'Details')); return new DBTable("ecomm_category", __CLASS__, $cols); }
function DBTable($dbname, $classname, $columns) { $this->columns = array(); $this->name = $dbname; $this->classname = $classname; foreach ($columns as $key => $column) { if (is_string($column)) { $column = DBColumn::make($column); } $this->columns[$column->name()] = $column; $sql = "select `" . $column->name() . "` from `{$dbname}` where id="; $column->setLoadSQL($sql); $column->setLoadQuery(new Query("{$sql}?", "i")); } $select = "select " . $this->loadColumnNames() . " from `{$dbname}`"; $this->select = $select; $this->fetchQuery = new Query("{$select} where id=?", "i"); $this->fetchAllQuery = new Query($select, ""); $this->deleteQuery = new Query("delete from `{$dbname}` where id=?", "i"); }
function createTable($table, $class, $customColumns = array()) { $cols = $customColumns; $columns = array(); $done = array(); foreach ($cols as $col) { $done[$col->name()] = true; } foreach ($columns as $col) { $name = $col->get('name'); if (isset($done[$name])) { error_log("Warning: column {$name} is specified twice; check both in {$class}.php and in dbtable"); } else { $cols[] = DBColumn::make($col->get('type'), $name, $col->get('label'), null, $col->get('modifier')); $done[$name] = true; } } $result = new DBTable($table, $class, $cols); return $result; }
function createTable() { $cols = array('id?', DBColumn::make('integer', 'order_nb', 'Order'), DBColumn::make('integer', 'product', 'Product'), DBColumn::make('text', 'product_name', 'Product Name'), DBColumn::make('integer', 'quantity', 'Quantity')); return new DBTable("ecomm_order_detail", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!text', 'ip_address', 'IP Address'), DBColumn::make('select', 'status', 'Status', array('1' => 'Active', '0' => 'Inactive')), DBColumn::make('integer', 'user', 'User'), DBColumn::make('text', 'shipping_class', 'Shipping Class'), DBColumn::make('text', 'payment_class', 'Payment Class')); return new DBTable("ecomm_session", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!select', 'country', 'Country', Address::getCountries()), DBColumn::make('!select', 'province', 'Province / State', Address::getStates()), DBColumn::make('!select', 'tax_class', 'Tax Class', TaxClass::getAllTaxClassesIdAndName()), DBColumn::make('!float', 'tax_rate', 'Tax Rate %'), DBColumn::make('timestamp', 'date_added', 'Date Added'), DBColumn::make('//text', 'last_modified', 'Last Modified'), DBColumn::make('tinymce', 'details', 'Details')); return new DBTable("ecomm_tax_rate", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!text', 'name', 'Title'), DBColumn::make('!select', 'supplier', 'Supplier', Module_EComm::getIndexes("ecomm_supplier", "id", "name", 0)), DBColumn::make('!select', 'category', 'Category', Module_EComm::getIndexes("ecomm_category", "id", "name", 0)), DBColumn::make('!select', 'producttype', 'Product Type', Module_EComm::getIndexes("ecomm_product_type", "id", "name", 0)), DBColumn::make('!select', 'tax_class', 'Tax Class', Module_EComm::getIndexes("ecomm_tax_class", "id", "name", 0)), DBColumn::make('!integer', 'stock_quantity', 'Stock Quantity'), DBColumn::make('//integer', 'image', 'Image'), DBColumn::make('!float', 'price', 'Price (' . SiteConfig::get("EComm::CurrencySign") . ")"), DBColumn::make('timestamp', 'date_added', 'Date Added'), DBColumn::make('//text', 'last_modified', 'Last Modified'), DBColumn::make('select', 'status', 'Status', array('1' => 'Active', '0' => 'Inactive')), DBColumn::make('tinymce', 'details', 'Details')); return new DBTable("ecomm_product", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('//integer', 'order_nb', 'Order'), DBColumn::make('select', 'status', 'Order Status', array("Pending" => "Pending", "Shipped" => "Shipped", "Complete" => "Complete")), DBColumn::make('textarea', 'comment', 'Comment')); return new DBTable("ecomm_order_comment", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('text', 'tid', 'Transaction ID'), DBColumn::make('integer', 'user', 'User'), DBColumn::make('text', 'customer_name', 'Customer Name'), DBColumn::make('text', 'user_email', 'Customer Email'), DBColumn::make('text', 'phone', 'Phone number'), DBColumn::make('text', 'shipping_street', 'Shipping street'), DBColumn::make('text', 'shipping_city', 'Shipping City'), DBColumn::make('text', 'shipping_postal', 'Shipping Postal'), DBColumn::make('text', 'shipping_province', 'Shipping Province'), DBColumn::make('text', 'shipping_country', 'Shipping Country'), DBColumn::make('text', 'billing_street', 'Billing Street'), DBColumn::make('text', 'billing_city', 'Billing City'), DBColumn::make('text', 'billing_postal', 'Billing Postal'), DBColumn::make('text', 'billing_province', 'Billing Province'), DBColumn::make('text', 'billing_country', 'Billing Country'), DBColumn::make('text', 'cost_subtotal', 'Sub Total'), DBColumn::make('text', 'cost_tax', 'Tax'), DBColumn::make('text', 'cost_shipping', 'Shipping Cost'), DBColumn::make('text', 'cost_total', 'Total'), DBColumn::make('text', 'ip', 'IP Address'), DBColumn::make('text', 'shipping_class', 'Shipping Class'), DBColumn::make('text', 'payment_class', 'Payment Class'), DBColumn::make('text', 'created', 'Timestamp'), DBColumn::make('textarea', 'delivery_instructions', 'Delivery Instructions'), DBColumn::make('text', 'status', 'Status')); return new DBTable("ecomm_order", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('integer', 'is_verified', 'Is Verified'), DBColumn::make('text', 'transaction', 'Transaction'), DBColumn::make('text', 'txnid', 'Paypal Transaction ID'), DBColumn::make('text', 'payment_status', 'Payment Status'), DBColumn::make('text', 'post_string', 'Post fields'), DBColumn::make('text', 'memo', 'Memo')); return new DBTable("ecomm_paypal_ipn", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('integer', 'session', 'Session ID'), DBColumn::make('integer', 'product', 'Product'), DBColumn::make('integer', 'quantity', 'Quantity'), DBColumn::make('integer', 'transaction', 'Transaction')); return new DBTable("ecomm_cart_item", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!text', 'name', 'Name'), DBColumn::make('//integer', 'image', 'Image'), DBColumn::make('timestamp', 'date_added', 'Date Added'), DBColumn::make('//text', 'last_modified', 'Last Modified'), DBColumn::make('select', 'status', 'Status', array('1' => 'Active', '0' => 'Inactive')), DBColumn::make('tinymce', 'details', 'Details')); return new DBTable("ecomm_supplier", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!integer', 'product', 'Product'), DBColumn::make('!integer', 'pallet_count', 'Pallet Count'), DBColumn::make('!float', 'weight', 'Weight'), DBColumn::make('!select', 'weight_unit', 'Weight Unit', array('KG' => 'KG', 'Cubic Feet' => 'Cubic Feet', 'Cubic Yards' => 'Cubic Yards', 'LB' => 'LB'))); return new DBTable("ecomm_product_properties", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('//integer', 'user', 'User'), DBColumn::make('//text', 'phone_number', 'Phone number'), DBColumn::make('//integer', 'shipping_address', 'Shipping Address'), DBColumn::make('//integer', 'billing_address', 'Billing Address')); return new DBTable("ecomm_user_details", __CLASS__, $cols); }
function createTable() { $cols = array('id?', DBColumn::make('!integer', 'product', 'Product'), DBColumn::make('!integer', 'image', 'Image')); return new DBTable("ecomm_product_alternative_image", __CLASS__, $cols); }