Jump to content

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


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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.