문제

저는 Magento CE 1.9.2.4와 Porto Theme를 사용하고 있습니다. 많은 변형이 있는 일부 구성 가능 제품이 있습니다(어떤 경우에는 각각 여러 옵션이 있는 5개의 속성이 있습니다). 각 변형에는 연관된 단순 제품이 있으며 가격은 수퍼 제품 속성 구성에서 설정됩니다.

내가 말할 수있는 한 모든 것이 Admin에서 올바르게 보입니다.

프런트 엔드 제품 페이지에서 처음으로 옵션을 선택하면 문제가 없으며 선택한 선택 사항에 따라 일부 옵션이 비활성화(회색으로 표시됨)됩니다. (예를 들어, 특정 크기는 특정 색상에서 사용 가능하지 않을 수 있으며, 다른 선택 등의 경우 해당 색상은 사용 가능하지 않을 수 있습니다.)

그러나 마음이 바뀌고 다른 옵션 조합을 선택하는 경우 일부 옵션이 비활성화된 상태로 남아 있으므로 이를 수행할 수 없습니다.

모든 옵션을 다시 '옵션 선택...'으로 재설정하려면 페이지를 완전히 새로고침해야 합니다.

이 주제 문제를 이해하지만 RWD 및 색상 견본이 도입된 이후 예상되는 동작입니다(구성 가능한 제품 ..... 내가 뭔가를 놓치고 있습니까?에 설명된 대로).

이 소리가 맞지 않습니까?나에게 버그처럼 보인다?!

제품 페이지의 '커스텀 디자인'을 변경하여 '모던' 테마와 같은 것을 대신 사용하면 예상한 대로 작동합니다. 첫 번째 드롭다운 옵션은 비활성화되지 않으며 값을 변경하면 그 아래의 모든 옵션이 '옵션 선택...'으로 재설정되고 그에 따라 다시 채워집니다.

\\app...[테마]......\\options\\configurable.phtml 코드와 configurable.js를 살펴보았지만 이 동작의 원인을 찾을 수 없습니다.

이 문제가 발생한 사람이 있습니까?또는 하위 테마의 기본 기능을 손상시키지 않고 위에서 설명한 '그냥' 제품 옵션 동작(이전 RWD 및 견본 모듈 동작)을 사용하도록 되돌리는 방법에 대한 조언이 있습니까?

\\app...[theme]......\\options\\configurable.phtml 파일을 삭제하고 그 영향을 처리할 수 있다고 생각합니다. 하지만 더 좋은 방법이 있습니까?

도움이 되었습니까?

해결책

/skin/frontend/rwd/default/js/configurableswatches/swatches-product.js를 살펴보십시오.

configurable.js의 많은 기능을 재정의하고 <select>개 필드를 모두 선택하는 대신 옵션과 함께 미리 로드하는 역할을 합니다(configurable.js가 처리하는 방법).Porto 테마에 swatches-product.js 또는 이와 유사한 것이 있는 것 같습니다(테마가 없어 확인할 수 없음).

더 도움이 되는 답변을 드리고 싶지만 비슷한 문제가 있어서 귀하의 질문을 보게 되었습니다.나중에 더 조사한 후에 업데이트할 수 있지만 그 동안에는 이것이 최소한 방향을 제시하기를 바랍니다.

업데이트:

swatches-product.js의 612행에 있는 이것을 찾고 계실 것입니다.

/**
 *
 * Reset all the options and their availability, the attribute labels, and the stock status
 **/
resetAvailableOptions: function() {
    var opt = this._E.optionOver;

    if (opt) {
        var attr = opt.attr;

        // Reset last label
        attr._e.attrLabel.innerHTML = attr._e.selectedOption ? this.getOptionLabel(attr._e.selectedOption) : '';

        // Reset current action
        this._F.currentAction = false;

        // process
        if (!attr._f.isCustomOption) {
            // Reset the availability of all options
            this.setAvailableOptions();
            // Set stock status
            this.checkStockStatus();
        }

        // reset the last optionOver
        this._E._last.optionOver = false;
    };
},

다른 팁

내가 원하는 것을 달성하기 위해 다음을 수행했습니다.

/skin/frontend/[테마]/js/configurableswatches/swatches-product.js에서

변화:

// rewrite the fillselect method from /js/varien/configurable.js
Product.Config.prototype.fillSelect = function (element) {
    return;
};

에게:

// rewrite the fillselect method from /js/varien/configurable.js
Product.Config.prototype.fillSelect = function (element) {
    var attributeId = element.id.replace(/[a-z]*/, '');
    var options = this.getAttributeOptions(attributeId);
    this.clearSelect(element);
    element.options[0] = new Option('', '');
    element.options[0].innerHTML = this.config.chooseText;

    var prevConfig = false;
    if(element.prevSetting){
        prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
    }

    if(options) {
        var index = 1;
        for(var i=0;i<options.length;i++){
            var allowedProducts = [];
            if(prevConfig) {
                for(var j=0;j<options[i].products.length;j++){
                    if(prevConfig.config.allowedProducts
                        && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
                        allowedProducts.push(options[i].products[j]);
                    }
                }
            } else {
                allowedProducts = options[i].products.clone();
            }

            if(allowedProducts.size()>0){
                options[i].allowedProducts = allowedProducts;
                element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
                if (typeof options[i].price != 'undefined') {
                    element.options[index].setAttribute('price', options[i].price);
                }
                element.options[index].config = options[i];
                index++;
            }
        }
    }
    //return;
};

또한 변경:

// rewrite the resetChildren method from /js/varien/configurable.js; it would reset the third attribute when selecting a swatch in the first attribute
Product.Config.prototype.resetChildren = function (element) {
    return;
};

에게:

// rewrite the resetChildren method from /js/varien/configurable.js; it would reset the third attribute when selecting a swatch in the first attribute
Product.Config.prototype.resetChildren = function (element) {
        if(element.childSettings) {
            for(var i=0;i<element.childSettings.length;i++){
                element.childSettings[i].selectedIndex = 0;
                element.childSettings[i].disabled = true;
                if(element.config){
                    this.state[element.config.id] = false;
                }
            }
        }
    //return;
};

이것은 기본 테마에서 내 자식 테마로 제품 옵션 동작을 복원했습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top