1. the product column autogenerates “SKU #1” “Item #1“. How can I change this into “SKU1” “Item1“?
please, add following code to functions.php in active theme
add_filter('woe_add_csv_headers','woe_rename_csv_columns', 10, 2);
function woe_rename_csv_columns($cols, $field) {
if($cols) {
foreach($cols as $k=>$v) {
$cols[$k] = preg_replace("/ #(\d+)/",'\\1',$v);
}
}
return $cols;
}
About 2nd line in file header.
Do you export csv or XLS file?
Thread Starter
Rob
(@seomandarin)
Appreciate the quick reply. The csv works like a charm. I’ve tried changing it to xls like this but no luck:
add_filter('woe_add_xls_headers','woe_rename_xls_columns', 10, 2);
function woe_rename_xls_columns($cols, $field) {
if($cols) {
foreach($cols as $k=>$v) {
$cols[$k] = preg_replace("/ #(\d+)/",'\\1',$v);
}
}
return $cols;
How to make it work for xls?
Thanks!
No need to do anything.
my code must work ok for both csv and xls
-
This reply was modified 9 years, 4 months ago by
algol.plus.
Thread Starter
Rob
(@seomandarin)
Ah yes, it does! Excellent.
Any thoughts on point 2? or is that hard to do to automate?
“2. Also, i have to create an extra line of columns on line 2 with a Chinese translation like in this example: http://imgur.com/a/B02qs Is there a way to do this?”
Thanks!
About 2nd line in file header.
it’s possible, but you haven’t replied to my question .
Do you export CSV or XLS file?
hi Rob
please, email to aprokaev@gmail.com
I’ll provide beta version for tests
This code will work in 1.2.3(Pro)
add_action( 'woe_xls_print_header', 'woe_add_2nd_xls_header', 10, 2 );
function woe_add_2nd_xls_header($objxls,$formatter) {
$data = array("Chinese(next cell is empty)","","text","here!");
$formatter->last_row++;
foreach ( $data as $pos => $text ) {
$formatter->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow( $pos, $formatter->last_row, $text );
}
}
-
This reply was modified 9 years, 4 months ago by
algol.plus.
Thread Starter
Rob
(@seomandarin)
Great! All seems to work perfectly. Thanks for that!
you’re welcome.
good luck!