Amazon Export Inventory

Exports your Amazon inventory to text.

  1. // ==UserScript==
  2. // @name Amazon Export Inventory
  3. // @namespace riceball
  4. // @locale en-us
  5. // @description Exports your Amazon inventory to text.
  6. // @include https://sellercentral.amazon.com/inventory/*
  7. // @version 1
  8. // @grant none
  9. // @run-at document-end
  10. // ==/UserScript==
  11.  
  12. /* Script assumes that Amazon has $ === jQuery, which is generally true.
  13. *
  14. * The idea behind this script is to export your inventory and use
  15. * it to post Craigslist or other ads to other marketplaces.
  16. * It applies a fixed price increase on every item, and then
  17. * calculates a shipping price based on the type of product:
  18. * CD, paperback, or hardcover.
  19. *
  20. * The shipping is a guess based on the product type, but it
  21. * is a fixed price, so you will need to adjust for heavy books.
  22. *
  23. * To use it, set your inventory list to display all your inventory
  24. * if possible, and then click the button. Copy-paste the data out.
  25. */
  26.  
  27. price_increase = 1.00
  28. audio_cd_shipping = 2.75;
  29. paperback_shipping = 2.80;
  30. hardcover_shipping = 3.50;
  31.  
  32. function getRows() {
  33. var ids = [];
  34. var myrows = [];
  35. $rows = $('.mt-row');
  36. $rows.each(function (idx) {
  37. ids.push($(this).attr('id'));
  38. });
  39. ids.forEach(function(id) {
  40. var selector = '#'+id;
  41. var quantity = $(selector+'-quantity-quantity').find('.a-input-text').attr('value');
  42. if (parseInt(quantity)==0) return; // skip if we don't have it
  43. var title = $(selector+'-title-title').find('.mt-link').attr('title');
  44. var price = $(selector+'-price-price').find('.a-input-text').attr('value');
  45. var newPrice = round_price(price_increase + parseFloat(price));
  46.  
  47. var withshipping = 0;
  48. if (title.match(/\[Audio CD\]/)) {
  49. withshipping = round_price(audio_cd_shipping + newPrice);
  50. } else if (title.match(/\[Hardcover\]/)) {
  51. withshipping = round_price(hardcover_shipping + newPrice);
  52. } else if (title.match(/\[Paperback\]/)) {
  53. withshipping = round_price(paperback_shipping + newPrice);
  54. }
  55. if (quantity > 1 && withshipping != 0 ) {
  56. myrows.push( title + " (qyt: " + quantity + ") :: $" + newPrice.toFixed(2) + " :: (w/shipping $" + withshipping.toFixed(2) + ")" );
  57. } else if (withshipping != 0) {
  58. myrows.push( title + " :: $" + newPrice + " :: (w/shipping $" + withshipping.toFixed(2) + ")" );
  59. } else {
  60. myrows.push( title + " :: $" + newPrice + " :: (w/shipping tbd)" );
  61. }
  62. });
  63. showDialog(myrows.join("\n"));
  64. }
  65.  
  66. function round_price(price) {
  67. return Math.round(price*100)/100;
  68. }
  69.  
  70. // shows a textarea with your string
  71. function showDialog(text) {
  72. var $ta = $('<textarea style="position:absolute; top:50px; left:0; width: 80%; height: 500px">');
  73. $ta.val(text);
  74. $('#sc-masthead').append($ta);
  75. }
  76.  
  77. function button_attacher() {
  78. console.log("button_attacher trying to attach");
  79. if ($('#sc-mkt-switcher-form').length > 0) {
  80. $mybutton = $('<button id="myamazonbutton" style="margin-right: 9px;">Export Inventory</button>');
  81. $mybutton.click(getRows);
  82. $('#sc-mkt-switcher-form').prepend($mybutton);
  83. window.clearInterval(amazonExportInventoryAttacher);
  84. amazonExportInventoryAttacher = undefined;
  85. } else {
  86. console.log("found no dialog - skipping");
  87. }
  88. }
  89.  
  90. console.log('export inventory executed');
  91. console.log('adding the button attacher');
  92. amazonExportInventoryAttacher = window.setInterval(button_attacher, 10000); // every 10 seconds, try to attach the button to the dialog.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址