Skip to main content

Order export layout

More
10 years 7 months ago #228722 by arveni
Order export layout was created by arveni
-- HikaShop version -- : 2.6.1

Hi,

I use mass action to export product order in csv and next manage my stock in a excel file
But I would like to know if it's possible to have one row for each ordered product by order. Right now there is one row by order and x columns for the product (order_id,..., item_1_code,...item_2_code,...) and I would like something like
- order_id,...item_1_code,...
- order_id,,...item_2_code,...
- ...
You did the job on the mass action tool when you select "show result" and not export to csv (see pic)

Is there anything I can do ? Which file I should check and which modification I have to do?

Thank

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #228768 by Xavier
Replied by Xavier on topic Order export layout
Hi,

This will indeed require custom code for now as this has not been implemented. I add this on our todo list.

The best would be to create a new mass action plugin:

And use as main function the function "onProcessOrderMassActionexportCsv", the current function for the default "export csv file" is :
Code:
function onProcessOrderMassActionexportCsv(&$elements,&$action,$k){ $formatExport = $action['formatExport']['format']; $email = $action['formatExport']['email']; $path = $action['formatExport']['path']; if(!empty($path)){ $url = $this->massaction->setExportPaths($path); }else{ $url = array('server'=>'','web'=>''); ob_get_clean(); } $app = JFactory::getApplication(); if($app->isAdmin() || (!$app->isAdmin() && !empty($path))){ $params = new stdClass(); $params->action['order']['order_id'] = 'order_id'; unset($action['formatExport']); $params = $this->massaction->_displayResults('order',$elements,$action,$k); $params->formatExport = $formatExport; $params->path = $url['server']; $params = $this->massaction->sortResult($params->table,$params); $this->massaction->_exportCSV($params); } if(!empty($email) && !empty($path)){ $config = hikashop_config(); $mailClass = hikashop_get('class.mail'); $content = array('type' => 'csv_export'); $mail = $mailClass->get('massaction_notification',$content); $mail->subject = JText::_('MASS_CSV_EMAIL_SUBJECT'); $mail->html = '1'; $csv = new stdClass(); $csv->name = basename($path); $csv->filename = $url['server']; $csv->url = $url['web']; $mail->attachments = array($csv); $mail->dst_name = ''; $mail->dst_email = explode(',',$email); $mailClass->sendMail($mail); } }
As you can see we are calling functions from the mass action class, so you can handle the data instead of the call:
Code:
$this->massaction->_exportCSV($params);

Please Log in or Create an account to join the conversation.

Time to create page: 0.183 seconds
Powered by Kunena Forum