function addsupplier(){ $legacy = JRequest::getInt('legacy', 0); if($legacy) { $suppliers = JRequest::getVar( 'cid', array(), '', 'array' ); $rows = array(); if(!empty($suppliers)){ JArrayHelper::toInteger($suppliers); $database = JFactory::getDBO(); $query = 'SELECT * FROM '.hikashop_table('supplier').' WHERE supplier_id IN ('.implode(',',$suppliers).')'; $database->setQuery($query); $rows = $database->loadObjectList(); } $this->assignRef('rows',$rows); $config =& hikashop_config(); $main_currency = $config->get('main_currency',1); $currency = hikashop_get('type.currency'); $this->assignRef('currency',$currency); if (!DACSHOP_PHP5) { $document =& JFactory::getDocument(); }else{ $document = JFactory::getDocument(); } $js = " window.hikashop.ready( function() { var dstTable = window.top.document.getElementById('supplier_listing'); var srcTable = document.getElementById('result'); for (var c = 0,m=srcTable.rows.length;caddScriptDeclaration($js); return true; } $suppliers_id = JRequest::getVar('cid', array(), '', 'array'); //$product_id = JRequest::getInt('product_id', 0); $output = '[]'; if(!empty($suppliers_id)) { JArrayHelper::toInteger($suppliers_id); $query = 'SELECT * FROM '.hikashop_table('supplier').' WHERE supplier_id IN ('.implode(',',$suppliers_id).')'; $db = JFactory::getDBO(); $db->setQuery($query); $suppliers = $db->loadObjectList(); $output = json_encode($suppliers); } $js = 'window.hikashop.ready(function(){window.parent.productMgr.addSupplier({suppliers:'.$output.'});});'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); return false; }