Home › Forums › WPLMS AddOns › Custom Learning Paths › Sale Learning Paths via woocommerce
- This topic has 24 replies, 2 voices, and was last updated 6 years, 3 months ago by Diana.
-
AuthorPosts
-
August 10, 2018 at 9:48 am #172063ICHARSSpectatorSome time back I had requested for a feature to sale learning paths via woocommerce where if a user bought a particular product, they would automatically be enrolled to a learning path and all courses connected in the learning path. I was provided with a code
After the update to the plugin this code is not working. I can see the Option "Product Bundle" on CLP page but but the dropdown to select the products is not present in front of the same. Kindly suggest...// Sell CLP via woocoommerce class WPLMS_CLP_iChars{ public static $instance; public static function init(){ if ( is_null( self::$instance ) ) self::$instance = new WPLMS_CLP_iChars(); return self::$instance; } private function __construct(){ add_filter('wplms_lp_metabox',array($this,'lp_metabox')); add_action('woocommerce_order_status_completed',array($this,'lp_approve_clp'),10,1); } function lp_metabox($args){ if(is_array($args)){ $query = new WP_Query(array( 'post_type'=>'product', 'posts_per_page'=>-1 )); $vibe_ichars = get_post_meta(get_the_ID(),'vibe_ichars',true); $products = array(array('label'=>'none','value'=>'')); if($query->have_posts()){ while($query->have_posts()){ $query->the_post(); $products[get_the_ID()]=array('label'=>get_the_title(),'value'=>get_the_ID()); } wp_reset_postdata(); } $args['vibe_ichars'] = array( 'label' => __('SELECT PRODUCT BUNDLE','wplms-clp'), // <label> 'desc' => __('select a product course bundle.','wplms-clp'), // description 'id' => 'vibe_ichars', // field id and name 'type' => 'multiselect', // type of field 'options' => $products, 'std' => $vibe_ichars ); } return $args; } function lp_approve_clp($order_id){ $order = new WC_Order( $order_id ); $items = $order->get_items(); $user_id=$order->get_user_id(); foreach($items as $item_id=>$item){ global $wpdb; $id = $wpdb->get_var("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'vibe_ichars' AND meta_value = ".$item['product_id']); if(!empty($id)){ //Get all step ids connected to the learning path $step_ids = wplms_clp_get_all_learningpath_step_ids($id); if( !empty($step_ids)){ if(add_user_meta($user_id,'wplms_user_custom_learning_path',$id)){ foreach ($step_ids as $step_id) { //check step completion $points = apply_filters('wplms_clp_step_user_points_on_enroll',0,$id,$step_id,$user_id); $steps[$step_id] = $points; } update_user_meta($user_id,'wplms_clp_points_'.$id,$steps); do_action('wplms_clp_user_enrolled',$user_id,$id); } } } } } } WPLMS_CLP_iChars::init(); add_filter('wplms_clp_step_description_length',function($length){ $length = 350; return $length; });
August 13, 2018 at 12:12 pm #172263DianaParticipant@ICHARS, Apologies for the delayed response here... Okay, I will check this on your site. But for that, I need your admin credentials as well as site URL in a private reply here. Please also give me the access of the Plugins editor so, I can check the code of your customizerAugust 13, 2018 at 5:44 pm #172302ICHARSSpectatorThis reply has been marked as private.August 14, 2018 at 12:24 pm #172383DianaParticipant@ICHARS, can you please share your FTP credentials as well in a private reply to debug the code. P.S. Mark your reply as privateAugust 15, 2018 at 4:28 pm #172493ICHARSSpectatorThis reply has been marked as private.August 17, 2018 at 4:51 am #172634DianaParticipantThis reply has been marked as private.August 17, 2018 at 6:39 pm #172710ICHARSSpectatorThis reply has been marked as private.August 20, 2018 at 6:34 am #172860DianaParticipant@ICHARS, Thanks for sharing. Let me check..August 21, 2018 at 2:55 pm #173060ICHARSSpectatorAny update on this, my upcoming workshops are getting affectedAugust 22, 2018 at 1:31 pm #173187DianaParticipantThis reply has been marked as private.August 24, 2018 at 8:29 pm #173536ICHARSSpectatorHi any update on this?August 27, 2018 at 1:13 pm #173739DianaParticipantThis reply has been marked as private.August 28, 2018 at 6:27 am #173841ICHARSSpectatorUpdate on this issue?August 28, 2018 at 11:24 am #173883DianaParticipantThis reply has been marked as private.August 29, 2018 at 12:52 pm #174076ICHARSSpectatorThank you. After the change it allows me to select a product but I need to be able to select multiple products. Users should be able to enroll into a CLP for Level 1 by purchasing a product which is either only a level 1 product or a level 1 to 3 product or a level 1 to 5 Product. The multi select option was working earlier for this but it stopped after the last update to clp plugin. Can you please suggest how do I bring back the multiselect functionality for product course bundle. I am also open to any other option that allows users to enroll for a CLP using one of the three products. -
AuthorPosts
- The topic ‘Sale Learning Paths via woocommerce’ is closed to new replies.