首页 文章

Magento - 简单的可配置产品定制

提问于
浏览
0

我正在使用Magento的Simple Configurable Products扩展 .

当用户更改下拉列表中的选项时,我希望能够更改相关产品 .

目前,扩展名更改了价格,短期和长期描述以及图像(即,当可配置下拉选项更改时,描述等更改为简单产品的描述等) . 我还需要能够获得以下内容:交叉销售Upsells相关产品

有没有人之前做过这个,或者知道这样做的方法?

非常感谢 .

1 回答

  • 1

    刚刚完成添加功能,可以在选项更改时更改URL,SKU和MSRP .

    它可以分两步完成 . 您将需要编写一些代码:

    • 在此配置变量中存储 Related products 块的渲染结果:

    app / code / community / OrganicInternet / SimpleConfigurableProducts / Catalog / Block / Product / View / Type / Configurable.php

    • 向DOM中注入config变量的内容:

    skin / frontend / base / default / js / scp_product_extension.js

    Update

    如果您已经想出如何更换SKU,那么对于相关/加售/交叉销售产品您将很容易 . 使用 $product->getRelatedProductCollection()$product->getUpSellProductCollection()$product->getCrossSellProductCollection() .

    您可以在此处查看完整的示例:Fetch up-sell / related / cross-sell product programatically

    Update 2

    line 20 Configurable.php 中插入此内容:

    $related = $product->getRelatedProductCollection()
      ->addAttributeToSelect('required_options')
      ->addAttributeToSort('position', Varien_Db_Select::SQL_ASC)
      ->addStoreFilter();
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($related);
    $related->load();
    
    $relatedOutput = '<ul>';
    foreach ($related as $item) {
      $item->setDoNotUseCategoryId(true);
      $relatedOutput .= '<li><a href="' . $item->getProductUrl() .'">'. $item->getName() .'</a></li>';
            }
    $relatedOutput .= '</ul>';
    $childProducts[$productId]['relatedProducts'] = $relatedOutput; // Stored to config var
    

    并使用 relatedProducts 作为配置变量 .

相关问题