Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product CSV bools #8

Open
jtrotsky opened this issue Mar 4, 2015 · 5 comments
Open

Product CSV bools #8

jtrotsky opened this issue Mar 4, 2015 · 5 comments

Comments

@jtrotsky
Copy link

jtrotsky commented Mar 4, 2015

In a Vend product CSV, there are some strict rules for what is a valid import to a Vend store.
The two boolean columns in the CSV are active and track_inventory.

Vend will only accept a 1 or 0 for bools, true and false are not valid. (this is our error.. but it exists either way.)

Currently vend-tools downloads products with active and track_inventory like this:

screenshot 2015-03-04 09 48 27

It needs to looks like this:

screenshot 2015-03-04 09 48 51

Should be a simple fix.
I don't know how it should look here, but this is what I did (in Golang):

// Both must be integer bools instead of the default strings.
a := 0
if *product.Active {
    a = 1
}
active := fmt.Sprintf("%v", a)

t := 0
if *product.TrackInventory {
    t = 1
}
trackInventory := fmt.Sprintf("%v", t)
@pulkitsinghal
Copy link
Contributor

@jtrotsky - Thanks! Yes, this should be accomplishable.

@elbrando - You use this feature quite a bit to print new barcodes right? By piping the data into your 3rd party software every so often ... correct? So, I want to make sure that if I make the changes suggested above ... replace true/false with 1/0 ... it should not break your process ... will it? Let us know.

@pulkitsinghal
Copy link
Contributor

I'm thinking of an explicit flag to enable the functionality, something like:

  1. --formatForVend true, or
  2. --vendCompatible true, or
  3. --vendFriendly true, or
  4. --vendFormatted true, or
  5. --dataFormat vend

@elbrando
Copy link

elbrando commented Mar 6, 2015

Yes, we use this a lot. The "true/false" vs. "0/1" thing is what it is. Should the field be true/false? Sure. Can we deal with the bifurcation? Sure.

Personally, I'd rather deal with the 0/1 until Vend makes it evaluate true/false, as it should. ;)

Mostly, I just wanted to use "bifurcation" in a meaningful way today. Thanks.

@pulkitsinghal
Copy link
Contributor

Soooo ... (god i'm dumb)... @elbrando you want 0/1 convention right?

@jtrotsky
Copy link
Author

jtrotsky commented Mar 6, 2015

@pulkitsinghal I like the idea of a --vendFriendly flag.

Personally, I'd rather deal with the 0/1 until Vend makes it evaluate true/false, as it should. ;)

Vend currently only evaluates 1/0, but yes it it definitely should take true/false also. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants