Search code examples
magentovirtualrecurring-billingrecurring

How to Set programmatically Recurring Profile options to Products


I am working on virtual products type in magento.i want to set following properties to product progrmmatically.

[recurring_profile] => Array
         (
             [start_date_is_editable] => 
             [schedule_description] => 
             [suspension_threshold] => 
             [bill_failed_later] => 
             [period_unit] => 
             [period_frequency] => 
             [period_max_cycles] => 
         )

I had searched but no success and i had tried some solutions then also no success.please help me to achive this task.

Thanks


Solution

  • $_product = Mage::getModel('catalog/product')->load($proid);
        $productname = $_product->getName();
        $_product->setIsRecurring('1');
        $_product->setRecurringProfile(array(
            'start_date_is_editable' => 0,
            'schedule_description' => $productname,
            'suspension_threshold' => 1,
            'bill_failed_later' => 1,
            'period_unit' => day,
            'period_frequency' => 12,
            'period_max_cycles' => 1
        ));