*** Multi-Browser OcUK Shopping Cart Bookmarklet (similar to the Chrome extension) ***

  • Thread starter Thread starter Pho
  • Start date Start date
Unfortunately I don't have either an iPad/Nexus so I can't look into it myself. OcUK could buy me one so I can do some extensive testing however (Nexus please!) :p.

Surprised it doesn't work on Chrome, as I'd imagine it's using the same engine as the desktop version- or is it the shortcut you're unable to create?
 
I done this and made the bookmark and it works, how do I copy the code?

It just highlights the whole box for me rather than the text, and then wont paste.
 
What is all this crap above me ?

You have all been smoking crack.

It's easier to browse on a tablet when you're not on the PC ;).

Orcvader how did you get it to work on the nexus?

I can't get it to work with Firefox on my nexus 7.

I have Firefox sync, so the bookmark was already on my desktop bookmark list. Just create a basket on OcUK as normal, then click on the address bar and select the shopping cart bookmark, and just like on the desktop it will create a box for you to copy/paste.

I done this and made the bookmark and it works, how do I copy the code?

It just highlights the whole box for me rather than the text, and then wont paste.

Once you highlight the whole code, either right click and press copy or press ctrl + c, then when you're replying in a thread, right click then paste or press ctrl + v.
 
Can't you select the text then hold your finger down on it to bring up the copy menu or something?

Usually yes, but because it is the coded text box, my iPad will only selct the whole box rather than just the text.

Then when I go to paste there is nothing there.

Was hoping the guys that did it above would tell me how.
 
Don't know mate. Are there any other compatible browsers on Windows 8? I'd try that first.

I also use that bookmarklet (basically, copy-pasta the code into a bookmark URL). Maybe worth a try.

PHP:
javascript:( function() { function readPrice(text) { var output = text; output = output.replace('\n', ""); output = output.replace('\r', ""); output = output.replace('(', ""); output = output.replace(')', ""); output = output.replace('\u00A3', ""); var price = parseFloat(output); return price; } function copyIntoClipboardIE(text) { if (window.clipboardData && window.clipboardData.getData) { window.clipboardData.setData("Text", str); } }; function copyIntoClipboardSWF(text) { var flashClipboard = false; var flashId = 'flashId-HKxmj5'; var clipboardSWF = '_clipboard.swf'; var content; /*'http://appengine.bravo9.com/copy-into-clipboard/clipboard.swf';*/ if(!document.getElementById(flashId)) { var div = document.createElement('div'); div.id = flashId; document.getElementById('maincell').appendChild(div); } if(flashClipboard) { content = '<embed src="' + clipboardSWF + '" FlashVars="clipboard=' + encodeURIComponent(text) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>'; } else { content = '<div id=\"OcUKBBGenerator\"><h1 class=\"bigred\">Your Cart Contents BB-Code</h1><p>Copy and paste the following into the forums:</p><textarea id=\"OcUKBBGeneratorTextArea\" cols=\"130\" rows=\"20\" onclick=\"this.focus(); this.select()\" style=\"width:99%\" readonly=\"readonly\">' + text + '</textarea></div>'; } document.getElementById(flashId).innerHTML = ''; document.getElementById(flashId).innerHTML = content; document.getElementById('OcUKBBGeneratorTextArea').focus(); document.getElementById('OcUKBBGeneratorTextArea').select(); }; var thumbnails = 'yes'; var shoppingBasket = document.getElementById("shoppingBkt"); var tbdy = shoppingBasket.getElementsByTagName('tbody')[0]; var rows = tbdy.getElementsByTagName('tr'); var str = "[COLOR=\"Yellow\"][b]YOUR BASKET[/b][/COLOR]\n"; var images = ""; console.log('Your Basket'); for (var i=1; i < rows.length - 4; i++) { var row = rows[i]; var cells = row.getElementsByTagName('td'); if (row.className == "basket_option") { var inputs = row.getElementsByTagName('input'); /* a complete system with no option price or count */ if(inputs.length == 0) { var cell = cells[0]; for (var j=0; j < cell.childNodes.length; j ++) { var option = cell.childNodes[j]; if(option.nodeName == "#text") { var desc = "[COLOR=\"Wheat\"]" + option.data + "[/COLOR]\n"; console.log(' option desc: ' + desc); str += desc; } } } /* a fully configurable build. */ else if(inputs.length == 1) { var desc = cells[0].childNodes[2].data; var qty = cells[1].childNodes[0].value; var price1 = readPrice(cells[2].childNodes[2].textContent); var price2 = readPrice(cells[2].childNodes[0].innerText); var price = (price1 > price2)? price1 : price2; console.log(' option desc: ' + desc); console.log(' option qty: ' + qty); console.log(' option price: ' + price); str += "[COLOR=\"Wheat\"]" + qty + " x " + desc + "[/COLOR] [b][COLOR=\"Yellow\"]" + "\u00A3" + price + "[/COLOR][/b]\n"; } } else { var image = cells[0].childNodes[0].src; var desc = cells[1].childNodes[0].textContent; var link = cells[1].childNodes[0].href; var qty = cells[2].childNodes[0].value; var price1 = readPrice(cells[3].childNodes[2].textContent); var price2 = readPrice(cells[3].childNodes[0].innerText); var price = (price1 > price2)? price1 : price2; var total1 = readPrice(cells[4].childNodes[2].textContent); var total2 = readPrice(cells[4].childNodes[0].innerText); var total = (total1 > total2)? total1 : total2; console.log('image: ' + image); console.log('desc: ' + desc); console.log('link: ' + link); console.log('qty: ' + qty); console.log('price: ' + price); images += "[url=\"" + link + "\"]" + "[img]" + image + "[/img][/url] "; str += qty + " x " + "[url=\"" + link + "\"]" + desc + "[/url] " + "[b][COLOR=\"Yellow\"]" + "\u00A3" + price + "[/COLOR][/b]"; if(qty > 1) { str += " [b][COLOR=\"DarkOrange\"](" + "\u00A3" + total.toFixed(2) + ")[/COLOR][/b]"; } str += "\n"; } } /* shipping costs */ var shipping = rows[rows.length - 3]; var shippingCells = shipping.getElementsByTagName('td'); var shippingValue = shippingCells[2].textContent; /* grand total */ var total = document.getElementById('orderTotal'); var totalCells = total.getElementsByTagName('td'); var totalValue = totalCells[2].textContent; console.log('Total: ' + totalValue + "(shipping " + shippingValue + ")"); str += "[b]Total : [COLOR=\"Yellow\"]" + totalValue + "[/COLOR][/b] " + "(includes shipping : " + shippingValue + ").\n"; if(thumbnails == 'yes') str += "\n" + images + "\n\n"; console.log(str); /* copy to console / clipboard / text area. */ copyIntoClipboardIE(str); copyIntoClipboardSWF(str); } )();
 
I don't know about anyone else, but lately I'm getting this error when trying to use the bookmarklet : -

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Creative AutoUpdate v1.40.01)
Timestamp: Sat, 16 Feb 2013 21:26:45 UTC


Message: 'desc' is null or not an object
Line: 112
Char: 5
Code: 0
URI: http://ocuk-shopping-cart-to-forum-converter.googlecode.com/git/ocuk.js


Strange, cause it worked several weeks ago.

However, if I use it on the OCUK homepage, It seems to work :-

YOUR BASKET
Total : (includes shipping : ).
 
Sorry only just seen that. It seems to work fine for me still on the cart page.

Is it a specific product which isn't working? It sounds like one which doesn't have a description (e.g. it's blank). Which browser are you using also?

Cheers.
 
Back
Top Bottom