mercredi 4 janvier 2017

PHP Price quotation calculator

I have following code for this page

http://ift.tt/2hQ6LBu Example post code 7800 Cement volume 100 The price of small mixer (POMP > Mini betonpomp is ok but need to calculate POMP>Giekpomp Picture link. What would be correct PHP to calculate large mixer and small mixer prices ?

<div class="steps-heading">
    <div class="row">
        <div class="col-xs-12 col-md-4 steps active">
            <a href="<?php echo Awf_Functions::createUrl('offerte-aanvragen/stap/1'); ?>">
                <span class="text-center">1</span> <img src="<?php echo Awf_Functions::createUrl('cmsPublic/themes/betonstorten/images/icon-check-active.png'); ?>" alt="Check" /> Afstand en cubage
            </a>
        </div>
        <div class="col-xs-12 col-md-4 steps <?php if($currentstep > 1): echo 'active'; $step2_img = 'icon-check-active.png'; else: $step2_img = 'icon-check.png'; endif; ?>">
            <a href="<?php if(!empty($step2)): echo Awf_Functions::createUrl('offerte-aanvragen/stap/2'); else: echo 'javascript:void(0);'; endif; ?>">
                <span class="text-center">2</span> <img src="<?php echo Awf_Functions::createUrl('cmsPublic/themes/betonstorten/images/'.$step2_img); ?>" alt="Check" /> Type en soort
            </a>
        </div>
        <div class="col-xs-12 col-md-4 steps <?php if($currentstep == 3 ): echo 'active'; $step3_img = 'icon-check-active.png'; else: $step3_img = 'icon-check.png'; endif; ?>">
            <span class="text-center">3</span> <img src="<?php echo Awf_Functions::createUrl('cmsPublic/themes/betonstorten/images/'.$step3_img); ?>" alt="Check" /> Offerte aanvragen
        </div>
    </div>
</div>
<div class="quote-contents">
    <div class="row">
        <div class="col-xs-12 col-md-8 step-container">
            <div class="step step1 <?php if($currentstep == 1): echo 'active'; endif; ?>">
                <h2>Afstand en cubage</h2>
                <form method="post" action="<?php echo Awf_Functions::createUrl('offerte-aanvragen'); ?>">
                    <div class="form-group">
                        <input type="text" name="postcode" class="form-control" placeholder="Postcode" value="<?php echo $userdata['postalcode']; ?>" />
                    </div>
                    <div class="form-group">
                        <input type="text" name="aantal_m" class="form-control" placeholder="Aantal m²" value="<?php echo $userdata['aantal_m']; ?>" />
                    </div>
                    <input type="submit" name="submit_calculator" value="Volgende stap" class="button" />
                </form>
            </div>
            <div class="step step2 <?php if($currentstep == 2): echo 'active'; endif; ?>">
                <h2>Beton samenstelling</h2>
                <p>Optioneel, u kunt altijd om advies vragen</p>
                <div class="row flex">
                    <div class="col-xs-12 col-sm-6 border-right">
                        <h3>Vloeibaarheid</h3>
                        <?php if(!empty($vloeibaarheid)): foreach($vloeibaarheid as $item): ?>
                        <div class="radio" data-price="<?php echo Awf_String::from($item['price'])->plain_price(); ?>" data-id="<?php echo $item['id']; ?>">
                            <input type="radio" name="vloeibaarheid" value="<?php echo $item['name']; ?>" id="vloeibaarheid-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>" <?php if(!empty($userdata['options'][$item['categories_id']]) and $userdata['options'][$item['categories_id']] == $item['id']):?>checked<?php endif;?> />
                            <label for="vloeibaarheid-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>"><?php echo $item['name']; ?></label>
                        </div>
                        <?php endforeach; endif; ?>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <h3>Cement soort</h3>
                        <?php if(!empty($cementsoort)): foreach($cementsoort as $item): ?>
                        <div class="radio" data-price="<?php echo Awf_String::from($item['price'])->plain_price(); ?>" data-id="<?php echo $item['id']; ?>">
                            <input type="radio" name="cement_soort" value="<?php echo $item['name']; ?>" id="cementsoort-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>" <?php if(!empty($userdata['options'][$item['categories_id']]) and $userdata['options'][$item['categories_id']] == $item['id']):?>checked<?php endif;?> />
                            <label for="cementsoort-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>"><?php echo $item['name']; ?></label>
                        </div>
                        <?php endforeach; endif; ?>
                    </div>
                </div>
                <hr />
                <div class="row flex">
                    <div class="col-xs-12 col-sm-6 border-right">
                        <h3>Loswijze</h3>
                        <?php if(!empty($loswijze)): foreach($loswijze as $item): ?>
                        <div class="radio" data-loswijze="<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>" data-price="<?php echo Awf_String::from($item['price'])->plain_price(); ?>" data-id="<?php echo $item['id']; ?>">
                            <input type="radio" name="loswijze" value="<?php echo $item['name']; ?>" id="loswijze-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>" <?php if(!empty($userdata['options'][$item['categories_id']]) and $userdata['options'][$item['categories_id']] == $item['id']):?>checked<?php endif;?> />
                            <label for="loswijze-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>"><?php echo $item['name']; ?></label>
                        </div>
                        <?php endforeach; endif; ?>
                    </div>
                    <div class="col-xs-12 col-sm-6">

                    </div>
                </div>
                <div class="spacer-30"></div>
                <div class="pompen hidden">
                    <h2>Kies uw pomp</h2>
                    <div class="row">
                        <?php if(!empty($pompen)):
                            foreach($pompen as $item):
                        ?>
                        <div class="col-xs-12 col-sm-6">
                            <div class="pomp">
                                <?php if(!empty($item['photos'])):
                                    $photo = array_values($item['photos']);
                                ?>
                                <div class="image" style="background-image: url('<?php echo $photo[0]['url'];?>');"></div>
                                <?php
                                else:
                                ?>
                                <div class="image bg-contain" style="background-image:url('<?php echo Awf_Functions::createUrl('cmsPublic/themes/betonstorten/images/betonstorten-logo-optimized.png'); ?>')"></div>
                                <?php
                                endif;
                                ?>
                                <div class="pomp-contents">
                                    <h3><?php echo $item['name']; ?></h3>
                                    <?php echo $item['content']; ?>
                                    <input type="radio" name="pomp" value="<?php echo $item['id']; ?>" id="pomp-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>" />
                                    <label class="pomp text-center <?php if(!empty($userdata['options'][$item['categories_id']]) and $userdata['options'][$item['categories_id']] == $item['id']):?>active<?php endif;?>" data-id="<?php echo $item['id']; ?>" for="pomp-<?php echo Awf_String::from($item['name'])->cleanForUrl(); ?>">deze wil ik</label>
                                </div>
                            </div>
                        </div>
                        <?php
                            endforeach;
                        endif;
                        ?>
                    </div>
                    <p><a href="#" target="_blank">Weet u niet welke u moet kiezen? Gebruik dan onze helper.</a></p>
                </div>
                <div class="form-group startlocatie">
                    <label class="col-xs-12 col-lg-7">Hoeveel meter is het vanaf betonpomp naar startlocatie?</label>
                    <div class="col-xs-12 col-lg-5">
                        <select name="aantal_meter" class="form-control meter_startlocatie">
                            <option value="0" disabled>Aantal meter</option>
                            <option value="5">5 m</option>
                            <option value="10">10 m</option>
                            <option value="15">15 m</option>
                            <option value="20">20 m</option>
                            <option value="25"> 25 m</option>
                        </select>
                    </div>
                </div>
                <hr />
                <div class="form-group">
                    <div class="col-xs-12">
                        <input type="submit" name="submit_quote" value="VRAAG OFFERTE AAN" /> <a href="#">> OF BESTEL DIRECT</a>
                    </div>
                </div>
            </div>
            <?php if($currentstep == 3): ?>
            <div class="step3">
                <h2>Offerte aanvraag</h2>
                <p>
                    Bedankt voor uw offerte aanvraag. Wij nemen zo spoedig mogelijk contact met u op.
                </p>
            </div>
            <?php endif; ?>
        </div>
        <div class="col-xs-12 col-md-4">
            <?php if(!empty($userdata['aantal_m']) and !empty($userdata['postalcode'])): ?>
            <div class="quote-block">
                <h2><img src="<?php echo Awf_Functions::createUrl('cmsPublic/themes/betonstorten/images/icon-euro.png'); ?>" alt="Euro" />Uw aanvraag</h2>
                <?php if(!empty($userdata['callfee'])): ?>
                <div class="row">
                    <div class="col-xs-6 col-md-8">
                        <?php echo $userdata['postalcode']; ?> <?php if(!empty($userdata['city'])): echo '- '.$userdata['city']; endif; ?>
                    </div>
                    <div class="col-xs-6 col-md-4">
                        <?php echo $userdata['callfee']; ?>
                    </div>
                </div>
                <?php endif; ?>
                <div class="row">
                    <div class="col-xs-6 col-md-8">
                        <?php echo $userdata['aantal_m']; ?> m<sup>2</sup>
                    </div>
                    <div class="col-xs-6 col-md-4">
                        <?php echo $userdata['concretePrice']; ?>
                    </div>
                </div>
                <hr />
                <div class="options">
                    <?php if(!empty($userdata['optionshtml'])): echo $userdata['optionshtml']; endif; ?>
                </div>
                <?php if(!empty($userdata['subtotal'])): ?>
                <hr />
                <div class="row">
                    <div class="col-xs-6 col-md-8">
                        <strong>Subtotaal</strong>
                    </div>
                    <div class="col-xs-6 col-md-4">
                        <span class="subtotal"><?php echo $userdata['subtotal']; ?></span>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6 col-md-8">
                        BTW 21%
                    </div>
                    <div class="col-xs-6 col-md-4">
                        <span class="vat"><?php echo $userdata['vat']; ?></span>
                    </div>
                </div>
                <?php endif; ?>
                <?php if(!empty($userdata['total'])): ?>
                <hr />
                <div class="row">
                    <div class="col-xs-6 col-md-8">
                        <strong>Totaal</strong>
                    </div>
                    <div class="col-xs-6 col-md-4">
                        <strong class="totalprice"><?php echo $userdata['total']; ?></strong>
                    </div>

                </div>
                <?php endif; ?>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>

Aucun commentaire:

Enregistrer un commentaire