【问题标题】:Magento: How to display recurring profile information for a configurable recurring productMagento:如何显示可配置重复产品的重复配置文件信息
【发布时间】:2013-03-10 00:11:23
【问题描述】:

我创建了一个可配置的产品,它允许用户在产品的重复版本和非重复版本之间进行选择(每个版本都是一个简单的产品)。我遇到的问题是,当用户选择重复选项时,他们不会看到他们会看到的简单重复产品的重复配置信息。如何让 Magento 有条件地为可配置产品显示此信息?

【问题讨论】:

    标签: magento magento-1.7 recurring-billing


    【解决方案1】:

    这是一个可行的解决方案,是通过一些幸运的猜测得出的。

    // check to see if the product is configurable
    if ( $_product->getTypeID() == 'configurable' ) {
        // get the associated products    
        $associatedProducts = $_product->getTypeInstance()->getUsedProducts();
        // iterate through the products, checking for recurring products
        foreach ( $associatedProducts as $associatedProduct ) {
            if ($associatedProduct->isRecurring()) {
                // get the recurring profile
                $profile = $associatedProduct->getRecurringProfile();
                // echo whichever array members you need
                echo '<p>billed '.$profile['period_frequency'].' time(s) per '.$profile['period_unit'].'</p>';
            }
        }
    }
    

    我在这里得到了一些帮助:http://www.phptechi.com/how-to-get-associated-child-product.html

    然后我只是为getRecurringProfile()做了一个幸运的方法名称猜测。

    var_dump($associatedProduct-&gt;getRecurrringProfile()) 产生:

    array(13) { 
    ["start_date_is_editable"]=> string(1) "1" 
    ["schedule_description"]=> string(0) "" 
    ["suspension_threshold"]=> string(0) "" 
    ["bill_failed_later"]=> string(1) "1" ["period_unit"]=> string(5) "month"        
    ["period_frequency"]=> string(1) "1" ["period_max_cycles"]=> string(0) "" 
    ["trial_period_unit"]=> string(0) "" ["trial_period_frequency"]=> string(0) "" 
    ["trial_period_max_cycles"]=> string(0) "" ["trial_billing_amount"]=> string(0) "" 
    ["init_amount"]=> string(0) "" ["init_may_fail"]=> string(1) "0" 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 1970-01-01
      • 2012-12-28
      • 2017-10-01
      相关资源
      最近更新 更多