Export csv changing part numbers

  • Posts: 234
  • Thank you received: 4
8 years 4 months ago #224550

-- HikaShop version -- : 2.6.0

Hello

I am exporting my orders however it removes any leading zero from the part numbers. How can I get it to not do this as my part numbers need the leading zero.

Thanks
Iain

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

  • Posts: 13201
  • Thank you received: 2322
8 years 4 months ago #224552

Hi,

Are you sure that the leading 0 are not removed by you csv file reader ?
Do you have tried to open the csv editor with a text editor like windows notepad ?

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

  • Posts: 234
  • Thank you received: 4
8 years 4 months ago #224776

Hello

At first I thought it was Excel however when opened in notepad it has removed the leading zero,

Thanks
Iain

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 4 months ago #224777

Hi,

How do you export your CSV ? What do you mean by "part number" ? The product code of the products ?
Could you provide a copy of the CSV ?

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

  • Posts: 234
  • Thank you received: 4
8 years 4 months ago #224825

Hello,

Yes product code, I am going into Orders, and selecting export. Please find attached the file.
The product code 546 is actually on the site 0546.

Yours
Iain

Attachments:

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 4 months ago #224856

Hi,

Ok, I see the problem.
Try changing the code:

if( is_numeric($value)) {
				$this->writeNumber($this->currLine, $i++, $value, $lastOne);
to:
if( is_numeric($value) && (preg_match('[^0-9]',$value) || ltrim($value,'0')===(string)$value)) {
				$this->writeNumber($this->currLine, $i++, $value, $lastOne);
in the file administrator/components/com_hikashop/helpers/spreadsheet.php and let us know if that works.

The following user(s) said Thank You: mad-q

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

  • Posts: 356
  • Thank you received: 7
  • Hikashop Business
3 years 1 month ago #331177

This also happens with 0's at the end of the product code;

example:

Product code 100294.110 is returned 100294.11 in the csv.

Yes I have checked this in notepad.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
3 years 1 month ago #331188

Hi,

I have tested this on my end with the export of a product with the latest version of HikaShop and I cannot reproduce:

File Attachment:

File Name: hikashopexport18.csv
File Size:10 KB

So I can only guess that you have a view override of product / export.php from an old version of HikaShop, or an old version of HikaShop and thus you're missing some of the fixes we've added to it.

Attachments:
Last edit: 3 years 1 month ago by nicolas.
The following user(s) said Thank You: grayt7

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

Time to create page: 0.087 seconds
Powered by Kunena Forum