samedi 27 octobre 2018

How to get the pricing based on the value selected from the dropdown menu in laravel

I need to get the price based on the tld selected from the dropdown menu, I have used the below code.

Find the code below :

  <div class="form-group">
       <label for="inputTransferDomain">Domain Name</label>
       <input type="text" class="form-control" name="domain" id="inputTransferDomain" value="" placeholder="example.com" data-toggle="tooltip" data-placement="left" data-trigger="manual" title="" data-original-title="Please enter your domain" required>
       </div>
       <?php //echo "<pre>";print_r($result['pricing']['com']['transfer']['1']);exit;?>
       <select id="tld" class="form-control select_plan" name="name" style="width:95%">
     <option value="--Select--">--Select--</option>
     @foreach($result['pricing'] as $key=>$value )
     <option value="" data-price=""></option>                             
     @endforeach
     </select>
     <select name="price" id="price_tld"  class="form-control" style="display:none; width: 95%; margin-top: 20px;" >
     </select>        
     </div>                                                 
     <div class="text-right col-lg-offset-3 col-lg-6 col-sm-12">
     <button type="submit" id="btnTransferDomain" class="btn btn-primary btn-transfer center-block">Add to Cart</button>
      </div>                            
      </div><!-- /.col-lg-6 -->
      </div><!-- /.row -->
</form>

My json data is as given below :

      Array
(
[com] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 637.70
            )

        [transfer] => Array
            (
                [1] => 637.70
            )

        [renew] => Array
            (
                [1] => 637.70
            )

    )

[in] => Array
    (
        [categories] => Array
            (
                [0] => ccTLD
                [1] => Geography
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 1014.67
            )

        [transfer] => Array
            (
                [1] => 1014.67
            )

        [renew] => Array
            (
                [1] => 1014.67
            )

    )

[info] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 200.00
            )

        [transfer] => Array
            (
                [1] => 200.00
            )

        [renew] => Array
            (
                [1] => 200.00
            )

    )

[net] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 829.76
            )

        [transfer] => Array
            (
                [1] => 829.76
            )

        [renew] => Array
            (
                [1] => 829.76
            )

    )

[biz] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 878.33
            )

        [transfer] => Array
            (
                [1] => 878.33
            )

        [renew] => Array
            (
                [1] => 878.33
            )

    )

[org] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 939.45
            )

        [transfer] => Array
            (
                [1] => 939.45
            )

        [renew] => Array
            (
                [1] => 939.45
            )

    )

[asia] => Array
    (
        [categories] => Array
            (
                [0] => gTLD
                [1] => ccTLD
                [2] => Geography
                [3] => Popular
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 1527.88
            )

        [transfer] => Array
            (
                [1] => 1527.88
            )

        [renew] => Array
            (
                [1] => 1527.88
            )

    )

[co.uk] => Array
    (
        [categories] => Array
            (
                [0] => ccTLD
                [1] => Geography
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 602.53
            )

        [transfer] => Array
            (
                [1] => 602.53
            )

        [renew] => Array
            (
                [1] => 602.53
            )

    )

[in.net] => Array
    (
        [categories] => Array
            (
                [0] => Other
            )

        [addons] => Array
            (
                [dns] => 1
                [email] => 1
                [idprotect] => 1
            )

        [group] => sale
        [register] => Array
            (
                [1] => 100.00
            )

        [transfer] => Array
            (
                [1] => 100.00
            )

        [renew] => Array
            (
                [1] => 100.00
            )

    )

    )

In the above json data, I have the tlds as [com],[in] etc., I need to display the price under [transfer] based on the tld's selected from dropdown menu.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire