Skip to content

Commit

Permalink
fix: bugfixes from regression test (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen authored Jun 7, 2024
1 parent 8edf722 commit 4440bf4
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 370 deletions.
2 changes: 1 addition & 1 deletion install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link>https://www.myparcel.nl/</link>

<!-- checked with compatible with Opencart 1x-->
<!-- yes is compatible, no is no compatible -->
<!-- yes is compatible, no is not compatible -->
<!-- ****************** ORDER_LIST.TWIG ******************* -->
<!-- ***************************************************** -->
<file path="admin/view/template/sale/order_list.twig"><!-- checked -->
Expand Down
11 changes: 11 additions & 0 deletions upload/admin/controller/extension/shipping/myparcel_shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public function index() {
$data['shipping_myparcel_shipping_cost'] = $this->config->get('shipping_myparcel_shipping_cost');
}

if (isset($this->request->post['shipping_myparcel_shipping_tax_class_id'])) {
$data['shipping_myparcel_shipping_tax_class_id'] = $this->request->post['shipping_myparcel_shipping_tax_class_id'];
} else {
$data['shipping_myparcel_shipping_tax_class_id'] = $this->config->get('shipping_myparcel_shipping_tax_class_id');
}

$this->load->model('localisation/tax_class');

$data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();

if (isset($this->request->post['shipping_myparcel_shipping_status'])) {
$data['shipping_myparcel_shipping_status'] = $this->request->post['shipping_myparcel_shipping_status'];
} else {
Expand Down Expand Up @@ -115,6 +125,7 @@ function install()
$this->model_setting_setting->editSetting('shipping_myparcel_shipping', array(
'shipping_myparcel_shipping_title' => 'Shipping & Handling',
'shipping_myparcel_shipping_cost' => 0,
'shipping_myparcel_shipping_tax_class_id' => 0,
'shipping_myparcel_shipping_status' => 1,
'shipping_myparcel_shipping_sort_order' => 0
));
Expand Down
1 change: 0 additions & 1 deletion upload/admin/controller/extension/total/myparcel_total.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function index()
} else {
$this->response->setOutput($this->load->view(MyParcel()->getTotalPath() . 'myparcel_total.tpl', $data));
}

}

function validate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@
<input type="text" name="shipping_myparcel_shipping_cost" value="{{ shipping_myparcel_shipping_cost }}" placeholder="{{ entry_cost }}" id="input-cost" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-tax-class">{{ entry_tax_class }}</label>
<div class="col-sm-10">
<select name="shipping_myparcel_shipping_tax_class_id" id="input-tax-class" class="form-control">
<option value="0">{{ text_none }}</option>
{% for tax_class in tax_classes %}
{% if tax_class.tax_class_id == shipping_myparcel_shipping_tax_class_id %}
<option value="{{ tax_class.tax_class_id }}" selected="selected">{{ tax_class.title }}</option>
{% else %}
<option value="{{ tax_class.tax_class_id }}">{{ tax_class.title }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
<div class="col-sm-10">
Expand Down
17 changes: 9 additions & 8 deletions upload/catalog/model/extension/shipping/myparcel_shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
class ModelExtensionShippingMyparcelShipping extends Model {
function getQuote($address) {

$checkout_settings = $this->config->get('module_myparcelnl_fields_checkout');
$status_config = $this->config->get('shipping_myparcel_shipping_status');
$status = !empty($status_config) ? true : false;
$belgium_enabled = !empty($checkout_settings['belgium_enabled']) ? true : false;
$country_iso_code = isset($address['iso_code_2']) ? $address['iso_code_2'] : null;
$checkout_settings = $this->config->get('module_myparcelnl_fields_checkout');
$status_config = $this->config->get('shipping_myparcel_shipping_status');
$status = !empty($status_config);
$belgium_enabled = !empty($checkout_settings['belgium_enabled']);
$country_iso_code = $address['iso_code_2'] ?? null;

$method_data = array();

Expand All @@ -29,7 +29,7 @@ function getQuote($address) {

$checkout_helper = MyParcel()->shipment->checkout;
$checkout_helper->setSessionOrderDeliveryOptions($this->session->data['myparcel_order_id']);
$data = isset($this->session->data['myparcel']) ? $this->session->data['myparcel'] : false;
$data = $this->session->data['myparcel'] ?? false;

if ($data) {
$total_array = $checkout_helper->getTotalArray($data);
Expand All @@ -40,13 +40,14 @@ function getQuote($address) {
}

$quote_data = array();
$total_price += $this->config->get('shipping_myparcel_shipping_cost');

$quote_data['myparcel_shipping'] = array(
'code' => 'myparcel_shipping.myparcel_shipping',
'title' => $this->config->get('shipping_myparcel_shipping_title'),
'cost' => $total_price,
'tax_class_id' => '',
'text' => $this->currency->format($this->tax->calculate($total_price, '', ''), $this->session->data['currency'])
'tax_class_id' => $this->config->get('shipping_myparcel_shipping_tax_class_id'),
'text' => $this->currency->format($this->tax->calculate($total_price, $this->config->get('shipping_myparcel_shipping_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'])
);

$method_data = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function filterEUOrders( $order_ids )
function isEUCountry($country_code)
{
// $eu_countries = array( 'GB', 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'EL', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE' );
$eu_countries = array( 'NL', 'BE', 'AT','BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'XK' );
$eu_countries = array( 'NL', 'BE', 'AT', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'XK' );
return in_array( $country_code, $eu_countries);
}

Expand Down Expand Up @@ -737,7 +737,6 @@ function set_module_text($language)
$data['entry_tab_3_title_shipment_processing_parameters'] = $language->get('entry_tab_3_title_shipment_processing_parameters');
$data['entry_tab_3_label_dropoff_days'] = $language->get('entry_tab_3_label_dropoff_days');
$data['entry_tab_3_label_cut_off_time'] = $language->get('entry_tab_3_label_cut_off_time');
$data['entry_tab_3_label_cut_off_time'] = $language->get('entry_tab_3_label_cut_off_time');
$data['entry_tab_3_label_dropoff_delay'] = $language->get('entry_tab_3_label_dropoff_delay');
$data['entry_tab_3_label_delivery_days_window'] = $language->get('entry_tab_3_label_delivery_days_window');
$data['entry_tab_3_label_additional_fee'] = $language->get('entry_tab_3_label_additional_fee');
Expand Down
Loading

0 comments on commit 4440bf4

Please sign in to comment.