我想将自定义属性中的值添加到Magento中的可配置产品的简短描述中 . 我正在使用SCP模块动态显示关于“Associated Simple Products”的简短描述, Headers 和价格 . 价格, Headers 和简短描述工作正常,但它不会更改长描述,也不会显示与简单产品关联的自定义属性 . 有人能帮我解决这个问题吗?我需要一些指示我该怎么做?我想我可以在我附加到这篇文章的SCP(简单可配置产品)模块的原始文件configurable.php上做到,但我不确定 . 先感谢您 .

public function getJsonConfig()
{
    $config = Zend_Json::decode(parent::getJsonConfig());

    $childProducts = array();

    //Create the extra price and tier price data/html we need.
    foreach ($this->getAllowProducts() as $product) {
        $productId  = $product->getId();
        $childProducts[$productId] = array(
            "price" => $this->_registerJsPrice($this->_convertPrice($product->getPrice())),
            "finalPrice" => $this->_registerJsPrice($this->_convertPrice($product->getFinalPrice()))
        );

        if (Mage::getStoreConfig('SCP_options/product_page/change_name')) {
            $childProducts[$productId]["productName"] = $product->getName();
        }
        if (Mage::getStoreConfig('SCP_options/product_page/change_description')) {
            $childProducts[$productId]["description"] = $product->getDescription();
        }
        if (Mage::getStoreConfig('SCP_options/product_page/change_short_description')) {
            $childProducts[$productId]["shortDescription"] = $product->getShortDescription();
        }

        if (Mage::getStoreConfig('SCP_options/product_page/change_attributes')) {
            $childBlock = $this->getLayout()->createBlock('catalog/product_view_attributes');
            $childProducts[$productId]["productAttributes"] = $childBlock->setTemplate('catalog/product/view/attributes.phtml')
                ->setProduct($product)
                ->toHtml();
        }

        #if image changing is enabled..
        if (Mage::getStoreConfig('SCP_options/product_page/change_image')) {
            #but dont bother if fancy image changing is enabled
            if (!Mage::getStoreConfig('SCP_options/product_page/change_image_fancy')) {
                #If image is not placeholder...
                if($product->getImage()!=='no_selection') {
                    $childProducts[$productId]["imageUrl"] = (string)Mage::helper('catalog/image')->init($product, 'image');
                }
            }
        }
    }

    //Remove any existing option prices.
    //Removing holes out of existing arrays is not nice,
    //but it keeps the extension's code separate so if Varien's getJsonConfig
    //is added to, things should still work.
    if (is_array($config['attributes'])) {
        foreach ($config['attributes'] as $attributeID => &$info) {
            if (is_array($info['options'])) {
                foreach ($info['options'] as &$option) {
                    unset($option['price']);
                }
                unset($option); //clear foreach var ref
            }
        }
        unset($info); //clear foreach var ref
    }

    $p = $this->getProduct();
    $config['childProducts'] = $childProducts;
    if ($p->getMaxPossibleFinalPrice() != $p->getFinalPrice()) {
        $config['priceFromLabel'] = $this->__('Price From:');
    } else {
        $config['priceFromLabel'] = $this->__('');
    }
    $config['ajaxBaseUrl'] = Mage::getUrl('oi/ajax/');
    $config['productName'] = $this->getProduct()->getName();
    $config['description'] = $this->getProduct()->getDescription();
    $config['shortDescription'] = $this->getProduct()->getShortDescription();

    if (Mage::getStoreConfig('SCP_options/product_page/change_image')) {
        $config["imageUrl"] = (string)Mage::helper('catalog/image')->init($this->getProduct(), 'image');
    }

    $childBlock = $this->getLayout()->createBlock('catalog/product_view_attributes');
    $config["productAttributes"] = $childBlock->setTemplate('catalog/product/view/attributes.phtml')
        ->setProduct($this->getProduct())
        ->toHtml();

    if (Mage::getStoreConfig('SCP_options/product_page/change_image')) {
        if (Mage::getStoreConfig('SCP_options/product_page/change_image_fancy')) {
            $childBlock = $this->getLayout()->createBlock('catalog/product_view_media');
            $config["imageZoomer"] = $childBlock->setTemplate('catalog/product/view/media.phtml')
                ->setProduct($this->getProduct())
                ->toHtml();
        }
    }

    if (Mage::getStoreConfig('SCP_options/product_page/show_price_ranges_in_options')) {
        $config['showPriceRangesInOptions'] = true;
        $config['rangeToLabel'] = $this->__('to');
    }
    //Mage::log($config);
    return Zend_Json::encode($config);
    //parent getJsonConfig uses the following instead, but it seems to just break inline translate of this json?
    //return Mage::helper('core')->jsonEncode($config);
}