php - Opencart Shipping Method Required -
i have created new shipping module based on post below
http://forum.opencart.com/viewtopic.php?f=142&t=30226
the shipping method checks members group user in, , if qualify free delivery based on cart price. works great, except when go checkout , select free shipping method comes error "warning: shipping method required!"
the model shipping below, can shed light on this?
<?php class modelshippingfreeusergroup extends model { function getquote($address) { $this->language->load('shipping/freeusergroup'); $customer_group_id = $this->customer->getcustomergroupid(); if ($customer_group_id < 1)$customer_group_id = 1; $cart_total = $this->cart->gettotal(); $strquery = "select * " . db_prefix . "members_delivery " . " price <= '" . $cart_total . "' , customer_group_id = '" . $customer_group_id . "' " . " limit 1"; $query = $this->db->query($strquery); //$shiparray = array(); $method_data = array(); if ($query->num_rows > 0) { foreach ($query->rows $result) { $quote_data['freeusergroup'] = array( 'code' => 'freeusergroup', 'title' => 'free delivery', 'cost' => 0.00, 'tax_class_id' => $this->config->get('weight_tax_class_id'),//0, 'text' => $this->currency->format(0.00) ); $method_data = array( 'code' => 'freeusergroup', 'title' => 'free delivery', 'quote' => $quote_data, 'sort_order' => $this->config->get('freeusergroup_sort_order'), 'error' => false ); } } return $method_data; } } ?>
i've managed fix it, didn't realize method data quote data required . in code, checking validate function on controller pointed me fact 'code' in quote data should 'freeusergroup.freeusergroup'
the first part of code taken method_data,
Comments
Post a Comment