first commit
This commit is contained in:
66
templates/shop-basket/basket-transport-methods.php
Normal file
66
templates/shop-basket/basket-transport-methods.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?
|
||||
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' );?>
|
||||
<? if ( \S::get_session( 'basket-inpost-info' ) ):?>
|
||||
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'zmien' );?></a>
|
||||
<? else:?>
|
||||
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'wybierz' );?></a>
|
||||
<? endif;?>
|
||||
<? endif;?>
|
||||
</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>
|
||||
Reference in New Issue
Block a user