Jump to content

I need to convert XML to CSV however I need to reduce the quantity of one column by 100


VikG

Recommended Posts

Hello everyone! I am new here so hopefully I do this right!

 

I have made a PHP script after a lot of google searches to make it work.

 

It works great however I need the following string to show the available stock to be in fact 100 pieces less than it actually is on the xml:

$prodarray = "\"$product_record->Product_Code\"".","."$product_record->Available_Stock-48".",All\n";

This will then write to a CSV file for example:

"SKU1",500,All

This is exported and run on a cron. So instead of 500 I would want it to be 100 units less to 400.

 

How easy is it to do this?

 

TIA

Just subtract 100 from $product_record->Available_Stock before sticking it into the string. Eg:

$stock = $product_record->Available_Stock - 100;
Then use $stock in your CSV string.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.