• Resolved Rob

    (@seomandarin)


    Hi,

    Great plugin, I’ve just purchased and rated it 5 stars.

    Although there’s 2 things I have to do to match the freight company ??

    1. the product column autogenerates “SKU #1” “Item #1“. How can I change this into “SKU1” “Item1“?

    2. Also, i have to create an extra line of columns on line 2 with a Chinese translation like in this example: https://imgur.com/a/B02qs Is there a way to do this?

    Many thanks!

    Regards
    Rob

    • This topic was modified 8 years, 4 months ago by Rob.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author algol.plus

    (@algolplus)

    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;
    }
    Plugin Author algol.plus

    (@algolplus)

    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!

    Plugin Author algol.plus

    (@algolplus)

    No need to do anything.

    my code must work ok for both csv and xls

    • This reply was modified 8 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: https://imgur.com/a/B02qs Is there a way to do this?”

    Thanks!

    Plugin Author algol.plus

    (@algolplus)

    About 2nd line in file header.
    it’s possible, but you haven’t replied to my question .

    Do you export CSV or XLS file?

    Thread Starter Rob

    (@seomandarin)

    xls

    Plugin Author algol.plus

    (@algolplus)

    hi Rob

    please, email to [email protected]

    I’ll provide beta version for tests

    Plugin Author algol.plus

    (@algolplus)

    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 8 years, 4 months ago by algol.plus.
    Thread Starter Rob

    (@seomandarin)

    Great! All seems to work perfectly. Thanks for that!

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome.
    good luck!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Renaming product columns’ is closed to new replies.