Location: PHPKode > projects > MembersGear > membersgear/admin/admin_product_upsell_m.php
<?php       
  require_once "../config/config.php";
  require_once INCLUDE_DIR."/users_class.php";
  require_once INCLUDE_DIR."/master_class.php"; 
  require_once INCLUDE_DIR."/folderProtection.php";
  require_once INCLUDE_DIR."/product_class.php";
  require_once INCLUDE_DIR."/passgen.php";
  require_once INCLUDE_DIR."/product_protection_class.php";
  require_once INCLUDE_DIR."/upsell_product_class.php";
  
  $users = new users_class();
  $upsell_obj=new upsell_product_class();
  $products = new product_class();
                                              
  if($_SERVER['REQUEST_METHOD']=="GET")
        $_SESSION[SESSION_PREFIX.'page_referrer']=$_SERVER['HTTP_REFERER'];
        
  if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can view products and thankyou page tracking')==false)
  {
                Redirect('admin_nopermission.php',true);  
  } 
   if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage products and thankyou page tracking')==false)
   {
                Redirect('admin_nopermission.php',true);     
   } 
   switch($_action)
    {
         case 'insert':
         
           $plus1=$_POST['plus1'];
           $plus2=$_POST['plus2'];
           $plus3=$_POST['plus3'];

                 
            if(isset($_POST['main_product_id']))
             $main_product_id=trim($_POST['main_product_id']); 
            else
             $main_product_id=0;

            $isMainProductExist=$products->GetSpecificProduct($main_product_id);
         
           if(is_numeric($main_product_id) and $main_product_id!=false)
           { 
                   $productInfo=$products->GetSpecificProduct($main_product_id);
                   $mainProduct_paygear_proId=$productInfo[0]['paygear_productid'];
                   
                   /*pro 1 */
                   $UpsellProduct1=0;
                   $UpsellProduct1_ID=0;
                   $UpsellProduct_No1='';
                   $UpsellProduct_Yes1='';
                   $UpsellProductLink1='';
                  
                   /* pro 2 */
                   $UpsellProduct2_ID=0;
                   $UpsellProduct2=0;
                   $UpsellProduct_No2='';
                   $UpsellProduct_Yes2='';
                   $UpsellProductLink2='';
                   
                   /* pro 3 */
                   $UpsellProduct3_ID=0;
                   $UpsellProduct3=0;
                   $UpsellProduct_No3='';
                   $UpsellProduct_Yes3='';
                   $UpsellProductLink3='';
                   
                   if($plus1=='true')
                    {
                      $UpsellProduct1_ID=0;
                      
                      $upsellSelectProduct1=$_POST['upsellSelectProduct1'];
                    
                      $UpsellProduct1_res=$products->GetSpecificProduct($upsellSelectProduct1);
                      $UpsellProduct1=$UpsellProduct1_res[0]['paygear_productid'];
                  
                    
                    
                      $secondUpsell=$_POST['Upsell2Select'];
                      $upsellpagelink1=$_POST['upsellpagelink1'];
                      
                      
                      $UpsellProductLink1=$_POST['upsellpagelink1'];
                      
                      $nobuttonaction='T';
                      if($secondUpsell=='secondUpsell')
                        $nobuttonaction='U';  
                      else if($secondUpsell=='thankyoupage')
                       $nobuttonaction='T';
                   
                      $yesbuttonaction_lev1=$_POST['Upsell2Selectyes'];
                       $yesbuttonaction='T';
                      if($yesbuttonaction_lev1=='secondUpsell')
                        $yesbuttonaction='U';  
                      else if($yesbuttonaction_lev1=='thankyoupage')
                       $yesbuttonaction='T';
                   
                       
                      $UpsellProduct_No1=$nobuttonaction; 
                      $UpsellProduct_Yes1=$yesbuttonaction; 
                       
                      $query1="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                      `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct1,
                      '$nobuttonaction','$upsellpagelink1',1,'$yesbuttonaction', "; 
                      
                       
                    }
                    
                   if($plus2=='true')
                    {
                        $upsellpagelink2=$_POST['upsellpagelink2'];
                        
                        $UpsellProductLink2= $upsellpagelink2;
                        
                        $upsellSelectProduct2=$_POST['upsellSelectProduct2'];
                        
                        
                        
                        $UpsellProduct2_res=$products->GetSpecificProduct($upsellSelectProduct2);
                        $UpsellProduct2=$UpsellProduct2_res[0]['paygear_productid'];
                       
                        
                        $Upsell3Select=$_POST['Upsell3Select'];
                       
                        $nobuttonaction='T';
                        if($Upsell3Select=='thirdupsell')
                          $nobuttonaction='U';  
                        else if($secondUpsell=='thankyoupage')
                        $nobuttonaction='T';
                       
                       $Upsell3Select_yes=$_POST['Upsell3Selectyes'];
                       $yesbuttonaction='T';
                        if($Upsell3Select_yes=='thirdupsell')
                          $yesbuttonaction='U';  
                        else if($Upsell3Select_yes=='thankyoupage')
                          $yesbuttonaction='T';
                       
                       
                       $UpsellProduct_No2=$nobuttonaction;
                       $UpsellProduct_Yes2=$yesbuttonaction;
                       
                         $query2="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                        `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct2,
                        '$nobuttonaction','$upsellpagelink2',2,'$yesbuttonaction', "; 
                      
                       
                     
                    
                    }
                   if($plus3=='true')
                    {
                        $upsellpagelink3=$_POST['upsellpagelink3'];
                          $UpsellProductLink3= $upsellpagelink3;
                    
                        $upsellSelectProduct3=$_POST['upsellSelectProduct3'];
                        
                        $UpsellProduct3_res=$products->GetSpecificProduct($upsellSelectProduct3);
                        $UpsellProduct3=$UpsellProduct3_res[0]['paygear_productid'];
                        
                        $nobuttonaction='T';
                        $yesbuttonaction='T';
                       
                        $UpsellProduct_No3=$nobuttonaction;
                        $UpsellProduct_Yes3=$yesbuttonaction;
                       
                         $query3="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                        `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct3,
                        '$nobuttonaction','$upsellpagelink3',3,'$yesbuttonaction', "; 
                      
                    
                    }  
                   
                   $paygearResult=$PaygearWebserviceClient->ManageUpsellProducts($mainProduct_paygear_proId,$UpsellProduct1_ID,$UpsellProduct1,
                                                            $UpsellProduct_Yes1,$UpsellProduct_No1,$UpsellProductLink1,$UpsellProduct2_ID,$UpsellProduct2,
                                                            $UpsellProduct_Yes2,$UpsellProduct_No2,$UpsellProductLink2,$UpsellProduct3_ID,$UpsellProduct3,
                                                            $UpsellProduct_Yes3,$UpsellProduct_No3,$UpsellProductLink3);
                                                            
                   if($paygearResult!=false)
                   {
                      $insertedId=explode(",",$paygearResult);
                      if($plus1=='true' and $insertedId[0] > 0)
                      {
                         $query1.=" $insertedId[0] )";
                         $upsell_obj->BaseView($query1); 
                      }
                      
                      if($plus2=='true' and $insertedId[1] >0 )
                      {
                        $query2.=" $insertedId[1] )"; 
                        $upsell_obj->BaseView($query2);          
                      }
                     
                      if($plus3=='true'  and $insertedId[2] >0)
                      {
                         $query3.=" $insertedId[2] )";  
                         $upsell_obj->BaseView($query3);
                      } 
                      
                     $message->SetMessage('Product upsell added successfully.');  
                     Redirect("admin_product_upsell_m.php?productid=$main_product_id");   
                   }
                   else
                    {
                      $message->SetMessage('Product upsell unsuccessful.');
                      Redirect('admin_product_v.php?err=true');  
                    }  
              }
             else
              {
                $message->SetMessage('Could not find given product.'); 
                Redirect('admin_product_v.php?err=true');    
              }                                          
           
                
            break;
          case 'update':
           
               $plus1=$_POST['plus1'];
               $plus2=$_POST['plus2'];
               $plus3=$_POST['plus3'];
               
                /*pro 1 */
                $UpsellProduct1=0;
                $UpsellProduct1_ID=0;
                $UpsellProduct_No1='';
                $UpsellProduct_Yes1='';
                $UpsellProductLink1='';

                /* pro 2 */
                $UpsellProduct2_ID=0;
                $UpsellProduct2=0;
                $UpsellProduct_No2='';
                $UpsellProduct_Yes2='';
                $UpsellProductLink2='';

                /* pro 3 */
                $UpsellProduct3_ID=0;
                $UpsellProduct3=0;
                $UpsellProduct_No3='';
                $UpsellProduct_Yes3='';
                $UpsellProductLink3='';
               
               
                if(isset($_POST['main_product_id']))
                  $main_product_id=trim($_POST['main_product_id']); 
                else
                 $main_product_id=0;

                $isMainProductExist=$products->GetSpecificProduct($main_product_id);
               
                if(is_numeric($main_product_id) and $isMainProductExist!=false)
                { 
                   $productInfo=$products->GetSpecificProduct($main_product_id); 
                   $mainProduct_paygear_proId=$productInfo[0]['paygear_productid'];
                   
                   $upsell_obj->deleteUpsell($main_product_id); 
                   
                   if($plus1=='true')
                    {
                          $UpsellProduct1_ID=0;
                          
                          if(isset($_POST['upsellPaygear_pro_id_Level1']) and $_POST['upsellPaygear_pro_id_Level1']!="")
                             $UpsellProduct1_ID= $_POST['upsellPaygear_pro_id_Level1'];
                             
                          $upsellSelectProduct1=$_POST['upsellSelectProduct1'];
                        
                          $UpsellProduct1_res=$products->GetSpecificProduct($upsellSelectProduct1);
                          $UpsellProduct1=$UpsellProduct1_res[0]['paygear_productid'];
                      
                        
                        
                          $secondUpsell=$_POST['Upsell2Select'];
                          $upsellpagelink1=$_POST['upsellpagelink1'];
                          
                          
                          $UpsellProductLink1=$_POST['upsellpagelink1'];
                          
                          $nobuttonaction='T';
                          if($secondUpsell=='secondUpsell')
                            $nobuttonaction='U';  
                          else if($secondUpsell=='thankyoupage')
                           $nobuttonaction='T';
                       
                          $yesbuttonaction_lev1=$_POST['Upsell2Selectyes'];
                           $yesbuttonaction='T';
                          if($yesbuttonaction_lev1=='secondUpsell')
                            $yesbuttonaction='U';  
                          else if($yesbuttonaction_lev1=='thankyoupage')
                           $yesbuttonaction='T';
                       
                           
                          $UpsellProduct_No1=$nobuttonaction; 
                          $UpsellProduct_Yes1=$yesbuttonaction; 
                           
                          $query1="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                          `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct1,
                          '$nobuttonaction','$upsellpagelink1',1,'$yesbuttonaction', "; 
                              
                               
                      }
                            
                    if($plus2=='true')
                    {
                            
                         if(isset($_POST['upsellPaygear_pro_id_Level2']) and $_POST['upsellPaygear_pro_id_Level2']!="")
                             $UpsellProduct2_ID= $_POST['upsellPaygear_pro_id_Level2'];
                        
                            
                            $upsellpagelink2=$_POST['upsellpagelink2'];
                            
                            $UpsellProductLink2= $upsellpagelink2;
                            
                            $upsellSelectProduct2=$_POST['upsellSelectProduct2'];
                            
                            
                            
                            $UpsellProduct2_res=$products->GetSpecificProduct($upsellSelectProduct2);
                            $UpsellProduct2=$UpsellProduct2_res[0]['paygear_productid'];
                           
                            
                            $Upsell3Select=$_POST['Upsell3Select'];
                           
                            $nobuttonaction='T';
                            if($Upsell3Select=='thirdupsell')
                              $nobuttonaction='U';  
                            else if($secondUpsell=='thankyoupage')
                            $nobuttonaction='T';
                           
                           $Upsell3Select_yes=$_POST['Upsell3Selectyes'];
                           $yesbuttonaction='T';
                            if($Upsell3Select_yes=='thirdupsell')
                              $yesbuttonaction='U';  
                            else if($Upsell3Select_yes=='thankyoupage')
                            $yesbuttonaction='T';
                           
                           
                           $UpsellProduct_No2=$nobuttonaction;
                           $UpsellProduct_Yes2=$yesbuttonaction;
                           
                             $query2="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                            `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct2,
                            '$nobuttonaction','$upsellpagelink2',2,'$yesbuttonaction', "; 
                            
                       }
                     if($plus3=='true')
                       {
                           if(isset($_POST['upsellPaygear_pro_id_Level3']) and $_POST['upsellPaygear_pro_id_Level3']!="")
                              $UpsellProduct3_ID= $_POST['upsellPaygear_pro_id_Level3'];
                         
                                
                                $upsellpagelink3=$_POST['upsellpagelink3'];
                                  $UpsellProductLink3= $upsellpagelink3;
                            
                                $upsellSelectProduct3=$_POST['upsellSelectProduct3'];
                                
                                $UpsellProduct3_res=$products->GetSpecificProduct($upsellSelectProduct3);
                                $UpsellProduct3=$UpsellProduct3_res[0]['paygear_productid'];
                                
                                $nobuttonaction='T';
                                $yesbuttonaction='T';
                               
                                $UpsellProduct_No3=$nobuttonaction;
                                $UpsellProduct_Yes3=$yesbuttonaction;
                               
                                 $query3="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                                `nobuttonaction`,`upsellpageurl`,`upselllevel`,`yesbuttonaction`,`paygear_productupsells_id`) values($main_product_id,$upsellSelectProduct3,
                                '$nobuttonaction','$upsellpagelink3',3,'$yesbuttonaction', "; 
                              
                            
                            }  
                           
                           $paygearResult=$PaygearWebserviceClient->ManageUpsellProducts($mainProduct_paygear_proId,$UpsellProduct1_ID,$UpsellProduct1,
                                                                    $UpsellProduct_Yes1,$UpsellProduct_No1,$UpsellProductLink1,$UpsellProduct2_ID,$UpsellProduct2,
                                                                    $UpsellProduct_Yes2,$UpsellProduct_No2,$UpsellProductLink2,$UpsellProduct3_ID,$UpsellProduct3,
                                                                    $UpsellProduct_Yes3,$UpsellProduct_No3,$UpsellProductLink3);
                                                                    
                       if($paygearResult!=false)
                       {
                              $insertedId=explode(",",$paygearResult);
                              if($plus1=='true' and $insertedId[0] > 0)
                              {
                                 $query1.=" $insertedId[0] )";
                                 $upsell_obj->BaseView($query1); 
                              }
                              
                              if($plus2=='true' and $insertedId[1] >0 )
                              {
                                $query2.=" $insertedId[1] )"; 
                                $upsell_obj->BaseView($query2);          
                              }
                             
                              if($plus3=='true'  and $insertedId[2] >0)
                              {
                                 $query3.=" $insertedId[2] )";  
                                 $upsell_obj->BaseView($query3);
                              }
                              $message->SetMessage('Product upsell updated successfully.');  
                              Redirect("admin_product_upsell_m.php?productid=$main_product_id");    
                        }      
                       else
                        {
                          $message->SetMessage('Product upsell unsuccessful.');
                          Redirect('admin_product_v.php?err=true');  
                        }
                }
               else
                {
                  $message->SetMessage('Could not find given product.');
                  Redirect('admin_product_v.php?err=true');  
                }      
                                                             
             
          break;
         case 'delete':
                if(isset($_GET['main_product_id']))
                  $lsId=trim($_GET['main_product_id']); 
               else
                 $lsId=0;
           
              $isMainProductExist=$products->GetSpecificProduct($lsId);
              if(is_numeric($lsId) and $isMainProductExist!=false )
                { 
                  
                   $productInfo=$products->GetSpecificProduct($lsId); 
                   $mainProduct_paygear_proId=$productInfo[0]['paygear_productid'];
                  
                  $result_del=$PaygearWebserviceClient->DeleteUpsellProduct($mainProduct_paygear_proId,1);
                  if($result_del!=false)
                  {
                      $upsell_obj->deleteUpsell($lsId);
                      $message->SetMessage('Product upsell deleted successfully.');  
                      Redirect('admin_product_v.php');  
                  }
                 else
                  {
                  
                    $message->SetMessage('Error while deleting product.');    
                    Redirect("admin_product_upsell_m.php?productid=$lsId&err=true"); 
                  }     
                }
              else
               {
                 $message->SetMessage('Could not find given product.');    
                  Redirect('admin_product_v.php?err=true'); 
               }   
                                                             
             
            break;
            
           case 'update_from_paygear':
              if(isset($_GET['main_product_id']))
                  $lsId=trim($_GET['main_product_id']); 
               else
                 $lsId=0;
           
              $isMainProductExist=$products->GetSpecificProduct($lsId);
              if(is_numeric($lsId) and $isMainProductExist!=false)
                { 
                  
                   $productInfo=$products->GetSpecificProduct($lsId); 
                   $mainProduct_paygear_proId=$productInfo[0]['paygear_productid'];
                   $paygearwebServ=new PaygearWebserviceClient();
                   $result=$paygearwebServ->updateFromPaygear_upsellProduct($mainProduct_paygear_proId);
                   
                   if($result!=false)
                   {
                     if(is_array($result[string]))
                      {
                        
                         $upsell_obj->deleteUpsell($lsId); 
                         $splitedValFields=explode("!@#\$%^*()",$result[string][0]);  
                         $valArr=array(); 
                         for($i=1;$i<=count($result[string])-1;$i++)
                         {
                            $splitedVal=explode("!@#\$%^*()",$result[string][$i]);
                             
                            for($j=0;$j<=count($splitedValFields)-1;$j++)
                             {
                               $valArr[$splitedValFields[$j]]=$splitedVal[$j];
                             }
                               $paygear_pro_inserted_id=$valArr['id'];
                               $mainProId=$valArr['MainProductId'];
                               $YesButtonUpsellPaygearProductId=$valArr['YesButtonUpsellProductId'];
                               $NoButtonAction=$valArr['NoButtonAction'];
                               $YesButtonAction=$valArr['YesButtonAction'];
                               $UpsellPageUrl=$valArr['UpsellPageUrl'];
                               $UpsellLevel=$valArr['UpsellLevel'];
                               $YesButtonUpsellPaygearProductId_map_to_membersgear=$upsell_obj->getMembersgearProductIdFromPaygearProductId($YesButtonUpsellPaygearProductId);
                               
                                $query2="Insert into ".TABLE_PREFIX."productupsells(`mainproductid`,`yesbuttonupsellproductid`,
                                `nobuttonaction`,`upsellpageurl`,`upselllevel`,`paygear_productupsells_id`,`yesbuttonaction`) values($lsId,$YesButtonUpsellPaygearProductId_map_to_membersgear,
                                '$NoButtonAction','$UpsellPageUrl',$UpsellLevel,$paygear_pro_inserted_id,'$YesButtonAction') ";
                                $upsell_obj->BaseView($query2);   
                         }
                       
                         $message->SetMessage('Product upsell updated from paygear successfully.');    
                         Redirect("admin_product_upsell_m.php?productid=$lsId");   
                      
                      }     
                     
                   }
                 else
                  {
                  
                    $message->SetMessage('Error while getting upesell product update from paygear.');    
                    Redirect("admin_product_upsell_m.php?productid=$lsId&err=true");   
                  }   
                 }
              else
               {
                 $message->SetMessage('Could not find given product.');    
                  Redirect('admin_product_v.php?err=true'); 
               }    
           break; 
         default:       
         
         if(isset($_GET['productid']))
          $prodId=trim($_GET['productid']); 
         else
           $prodId=0;
           
          $isMainProductExist=$products->GetSpecificProduct($prodId);
          if(is_numeric($prodId) and $isMainProductExist!=false)
           {
                
              $allupsellProduct=$upsell_obj->getUpsellProduct($prodId);
              $ifProductSetForUpsell1=$upsell_obj->GetSpecificUpsellProduct($prodId,1);
              $ifProductSetForUpsell2=$upsell_obj->GetSpecificUpsellProduct($prodId,2);
              $ifProductSetForUpsell3=$upsell_obj->GetSpecificUpsellProduct($prodId,3);
              
              if($ifProductSetForUpsell1!=false or $ifProductSetForUpsell2!=false or $ifProductSetForUpsell3!=false)
              {
               
                    if($ifProductSetForUpsell1!=false)
                     {
                         $upsellurlLevel1=$ifProductSetForUpsell1[0]['upsellpageurl'];
                         $upsellyesLevel1=$ifProductSetForUpsell1[0]['yesbuttonupsellproductid'];
                         $upsellnoLevel1=$ifProductSetForUpsell1[0]['nobuttonaction'];
                         $upsellyesLevel1_action=$ifProductSetForUpsell1[0]['yesbuttonaction'];
                         $upsellPaygear_pro_id_Level1=$ifProductSetForUpsell1[0]['paygear_productupsells_id'];
                         
                        
                         $smarty->assign('upsellPaygear_pro_id_Level1',$upsellPaygear_pro_id_Level1);
                         $smarty->assign('upsellurlLevel1',$upsellurlLevel1);
                         $smarty->assign('upsellyesLevel1',$upsellyesLevel1);
                         $smarty->assign('upsellnoLevel1',$upsellnoLevel1);
                         $smarty->assign('upsellyesLevel1_action',$upsellyesLevel1_action);
                         //$smarty->assign('upsellnoLevel1_editId',$ifProductSetForUpsell1[0]['id']);
                         $smarty->assign('plus1','true');
                     
                     }
                    else
                     $smarty->assign('plus1','false');   
                       
                   if($ifProductSetForUpsell2!=false)
                    {
                    
                         $upsellurlLevel2=$ifProductSetForUpsell2[0]['upsellpageurl'];
                         $upsellyesLevel2=$ifProductSetForUpsell2[0]['yesbuttonupsellproductid'];
                         $upsellnoLevel2=$ifProductSetForUpsell2[0]['nobuttonaction'];
                         $upsellyesLevel2_action=$ifProductSetForUpsell2[0]['yesbuttonaction'];
                         $upsellPaygear_pro_id_Level2=$ifProductSetForUpsell2[0]['paygear_productupsells_id'];
                         
                        
                         $smarty->assign('upsellPaygear_pro_id_Level2',$upsellPaygear_pro_id_Level2);
                         $smarty->assign('upsellurlLevel2',$upsellurlLevel2);
                         $smarty->assign('upsellyesLevel2',$upsellyesLevel2);
                         $smarty->assign('upsellnoLevel2',$upsellnoLevel2);
                         $smarty->assign('upsellyesLevel2_action',$upsellyesLevel2_action);
                         //$smarty->assign('upsellnoLevel2_editId',$ifProductSetForUpsell2[0]['id']);
                         $smarty->assign('plus2','true');
                    
                    }
                   else
                     $smarty->assign('plus2','false'); 
                      
                   if($ifProductSetForUpsell3!=false)
                    {
                         $upsellurlLevel3=$ifProductSetForUpsell3[0]['upsellpageurl'];
                         $upsellyesLevel3=$ifProductSetForUpsell3[0]['yesbuttonupsellproductid'];
                         $upsellnoLevel3=$ifProductSetForUpsell3[0]['nobuttonaction'];
                         $upsellPaygear_pro_id_Level3=$ifProductSetForUpsell3[0]['paygear_productupsells_id'];
                         
                        
                         $smarty->assign('upsellPaygear_pro_id_Level3',$upsellPaygear_pro_id_Level3);
                         $smarty->assign('upsellurlLevel3',$upsellurlLevel3);
                         $smarty->assign('upsellyesLevel3',$upsellyesLevel3);
                         $smarty->assign('upsellnoLevel3',$upsellnoLevel3);
                         //$smarty->assign('upsellnoLevel3_editId',$ifProductSetForUpsell3[0]['id']);
                         $smarty->assign('plus3','true');
                    
                    }
                   else
                     $smarty->assign('plus3','false');   
                 
                  
                   $smarty->assign('IsEdit','yes');
                 
               }
              else
               {
                 $smarty->assign('plus1','false');
                 $smarty->assign('plus2','false');
                 $smarty->assign('plus3','false');
               
               } 
              $getMainProduct=$products->GetSpecificProduct($prodId);
              
              $smarty->assign('main_product_id',$prodId);
              $smarty->assign('product_name',$getMainProduct[0]['name']);
              $smarty->assign('upsellproducts',$allupsellProduct);
              if($message->IsMessageExists())
              {
               $smarty->assign('msg',$lsmsg=$message->GetMessage()); 
              }
              $smarty->display('admin_product_upsell_m.tpl');
            
           }
         else
          {
                $message->SetMessage('Could not find given product.');    
                Redirect('admin_product_v.php?err=true');  
          
          }  
               
    }        
    
?>
Return current item: MembersGear