/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); //wp_enqueue_script('jquery-form'); $title = $instance['title']; $number_posts = $instance['number_posts'] ? $instance['number_posts'] : 5; echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $currency_sign = get_option('_wpmp_curr_sign', '$'); $shopping_cart = load_ajax_cart(); //$shopping_cart1=$shopping_cart); //print_r($shopping_cart1); if (count($cart_items) == 0) { $cart = __("No item in cart.", "wpmarketplace") . "<br/><a href='" . $settings['continue_shopping_url'] . "'>" . __("Continue shopping", "wpmarketplace") . "</a>"; } ?> <div id="mini_cart_widget" title="<?php __("Clicke here to view cart details", "wpmarketplace"); ?> "><b><?php echo $shopping_cart['items']; ?> items</b> ( Subtotal: <?php echo $currency_sign . wpmp_get_cart_subtotal(); ?> ) </div> <div id="mini_cart_details"><?php echo $shopping_cart['content']; ?> </div> <style type="text/css"> #mini_cart_widget{ padding: 5px; cursor: pointer; border:1px solid #ccc; border-radius:5px; padding: 5px; background: url('<?php echo plugins_url('wpmarketplace/images/cart.png'); ?> ') 8px center no-repeat; line-height: 36px; height: 36px; padding-left: 36px; } #mini_cart_details{ display: none; border:1px solid #ccc; border-radius:5px; margin: 10px 0; } .wpmp_cart_delete_item{ text-decoration: none; padding: 5px; color: #800000 !important; } </style> <script type="text/javascript"> jQuery('#mini_cart_widget').live("click",function(){ jQuery('#mini_cart_details').slideToggle(); }); </script> <?php echo $after_widget; }
$flat_rate = $flat_rate; //calculate flat rate tax } $ship_methods .= '<option rel="' . $flat_rate . '" value="' . $settings['flat_rate_title'] . '">' . $settings['flat_rate_title'] . " {$currency_sign}" . $flat_rate . '</option>'; } if ($settings['free_shipping_enabled'] == 1) { if (wpmp_get_cart_subtotal() >= $settings['free_shipping_min_amount']) { $ship_methods .= '<option rel="0" value="' . $settings['free_shipping_title'] . '">' . $settings['free_shipping_title'] . '</option>'; } } if ($settings['local-delivery_enabled'] == 1) { if ($settings['local-delivery_type'] != "free") { if ($settings['local-delivery_type'] == "fixed") { $delivery_fee = $settings['local-delivery_fee']; } else { $delivery_fee = wpmp_get_cart_subtotal() * ($settings['local-delivery_fee'] / 100); } } else { $delivery_fee = 0; } $ship_methods .= '<option rel="' . $delivery_fee . '" value="' . $settings['local-delivery_title'] . '">' . $settings['local-delivery_title'] . " {$currency_sign}" . $delivery_fee . '</option>'; } } else { $ship_methods .= '<option value="0">No shipping</option>'; } $ship_methods = apply_filters("wpmp_apply_shipping_method", $ship_methods); echo $ship_methods; ?> </select> <br> <input type="hidden" name="shipping_rate" value="0" id="shipping_rate" /> </div>
function wpmp_calculate_tax() { $cartsubtotal = wpmp_get_cart_subtotal(); $taxr = array(); $order = new Order(); $order_info = $order->GetOrder($_SESSION['orderid']); $bdata = unserialize($order_info->billing_shipping_data); $settings = maybe_unserialize(get_option('_wpmp_settings')); if ($settings['tax']['enable'] == 1) { if ($settings['tax']['tax_rate']) { foreach ($settings['tax']['tax_rate'] as $key => $rate) { if ($rate['country']) { foreach ($rate['country'] as $r_country) { if ($r_country == $bdata['shippingin']['country']) { $taxr['label'] = $rate['label']; $taxr['rate'] = $cartsubtotal * $rate['rate'] / 100; break; } } } } } } return $taxr; }