Sales -> Orders -> Add New -> Select customer from the customer drop-down (it fills in the customer group correctly) -> Continue -> select product from the drop-down (it marks non-required options as required by the way, another little bug) -> Add Product
The product is now in the list at the top, but it has the default price, not the customer group price.
Can you fix the customer group price, please, as it is causing a bit of a nightmare when I am taking telephone orders.
The * against non-required options is a nuisance, but not a problem as it doesn't enforce the false requirement.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Open file catalog/controller/api/customer.php and change:
Code: Select all
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'))) {
Code: Select all
if (!empty($this->request->post['customer_group_id']))
daniGo wrote: ↑Wed Nov 11, 2020 4:08 amIt's not fixed, this bug is still present.
Open file catalog/controller/api/customer.php and change:
intoCode: Select all
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'))) {
Code: Select all
if (!empty($this->request->post['customer_group_id']))
Code: Select all
if (!empty($this->request->post['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display'))) {
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
If the admin has customer group and don't want to show in registration page list, then he can't place the manual order with prices for this customer group.
Which is why we need to check if the posted customer group ID on the browser has been validated.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
See for yourself: viewtopic.php?f=201&t=220859#p804767 .
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Either the admin must allow to show customer group in registration page (System > Settings > Edit Store > Options Tab > Select all customer groups to visible on registration page) or replace the provided code by daniGo in ../customer.php file
Thank you daniGo,
The right answer is the store lookup due to external APIs that can access customer groups data. By comparing with the store data, we can determine from which stores these customer groups belongs too as opposed to simply lookup at the customer group IDs without knowing from which stores they originate from.azzi-charbel wrote: ↑Fri Nov 20, 2020 8:28 pmdaniGo's answer is working as expected.
Either the admin must allow to show customer group in registration page (System > Settings > Edit Store > Options Tab > Select all customer groups to visible on registration page) or replace the provided code by daniGo in ../customer.php file
Thank you daniGo,
Perhaps the customer activity should be added there from the events in the mean time.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
It's rather the one specifically built-in the core out-of-the-box. If you believe it to be addressed as my own perspective, then you are simply greatly mistaking the ways Opencart is currently built originally.This is only your point of view, not the right answer.
As for customer groups, either allowed or not allowed, by simply validating the customer group IDs, not considering store lookups, it also means that you'd be willing to validate any customer groups regardless of the stores which also encourages external API users to use. In the end, it may even impact prices furthermore. Therfore, it all comes down to you as a store owner to handle.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Already explained on the above. The reason why you're re-asking, it's because you don't understand why this restriction needed to be there in the first place.daniGo wrote: ↑Sun Nov 22, 2020 3:43 pmThis store lookups for order edit was added in version 2.0.0.0. and I really don't understand why. In previous versions it was only for customer registration page. I understand why is needed in the customer registration page, for customer restriction, this way they can't select from all the customer groups you created. But why this restriction in the admin side.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
If there be the same restriction in the customer edit page and i can't select customer group which don't belong to the store where customer register, then this restriction could be reasonable.
But now I can assign any customer group to the customer . Later the customer places an order and I can't add or remove the product because the system changes prices every time due to the wrong customer group.
And when you edit the order there should be some error displayed not just change the prices.
Your side of view.
Then, that would rather be the right course of action; to notify store owners rather than removing the store's validation.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
// Customer Group
if (($this->customer->isLogged() && ($this->customer->getGroupId() == $this->request->post['customer_group_id'])) || (is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display')))) {
$customer_group_id = $this->request->post['customer_group_id'];
} else {
$json['error']['customer_group'] = $this->language->get('error_customer_group');
}
Now when you select a customer group the custom fields are displayed according to the group. But when you send the data to the api customer_group_id change because of the lookup and the custom field validation is wrong, because the wrong cutomer_group_id is used.
You could always submit a Pull Requests on Github Opencart repository to address the issue in the hopes to get this solution implemented in the master branch eventually.daniGo wrote: ↑Mon Nov 23, 2020 7:15 amIf you really think this restriction is needed then i think at least the code could change this way:
If the admin login like customer (using customer_id) use the default customer group other way do the store lookups. I also think that on the order editing page, customer groups should be filtered according to which store is chosen.Code: Select all
// Customer Group if (($this->customer->isLogged() && ($this->customer->getGroupId() == $this->request->post['customer_group_id'])) || (is_array($this->config->get('config_customer_group_display')) && in_array($this->request->post['customer_group_id'], $this->config->get('config_customer_group_display')))) { $customer_group_id = $this->request->post['customer_group_id']; } else { $json['error']['customer_group'] = $this->language->get('error_customer_group'); }
Now when you select a customer group the custom fields are displayed according to the group. But when you send the data to the api customer_group_id change because of the lookup and the custom field validation is wrong, because the wrong cutomer_group_id is used.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 74 guests