Skip to content

Commit

Permalink
Merge pull request opencart#52 from 4pxs/dev-remove-option
Browse files Browse the repository at this point in the history
remove option
  • Loading branch information
4pxs committed Mar 25, 2017
2 parents 93eb260 + 5791046 commit f56430c
Show file tree
Hide file tree
Showing 53 changed files with 28 additions and 2,941 deletions.
407 changes: 0 additions & 407 deletions public/admin/controller/catalog/option.php

This file was deleted.

93 changes: 0 additions & 93 deletions public/admin/controller/catalog/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,60 +632,6 @@ protected function getForm() {
}
}

// Options
$this->load->model('catalog/option');

if (isset($this->request->post['product_option'])) {
$product_options = $this->request->post['product_option'];
} elseif (isset($this->request->get['product_id'])) {
$product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
} else {
$product_options = array();
}

$data['product_options'] = array();

foreach ($product_options as $product_option) {
$product_option_value_data = array();

if (isset($product_option['product_option_value'])) {
foreach ($product_option['product_option_value'] as $product_option_value) {
$product_option_value_data[] = array(
'product_option_value_id' => $product_option_value['product_option_value_id'],
'option_value_id' => $product_option_value['option_value_id'],
'quantity' => $product_option_value['quantity'],
'subtract' => $product_option_value['subtract'],
'price' => $product_option_value['price'],
'price_prefix' => $product_option_value['price_prefix'],
'points' => $product_option_value['points'],
'points_prefix' => $product_option_value['points_prefix'],
'weight' => $product_option_value['weight'],
'weight_prefix' => $product_option_value['weight_prefix']
);
}
}

$data['product_options'][] = array(
'product_option_id' => $product_option['product_option_id'],
'product_option_value' => $product_option_value_data,
'option_id' => $product_option['option_id'],
'name' => $product_option['name'],
'type' => $product_option['type'],
'value' => isset($product_option['value']) ? $product_option['value'] : '',
'required' => $product_option['required']
);
}

$data['option_values'] = array();

foreach ($data['product_options'] as $product_option) {
if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
if (!isset($data['option_values'][$product_option['option_id']])) {
$data['option_values'][$product_option['option_id']] = $this->model_catalog_option->getOptionValues($product_option['option_id']);
}
}
}

$this->load->model('customer/customer_group');

$data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
Expand Down Expand Up @@ -814,7 +760,6 @@ protected function getForm() {
$data['product_form_block_store'] = $this->load->view('catalog/product_form_block_store', $data);
$data['product_form_block_related'] = $this->load->view('catalog/product_form_block_related', $data);
$data['product_form_block_attribute'] = $this->load->view('catalog/product_form_block_attribute', $data);
$data['product_form_block_option'] = $this->load->view('catalog/product_form_block_option', $data);
$data['product_form_block_discount'] = $this->load->view('catalog/product_form_block_discount', $data);
$data['product_form_block_special'] = $this->load->view('catalog/product_form_block_special', $data);
$data['product_form_block_image'] = $this->load->view('catalog/product_form_block_image', $data);
Expand Down Expand Up @@ -889,7 +834,6 @@ public function autocomplete() {

if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model'])) {
$this->load->model('catalog/product');
$this->load->model('catalog/option');

$filter_name = $this->request->vget('filter_name', '');
$filter_model = $this->request->vget('filter_model', '');
Expand All @@ -905,47 +849,10 @@ public function autocomplete() {
$results = $this->model_catalog_product->getProducts($filter_data);

foreach ($results as $result) {
$option_data = array();

$product_options = $this->model_catalog_product->getProductOptions($result['product_id']);

foreach ($product_options as $product_option) {
$option_info = $this->model_catalog_option->getOption($product_option['option_id']);

if ($option_info) {
$product_option_value_data = array();

foreach ($product_option['product_option_value'] as $product_option_value) {
$option_value_info = $this->model_catalog_option->getOptionValue($product_option_value['option_value_id']);

if ($option_value_info) {
$product_option_value_data[] = array(
'product_option_value_id' => $product_option_value['product_option_value_id'],
'option_value_id' => $product_option_value['option_value_id'],
'name' => $option_value_info['name'],
'price' => (float)$product_option_value['price'] ? $this->currency->format($product_option_value['price'], $this->config->get('config_currency')) : false,
'price_prefix' => $product_option_value['price_prefix']
);
}
}

$option_data[] = array(
'product_option_id' => $product_option['product_option_id'],
'product_option_value' => $product_option_value_data,
'option_id' => $product_option['option_id'],
'name' => $option_info['name'],
'type' => $option_info['type'],
'value' => $product_option['value'],
'required' => $product_option['required']
);
}
}

$json[] = array(
'product_id' => $result['product_id'],
'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
'model' => $result['model'],
'option' => $option_data,
'price' => $result['price']
);
}
Expand Down
1 change: 0 additions & 1 deletion public/admin/controller/common/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function index() {
$data['manufacturer'] = $this->url->link('catalog/manufacturer', 'token=' . $this->session->data['token'], 'SSL');
$data['marketing'] = $this->url->link('marketing/marketing', 'token=' . $this->session->data['token'], 'SSL');
$data['module'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
$data['option'] = $this->url->link('catalog/option', 'token=' . $this->session->data['token'], 'SSL');
$data['order'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL');
$data['order_status'] = $this->url->link('localisation/order_status', 'token=' . $this->session->data['token'], 'SSL');
$data['payment'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');
Expand Down
91 changes: 1 addition & 90 deletions public/admin/controller/sale/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public function getForm() {
'product_id' => $product['product_id'],
'name' => $product['name'],
'model' => $product['model'],
'option' => $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']),
'quantity' => $product['quantity'],
'price' => $product['price'],
'total' => $product['total'],
Expand Down Expand Up @@ -598,37 +597,11 @@ public function info() {
$products = $this->model_sale_order->getOrderProducts($this->request->get['order_id']);

foreach ($products as $product) {
$option_data = array();

$options = $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);

foreach ($options as $option) {
if ($option['type'] != 'file') {
$option_data[] = array(
'name' => $option['name'],
'value' => $option['value'],
'type' => $option['type']
);
} else {
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);

if ($upload_info) {
$option_data[] = array(
'name' => $option['name'],
'value' => $upload_info['name'],
'type' => $option['type'],
'href' => $this->url->link('tool/upload/download', 'token=' . $this->session->data['token'] . '&code=' . $upload_info['code'], 'SSL')
);
}
}
}

$data['products'][] = array(
'order_product_id' => $product['order_product_id'],
'product_id' => $product['product_id'],
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']),
Expand Down Expand Up @@ -1183,33 +1156,9 @@ public function invoice() {
$products = $this->model_sale_order->getOrderProducts($order_id);

foreach ($products as $product) {
$option_data = array();

$options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);

foreach ($options as $option) {
if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);

if ($upload_info) {
$value = $upload_info['name'];
} else {
$value = '';
}
}

$option_data[] = array(
'name' => $option['name'],
'value' => $value
);
}

$product_data[] = array(
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value'])
Expand Down Expand Up @@ -1361,50 +1310,12 @@ public function shipping() {
$products = $this->model_sale_order->getOrderProducts($order_id);

foreach ($products as $product) {
$option_weight = '';

$product_info = $this->model_catalog_product->getProduct($product['product_id']);

if ($product_info) {
$option_data = array();

$options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);

foreach ($options as $option) {
$option_value_info = $this->model_catalog_product->getProductOptionValue($order_id, $product['order_product_id']);

if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);

if ($upload_info) {
$value = $upload_info['name'];
} else {
$value = '';
}
}

$option_data[] = array(
'name' => $option['name'],
'value' => $value
);

$product_option_value_info = $this->model_catalog_product->getProductOptionValue($product['product_id'], $option['product_option_value_id']);

if ($product_option_value_info) {
if ($product_option_value_info['weight_prefix'] == '+') {
$option_weight += $product_option_value_info['weight'];
} elseif ($product_option_value_info['weight_prefix'] == '-') {
$option_weight -= $product_option_value_info['weight'];
}
}
}

$product_data[] = array(
'name' => $product_info['name'],
'model' => $product_info['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'location' => $product_info['location'],
'sku' => $product_info['sku'],
Expand All @@ -1413,7 +1324,7 @@ public function shipping() {
'jan' => $product_info['jan'],
'isbn' => $product_info['isbn'],
'mpn' => $product_info['mpn'],
'weight' => $this->weight->format(($product_info['weight'] + $option_weight) * $product['quantity'], $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))
'weight' => $this->weight->format(($product_info['weight']) * $product['quantity'], $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))
);
}
}
Expand Down
40 changes: 0 additions & 40 deletions public/admin/language/english/catalog/option.php

This file was deleted.

5 changes: 0 additions & 5 deletions public/admin/language/english/catalog/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
$_['text_plus'] = '+';
$_['text_minus'] = '-';
$_['text_default'] = 'Default';
$_['text_option'] = 'Option';
$_['text_option_value'] = 'Option Value';
$_['text_percent'] = 'Percentage';
$_['text_amount'] = 'Fixed Amount';

Expand Down Expand Up @@ -49,7 +47,6 @@
$_['entry_price'] = 'Price';
$_['entry_tax_class'] = 'Tax Class';
$_['entry_points'] = 'Points';
$_['entry_option_points'] = 'Points';
$_['entry_subtract'] = 'Subtract Stock';
$_['entry_weight_class'] = 'Weight Class';
$_['entry_weight'] = 'Weight';
Expand All @@ -66,8 +63,6 @@
$_['entry_attribute'] = 'Attribute';
$_['entry_attribute_group'] = 'Attribute Group';
$_['entry_text'] = 'Text';
$_['entry_option'] = 'Option';
$_['entry_option_value'] = 'Option Value';
$_['entry_required'] = 'Required';
$_['entry_status'] = 'Status';
$_['entry_sort_order'] = 'Sort Order';
Expand Down
2 changes: 0 additions & 2 deletions public/admin/language/english/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
$_['button_custom_field_value_add'] = 'Add Custom Field';
$_['button_product_add'] = 'Add Product';
$_['button_filter_add'] = 'Add Filter';
$_['button_option_add'] = 'Add Option';
$_['button_option_value_add'] = 'Add Option Value';
$_['button_discount_add'] = 'Add Discount';
$_['button_special_add'] = 'Add Special';
$_['button_image_add'] = 'Add Image';
Expand Down
1 change: 0 additions & 1 deletion public/admin/language/english/common/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
$_['text_modification'] = 'Modifications';
$_['text_manufacturer'] = 'Manufacturers';
$_['text_module'] = 'Modules';
$_['text_option'] = 'Options';
$_['text_order'] = 'Orders';
$_['text_order_status'] = 'Order Statuses';
$_['text_payment'] = 'Payments';
Expand Down
2 changes: 0 additions & 2 deletions public/admin/language/english/sale/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
$_['text_edit'] = 'Edit Order';
$_['text_order_detail'] = 'Order Details';
$_['text_customer_detail'] = 'Customer Details';
$_['text_option'] = 'Options';
$_['text_store'] = 'Store';
$_['text_date_added'] = 'Date Added';
$_['text_payment_method'] = 'Payment Method';
Expand Down Expand Up @@ -91,7 +90,6 @@
$_['entry_zone'] = 'Region / State';
$_['entry_zone_code'] = 'Region / State Code';
$_['entry_product'] = 'Choose Product';
$_['entry_option'] = 'Choose Option(s)';
$_['entry_quantity'] = 'Quantity';
$_['entry_to_name'] = 'Recipient\'s Name';
$_['entry_to_email'] = 'Recipient\'s Email';
Expand Down
Loading

0 comments on commit f56430c

Please sign in to comment.