Skip to content

Commit

Permalink
Fixing redirects and fixing front-end of modal Delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Moraes committed Oct 24, 2018
1 parent 99605ad commit f43c815
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 30 deletions.
14 changes: 8 additions & 6 deletions app/config/wp/woo-custom-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

function woocommerce_custom_redirections() {
/* Case1: Non logged user on checkout page (cart empty or not empty) */
if ( !is_user_logged_in() && is_checkout() )
wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id') ) );
if ( !is_user_logged_in() && is_checkout() ) {
wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id') ).'?ischeckout=true' );
exit;
}

/* Case2: Logged user on my account page with something in cart */
// if( is_user_logged_in() && ! WC()->cart->is_empty() && is_account_page() )
// wp_redirect( get_permalink( get_option('woocommerce_checkout_page_id') ) );
$is_checkout = isset($_GET['ischeckout']) ?: false;
if( is_user_logged_in() && ! WC()->cart->is_empty() && is_account_page() && $is_checkout == true)
wp_redirect( get_permalink( get_option('woocommerce_checkout_page_id') ) );
}


Expand All @@ -21,5 +24,4 @@ function woocommerce_custom_redirections() {

function wdm_add_custom_order_line_item_meta($item, $cart_item_key, $values, $order) {
$item->add_meta_data('_many_test', 'test');
}

}
2 changes: 2 additions & 0 deletions resources/assets/sass/woocommerce/_common.sass
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ input[name='update_cart']
border: 1px solid rgba(0,0,0,.1)
margin-bottom: 50px
border-radius: 4px
.radio
display: inline

.woocommerce-form-register
.select
Expand Down
8 changes: 8 additions & 0 deletions resources/views/header/_head.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
<meta name="theme-color" content="#00695C">
<meta name="description" content="{{ site.description }}">

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PXF9BK9');</script>
<!-- End Google Tag Manager -->

<link rel="pingback" href="{{ site.pingback_url }}"/>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

Expand Down
6 changes: 6 additions & 0 deletions resources/views/header/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
{# </head> #}

<body class="{{ body_class }}">

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PXF9BK9"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

<div class="pageloader is-active"></div>

<div id="app">
Expand Down

Large diffs are not rendered by default.

File renamed without changes.
4 changes: 2 additions & 2 deletions static/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"app.css": "css/app.58656b497094aa9ab7d2.css",
"app.js": "js/app.4561faf781a28f41d1c4.js",
"app.css": "css/app.cd7fb5d4b77f1c552dab.css",
"app.js": "js/app.9a3d1a571d3ea42019d0.js",
"login.css": "css/login.1d74128b88bfc70aea2f.css",
"login.js": "js/login.9caa3fd3b4682e79cf02.js",
"admin.css": "css/admin.2013b7037ab119ed3b29.css",
Expand Down
30 changes: 9 additions & 21 deletions woocommerce/cart/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@

<button type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?></button>



<?php do_action( 'woocommerce_cart_actions' ); ?>

<?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
Expand All @@ -176,18 +174,11 @@


<div class="cart__delivery">
<?php _e('Custom Delivery', 'base-camp'); ?>?
<input type="radio" id="deliveryYes" class="is-checkradio" v-model="modalDelivery.delivery" v-on:click="openDeliveryModal()" value="yes">
<label for="deliveryYes" class="radio">Yes</label>
<label for="deliveryYes" class="radio"><?php _e('Delivery', 'base-camp'); ?></label>

<input type="radio" id="deliveryNo" class="is-checkradio" v-model="modalDelivery.delivery" v-on:click="closeDeliveryModal()" value="no">
<label for="deliveryNo" class="radio">No</label>

<?php /*
<div class="cart_delivery-details" v-if="modalDelivery.delivery == 'yes'">
<p v-if="modalDelivery.type" class="is-capitalized"><strong><?php _e('Location type', 'base-camp'); ?>:</strong> {{ modalDelivery.type }}</p>
</div>
*/ ?>
<label for="deliveryNo" class="radio"><?php _e('Pickup', 'base-camp'); ?></label>
</div>


Expand All @@ -211,7 +202,7 @@
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Custom Delivery </p>
<p class="modal-card-title">Delivery </p>
<button class="delete" aria-label="close" v-on:click="closeDeliveryModal()"></button>
</header>

Expand All @@ -224,9 +215,10 @@
<div class="select">
<select v-model="modalDelivery.type">
<option><?php _e('Select', 'base-camp'); ?></option>
<option value="hotel">Hotel</option>
<option value="hotel"><?php _e('Hotel', 'base-camp'); ?></option>
<!-- <option value="residence">Residence</option> -->
<option value="ship"><?php _e('Ship', 'base-camp'); ?></option>
<option value="residence"><?php _e('Residence', 'base-camp'); ?></option>
<!-- <option value="other">Other</option> -->
</select>
</div>
Expand All @@ -240,21 +232,17 @@
<div class="columns">
<div class="column">
<div class="field">
<label class="label">Arrival Date</label>
<div class="control">
<div class="field">
<label class="label">Arrival Date</label>
<datepicker :language="lang.br" input-class="input" :bootstrap-styling="true" v-model="modalDelivery.arrival_date"></datepicker>
</div>
<datepicker :language="lang.br" input-class="input" :bootstrap-styling="true" v-model="modalDelivery.arrival_date"></datepicker>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label">Departure Date</label>
<div class="control">
<div class="field">
<label class="label">Departure Date</label>
<datepicker :language="lang.br" input-class="input" v-model="modalDelivery.departure_date"></datepicker>
</div>
<datepicker :language="lang.br" input-class="input" v-model="modalDelivery.departure_date"></datepicker>
</div>
</div>
</div>
Expand Down

0 comments on commit f43c815

Please sign in to comment.