Post by sengot » Thu Sep 13, 2018 7:05 pm

I've recently installed OpenCart 3.0.2.0
When I tried to create order from admin panel, any discount rules added in product section does not take effect:
Image

But if I order from storefront, it does work:
Image

Any idea? It works on OpenCart 2.x
Thanks in advance!

Newbie

Posts

Joined
Wed Mar 28, 2018 11:38 am

Post by straightlight » Fri Sep 14, 2018 6:07 am

More information is needed based on extensions or discounts being used from the core. Step-by-step procedures required in order to reproduce the issue (especially if addressing the issue as part of the core).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Fri Sep 14, 2018 5:06 pm

Just login as the customer you want (can be done from the admin area) and place the order on the front-end.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by dejohnson21 » Sat Jan 05, 2019 1:04 am

I am having exactly the same issue with the same OC version.
Of course an easy work around is placing the order from the store front, but this is not a solution.
If somebody has a fix for this please provide this or indicate how we can submit a bug report.
thank you,

Newbie

Posts

Joined
Wed Sep 05, 2018 9:00 pm

Post by ADD Creative » Sat Jan 05, 2019 1:16 am

I think the issue may have been reported here.
https://github.com/opencart/opencart/issues/7124

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by davecook80 » Wed Oct 23, 2019 7:13 am

I think we have found the problem what is happening is in admin settings if the display setting for showing customer group registration is unticked this issue happens, see attached.

Not sure why in recent versions this is the case as this check box is only supposed to not display the customer group on registration and shouldn't have any interference with customer group pricing. However once ticked customer group pricing is restored to admin :-\

Does anyone have a fix for this problem as this is an issue if we need to offer better customer groups for certain customers and not want other customers to see that they're not on the best customer group prices?

Attachments

Screenshot_20191021-194556.png

Screenshot_20191021-194556.png (1.19 MiB) Viewed 3910 times


User avatar
New member

Posts

Joined
Fri Nov 01, 2013 3:25 am
Location - Australia

Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by davecook80 » Fri Oct 25, 2019 7:19 am

:) This worked
Thanks ADD Creative for the link

Go to
catalog/controller/api/customer.php

Replace all with

Code: Select all

<?php
class ControllerApiCustomer extends Controller {
	public function index() {
		$this->load->language('api/customer');
		// Delete past customer in case there is an error
		unset($this->session->data['customer']);
		$json = array();
		if (!isset($this->session->data['api_id'])) {
			$json['error']['warning'] = $this->language->get('error_permission');
		} else {
			// Add keys for missing post vars
			$keys = array(
				'customer_id',
				'customer_group_id',
				'firstname',
				'lastname',
				'email',
				'telephone',
			);
			foreach ($keys as $key) {
				if (!isset($this->request->post[$key])) {
					$this->request->post[$key] = '';
				}
			}
			// Customer
			if ($this->request->post['customer_id']) {
				$this->load->model('account/customer');
				$customer_info = $this->model_account_customer->getCustomer($this->request->post['customer_id']);
				if (!$customer_info || !$this->customer->login($customer_info['email'], '', true)) {
					$json['error']['warning'] = $this->language->get('error_customer');
				}
			}
			if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
				$json['error']['firstname'] = $this->language->get('error_firstname');
			}
			if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
				$json['error']['lastname'] = $this->language->get('error_lastname');
			}
			if ((utf8_strlen($this->request->post['email']) > 96) || (!filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL))) {
				$json['error']['email'] = $this->language->get('error_email');
			}
			if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
				$json['error']['telephone'] = $this->language->get('error_telephone');
			}
			// Customer Group
			if (is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) {
			if (!empty($this->request->post['customer_group_id'])) {
				$customer_group_id = $this->request->post['customer_group_id'];
			} else {
				$customer_group_id = $this->config->get('config_customer_group_id');
			}
			// Custom field validation
			$this->load->model('account/custom_field');
			$custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id);
			foreach ($custom_fields as $custom_field) {
				if ($custom_field['location'] == 'account') {
					if ($custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['custom_field_id']])) {
						$json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/' . html_entity_decode($custom_field['validation'], ENT_QUOTES, 'UTF-8') . '/')))) {
						$json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					}
				}
			}
			if (!$json) {
				$this->session->data['customer'] = array(
					'customer_id'       => $this->request->post['customer_id'],
					'customer_group_id' => $customer_group_id,
					'firstname'         => $this->request->post['firstname'],
					'lastname'          => $this->request->post['lastname'],
					'email'             => $this->request->post['email'],
					'telephone'         => $this->request->post['telephone'],
					'custom_field'      => isset($this->request->post['custom_field']) ? $this->request->post['custom_field'] : array()
				);
				$json['success'] = $this->language->get('text_success');
			}
		}
		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
} 
}
Worked for me on Version 3.0.3.1 8)

User avatar
New member

Posts

Joined
Fri Nov 01, 2013 3:25 am
Location - Australia

Post by vehiclerhys » Fri Nov 22, 2024 1:15 am

will this work for Version 3.0.4.0?

Apply discount with orders made in admin ?

Newbie

Posts

Joined
Wed Sep 07, 2022 2:50 pm

Post by vehiclerhys » Fri Nov 22, 2024 1:23 am

Just tried and seem to work Ok,

does not change if you click EDIT on a existing order, but works Fine for new orders made in admin.


vehiclerhys wrote:
Fri Nov 22, 2024 1:15 am
will this work for Version 3.0.4.0?

Apply discount with orders made in admin ?

Newbie

Posts

Joined
Wed Sep 07, 2022 2:50 pm

Post by fogma » Wed Nov 27, 2024 7:27 am

This does seem to work on 3.0.4.0 and I can edit existing orders and apply customer group discounts.

Here is an OCMOD file.

Attachments


New member

Posts

Joined
Wed Aug 13, 2008 4:16 am
Who is online

Users browsing this forum: No registered users and 38 guests