Post by joemaydew » Mon Jun 13, 2016 7:10 pm

Hello,

I am currently using the Export_XLS extension to export my orders as CSV. The below code adds each line to the CSV for me to import to my courier and create shipping labels.

What I need is to add the SKU to the export. I am aware that the SKU is not part of the order table. Can someone please help me with this if possible?

Code: Select all

// Add each product line
$this->objPHPExcel->getActiveSheet()->setCellValue('A' . $counter, $this->data['orders'][0]['shipping_address_1']);
$this->objPHPExcel->getActiveSheet()->setCellValue('B' . $counter, $this->data['orders'][0]['shipping_address_2']);
$this->objPHPExcel->getActiveSheet()->setCellValue('C' . $counter, $this->data['orders'][0]['shipping_city']);
$this->objPHPExcel->getActiveSheet()->setCellValue('D' . $counter, $this->data['orders'][0]['shipping_zone']);
$this->objPHPExcel->getActiveSheet()->setCellValue('E' . $counter, $this->data['orders'][0]['shipping_postcode']);
$this->objPHPExcel->getActiveSheet()->setCellValue('F' . $counter, $this->data['orders'][0]['shipping_firstname']);
$this->objPHPExcel->getActiveSheet()->setCellValue('G' . $counter, $this->data['orders'][0]['shipping_lastname']);
$this->objPHPExcel->getActiveSheet()->setCellValue('H' . $counter, $this->data['orders'][0]['email']);
$this->objPHPExcel->getActiveSheet()->setCellValue('L' . $counter, $this->data['orders'][0]['order_id']);

User avatar
New member

Posts

Joined
Wed May 07, 2014 4:58 pm
Location - Staffordshire, United Kingdom

Post by florinsith » Tue Jun 14, 2016 12:26 am

What is in $this->data['orders'] ? If its filled by the admin getOrder method? If yes that that doesnt return the sku, youll have to fetch it separatly for each product or join the product table in the getOrder method. Tho by the second index it doesnt seem like it uses that method.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by joemaydew » Thu Jun 16, 2016 5:40 pm

I think it is getOrder method. Can you explain how I would call the product table??

User avatar
New member

Posts

Joined
Wed May 07, 2014 4:58 pm
Location - Staffordshire, United Kingdom
Who is online

Users browsing this forum: No registered users and 45 guests