Jump to content
Latest News: (loading..)
jampjamp

$order->info['total'] gets only sub-total + shipping, without order total modules

Recommended Posts

As in title, I need that value for my external payments service, it has worked in MS 2.2 as

Quote

        $value= number_format($order->info['total']*$order->info['currency_value'], 2);

But now, as I can see, $order->info['total'] sends only a value of sub-total + shipping, without any order total module, so the value shown on checkout_confirmation is another than send by code above.

Share this post


Link to post
Share on other sites

Hi jampjamp,

normally there are order_total modules for payments which have an extra fee. e.g. ot_codfee.php.

Best regards

Christoph

Share this post


Link to post
Share on other sites

Thanks for your reply @beerbee

I know that. I mean, I need to get the final total value in the payment module, with some discounts, with some extra fees etc. It has worked in MS2.2 (by code shown above in quote), but it doesn't in bootstrap edition.

Edited by jampjamp

Share this post


Link to post
Share on other sites

sorry for my misunderstanding,  I have a payment module which wouldn't take raiwas discount code into account, I was lucky that the people from the company adapted it so now it works again, things had to be moved into function before_process() in that module, I really don't know if that is helpful, but maybe a clue?

Best regards

Christoph

Edited by beerbee

Share this post


Link to post
Share on other sites

Looks like it isn't a problem with clear osC, because I've tested it and it works right (don't know how, because if I would just echo $order->info['total'] it will show the value without extra modules, but in payment module it works as it should).

@raiwa Do you have any ideas? :(

Share this post


Link to post
Share on other sites

@jampjamp

If it works on a unmodified store, you'll have to search for the modification which breaks the code.

Go with patience step by step adding relevant modified files/modifications to the clear store installation to isolate the reason of the break.

I have no better advice not knowing what you modified.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@raiwa I've done some "step by step" backups, so it was actually easy to find out what's the cause of my problem. It's about QTPro.

It's all about one line of includes/modules/header_tags/ht_qtpro_stock_check.php. In function execute() there is a part with (starting at 61 line):

} elseif (basename($PHP_SELF) == 'checkout_confirmation.php') {
        
        require('includes/classes/order_qtpro.php');
        $order = new order_qtpro;

All I have to fix my problem is delete the line:

$order = new order_qtpro;

Then my payment service gets the correct value of order, with price changes made by order_total modules.

Luckily, it's your addon my friend :)

So my question to you is, how important is that part of code? I don't think I can just put that in trash, so maybe you have some idea how to exchange it?

Edited by jampjamp

Share this post


Link to post
Share on other sites

@jampjamp,

 

the importance of this is the stock substraction for qtpro stock controlled attributes.

It would be important to know if you modified the core order class: includes/classes/order.php, if yes, you should replicate your modifications into the order_qtpro.php class

Share this post


Link to post
Share on other sites

@raiwa thanks for your answer

I didn't, includes/classes/order.php is fully original (same bytes, also checked with notepad++'s "compare" plugin).

Do you have any ideas how to get around of it?

Share this post


Link to post
Share on other sites

for now you could try to merge the modifications made in the order_qtpro.php class  into the core order class and remove all instances of:

 require('includes/classes/order_qtpro.php');
        $order = new order_qtpro;

 

When I have a time I'll have a deeper look. Maybe it's because your payment service manipulates the core order class. Which was the exact payment service where it happens?

Share this post


Link to post
Share on other sites

@raiwa I tried to put that class from order_qtpro.php to order.php (before and after original class) and delete those two lines you've quoted, but it doesn't work then - stops to change the quantity of bought attribute.

But, if I just delete:

        $order = new order_qtpro;

It still works as it should (order goes thru and stock of attribute is changed). Are you sure I need to make that change?

Payment module is local polish service called dotpay, here is the original module file: https://pastebin.com/3zZCzAss

Share this post


Link to post
Share on other sites

I meant to combine (add the modifications) of the qtpro cart function to the core cart function, not to add.

I checked now and the only difference is this:

            $attributes_query = tep_db_query("select popt.products_options_name, popt.products_options_track_stock, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
            $attributes = tep_db_fetch_array($attributes_query);

            $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
                                                                     'value' => $attributes['products_options_values_name'],
                                                                     'option_id' => $option,
                                                                     'value_id' => $value,
                                                                     'prefix' => $attributes['price_prefix'],
                                                                     'price' => $attributes['options_values_price'],
                                                                     'track_stock' => $attributes['products_options_track_stock']);

"products_options_track_stock" is added to the $attributes_query and the array.

If you apply this modification to your core order class and remove the qtpro_order instance, all should work correct.

I remember now, this is only needed to restock the attribute stock if an order is deleted in admin, it is not needed for the order stock substraction of attributes, sorry.

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello Mick @jampjamp,

 

I did some check for the issue with the order_qtpro class and found that it is not needed to include it in the header tag module, just as you stated at the beginning. It is included in checkout_process.php via qtpro_hook and all works correct like this. And yes, it is needed for stock substraction in checkout.

So I uploaded a new version 5.5 where these lines are removed in ht_qtpro_stock_check.php and no additional modifications are needed in the core order class.

If you wish to give it a try.

rgds

Rainer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×