ShoppinPal / vend-tools

A command-line-interface (CLI) which allows you to easily perform custom tasks for your vendhq.com instance
http://shoppinpal.github.io/vend-tools/
GNU General Public License v2.0
3 stars 3 forks source link

Product CSV outlet tax showing blank for exclusive #12

Open jtrotsky opened 9 years ago

jtrotsky commented 9 years ago

It looks like the outlet_tax for each outlet is showing blank. If the outlet_tax is just the outlet default then it should show Default tax, otherwise it should show the specific outlet tax.

pulkitsinghal commented 9 years ago

This was intentional thus far and I would like to get you opinion on how to solve the following challenge:

    "taxes": [
      {
        "outlet_id": "yyy",
        "tax_id": "zzz"
      },
    ]

If a retailer has 9000 products, given the structure of taxes array inside a product response ... it requires a lookup to get the names, that means a whole bunch of lookups and with the api rate limiting I think the report may never finish!

But hmmm.... if I just fetch all the taxes in advance then its just one extra pre-emptive api call isn't it? You know what ... on second thought this may be feasible!

pulkitsinghal commented 9 years ago

@jtrotsky - Can you help me out and paste some data or snapshot of what it looks like when the value won't be Default tax ... does it use the tax name, or tax id or the actual tax numerical value?

jtrotsky commented 9 years ago

Hi @pulkitsinghal ,

It uses the tax name.

/api/taxes :

taxes: [
{
id: "b8ca3a65-0109-11e4-fbb5-5d6838e3db38",
name: "AU GST",
rate: 0.1,
default: false,
active: true,
rates: [
{
id: "38e3c309-5d68-11e4-9bb5-b8ca3a65011c",
rate: 0.1,
name: "AU GST"
}
]
}

The way I do it is to gather all the taxes from /api/taxes and then whilst writing the product info I go through each outlet and find the tax with default: true, if I find a match then I can put Default tax, otherwise I use the tax_name from the product.

It looks like this for a tax exclusive store with various taxes on different products/outlets: (ignore the blanks, this is for composite product entries)

screenshot 2015-03-04 13 30 50