{"product_id":"durapost-fence-calculator","title":"DuraPost VISTA Fence Calculator \u0026 Complete Kit Builder","description":"\u003cstyle\u003e\n#ww-dp-selector{--g:#173f35;--g2:#0f2d26;--bg:#f4f6f3;--line:#d8dfda;--ink:#17211d;--muted:#65716c;max-width:1240px;margin:0 auto 50px;color:var(--ink);font-family:inherit}.dp-hero{position:relative;min-height:430px;border-radius:22px;overflow:hidden;background:var(--g2);margin:0 16px 30px}.dp-hero img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.52}.dp-hero__inner{position:relative;z-index:1;max-width:760px;padding:58px 48px;color:#fff}.dp-badge{display:inline-block;padding:8px 13px;border-radius:999px;background:rgba(255,255,255,.16);font-size:.82rem;font-weight:800;letter-spacing:.04em;text-transform:uppercase}.dp-hero h1{font-size:clamp(2.2rem,5vw,4.6rem);line-height:.98;margin:18px 0}.dp-hero p{font-size:1.14rem;line-height:1.55;max-width:680px}.dp-wrap{padding:0 16px}.dp-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,.78fr);gap:28px;align-items:start}.dp-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:26px;box-shadow:0 10px 30px rgba(19,46,38,.06)}.dp-card h2{margin:0 0 7px;font-size:1.65rem}.dp-muted{color:var(--muted)}.dp-field{margin:20px 0}.dp-field label,.dp-field legend{display:block;font-weight:800;margin-bottom:8px}.dp-field input[type=number],.dp-field select{width:100%;min-height:52px;border:1px solid #a9b5af;border-radius:11px;padding:10px 12px;background:#fff;font:inherit;color:var(--ink)}.dp-field small{display:block;margin-top:7px;line-height:1.4;color:var(--muted)}.dp-split{display:grid;grid-template-columns:1fr 1fr;gap:14px}.dp-swatches{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.dp-swatches.two{grid-template-columns:repeat(2,1fr)}.dp-choice{position:relative}.dp-choice input{position:absolute;opacity:0}.dp-choice label{display:block;border:2px solid var(--line);border-radius:12px;padding:12px 8px;text-align:center;cursor:pointer;background:#fff}.dp-choice input:checked+label{border-color:var(--g);box-shadow:0 0 0 2px rgba(23,63,53,.12)}.dp-dot{display:block;width:34px;height:34px;border-radius:50%;margin:0 auto 7px;border:1px solid rgba(0,0,0,.14)}.graphite{background:#414548}.teak{background:#9b6847}.oyster{background:#d8d0c2}.anthracite{background:#383e42}.black{background:#111}.dp-advanced{margin-top:20px;border-top:1px solid var(--line);padding-top:10px}.dp-advanced summary{font-weight:800;cursor:pointer;padding:10px 0}.dp-result{position:sticky;top:18px;background:var(--bg)}.dp-status{display:inline-flex;align-items:center;gap:7px;font-size:.86rem;font-weight:800}.dp-status:before{content:'';width:9px;height:9px;border-radius:50%;background:#ca8a04}.dp-status.ready:before{background:#15803d}.dp-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:19px 0}.dp-stat{padding:14px 8px;text-align:center;background:#fff;border-radius:10px}.dp-stat strong{display:block;font-size:1.38rem;color:var(--g)}.dp-lines{margin:15px 0}.dp-line{display:grid;grid-template-columns:1fr auto;gap:14px;padding:11px 0;border-bottom:1px solid var(--line)}.dp-line strong{text-align:right}.dp-line em{display:block;font-size:.82rem;color:var(--muted);font-style:normal;margin-top:2px}.dp-total{display:flex;justify-content:space-between;align-items:end;border-top:2px solid var(--g);padding-top:17px;margin-top:16px}.dp-total strong{font-size:1.9rem;color:var(--g)}.dp-button,.dp-secondary{display:block;width:100%;border-radius:12px;padding:14px 18px;font:inherit;font-weight:850;font-size:1rem;cursor:pointer;margin-top:10px;text-align:center;text-decoration:none}.dp-button{border:0;background:var(--g);color:#fff;padding:16px 18px}.dp-button:disabled{background:#89938f;cursor:not-allowed}.dp-secondary{border:1px solid var(--g);background:#fff;color:var(--g)}.dp-alert{padding:14px 15px;border-radius:10px;margin-top:13px;background:#fff5d9;border:1px solid #e2c567;line-height:1.45}.dp-alert.error{background:#fbe9e7;border-color:#d78e86}.dp-alert.ok{background:#eaf6ed;border-color:#93c69d}.dp-small{font-size:.88rem;line-height:1.45}.dp-section{margin:44px 0}.dp-section h2{font-size:2rem}.dp-info-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.dp-info{padding:21px;border:1px solid var(--line);border-radius:14px;background:#fff}.dp-info h3{margin:0 0 8px}.dp-table{width:100%;border-collapse:collapse;background:#fff;border-radius:14px;overflow:hidden}.dp-table th,.dp-table td{padding:13px 14px;border-bottom:1px solid var(--line);text-align:left}.dp-table th{background:var(--g);color:#fff}.dp-note{padding:18px;border-left:4px solid var(--g);background:var(--bg);margin-top:22px}.dp-loading{opacity:.65;pointer-events:none}@media(max-width:900px){.dp-grid{grid-template-columns:1fr}.dp-result{position:static}.dp-info-grid{grid-template-columns:1fr}.dp-hero__inner{padding:40px 24px}.dp-hero{min-height:470px}}@media(max-width:560px){.dp-split,.dp-swatches,.dp-swatches.two,.dp-stats{grid-template-columns:1fr}.dp-card{padding:19px}.dp-wrap{padding:0 10px}.dp-hero{margin-left:10px;margin-right:10px}}\n\u003c\/style\u003e\n\u003cdiv id=\"ww-dp-selector\"\u003e\n\u003csection class=\"dp-hero\"\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0773\/7068\/7812\/files\/durapost-vista-collection-hero.png?v=1784820738\" alt=\"DuraPost VISTA composite fencing in a landscaped garden\"\u003e\u003cdiv class=\"dp-hero__inner\"\u003e\n\u003cspan class=\"dp-badge\"\u003eWern-Wood complete fence selector\u003c\/span\u003e\u003ch1\u003eBuild your complete DuraPost VISTA fence\u003c\/h1\u003e\n\u003cp\u003eTell us the length, height and what the fence starts and finishes against. We calculate the correct VISTA boards, profiles, shared posts, finishing pieces, fixings and Postmix—then add the complete stocked package to your basket.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/section\u003e\n\u003cdiv class=\"dp-wrap\"\u003e\n\u003cdiv class=\"dp-grid\"\u003e\n\u003csection class=\"dp-card\"\u003e\u003ch2\u003e1. Describe the fence\u003c\/h2\u003e\n\u003cp class=\"dp-muted\"\u003eMeasure the straight fence line. Do not include a gate opening in the length.\u003c\/p\u003e\n\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-length\"\u003eHow long is the fence?\u003c\/label\u003e\u003cinput id=\"dp-length\" type=\"number\" min=\"0.5\" max=\"100\" step=\"0.1\" value=\"7.3\" inputmode=\"decimal\"\u003e\u003csmall\u003eEnter metres. VISTA bays are calculated at a nominal 1.825m and the final bay may need cutting to suit the exact run.\u003c\/small\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-height\"\u003eHow tall is the fence?\u003c\/label\u003e\u003cselect id=\"dp-height\"\u003e\u003coption value=\"600\"\u003eApprox. 0.6m \/ 2ft — 4 boards high\u003c\/option\u003e\n\u003coption value=\"900\"\u003eApprox. 0.9m \/ 3ft — 6 boards high\u003c\/option\u003e\n\u003coption value=\"1200\"\u003eApprox. 1.2m \/ 4ft — 8 boards high\u003c\/option\u003e\n\u003coption value=\"1500\"\u003eApprox. 1.5m \/ 5ft — 10 boards high\u003c\/option\u003e\n\u003coption value=\"1800\" selected\u003eApprox. 1.8m \/ 6ft — 12 boards high\u003c\/option\u003e\u003c\/select\u003e\u003csmall\u003eCalculated from 150mm VISTA board courses. Aluminium top and bottom profiles affect the final assembled height slightly.\u003c\/small\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-split\"\u003e\n\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-start\"\u003eWhat does the fence start from?\u003c\/label\u003e\u003cselect id=\"dp-start\"\u003e\u003coption value=\"free\" selected\u003eNew freestanding end post\u003c\/option\u003e\n\u003coption value=\"wall\"\u003eWall or existing post\u003c\/option\u003e\n\u003coption value=\"corner\"\u003eTurns a 90° corner\u003c\/option\u003e\n\u003coption value=\"gate\"\u003eMeets a garden gate\u003c\/option\u003e\u003c\/select\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-end\"\u003eWhat does the fence finish against?\u003c\/label\u003e\u003cselect id=\"dp-end\"\u003e\u003coption value=\"free\" selected\u003eNew freestanding end post\u003c\/option\u003e\n\u003coption value=\"wall\"\u003eWall or existing post\u003c\/option\u003e\n\u003coption value=\"corner\"\u003eTurns a 90° corner\u003c\/option\u003e\n\u003coption value=\"gate\"\u003eMeets a garden gate\u003c\/option\u003e\u003c\/select\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cfieldset class=\"dp-field\" style=\"border:0;padding:0\"\u003e\n\u003clegend\u003eVISTA board colour\u003c\/legend\u003e\n\u003cdiv class=\"dp-swatches\"\u003e\n\u003cdiv class=\"dp-choice\"\u003e\n\u003cinput type=\"radio\" name=\"dp-board\" id=\"dp-graphite\" value=\"graphite\" checked\u003e\u003clabel for=\"dp-graphite\"\u003e\u003cspan class=\"dp-dot graphite\"\u003e\u003c\/span\u003eGraphite\u003c\/label\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-choice\"\u003e\n\u003cinput type=\"radio\" name=\"dp-board\" id=\"dp-teak\" value=\"teak\"\u003e\u003clabel for=\"dp-teak\"\u003e\u003cspan class=\"dp-dot teak\"\u003e\u003c\/span\u003eTeak\u003c\/label\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-choice\"\u003e\n\u003cinput type=\"radio\" name=\"dp-board\" id=\"dp-oyster\" value=\"oyster\"\u003e\u003clabel for=\"dp-oyster\"\u003e\u003cspan class=\"dp-dot oyster\"\u003e\u003c\/span\u003eOyster\u003c\/label\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/fieldset\u003e\n\u003cfieldset class=\"dp-field\" style=\"border:0;padding:0\"\u003e\n\u003clegend\u003ePosts and aluminium frame\u003c\/legend\u003e\n\u003cdiv class=\"dp-swatches two\"\u003e\n\u003cdiv class=\"dp-choice\"\u003e\n\u003cinput type=\"radio\" name=\"dp-frame\" id=\"dp-anthracite\" value=\"anthracite\" checked\u003e\u003clabel for=\"dp-anthracite\"\u003e\u003cspan class=\"dp-dot anthracite\"\u003e\u003c\/span\u003eAnthracite Grey\u003c\/label\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-choice\"\u003e\n\u003cinput type=\"radio\" name=\"dp-frame\" id=\"dp-black\" value=\"black\"\u003e\u003clabel for=\"dp-black\"\u003e\u003cspan class=\"dp-dot black\"\u003e\u003c\/span\u003eBlack\u003c\/label\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/fieldset\u003e\n\u003cdetails class=\"dp-advanced\"\u003e\u003csummary\u003eInstallation options\u003c\/summary\u003e\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-post-length\"\u003eClassic post length\u003c\/label\u003e\u003cselect id=\"dp-post-length\"\u003e\u003coption value=\"2400\" selected\u003e2.4m Classic post\u003c\/option\u003e\n\u003coption value=\"2700\"\u003e2.7m Classic post — extra installation flexibility\u003c\/option\u003e\u003c\/select\u003e\u003csmall\u003eFinished height, ground, exposure and embedment determine the correct post and foundation. Check unusual or exposed installations before ordering.\u003c\/small\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-field\"\u003e\n\u003clabel for=\"dp-postmix\"\u003ePostmix allowance for each new post\u003c\/label\u003e\u003cselect id=\"dp-postmix\"\u003e\u003coption value=\"0\"\u003eDo not add Postmix\u003c\/option\u003e\n\u003coption value=\"2\" selected\u003e2 × 20kg bags per post\u003c\/option\u003e\n\u003coption value=\"3\"\u003e3 × 20kg bags per post\u003c\/option\u003e\u003c\/select\u003e\u003csmall\u003eA practical ordering allowance only. Actual concrete use depends on hole dimensions and ground conditions.\u003c\/small\u003e\n\u003c\/div\u003e\u003c\/details\u003e\u003c\/section\u003e\n\u003caside class=\"dp-card dp-result\" aria-live=\"polite\"\u003e\u003cdiv id=\"dp-status\" class=\"dp-status\"\u003eLoading live product prices\u003c\/div\u003e\n\u003ch2 style=\"margin-top:10px\"\u003e2. Your complete fence\u003c\/h2\u003e\n\u003cp id=\"dp-summary\" class=\"dp-muted\"\u003eCalculating your material list…\u003c\/p\u003e\n\u003cdiv class=\"dp-stats\"\u003e\n\u003cdiv class=\"dp-stat\"\u003e\n\u003cstrong id=\"dp-bays\"\u003e0\u003c\/strong\u003e\u003cspan\u003ebays\u003c\/span\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-stat\"\u003e\n\u003cstrong id=\"dp-boards\"\u003e0\u003c\/strong\u003e\u003cspan\u003eboards\u003c\/span\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"dp-stat\"\u003e\n\u003cstrong id=\"dp-posts\"\u003e0\u003c\/strong\u003e\u003cspan\u003enew posts\u003c\/span\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv id=\"dp-lines\" class=\"dp-lines\"\u003e\u003c\/div\u003e\n\u003cdiv class=\"dp-total\"\u003e\n\u003cspan\u003eEstimated products\u003c\/span\u003e\u003cstrong id=\"dp-total\"\u003e—\u003c\/strong\u003e\n\u003c\/div\u003e\n\u003cdiv id=\"dp-warning\"\u003e\u003c\/div\u003e\n\u003cbutton id=\"dp-add\" class=\"dp-button\" type=\"button\" disabled\u003eLoading products…\u003c\/button\u003e\u003cbutton id=\"dp-copy\" class=\"dp-secondary\" type=\"button\"\u003eCopy material list\u003c\/button\u003e\u003ca class=\"dp-secondary\" href=\"\/pages\/contact\"\u003eAsk Wern-Wood to check this layout\u003c\/a\u003e\u003cdiv id=\"dp-message\" class=\"dp-small\" role=\"status\"\u003e\u003c\/div\u003e\n\u003cp class=\"dp-small dp-muted\"\u003ePrices include VAT and load from the live products. Delivery is calculated separately. Check final dimensions and installation requirements before setting posts.\u003c\/p\u003e\u003c\/aside\u003e\n\u003c\/div\u003e\n\u003csection class=\"dp-section\"\u003e\u003ch2\u003eHow the selector chooses the components\u003c\/h2\u003e\n\u003cdiv class=\"dp-info-grid\"\u003e\n\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eExact board courses\u003c\/h3\u003e\n\u003cp\u003eVISTA boards are 150mm high. Height determines the number of boards per bay, then packs of four are rounded across the whole run so spare boards are not multiplied unnecessarily.\u003c\/p\u003e\u003c\/article\u003e\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eShared intermediate posts\u003c\/h3\u003e\n\u003cp\u003eAdjoining bays share a Classic post. The calculator adds one post at each internal joint and separately chooses the correct connection at the start and end.\u003c\/p\u003e\u003c\/article\u003e\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eConnection-led ordering\u003c\/h3\u003e\n\u003cp\u003eA freestanding end uses a Classic post and finishing infill. A wall uses a U-channel. A corner or light gate uses a gate\/corner post with the correct U-channel.\u003c\/p\u003e\u003c\/article\u003e\n\u003c\/div\u003e\u003c\/section\u003e\n\u003csection class=\"dp-section\"\u003e\u003ch2\u003eVISTA height guide\u003c\/h2\u003e\n\u003ctable class=\"dp-table\"\u003e\n\u003cthead\u003e\u003ctr\u003e\n\u003cth\u003eNominal boarded height\u003c\/th\u003e\n\u003cth\u003eBoards per bay\u003c\/th\u003e\n\u003cth\u003ePacks for one bay\u003c\/th\u003e\n\u003c\/tr\u003e\u003c\/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e0.6m \/ 2ft\u003c\/td\u003e\n\u003ctd\u003e4\u003c\/td\u003e\n\u003ctd\u003e1\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e0.9m \/ 3ft\u003c\/td\u003e\n\u003ctd\u003e6\u003c\/td\u003e\n\u003ctd\u003e2\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1.2m \/ 4ft\u003c\/td\u003e\n\u003ctd\u003e8\u003c\/td\u003e\n\u003ctd\u003e2\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1.5m \/ 5ft\u003c\/td\u003e\n\u003ctd\u003e10\u003c\/td\u003e\n\u003ctd\u003e3\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1.8m \/ 6ft\u003c\/td\u003e\n\u003ctd\u003e12\u003c\/td\u003e\n\u003ctd\u003e3\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cdiv class=\"dp-note\"\u003e\n\u003cstrong\u003eWhy full-run calculation matters:\u003c\/strong\u003e a 0.9m fence uses six boards per bay. Across two bays that is twelve boards—three packs, not four. The selector rounds packs across the complete project.\u003c\/div\u003e\u003c\/section\u003e\n\u003csection class=\"dp-section\"\u003e\u003ch2\u003eBefore ordering\u003c\/h2\u003e\n\u003cdiv class=\"dp-info-grid\"\u003e\n\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eMeasure actual components\u003c\/h3\u003e\n\u003cp\u003eThe calculator estimates nominal 1.825m bays. Follow the current DuraPost installation guide and measure supplied profiles before permanently setting posts.\u003c\/p\u003e\u003c\/article\u003e\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eGate limit\u003c\/h3\u003e\n\u003cp\u003eThe stocked light-duty gate\/end\/corner post is intended for light gates. Heavier, wider or exposed gates require a checked specification.\u003c\/p\u003e\u003c\/article\u003e\u003carticle class=\"dp-info\"\u003e\u003ch3\u003eComplex layouts\u003c\/h3\u003e\n\u003cp\u003eChanges in level, multiple corners, sloping ground, unusual exposure and non-standard gates should be checked from a sketch. The selector stops rather than sell an incomplete connection.\u003c\/p\u003e\u003c\/article\u003e\n\u003c\/div\u003e\u003c\/section\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cscript\u003e\n(function(){var root=document.getElementById('ww-dp-selector');if(!root)return;function mount(){var section=root.closest('.shopify-section'),main=document.querySelector('#MainContent')||document.querySelector('main');if(section\u0026\u0026main\u0026\u0026section.parentNode===main){main.insertBefore(root,section);section.style.display='none';}}if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',mount);else mount();\nvar BAY=1.825,loaded=false,catalog={'B806240A':{id:57033645719876,price:4526,available:true},'B8062403':{id:57033645752644,price:4526,available:true},'B806270A':{id:57033646178628,price:5435,available:true},'B8062703':{id:57033646211396,price:5435,available:true},'B807240A':{id:57033646801220,price:8144,available:true},'B8072403':{id:57033646833988,price:8144,available:true},'B805821A':{id:57033647194436,price:2476,available:true},'B8058213':{id:57033647227204,price:2476,available:true},'B826182A-FSC':{id:57033648603460,price:5759,available:true},'B826182B-FSC':{id:57033648636228,price:5759,available:true},'B826182G-FSC':{id:57033648668996,price:5759,available:true},'B827182A':{id:57033649226052,price:4968,available:true},'B8271823':{id:57033649258820,price:4968,available:true},'B3SD4028A':{id:57033649520964,price:277,available:true},'BAGS':{id:47146314203460,price:499,available:true}};\nvar handles=['durapost-classic-steel-fence-post-2-4m','durapost-classic-steel-fence-post-2-7m','durapost-light-duty-gate-end-corner-post-2-4m','durapost-classic-post-end-infill-2-1m','durapost-vista-composite-fencing-boards-1-82m-pack-of-4','durapost-vista-aluminium-infill-profile-set-1-82m','durapost-vista-self-drilling-screws-4-28mm-bag-of-16','durapost-u-channel-2-1m','postmix-20kg-rapid-set-post-concrete-postcrete'];var $=function(id){return document.getElementById(id)},selected=function(name){var x=root.querySelector('input[name=\"'+name+'\"]:checked');return x?x.value:null},money=function(p){return new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(p\/100)},sku=function(type,frame,length){var f=frame==='anthracite'?'A':'3';if(type==='classic')return length==='2700'?'B806270'+f:'B806240'+f;if(type==='light')return'B807240'+f;if(type==='end')return'B805821'+f;if(type==='infill')return'B827182'+f;if(type==='screw')return frame==='anthracite'?'B3SD4028A':'B3SD40283';if(type==='channel')return'B807050'+f;};function boardSku(c){return c==='graphite'?'B826182A-FSC':c==='teak'?'B826182B-FSC':'B826182G-FSC'}function connectionLabel(v){return v==='free'?'freestanding end post':v==='wall'?'wall \/ existing post':v==='corner'?'90° corner':v==='gate'?'garden gate':'connection'}function item(s,q,label,required){return{sku:s,qty:q,label:label,product:catalog[s],required:required!==false}}\nfunction calculate(){var length=Math.max(0,parseFloat($('dp-length').value)||0),height=parseInt($('dp-height').value,10),start=$('dp-start').value,end=$('dp-end').value,board=selected('dp-board'),frame=selected('dp-frame'),postLength=$('dp-post-length').value,mixPer=parseInt($('dp-postmix').value,10)||0;var bays=length?Math.ceil(length\/BAY):0,boardsPerBay=height\/150,totalBoards=bays*boardsPerBay,boardPacks=Math.ceil(totalBoards\/4),spares=boardPacks*4-totalBoards,internal=Math.max(0,bays-1),freeEnds=(start==='free'?1:0)+(end==='free'?1:0),specialEnds=(start==='corner'||start==='gate'?1:0)+(end==='corner'||end==='gate'?1:0),channels=(start==='free'?0:1)+(end==='free'?0:1),classicPosts=internal+freeEnds,allPosts=classicPosts+specialEnds,postmix=allPosts*mixPer,items=[];if(bays){items.push(item(boardSku(board),boardPacks,'VISTA board packs'));items.push(item(sku('infill',frame),bays,'VISTA aluminium infill sets'));items.push(item(sku('screw',frame),bays,'VISTA self-drilling screw bags'));if(classicPosts)items.push(item(sku('classic',frame,postLength),classicPosts,postLength==='2700'?'2.7m Classic posts':'2.4m Classic posts'));if(specialEnds)items.push(item(sku('light',frame),specialEnds,'Light-duty gate\/end\/corner posts'));if(freeEnds)items.push(item(sku('end',frame),freeEnds,'Classic post end infills'));if(channels)items.push(item(sku('channel',frame),channels,'Matching DuraPost U-channels'));if(postmix)items.push(item('BAGS',postmix,'Postmix 20kg bags',false));}var missing=[],unavailable=[],total=0;items.forEach(function(x){if(!x.product){if(x.required)missing.push(x.label);}else if(!x.product.available){unavailable.push(x.label);}else total+=x.product.price*x.qty;});$('dp-bays').textContent=bays;$('dp-boards').textContent=totalBoards;$('dp-posts').textContent=bays?allPosts:0;$('dp-summary').textContent=bays?bays+' bay'+(bays===1?'':'s')+' cover '+(bays*BAY).toFixed(3)+'m nominally. Start: '+connectionLabel(start)+'. End: '+connectionLabel(end)+'.':'Enter a fence length to calculate the package.';$('dp-lines').innerHTML=items.map(function(x){var price=x.product?money(x.product.price*x.qty):'Price required',detail=x.qty+' required';if(x.sku.indexOf('B826')===0){detail=x.qty+' pack'+(x.qty===1?'':'s')+' of 4';if(spares)detail+=' · '+spares+' spare board'+(spares===1?'':'s');}return'\u003cdiv class=\"dp-line\"\u003e\u003cspan\u003e'+x.label+'\u003cem\u003e'+detail+'\u003c\/em\u003e\u003c\/span\u003e\u003cstrong\u003e'+price+'\u003c\/strong\u003e\u003c\/div\u003e';}).join('');$('dp-total').textContent=bays?money(total)+(missing.length?' + quote items':''):'—';var warning=$('dp-warning'),button=$('dp-add'),status=$('dp-status'),ready=bays\u0026\u0026loaded\u0026\u0026!missing.length\u0026\u0026!unavailable.length;if(!bays){warning.innerHTML='';button.disabled=true;button.textContent='Enter a fence length';}else if(missing.length){warning.innerHTML='\u003cdiv class=\"dp-alert\"\u003e\u003cstrong\u003eChecked connection required.\u003c\/strong\u003e This layout needs '+missing.join(', ')+'. Those components are not yet live online, so the selector will not create an incomplete basket.\u003c\/div\u003e';button.disabled=true;button.textContent='Complete connection requires a checked quote';}else if(unavailable.length){warning.innerHTML='\u003cdiv class=\"dp-alert error\"\u003e\u003cstrong\u003eTemporarily unavailable:\u003c\/strong\u003e '+unavailable.join(', ')+'.\u003c\/div\u003e';button.disabled=true;button.textContent='One or more items unavailable';}else if(!loaded){warning.innerHTML='';button.disabled=true;button.textContent='Loading live products…';}else{warning.innerHTML='\u003cdiv class=\"dp-alert ok\"\u003e\u003cstrong\u003eComplete stocked package.\u003c\/strong\u003e Add all calculated materials together.\u003c\/div\u003e';button.disabled=false;button.textContent='Add complete fence to basket';}status.textContent=loaded?(ready?'Complete package ready':'Layout calculated'):'Loading live product prices';status.className='dp-status'+(ready?' ready':'');return{items:items,bays:bays,ready:ready,length:length,height:height,start:start,end:end};}\nfunction load(){return Promise.allSettled(handles.map(function(h){return fetch('\/products\/'+h+'.js',{headers:{Accept:'application\/json'}}).then(function(r){if(!r.ok)throw new Error(h);return r.json();});})).then(function(results){results.forEach(function(r){if(r.status!=='fulfilled')return;(r.value.variants||[]).forEach(function(v){if(v.sku)catalog[v.sku]={id:v.id,price:v.price,available:v.available!==false};});});loaded=true;calculate();});}root.addEventListener('input',calculate);root.addEventListener('change',calculate);$('dp-add').addEventListener('click',function(){var c=calculate();if(!c.ready)return;var items=c.items.filter(function(x){return x.qty\u003e0\u0026\u0026x.product;}).map(function(x){return{id:x.product.id,quantity:x.qty,properties:{'_Built with':'DuraPost VISTA Fence Selector'}}}),button=this;button.disabled=true;button.textContent='Adding complete fence…';root.classList.add('dp-loading');fetch('\/cart\/add.js',{method:'POST',headers:{'Content-Type':'application\/json','Accept':'application\/json'},body:JSON.stringify({items:items})}).then(function(r){if(!r.ok)return r.json().then(function(e){throw e});return r.json();}).then(function(){window.location.href='\/cart';}).catch(function(e){root.classList.remove('dp-loading');button.disabled=false;button.textContent='Add complete fence to basket';$('dp-message').innerHTML='\u003cdiv class=\"dp-alert error\"\u003eThe package could not be added. Refresh and try again, or ask Wern-Wood to check the list.\u003c\/div\u003e';});});$('dp-copy').addEventListener('click',function(){var c=calculate(),text='DuraPost VISTA fence: '+c.length+'m long, '+(c.height\/1000).toFixed(1)+'m high\\nStart: '+connectionLabel(c.start)+'\\nEnd: '+connectionLabel(c.end)+'\\n\\n'+c.items.map(function(x){return x.qty+' × '+x.label;}).join('\\n');navigator.clipboard\u0026\u0026navigator.clipboard.writeText(text).then(function(){$('dp-message').innerHTML='\u003cdiv class=\"dp-alert ok\"\u003eMaterial list copied.\u003c\/div\u003e';});});calculate();load();})();\n\u003c\/script\u003e","brand":"DuraPost by Birkdale","offers":[{"title":"DuraPost VISTA Fence Selector","offer_id":57033724723524,"sku":"DURAPOST-CALCULATOR","price":57.59,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0773\/7068\/7812\/files\/durapost-vista-collection-hero.png?v=1784820738","url":"https:\/\/www.wern-wood.com\/products\/durapost-fence-calculator","provider":"Wern-Wood","version":"1.0","type":"link"}