Is it possible to add a payment method that only an OpenCart administrator can use when creating an order manually?
I want customers to have a PayPal option only, but allow administrators to have PayPal and Checks (for example).
Help is very much appreciated! Thanks
I want customers to have a PayPal option only, but allow administrators to have PayPal and Checks (for example).
Help is very much appreciated! Thanks
1. EDIT:
catalog/model/payment/<any-payment>.php
2. FIND:
3. REPLACE:
catalog/model/payment/<any-payment>.php
2. FIND:
Code: Select all
if ($status) {
Code: Select all
// Show only if logged in as admin
$this->load->library('user');
$this->user = new User($this->registry);
if (!$this->user->isLogged()) {
$status = false;
}
2.x versions use an API to get the data from the front, so you should be able to do it by checking for the api_id in the session data:
Code: Select all
IN:
/catalog/model/payment/FILENAME.php
AFTER:
public function getMethod($address, $total) {
ADD:
if (empty($this->session->data['api_id'])) return;
Sorry for resurrecting an old thread but I'm looking to do this also and I'm struggling a little with the 2.x instructions, can I get a little more detail on how to do this please?
I run a market stall alongside website sales, and would need to add two hidden methods, call them admin-card and admin-cash, for when I manually enter things.
I run a market stall alongside website sales, and would need to add two hidden methods, call them admin-card and admin-cash, for when I manually enter things.
Are you using OpenCart 2.3? The edit is exactly the same in OpenCart 2.3, but filepaths are different. The new filepath would be:
/catalog/model/extension/payment/FILENAME.php
If you actually need to install *new* payment methods, you'll probably need to find new ones in the marketplace, or hire someone to duplicate the extensions for you. It's something you need to have some coding knowledge for.
/catalog/model/extension/payment/FILENAME.php
If you actually need to install *new* payment methods, you'll probably need to find new ones in the marketplace, or hire someone to duplicate the extensions for you. It's something you need to have some coding knowledge for.
Couldn't I just edit/rename two existing payments that don't do anything, like say cash on collection and cheque or something like that.
I mean you say "just get the api id from session data", that just goes over my head, can you explain that?
And do we add your code to qphorias code or is qphorias edit not relevant?
I mean you say "just get the api id from session data", that just goes over my head, can you explain that?
And do we add your code to qphorias code or is qphorias edit not relevant?
Editing and / or renaming any extensions provided from the core could impact the store upon each upgrades rather than duplicating those modules.Benville wrote: ↑Fri Nov 24, 2017 12:12 amCouldn't I just edit/rename two existing payments that don't do anything, like say cash on collection and cheque or something like that.
I mean you say "just get the api id from session data", that just goes over my head, can you explain that?
And do we add your code to qphorias code or is qphorias edit not relevant?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
1. Yes, you can rename the titles of the payment methods if you want. Just don't edit the actual code of the payment method.
2. Qphoria's code is for OpenCart 1.5. Mine is for OpenCart 2 and 3.
3. You don't need to understand how my code works, if it's over your head. Just add it and that payment method should only appear for admin users.
2. Qphoria's code is for OpenCart 1.5. Mine is for OpenCart 2 and 3.
3. You don't need to understand how my code works, if it's over your head. Just add it and that payment method should only appear for admin users.
The API ID can only be obtained starting from Opencart v2.x releases and above originally from the core.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
You don't need to get the api_id. That's just the variable you're checking for in the code I suggested. Again, you don't need to know how it works, just make the edit exactly as I've described.
Hi Guys,
I'm tiring to hide one payment method from being selectable in admin orders entry "credit card online"(so only selectable from online store checkout)
Is there a similer way to do this on admin side?
Thanks heaps for reading my post and for any advice
I'm tiring to hide one payment method from being selectable in admin orders entry "credit card online"(so only selectable from online store checkout)
Is there a similer way to do this on admin side?
Thanks heaps for reading my post and for any advice
With v2.x releases and above, that is not necessary since it already requires an API access to apply those requests from the admin via the catalog. Restricting the api_id such as demonstrated by Johnathan above should do it for credit cards as needed.Is there a similer way to do this on admin side?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 123 guests