Merge branch 'feat/cafe24-swipe-by-name'
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
- 정보 패널(`routes_product_info.py`, `_side.html`)에서 상품명·판매가·공급가·소비자가, 대표이미지, 옵션(생성/이름·썸네일·표시방식 수정/삭제)·품목(자체코드·추가금액·진열·판매) 수정.
|
||||
- 대표이미지는 `POST /admin/products/{no}/images` 에 base64 data URI + `image_upload_type=A`.
|
||||
NNEditor 업로드 경로를 PUT `detail_image` 에 넣는 방식은 적용 안 됨.
|
||||
- 옵션/품목 팝업(단일 옵션 화면) 「모바일 스와이프 코드 복사」: `// 상품명` + `"품목코드": "/web/…썸네일 경로",` 줄들을 클립보드로
|
||||
- 옵션/품목 팝업(단일 옵션 화면) 「모바일 스와이프 복사(코드)」: `// 상품명` + `"품목코드": "/web/…썸네일 경로",` 줄들을 클립보드로
|
||||
(`cafe24-options.js` `swipeCode` — 행에 지금 보이는 썸네일 기준, 도메인/CDN 은 떼고 `/web/` 부터).
|
||||
「모바일 스와이프 복사(이름)」은 키가 품목코드 대신 옵션값 이름(`swipeCode(tbody, true)`, 품목코드 있는 행만).
|
||||
- 권한키 `cafe24`(연결/해제는 admin 전용).
|
||||
|
||||
## 규칙
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/static/cafe24-options.js?v=20261106a"></script>
|
||||
<script src="/static/cafe24-options.js?v=20261106b"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var pane = document.getElementById("cf24-editor-pane");
|
||||
|
||||
@@ -246,7 +246,8 @@
|
||||
// 썸네일은 행에 **지금 보이는** 이미지(버튼 → 연결 → 품목 이미지, 깨진 후보는 건너뛴 결과)다.
|
||||
// // 상품명
|
||||
// "P00000CM000A": "/web/product/extra/202503/….jpg",
|
||||
function swipeCode(tbody) {
|
||||
// byName 이면 품목코드 대신 옵션값 이름을 키로 쓴다(「모바일 스와이프 복사(이름)」).
|
||||
function swipeCode(tbody, byName) {
|
||||
var lines = ["// " + (state.productName || ("상품번호 " + no))];
|
||||
var count = 0;
|
||||
var missing = 0;
|
||||
@@ -256,7 +257,8 @@
|
||||
var img = tr.querySelector("img.cf24-opt-thumb");
|
||||
var path = img ? shopPath(img.getAttribute("src")) : "";
|
||||
if (!path) missing++;
|
||||
lines.push(' "' + code + '": "' + path + '",');
|
||||
var key = byName ? tr.querySelector('[name="option_text"]').value.trim() : code;
|
||||
lines.push(" " + JSON.stringify(key) + ': "' + path + '",');
|
||||
count++;
|
||||
});
|
||||
return { text: lines.join("\n"), count: count, missing: missing };
|
||||
@@ -396,7 +398,8 @@
|
||||
' <label class="cf24-side-field cf24-u-optname"><span>옵션명</span><input type="text" name="option_name" value="' + esc(group.option_name) + '" placeholder="예: 구성" /></label>' +
|
||||
' <label class="cf24-side-field cf24-side-field-type"><span>표시방식</span>' + typeSelect(group.option_display_type || DEFAULT_TYPE, "option_display_type") + "</label>" +
|
||||
' <span class="cf24-u-head-actions">' +
|
||||
(isNew ? "" : ' <button type="button" class="erp-btn erp-btn-outline" id="cf24-u-swipe" title="품목코드와 썸네일 경로를 모바일 스와이프(product-swiper.js) 형식으로 복사합니다">모바일 스와이프 코드 복사</button>') +
|
||||
(isNew ? "" : ' <button type="button" class="erp-btn erp-btn-outline cf24-u-swipe" data-by="code" title="품목코드와 썸네일 경로를 모바일 스와이프(product-swiper.js) 형식으로 복사합니다">모바일 스와이프 복사(코드)</button>' +
|
||||
' <button type="button" class="erp-btn erp-btn-outline cf24-u-swipe" data-by="name" title="옵션값 이름과 썸네일 경로를 모바일 스와이프(product-swiper.js) 형식으로 복사합니다">모바일 스와이프 복사(이름)</button>') +
|
||||
' <button type="button" class="erp-btn erp-btn-outline" id="cf24-u-import">옵션값 불러오기</button>' +
|
||||
' <button type="button" class="erp-btn erp-btn-outline" id="cf24-u-add">+ 행 추가</button>' +
|
||||
" </span>" +
|
||||
@@ -446,9 +449,8 @@
|
||||
tr.querySelector('[name="option_text"]').focus();
|
||||
});
|
||||
body.querySelector("#cf24-u-import").addEventListener("click", function () { openImport(isNew, tbody, msg); });
|
||||
var swipeBtn = body.querySelector("#cf24-u-swipe");
|
||||
if (swipeBtn) swipeBtn.addEventListener("click", function () {
|
||||
var out = swipeCode(tbody);
|
||||
body.querySelectorAll(".cf24-u-swipe").forEach(function (swipeBtn) { swipeBtn.addEventListener("click", function () {
|
||||
var out = swipeCode(tbody, swipeBtn.dataset.by === "name");
|
||||
if (!out.count) { window.erpAlert("품목코드가 있는 행이 없습니다."); return; }
|
||||
copyText(out.text, function () {
|
||||
var old = swipeBtn.textContent;
|
||||
@@ -457,7 +459,7 @@
|
||||
msg.textContent = "스와이프 코드 " + out.count + "개 품목 복사" +
|
||||
(out.missing ? " — 썸네일 없는 품목 " + out.missing + "개는 경로가 비어 있습니다" : "");
|
||||
});
|
||||
});
|
||||
}); });
|
||||
body.querySelector("#cf24-u-save").addEventListener("click", function () { saveUnified(isNew, tbody, msg); });
|
||||
var del = body.querySelector("#cf24-opt-delete");
|
||||
if (del) del.addEventListener("click", deleteOptions);
|
||||
|
||||
Reference in New Issue
Block a user