Skip to content

Commit

Permalink
Merge pull request #18 from Codaone/Branch-1.1.0
Browse files Browse the repository at this point in the history
Branch 1.1.0
  • Loading branch information
mikakoi authored May 5, 2017
2 parents 758fc0a + e9d452a commit b670a9f
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 193 deletions.
26 changes: 10 additions & 16 deletions includes/class-logitrail-shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,27 +194,21 @@ public function init_form_fields() {
* @return void
*/
public function calculate_shipping( $package = Array() ) {
global $woocommerce;

$shipping_methods = array('pickup' => 'Nouto', 'letter' => 'Kirje', 'home' => 'Ovelle');
$title = $this->settings['title'];
$unique_id = $woocommerce->session->get_customer_id();
if($title == '') {
$type = get_transient('logitrail_' . $unique_id . '_type');
$title = ($type && array_key_exists($type, $shipping_methods) ? $shipping_methods[$type] : 'Toimitustapaa ei ole valittu');
}
$shipping_methods = array('pickup' => 'Nouto', 'letter' => 'Kirje', 'home' => 'Ovelle');
$title = $this->settings['title'];
if($title == '') {
$type = WC()->session->get('type');
$title = ($type && array_key_exists($type, $shipping_methods) ? $shipping_methods[$type] : 'Toimitustapaa ei ole valittu');
}

$postage = get_transient('logitrail_' . $unique_id . '_price');
$postage = WC()->session->get('price');
$this->add_rate( array(
'id' => $this->id . '_postage',
'id' => $this->id . '_postage',
'label' => $title,
'cost' => $postage,
'cost' => $postage,
'sort' => 0
) );

$debug_mode = ($this->settings['debug_mode'] === 'yes' ? true : false);
if($debug_mode) {
Logitrail_WooCommerce::logitrail_debug_log('Informing WooCommerce postage as ' . $postage);
}
Logitrail_WooCommerce::logitrail_debug_log('Informing WooCommerce postage as ' . $postage);
}
}
Loading

0 comments on commit b670a9f

Please sign in to comment.