Files
shopPRO/templates/shop-basket/basket-transport-methods.php
2024-11-16 10:57:09 +01:00

73 lines
3.0 KiB
PHP

<?
if ( is_array( $this -> transports_methods ) )
{
$transport_found = false;
$default_transport_id = false;
foreach ( $this -> transports_methods as $transport_method )
{
if ( $transport_method['id'] == $this -> transport_id )
$transport_found = true;
if ( $transport_method['default'] )
$default_transport_id = $transport_method['id'];
}
if ( !$transport_found )
{
$this -> transport_id = $default_transport_id;
\S::set_session( 'basket-transport-method-id', $default_transport_id );
}
}
?>
<? if ( is_array( $this -> transports_methods ) ): foreach ( $this -> transports_methods as $transport_method ):?>
<div class="options">
<div class="check">
<input type="radio" class="icheck" name="transport_method" value="<?= $transport_method['id'];?>" <? if ( $transport_method['id'] == $this -> transport_id ):?>checked="checked"<? endif;?>>
</div>
<div class="description">
<div><?= $transport_method['name_visible'] != '' ? $transport_method['name_visible'] : $transport_method['name'];?></div>
<div class="small"><?= $transport_method['description'];?></div>
</div>
<div class="price">
<?= \S::decimal( $transport_method['cost'], 2 );?> zł
</div>
</div>
<? if ( $transport_method['id'] == 1 or $transport_method['id'] == 2 ):?>
<div class="inpost-info inpost-info-<?= $transport_method['id'];?>">
<? if ( $transport_method['id'] == $this -> transport_id ):?><?= \S::get_session( 'basket-inpost-info' );?>
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'wybierz' );?></a>
<? endif;?>
</div>
<? endif;?>
<? if ( $transport_method['id'] == 9 ):?>
<div class="orlen-info orlen-info-<?= $transport_method['id'];?>">
<input type="hidden" name="orlen_point_id" id="orlen_point_id" value="<?= \S::get_session( 'basket_orlen_point_id' );?>">
<?
if ( \S::get_session( 'basket-transport-method-id' ) != 9 )
$class = 'hidden';
?>
<span id="orlen_point_info" class="<?= $class;?>"><?= \S::get_session( 'basket_orlen_point_info' );?></span>
<a href="#" class="orlen-widget <?= $class;?>" data-target="#orlen_point_id" data-label="#orlen_point_info" data-type="all" data-layout="tabs" onclick="return false;"><?= \S::lang( 'wybierz' );?></a>
</div>
<? endif;?>
<? endforeach; endif;?>
<script class="footer" type="text/javascript">
$( function() {
<? if ( \S::get_session( 'basket-transport-method-id' ) ):?>
transport_checked( <?= \S::get_session( 'basket-transport-method-id' );?>, <?= \S::get_session( 'basket-payment-method-id' ) != '' ? \S::get_session( 'basket-payment-method-id' ) : 0;?>, false );
<? endif;?>
$( '#transport-methods .icheck' ).iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue'
});
$( '#transport-methods .icheck' ).on( 'ifChecked', function( event )
{
var transport_method_id = $( this ).val();
transport_checked( transport_method_id, 0, true );
});
});
</script>