{"action":"created","issue":{"url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/27","labels_url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/27/comments","events_url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/27/events","html_url":"https://github.com/RobertSpread/spreadcart/pull/27","id":120799456,"number":27,"title":"Revised to decouple from SpreadShop JS and use Spreadshirt APIs","user":{"login":"jtlapp","id":138133,"avatar_url":"https://avatars.githubusercontent.com/u/138133?v=3","gravatar_id":"","url":"https://api.github.com/users/jtlapp","html_url":"https://github.com/jtlapp","followers_url":"https://api.github.com/users/jtlapp/followers","following_url":"https://api.github.com/users/jtlapp/following{/other_user}","gists_url":"https://api.github.com/users/jtlapp/gists{/gist_id}","starred_url":"https://api.github.com/users/jtlapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtlapp/subscriptions","organizations_url":"https://api.github.com/users/jtlapp/orgs","repos_url":"https://api.github.com/users/jtlapp/repos","events_url":"https://api.github.com/users/jtlapp/events{/privacy}","received_events_url":"https://api.github.com/users/jtlapp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-07T15:34:34Z","updated_at":"2015-12-09T14:58:32Z","closed_at":"2015-12-09T12:47:42Z","pull_request":{"url":"https://api.github.com/repos/RobertSpread/spreadcart/pulls/27","html_url":"https://github.com/RobertSpread/spreadcart/pull/27","diff_url":"https://github.com/RobertSpread/spreadcart/pull/27.diff","patch_url":"https://github.com/RobertSpread/spreadcart/pull/27.patch"},"body":"Largely revised to decouple from SpreadShop JS and use Spreadshirt APIs:\r\n\r\n(1) Now reads the basket from the Spreadshirt API, no longer from local storage, except for the apiBasketId. The basket is read into a new class SpreadCartBasket, whose data structure mirrors much of the API XML. The node.js proxy now supports a 'read' action to read the cart from the SpreadShop API. The PHP proxy will need to add this action.\r\n\r\n(2) Upon receiving a failure to read the basket from the API, assumes that the basket is now invalid and empty. In particular, this happens upon returning to the web site after checkout.\r\n\r\n(3) Changed proxy 'operation' parameter to 'action' parameter to match your good choice of terms in the PHP proxy. Done in both spreadCart.js and nodejs/cart.js. You'll need to update your PHP proxy.\r\n\r\n(4) Upon adding an item to the basket, timeouts run in series reading the basket from the API until either a maximum number of tries or we get a basket with a different quantity of items. updateMillis and updateTries configure this.\r\n\r\n(5) If the new 'decouple' configuration variable is true, the timeout series will run on every click made to a page that contains the spreadshop config variable spread_shop_config. There is no dependency on SpreadShop CSS IDs. This mode also allows spreadCart to synchronize with the SpreadShop basket.\r\n\r\n(6) No longer dependent on the event onSpreadShopLoaded. Instead runs a timeout series at page load waiting for the necessary components to appear.\r\n\r\n(7) The basket structure is built in its entirety at page load and its contents assigned when visible, instead of building as basket data becomes ready.\r\n\r\n(8) When an item is deleted, the item display is immediately removed and the basket is reread from the API to update totals. This is particularly important for updating shipping cost.\r\n\r\n(9) If the user ever deletes anything from the shopping cart while on a page that has SpreadShop, the page reloads when the user closes the cart, in order to force SpreadShop to use the modified shopping cart. We'll need to do the same when changing item quantities.\r\n\r\n(10) Changed font of #totalQuantity to sans-serif, which is more readable when small.\r\n\r\n(11) Replaced hardcoded \"font-size:60%\" in shopping cart footer notes with class=\"miniBasketNote\", added class to CSS.\r\n\r\n(12) Spaced the cart total row a bit from the shipping row.\r\n\r\n(13) Changed #checkoutLink to #miniBasketCheckoutLink to reduce chances of conflict with SpreadShop or hosting site.\r\n\r\n(14) url-encoded the 'emptyBasketUrl' checkout parameter\r\n\r\n(15) Made basketItemName, basketItemPrice, and miniBasketLabel (totals lines) all the same font size (110%). Made miniBasketNote font size 75%.\r\n\r\n(16) Added UTC timestamp and node.js server error log.\r\n\r\n(17) Added \"-offline\" option to node.js server to have all requests return public/offline.html."},"comment":{"url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/comments/163280946","html_url":"https://github.com/RobertSpread/spreadcart/pull/27#issuecomment-163280946","issue_url":"https://api.github.com/repos/RobertSpread/spreadcart/issues/27","id":163280946,"user":{"login":"jtlapp","id":138133,"avatar_url":"https://avatars.githubusercontent.com/u/138133?v=3","gravatar_id":"","url":"https://api.github.com/users/jtlapp","html_url":"https://github.com/jtlapp","followers_url":"https://api.github.com/users/jtlapp/followers","following_url":"https://api.github.com/users/jtlapp/following{/other_user}","gists_url":"https://api.github.com/users/jtlapp/gists{/gist_id}","starred_url":"https://api.github.com/users/jtlapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtlapp/subscriptions","organizations_url":"https://api.github.com/users/jtlapp/orgs","repos_url":"https://api.github.com/users/jtlapp/repos","events_url":"https://api.github.com/users/jtlapp/events{/privacy}","received_events_url":"https://api.github.com/users/jtlapp/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T14:58:32Z","updated_at":"2015-12-09T14:58:32Z","body":"That is, your PHP proxy requests XML from the API and then stores this XML in a JSON field called \"xml\" for return to the client."}}