I think that calculation should be made in the controller php file rather than in the tpl one, and then passed to the tpl file with the following method :
Actually you can do this without modifying any standard code.
Make your contorller addons/my_changes/orders.post.php and then add in your “if($mode == 'details')”; Youll probably need to extract your order_info array and save it back by:
$order_info = $view->get_var('order_info);
then after you've updated the data structure put it back with
$view->assign('order_info', $order_info);
This will ensure your changes don't get clobbered in the next upgrade you do.
Actually you can do this without modifying any standard code.
Make your contorller addons/my_changes/orders.post.php and then add in your “if($mode == 'details')”; Youll probably need to extract your order_info array and save it back by:
$order_info = $view->get_var('order_info);
then after you've updated the data structure put it back with
$view->assign('order_info', $order_info);
This will ensure your changes don't get clobbered in the next upgrade you do.
@kemeris - I'd guess that when the invoice is printed that a redirect is being done before your controller is run. Hence, you might want to use a 'pre' controller versus a 'post' controller which should ensure that your controller is run BEFORE the standard controller for 'orders'.
@kemeris - I’d guess that when the invoice is printed that a redirect is being done before your controller is run. Hence, you might want to use a ‘pre’ controller versus a ‘post’ controller which should ensure that your controller is run BEFORE the standard controller for ‘orders’.
[/quote]
thanks for suggestion, but this does not work.
In this case I need to execute
$order_info = fn_get_order_info($_REQUEST['order_id']);
```<br />
in my "orders.pre.php" and remove this function call in "orders.php"<br />
In this case this is not hook based solution anymore <img src="upload://nMBtKsE7kuDHGvTX96IWpBt1rTb.gif" class="bbc_emoticon" alt=":-("><br />
<br />
I just looked at "fn_get_order_info" function located in fn.cart.php and found this statement:<br />
```php
fn_set_hook('get_order_info', $order, $additional_data);
```<br />
<br />
cs-cart docs describes this as "code hook" but there is no example how to use it and where to put my hook file.<br />
<br />
Can I make my calculations in this function's hook somehow?<br />
<br />
Thanks
Then add a function called fn_my_changes_get_order_info(&$order_info, &$added_info)
to your addons/my_changes/func.php file.
You can adjust the $order_info data to anything you want.
There's a whole tutorial on using PHP hooks in the developers section that I wrote quite a while ago. I think there are 6 or so separate threads. It should tell you everything you need to know about using PHP/code hooks.
There's a whole tutorial on using PHP hooks in the developers section that I wrote quite a while ago. I think there are 6 or so separate threads. It should tell you everything you need to know about using PHP/code hooks.
[/quote]
Thank you, just found your “PHP Controllers” posts, reading them right now. These are invaluable, really!