adding more info click to custom fields?

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19409

it seems to be working now, thanks , one last question... i want to have for some fields a link next to it i used this echo ("<a type=\"text/html\" rel=\"height[600];width[500]\" class=\"jcepopup\" href=\"index.php?option=com_content&view=article&id=22:help1&catid=7:iq\">?</a>"); which worked before but not it is not..

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19414

you need to add them in the file custom_fields of the view checkout inside the foreach code. For example, you could add the code:
if($fieldName=='ein') echo '<a type="text/html" rel="height[600];width[500]" class="jcepopup" href="index.php?option=com_content&view=article&id=22:help1&catid=7:iq">?</a>';
after the code:
echo $this->fieldsClass->getFieldName($oneExtraField);

and that will add a ? for the ein field. Just repeat the line several times and change the fieldname check and the link and you're done.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19682

So I was wondering if I can put an other if statement is side the ones that are already there... for exsamples I will be adding an other radio selection field and I would like to have it load some fieds too.. so it would flow something like this..

Make a selection
Some fields show up, one of these fields is a radio selection if based on what they selec there I would like to show more fields below it or not..

Also I want to style these a bit better with divs and graphics what would you suggest?

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19702

Well, everything is possible, you just have to code it...


For the styling, with firebug you can get the class names of the different elements and use them in your CSS style definitions. You can do a lot of nice styling with CSS only.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19703

if(obj.name=='data[order][user_choice]'){
var hide = new Array();
var show = new Array();
if(obj.id=='user_choice_activate_both'){
show.push('number_choice');
if(obj.name=='data[order][number_choice]'){
var hide = new Array();
var show = new Array();
if(obj.id=='change_number'){
show.push('accountname');
show.push('billingaddress');
show.push('phone_number');
show.push('carrier');
show.push('account_number');
show.push('pin');
show.push('ssn');
show.push('esnnumber');
show.push('mobile_serial_lock_code');
hide.push('ein');
hide.push('iqaccount'); }
}}}
....


i am trying to get something like this, what do you think, would it work? of course every selection will ask if they want to keep their number and based on that those fields show.. Thanks for your help

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19722

You should do like that:
if(obj.name=='data[order][user_choice]'){
var hide = new Array();
var show = new Array();
// push the fields to say which one should be hidden and which one should be displayed based on the id
}else if(obj.name=='data[order][number_choice]'){
var hide = new Array();
var show = new Array();
// push the fields to say which one should be hidden and which one should be displayed based on the id
}

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19727

radio field to select whether you would like to keep your number or not is in 2 of the option of the user_choice in other words it's nested. based on the code on there now if(obj.id=='keep_number') which would be the value of the selection "i want to keep my number" from the field "Number_choice". " if(obj.id=='keep_number') " this is not necessary? how would it would it know what was the selection?

the

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19736

It is necessary. That "if" should be in the "else if" block of the previous code snippet, instead of the comment and with additional code to push the fields. That's what my comment was saying basically...

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19750

so this is what i have so far and still can't get it to work... whats wrong with it nic?

function hikashopHandleCases(obj){
   if(obj.name=='data[order][user_choice]'){
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
       show.push('numberchoice')
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       show.push('numberchoice')
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
       show.push('iqaccount');
       
       hide.push('numberchoice')
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
     }
     else if(obj.id=='user_choice_activate_phone'){
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       show.push('iqaccount');
       show.push('numberchoice')
      
     }
      else(obj.id=='user_choice_activate_phone'){
       hide.push('numberchoice')
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }
     }
     else if(obj.name=='data[order][numberchoice]'){
       var hide2 = new Array();
       var show2 = new Array();
       if(obj.id=='keepnumber'){
       show.push('numberchoice')
       show.push('customtext_173_13_32_23');
       show.push('accountname');
       show.push('billingaddress');
       show.push('phone_number');
       show.push('carrier');
       show.push('account_number');
       show.push('pin');
       show.push('ssn');
     
}
else(obj.id=='newnumber'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
}  
   }
   
  switchFields(show,hide);
}

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19759

You need to have one hide push or one show push per field for each condition. You should have a lot more lines, like what I did for your previous customization.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19812

minus the user_choice field which i didn't see in the original code being pushed, they are 12 fields. here is the code with those 12.

function hikashopHandleCases(obj){
   if(obj.name=='data[order][user_choice]'){
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
      show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
         hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     else if(obj.id=='user_choice_activate_phone'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
      else{
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }
     }
     
   else if(obj.name=='data[order][numberchoice]'){
       var hide2 = new Array();
       var show2 = new Array();
       if(obj.id=='numberchoice_keepnumber'){
       show.push('numberchoice')
       show.push('customtext_173_13_32_23');
       show.push('accountname');
       show.push('billingaddress');
       show.push('phone_number');
       show.push('carrier');
       show.push('account_number');
       show.push('pin');
       show.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       show.push('iqaccount');
     
}
else(obj.id=='numberchoice_newnumber'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
}  
 
   }

switchFields(show,hide);
}


please feel free and login to the site to help... it would only take 2 minuets of your time.... i just don't can't seem to understand why it wouldn't work.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19813

This seems to be working

function hikashopHandleCases(obj){
   if(obj.name=='data[order][user_choice]'){
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
      show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     else if(obj.id=='user_choice_activate_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     
     }
     

switchFields(show,hide);

   
}

what i am trying to do is when they select that they want to keep their number i want them to see these fields
   show.push('customtext_173_13_32_23'); 
       show.push('accountname'); 
       show.push('billingaddress'); 
       show.push('phone_number'); 
       show.push('carrier'); 
       show.push('account_number'); 
       show.push('pin'); 
       show.push('ssn'); 
the other fields that are currently being viewed from the selection would also show. this part of this project is killing the deadline... hopefully it's something simple..

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19816

You should try to add the code

else if(obj.name=='data[order][numberchoice]'){ 
       var hide = new Array(); 
       var show = new Array(); 
       if(obj.id=='numberchoice_keepnumber'){ 
       show.push('customtext_173_13_32_23'); 
       show.push('accountname'); 
       show.push('billingaddress'); 
       show.push('phone_number'); 
       show.push('carrier'); 
       show.push('account_number'); 
       show.push('pin'); 
       show.push('ssn');       
} 
else if(obj.id=='numberchoice_newnumber'){ 
       hide.push('customtext_173_13_32_23'); 
       hide.push('accountname'); 
       hide.push('billingaddress'); 
       hide.push('phone_number'); 
       hide.push('carrier'); 
       hide.push('account_number'); 
       hide.push('pin'); 
       hide.push('ssn'); 
}   
   } 

just before the switchFields(show,hide); line in your working code of your previous message.

Last edit: 13 years 5 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19817

this is what is now and no fields are showing

function hikashopHandleCases(obj){
   if(obj.name=='data[order][user_choice]'){
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
      show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     else if(obj.id=='user_choice_activate_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     
     }
     
  else if(obj.name=='data[order][numberchoice]'){  
       var hide = new Array();  
       var show = new Array();  
       if(obj.id=='numberchoice_keepnumber'){  
       show.push('customtext_173_13_32_23');  
       show.push('accountname');  
       show.push('billingaddress');  
       show.push('phone_number');  
       show.push('carrier');  
       show.push('account_number');  
       show.push('pin');  
       show.push('ssn');        
}  
else(obj.id=='numberchoice_newnumber'){  
       hide.push('customtext_173_13_32_23');  
       hide.push('accountname');  
       hide.push('billingaddress');  
       hide.push('phone_number');  
       hide.push('carrier');  
       hide.push('account_number');  
       hide.push('pin');  
       hide.push('ssn');  
}    
   }  
 
switchFields(show,hide);

   
}

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19818

There is a syntax error, it should be:
else if(obj.id=='numberchoice_newnumber'){
not:
else(obj.id=='numberchoice_newnumber'){

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19819

Great that got it working.. but i noticed that if the keepnumber was left selected when we go to an other selection and come back to it, even tho the radio is checked no fields show up. having to re-click back and forward between a new number to keep number to get them to show again. the first time we put the custom code we had something similar to this happen. how can we address this?

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19821

You should try to replace:
if(obj.name=='data[order][user_choice]'){

by:

var doextra = false;
if(obj.name=='data[order][user_choice]'){
doextra =true;


and:
switchFields(show,hide);

by:
switchFields(show,hide);
if(doextra){
var keepnumber = document.getElementById('numberchoice_keepnumber');
if(keepnumber.checked){
hikashopHandleCases(keepnumber);
}
}

that way, when the first selection option is selected and that the number selection is on, the hikashopHandleCases function will be called on the number selection and make the fields displayed in necessary.

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 5 months ago #19822

is seems that broke it some how , here is a complete view at it.

function hikashopHandleCases(obj){
   if(obj.name=='data[order][user_choice]'){
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
      show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     else if(obj.id=='user_choice_activate_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     
     }
     var doextra = false;
  else if(obj.name=='data[order][user_choice]'){
        doextra =true;  
       var hide = new Array();  
       var show = new Array();  
       if(obj.id=='numberchoice_keepnumber'){  
       show.push('customtext_173_13_32_23');  
       show.push('accountname');  
       show.push('billingaddress');  
       show.push('phone_number');  
       show.push('carrier');  
       show.push('account_number');  
       show.push('pin');  
       show.push('ssn');        
}  
else if(obj.id=='numberchoice_newnumber'){  
       hide.push('customtext_173_13_32_23');  
       hide.push('accountname');  
       hide.push('billingaddress');  
       hide.push('phone_number');  
       hide.push('carrier');  
       hide.push('account_number');  
       hide.push('pin');  
       hide.push('ssn');  
}    
   }  
switchFields(show,hide);
if(doextra){
var keepnumber = document.getElementById('numberchoice_keepnumber');
if(keepnumber.checked){
hikashopHandleCases(keepnumber);
}
}


   
}

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19823

Please make the modifications as I said...
I didn't told you to replace
else if(obj.name=='data[order][numberchoice]'){
but
if(obj.name=='data[order][user_choice]'){

Please Log in or Create an account to join the conversation.

  • Posts: 156
  • Thank you received: 0
13 years 4 months ago #20050

that got it working sorry :( lol.., but i just noticed that if i leave the keepnumber selected and move down to the next option on the user_choice. when only one field should be showing all the field from the keepnumber stay showing; here is the latest code.

function hikashopHandleCases(obj){

var doextra = false;
   if(obj.name=='data[order][user_choice]'){
doextra =true;
    var hide = new Array();
    var show = new Array();
     if(obj.id=='user_choice_activate_both'){
      show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_other_phone'){
       show.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       show.push('esnnumber');
       show.push('mobile_serial_lock_code');
       hide.push('iqaccount');
     }else if(obj.id=='user_choice_activate_plan_iq_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     else if(obj.id=='user_choice_activate_phone'){
       hide.push('numberchoice')
       hide.push('customtext_173_13_32_23');
       hide.push('accountname');
       hide.push('billingaddress');
       hide.push('phone_number');
       hide.push('carrier');
       hide.push('account_number');
       hide.push('pin');
       hide.push('ssn');
       hide.push('esnnumber');
       hide.push('mobile_serial_lock_code');
       show.push('iqaccount');
     }
     
     }

  else if(obj.name=='data[order][numberchoice]'){
       var hide = new Array();  
       var show = new Array();  

       if(obj.id=='numberchoice_keepnumber'){  
       show.push('customtext_173_13_32_23');  
       show.push('accountname');  
       show.push('billingaddress');  
       show.push('phone_number');  
       show.push('carrier');  
       show.push('account_number');  
       show.push('pin');  
       show.push('ssn');        
}  
else if(obj.id=='numberchoice_newnumber'){  
       hide.push('customtext_173_13_32_23');  
       hide.push('accountname');  
       hide.push('billingaddress');  
       hide.push('phone_number');  
       hide.push('carrier');  
       hide.push('account_number');  
       hide.push('pin');  
       hide.push('ssn');  
}    
   }  
switchFields(show,hide);
if(doextra){
var keepnumber = document.getElementById('numberchoice_keepnumber');
if(keepnumber.checked){
hikashopHandleCases(keepnumber);
}
}


   
}

Please Log in or Create an account to join the conversation.

Time to create page: 0.094 seconds
Powered by Kunena Forum