'orditems', 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'OrderItemsEventHandler','file'=>'order_items_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'OrderItemsTagProcessor','file'=>'order_items_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, 'AggregateTags' => Array( Array( 'AggregateTo' => '#PARENT#', 'AggregatedTagName' => 'ItemFieldEquals', 'LocalTagName' => 'FieldEquals', ), ), 'Hooks' => Array( Array( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => '#PARENT#', 'HookToSpecial' => '', 'HookToEvent' => Array('OnPreSave', 'OnRecalculateItems'), 'DoPrefix' => '', 'DoSpecial' => '', 'DoEvent' => 'OnUpdate', ), ), 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), 'IDField' => 'OrderItemId', 'TitleField' => 'OrderItemId', 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events 'TableName' => TABLE_PREFIX.'OrderItems', 'ParentTableKey'=> 'OrderId', // linked field in master table 'ForeignKey' => 'OrderId', // linked field in subtable 'ParentPrefix' => 'ord', 'AutoDelete' => true, 'AutoClone' => true, 'ItemType' => 11, 'CalculatedFields' => Array( '' => Array( 'ExtendedPrice' => '%1$s.Price * %1$s.Quantity', 'ExtendedPriceFlat' => '%1$s.FlatPrice * %1$s.Quantity', 'QuantityAvailable' => 'IF( ISNULL(p.QtyInStock) AND ISNULL(p.ProductId),"!la_ProductDeleted!", IF(p.Type = 1, IF(p.InventoryStatus = 2, poc.QtyInStock, p.QtyInStock), "") )', 'ItemDiscount' => '(%1$s.FlatPrice - %1$s.Price)', 'SKU' => 'IF(p.InventoryStatus = 2 OR NOT ISNULL(poc.CombinationCRC), poc.SKU, p.SKU)', // inventory by options OR combination found ), ), 'ListSQLs' => Array( ''=>' SELECT %1$s.*, p.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Products p ON %1$s.ProductId = p.ProductId LEFT JOIN '.TABLE_PREFIX.'ProductOptionCombinations poc ON (%1$s.ProductId = poc.ProductId) AND (%1$s.OptionsSalt = poc.CombinationCRC)',), 'ItemSQLs' => Array( ''=>'SELECT *, (Quantity*Price) AS ExtendedPrice, 0 AS QuantityAvailable FROM %s',), 'ListSortings' => Array( '' => Array( 'Sorting' => Array('ProductName' => 'asc', 'BackOrderFlag' => 'asc'), ) ), 'Fields' => Array( 'OrderItemId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'OrderId' => Array('type' => 'int','not_null' => 1, 'default' => 0), 'ProductId' => Array('type' => 'int','not_null' => 1, 'default' => 0), 'ProductName' => Array('type' => 'string','not_null' => 1, 'default' => ''), 'Quantity' => Array('type' => 'int','not_null' => 1, 'default' => 0), 'QuantityReserved' => Array('type' => 'int', 'default' => null), 'FlatPrice' => Array('type' => 'double','formatter'=>'kFormatter','format'=>'%01.2f','not_null' => '1','default' => '0.0000'), 'Price' => Array('type' => 'double','formatter'=>'kFormatter','format'=>'%01.2f','not_null' => '1','default' => '0.0000'), 'Cost' => Array('type' => 'double','formatter'=>'kFormatter','format'=>'%01.2f','not_null' => '1','default' => '0.0000'), 'BackOrderFlag' => Array('type' => 'int', 'default' => 0), 'Weight' => Array ('type' => 'double', 'default' => NULL), 'ShippingTypeId' => Array ('type' => 'string', 'default' => NULL), 'ItemData' => Array('type' => 'string','default' => null), 'OptionsSalt' => Array('type' => 'int', 'default' => 0), 'SplitShippingGroup' => Array('type' => 'int', 'not_null' => 1, 'default' => 0,), 'PackageNum' => Array('type' => 'int', 'not_null' => 1, 'default' => 0,), ), 'VirtualFields' => Array( 'ExtendedPrice' => Array('type'=>'double','formatter'=>'kFormatter','format'=>'%01.2f','default'=>'0.00'), 'ExtendedPriceFlat' => Array('type'=>'double','formatter'=>'kFormatter','format'=>'%01.2f','default'=>'0.00'), 'QuantityAvailable' => Array('type'=>'int','default'=>0), 'DiscountType' => Array('type'=>'string','default'=>''), 'DiscountId' => Array('type'=>'int','default'=>0), 'Name' => Array('formatter' => 'kMultiLanguage'), 'ItemDiscount' => Array('type'=>'double','formatter'=>'kFormatter','format'=>'%01.2f','default'=>'0.00'), 'SKU' => Array('type' => 'string', 'default' => ''), ), 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_product.gif',1=>'icon16_product.gif',2=>'icon16_product_pending.gif',0=>'icon16_product_disabled.gif'), 'Fields' => Array( 'ProductName' => Array( 'title'=>'la_col_ProductNameId', 'data_block' => 'grid_productname_td' ), 'Quantity' => Array( 'title'=>'la_col_Quantity', 'data_block' => 'grid_quantity_td' ), 'QuantityReserved' => Array( 'title'=>'la_col_QuantityReserved'), 'QuantityAvailable' => Array( 'title'=>'la_col_QuantityAvailable'), 'Price' => Array( 'title'=>'la_col_Price', 'data_block' => 'grid_price_td' ), 'ExtendedPrice' => Array( 'title'=>'la_col_ExtendedPrice', 'data_block' => 'grid_extendedprice_td' ), ), ), 'NotEditable' => Array( 'Icons' => Array('default'=>'icon16_product.gif',1=>'icon16_product.gif',2=>'icon16_product_pending.gif',0=>'icon16_product_disabled.gif'), 'Fields' => Array( 'ProductName' => Array( 'title'=>'la_col_ProductNameId', 'data_block' => 'grid_productname_td' ), 'Quantity' => Array( 'title'=>'la_col_Quantity'), 'QuantityReserved' => Array( 'title'=>'la_col_QuantityReserved'), 'QuantityAvailable' => Array( 'title'=>'la_col_QuantityAvailable'), 'Price' => Array( 'title'=>'la_col_Price' ), 'ExtendedPrice' => Array( 'title'=>'la_col_ExtendedPrice'), ), ), ), );