Magento - 显示简单的产品图片和描述

时间:2012-06-11 19:06:51

标签: magento

我真的需要magento中的以下内容。当客户显示配置产品并选择颜色时,应显示简单的产品图像和描述。我已经在使用SCP产品,但是需要选择颜色和尺寸,否则它不会改变图片。此外,此模块还会更改电子邮件项目的外观以及pdf的

有人知道不同的解决方案吗?


感谢您的回复,让我将此问题分成2个问题。

问题1:

当我使用SCP时,他不再在我的电子邮件和pdf中的项目表上显示颜色和大小。因此,我不容易看到我需要抓取哪些产品才能送货。

问题2:

确实,他需要更改下拉列表,尺寸和颜色以显示简单的产品细节。这需要改为只有颜色。我发现了一篇文章,其中列出了一些代码来实现这一点,但不适合我。

http://www.magentocommerce.com/boards/site.php/viewthread/30929/P0/

所以我改变了通过mysql找到的attribID并将值颜色更改为我的colorattribute,这是kleurproduct

添加了此代码

Product.Config.prototype.reloadPrice = function() {
var childProductId = this.getMatchingSimpleProduct();
var childProducts = this.config.childProducts;
var attribID = 158;
var kleurproductDropdown = document.getElementById('attribute' + attribID);
var kleurproductSelectedIndex = kleurproductDropdown.selectedIndex;
var kleurproduct_value  = kleurproductDropdown.options[kleurproductSelectedIndex].text;
//if the price ranges option is checked in the backend then a colon and the price is added to the dropdown
if (kleurproduct_value.indexOf(':') > -1) {
    kleurproduct_value = kleurproduct_value.substr(0,kleurproduct_value.indexOf(':'));
}
var usingZoomer = false;
if(this.config.imageZoomer){
    usingZoomer = true;
}

if (childProductId){
    var price = childProducts[childProductId]["price"];
    var finalPrice = childProducts[childProductId]["finalPrice"];
    optionsPrice.productPrice = finalPrice;
    optionsPrice.productOldPrice = price;
    optionsPrice.reload();
    optionsPrice.reloadPriceLabels(true);
    optionsPrice.updateSpecialPriceDisplay(price, finalPrice);
    this.updateProductShortDescription(childProductId);
    this.updateProductDescription(childProductId);
    this.updateProductName(childProductId);
    this.updateProductAttributes(childProductId);
    this.updateFormProductId(childProductId);
    this.addParentProductIdToCartForm(this.config.productId);
    this.showCustomOptionsBlock(childProductId, this.config.productId);
    if (usingZoomer) {
        this.showFullImageDiv(childProductId, this.config.productId);
    }else{
        this.updateProductImage(childProductId);
    }

}
//added else if for when just a kleurproduct is selected
else if (kleurproduct_value) {
    for (var product in childProducts) {
        //find the kleurproduct attribute in the childProduct html
        var colStartPos = childProducts[product].productAttributes.indexOf('<th class="label">kleurproduct</th>')
        colStartPos = childProducts[product].productAttributes.indexOf('>', colStartPos + 28)
        var colEndPos = childProducts[product].productAttributes.indexOf('</td>', colStartPos)
        //check each child product for matching kleurproduct
        if (childProducts[product].productAttributes.substr(colStartPos + 1, colEndPos - colStartPos - 1)==kleurproduct_value) {
            childProductId = product;
            var price = childProducts[childProductId]["price"];
            var finalPrice = childProducts[childProductId]["finalPrice"];
            optionsPrice.productPrice = finalPrice;
            optionsPrice.productOldPrice = price;
            optionsPrice.reload();
            optionsPrice.reloadPriceLabels(true);
            optionsPrice.updateSpecialPriceDisplay(price, finalPrice);
            this.updateProductShortDescription(childProductId);
            this.updateProductDescription(childProductId);
            this.updateProductName(childProductId);
            this.updateProductAttributes(childProductId);
            this.updateFormProductId(childProductId);
            this.addParentProductIdToCartForm(this.config.productId);
            this.showCustomOptionsBlock(childProductId, this.config.productId);
            if (usingZoomer) {
                this.showFullImageDiv(childProductId, this.config.productId);
            }else{
                this.updateProductImage(childProductId);
             }
            //one product was found, exit the loop
            break;
         }
    }
}
else {
    var cheapestPid = this.getProductIdOfCheapestProductInScope("finalPrice");
    //var mostExpensivePid = this.getProductIdOfMostExpensiveProductInScope("finalPrice");
    var price = childProducts[cheapestPid]["price"];
    var finalPrice = childProducts[cheapestPid]["finalPrice"];
    optionsPrice.productPrice = finalPrice;
    optionsPrice.productOldPrice = price;
    optionsPrice.reload();
    optionsPrice.reloadPriceLabels(false);
    optionsPrice.updateSpecialPriceDisplay(price, finalPrice);
    this.updateProductShortDescription(false);
    this.updateProductDescription(false);
    this.updateProductName(false);
    this.updateProductAttributes(false);
    this.showCustomOptionsBlock(false, false);
    if (usingZoomer) {
        this.showFullImageDiv(false, false);
    }else{
        this.updateProductImage(false);
    }
}

};

2 个答案:

答案 0 :(得分:1)

SCP扩展做了很多事情。 Fist是您提到的UI增强功能,其中图像和其他产品详细信息会发生变化,以匹配所选的特定简单产品。 SCP所做的另一件事是改变Magento的定价方式,以便在购买可配置产品时,客户需要支付选择的简单产品变体的价格而不是父可配置价格。定价逻辑的变化是电子邮件和pdf格式变化背后的原因。

当简单产品链接到可由两个不同属性配置时,用户需要同时选择两者以便唯一地标识特定的简单产品,从而唯一地标识要显示的图像。

在服装示例中,一旦选择了颜色,就可以显示图像,因为在大多数情况下,每种尺寸的图像都是相同的。 SCP扩展提供了它自己的JavaScript,它响应选择框上的更改事件以触发Ajax加载等。一旦选择了颜色,就可以修改此JavaScript代码,找到第一个大小,并且第一个相应的简单产品并加载它的图像。

答案 1 :(得分:0)

你可以尝试这个比SCP更多的新模块

SDOCP - Simple details on configurable products