Hi again,
I want to make changes to the admin/currencies.php file.
without going into the reasons why (it will take too long to explain)
I have added a collumn to the currencies table and want to add some info into this from the admin/currencies.php page and also a modified currencies update module that I am creating.
I have looked round a bit and played with a few things, but I am assuming that if I want to make changes to this file I will need to make changes to the core code - from what I can tell there are no hooks here and I can not override this file...
am I correct in this assumption?
Making Changes to admin/currencies.php
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Making Changes to admin/currencies.php
Have a look at this line: https://github.com/CE-PhoenixCart/Phoen ... es.php#L15
And look at the link I have given previously - especially the hook in admin/manufacturers.php
That should give you something to work with
//Daniel
And look at the link I have given previously - especially the hook in admin/manufacturers.php
That should give you something to work with
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- burt
- Core Team
- Posts: 4561
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 413 times
Re: Making Changes to admin/currencies.php
No.
Have a read of;
viewtopic.php?p=13652#p13652
This software is very flexible. Obviously different admin page, but the idea is the same.
- Portman
- Contributor
- Posts: 158
- Joined: Mon Mar 08, 2021 1:04 am
- Phoenix Version: v1.0.8.20
- Has thanked: 29 times
- Been thanked: 4 times
Re: Making Changes to admin/currencies.php
Ok, obviously I am very thick... I am really struggling to get my head around hooks...
Could someone help me with a bit of a walk through if it not too much hassle...
In Admin Currencies, I have only changed a small section of code;
Line 73
from;
to;
I want the value in currencies->value to remain at 1 for all currencies so that there are no changes to the actual value of the product regardless of the currency the user is using (see Background info below for explination) - I assume this does not change here unless I edit it manually with the edit feature otherwise, I can control this with the new update currencies module I created.
How do I create a hook to do this and where do I save it?
I have also needed to make minor changes to the following files...
admin/includes/actions/currencies/save.php
admin/includes/actions/currencies/infoboxes/default.php
admin/includes/actions/currencies/infoboxes/edit.php
I assume I have to create override files for these rather than hooks, is that correct? I am also still not sure where I should save the override files for these.
I hope this is not too much to ask but I feel like if i get a walk through on something I am actually trying to change then it will help it sink in a lot more.
Your help is appreciated.
Background info: I have groups set up using wholesalePro by @raiwa and have forced currencies by group I want my international wholesale customers to purchase items in their own currency as a static price rather than based on what the AUD is doing ... the inv_value value will be used later on for sales reports . Also, if they want to pay via Credit card (vs paypal) then their purchase will need to be converted to AUD before it is put through and I intend for the inv_value to be used at this point too. Hope that makes sense.
Could someone help me with a bit of a walk through if it not too much hassle...
In Admin Currencies, I have only changed a small section of code;
Line 73
from;
Code: Select all
return number_format($row['value'], 8); Code: Select all
return number_format($row['inv_value'], 8); How do I create a hook to do this and where do I save it?
I have also needed to make minor changes to the following files...
admin/includes/actions/currencies/save.php
admin/includes/actions/currencies/infoboxes/default.php
admin/includes/actions/currencies/infoboxes/edit.php
I assume I have to create override files for these rather than hooks, is that correct? I am also still not sure where I should save the override files for these.
I hope this is not too much to ask but I feel like if i get a walk through on something I am actually trying to change then it will help it sink in a lot more.
Your help is appreciated.
Background info: I have groups set up using wholesalePro by @raiwa and have forced currencies by group I want my international wholesale customers to purchase items in their own currency as a static price rather than based on what the AUD is doing ... the inv_value value will be used later on for sales reports . Also, if they want to pay via Credit card (vs paypal) then their purchase will need to be converted to AUD before it is put through and I intend for the inv_value to be used at this point too. Hope that makes sense.
- burt
- Core Team
- Posts: 4561
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 413 times
Re: Making Changes to admin/currencies.php
I'll throw another few jigsaw pieces onto the floor...
All (admin side) actions run through this file; admin/includes/segments/process_action.php
This file has 3 Hook calls in it;
Therefore, all actions can utilise these three hooks.
It might be the case, that none of those hooks are useable for a shopowners needs, in which case, some hardcoding may be suitable, or replacement of files (there is no override in the admin area). I think in 95% (or more) of use cases, those three hooks are useable and useful.
The middle one [ $hook_action ] is a little more complicated as it is named depending on the action being used. For example, if you edit an existing currency, then press SAVE...the used action is called "saveAction", which would look like this in a hook;
All (admin side) actions run through this file; admin/includes/segments/process_action.php
This file has 3 Hook calls in it;
Code: Select all
L15: $admin_hooks->cat('preAction');
L20: $admin_hooks->cat($hook_action);
L27: $admin_hooks->cat('postAction'); It might be the case, that none of those hooks are useable for a shopowners needs, in which case, some hardcoding may be suitable, or replacement of files (there is no override in the admin area). I think in 95% (or more) of use cases, those three hooks are useable and useful.
The middle one [ $hook_action ] is a little more complicated as it is named depending on the action being used. For example, if you edit an existing currency, then press SAVE...the used action is called "saveAction", which would look like this in a hook;
Code: Select all
public function listen_saveAction() {
// logic
}- Portman
- Contributor
- Posts: 158
- Joined: Mon Mar 08, 2021 1:04 am
- Phoenix Version: v1.0.8.20
- Has thanked: 29 times
- Been thanked: 4 times
Re: Making Changes to admin/currencies.php
ok, thanks for your help everyone... I've had a bit of a play around with this with no luck... I will stick with the core code modifications for now and have another play around with it all once I have my site up and running and have more time on my hands.