Specification
Product Name: Stainless steel chamfering reamer
Net Weight: 177g
Size: 29 x 80mm / 1.1 x 3.1in
For 20mm Dog hole workbench
Features
1) Stainless steel chamfering reamer for woodworking use.
2) Millimeter-level precision fits for accurate chamfering work.
3) Replaceable blade design for convenient blade changes.
4) Helps create smoother inner hole edges.
5) Compact 29 x 80mm size for easy handling.
Package Included
1x Stainless steel chamfering reamer
{
const attrs = {};
if (v.option_summary && v.option_summary !== 'Standard') {
v.option_summary.split(' / ').forEach((part, idx) => {
const sep = part.indexOf(': ');
if (sep !== -1) {
const key = part.substring(0, sep).trim();
const val = part.substring(sep + 2).trim();
attrs[key] = val;
} else {
attrs[`Option ${idx + 1}`] = part.trim();
}
});
}
if (v.warehouse) {
attrs['Warehouse'] = v.warehouse;
}
return { ...v, attrs };
});
// 2. Collect unique option groups and values
const attributeGroups = new Map();
parsedVariants.forEach(v => {
Object.entries(v.attrs).forEach(([key, val]) => {
if (!attributeGroups.has(key)) {
attributeGroups.set(key, new Set());
}
attributeGroups.get(key).add(val);
});
});
const initialVariant = parsedVariants.find(v => v.id == defaultVariantId)
|| parsedVariants[0];
const currentSelection = initialVariant
? { ...initialVariant.attrs }
: {};
// 3. Render grouped option buttons
function renderOptionSelectors() {
if (!optionsContainer) return;
optionsContainer.innerHTML = '';
attributeGroups.forEach((valuesSet, groupName) => {
if (valuesSet.size <= 1 && groupName === 'Warehouse') return;
const groupDiv = document.createElement('div');
groupDiv.className = 'option-group';
const label = document.createElement('label');
const activeVal = currentSelection[groupName] || '';
label.textContent = `${groupName}: ${activeVal}`;
groupDiv.appendChild(label);
const pillsDiv = document.createElement('div');
pillsDiv.className = 'option-pills';
valuesSet.forEach(val => {
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'opt-pill';
btn.textContent = val;
if (currentSelection[groupName] === val) {
btn.classList.add('active');
}
const hasStock = parsedVariants.some(v =>
v.attrs[groupName] === val &&
parseInt(v.stock_qty, 10) > 0
);
if (!hasStock) {
btn.classList.add('unavailable');
}
btn.addEventListener('click', () => {
currentSelection[groupName] = val;
resolveMatchingVariant(groupName, val);
renderOptionSelectors();
});
pillsDiv.appendChild(btn);
});
groupDiv.appendChild(pillsDiv);
optionsContainer.appendChild(groupDiv);
});
}
// 4. Match selected options to exact variant SKU & price
function resolveMatchingVariant(changedGroup, changedVal) {
let match = parsedVariants.find(v =>
Object.entries(currentSelection).every(
([k, val]) => v.attrs[k] === val
)
);
if (!match && changedGroup) {
match = parsedVariants.find(v =>
v.attrs[changedGroup] === changedVal &&
parseInt(v.stock_qty, 10) > 0
) || parsedVariants.find(v =>
v.attrs[changedGroup] === changedVal
);
if (match) {
Object.assign(currentSelection, match.attrs);
}
}
if (!match) return;
priceEl.textContent = '$' + parseFloat(match.retail_price).toFixed(2);
hiddenInput.value = match.id;
imgEl.onerror = function() {
this.onerror = null;
this.src = noImagePlaceholder;
};
imgEl.src = match.variant_image_url || fallbackImage || noImagePlaceholder;
whBadge.textContent = 'Ships from: ' + match.warehouse;
const qty = parseInt(match.stock_qty, 10);
if (qty > 0) {
stockBadge.textContent = `In Stock (${qty} left)`;
stockBadge.className = 'badge badge-stock';
qtyInput.max = qty;
if (parseInt(qtyInput.value, 10) > qty) {
qtyInput.value = qty;
}
buyBtn.disabled = false;
buyBtn.textContent = 'Add to Cart';
} else {
stockBadge.textContent = 'Out of Stock';
stockBadge.className = 'badge badge-out';
buyBtn.disabled = true;
buyBtn.textContent = 'Sold Out';
}
}
// 5. Thumbnail click handler
document.querySelectorAll('.thumb-btn').forEach(thumb => {
thumb.addEventListener('click', () => {
document.querySelectorAll('.thumb-btn')
.forEach(t => t.classList.remove('active'));
thumb.classList.add('active');
imgEl.onerror = function() {
this.onerror = null;
this.src = noImagePlaceholder;
};
imgEl.src = thumb.dataset.img || noImagePlaceholder;
});
});
if (parsedVariants.length > 0) {
renderOptionSelectors();
}