Post by thegeekz » Wed Oct 24, 2012 10:37 am

enigma1 wrote:See my previous post about the sub-total and checkout/manual, the sub-total code will take the cart prices and then it will be added to the total excluding tax. So in this case you need to pass an argument perhaps with the url, so when the order sub-total is calculated via the admin back end to return the prices of products from the cart with or without the tax depending on the circumstances. And there is no provision for this in the code. The same part of code checkout/manual is used in the catalog end.
Checkout/manual?

I still have problems trying to avoid the Item U. Price and the Item Total gets $7 addition after Pressing Save...

Few clarifications regarding your 1st set :

admin/controller/sale/order.php you could change the code so it display the products total inc tax:


-- what does this do? Make sub-total = 0? but why need to do that?

Find in the admin/controller/sale/order.php:

Code: Select all

Code: Select all

    foreach ($order_products as $order_product) {
Right above it add:

Code: Select all

    $sub_total_with_tax = 0;



1st Set :
-----------------------------------------------------------------------

Instead of this ---

Find this :

Code: Select all

    $this->data['order_products'][] = array(
Right above it add:

Code: Select all

                $total_item_taxed = number_format($order_product['total'] + ($this->config->get('config_tax') ? ($order_product['tax'] * $order_product['quantity']) : 0), 4);
                $sub_total_with_tax += $total_item_taxed;



Backend : Order total tab -- > Item Unit price incl tax / Item Total price incl tax -- change :

Code: Select all

'price'            => $order_product['price'],
'total'            => $order_product['total'],
to:

Code: Select all

'price'            => $total_item_taxed,
'total'             => $total_item_taxed
--------------------------------------------------------------------------

-- change it this way instead :

Replace this:

Code: Select all

'price'            => $order_product['price'],
'total'            => $order_product['total']

With:

Code: Select all

'price'            => $this->currency->format($order_product['price'] + ($this->config->get('config_tax') ? $order_product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
'total'             => $this->currency->format($order_product['total'] + ($this->config->get('config_tax') ? ($order_product['tax'] * $order_product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value'])


--------------------------------------------------------------
What does the following section do?

Find this code:

Code: Select all

    $this->template = 'sale/order_form.tpl';
Right above it add:

Code: Select all

            for( $i=0, $j=count($this->data['order_totals']); $i<$j; $i++) {
              if( $this->data['order_totals'][$i]['code'] == 'sub_total' ) {
                $this->data['order_totals'][$i]['value'] = number_format($sub_total_with_tax,4);
                $this->data['order_totals'][$i]['text'] = $this->currency->format($sub_total_with_tax, $order_info['currency_code'], $order_info['currency_value']);
                break;
              }
            }
------------------------------------------------

When you press the update totals button the catalog/controller/checkout/manual.php is invoked so you would have to change the code there too.

For the products it was relatively simple to change the json array as this in an ajax call so

Find this code

Code: Select all

    $json['order_product'][] = array(
Right above it add:

Code: Select all

          if (isset($this->request->post['order_product'])) {                        
                        $product_total_price = number_format( $product['total'] + ($this->config->get('config_tax') ? ($this->tax->getTax($product['price'], $product['tax_class_id']) * $product['quantity']) : 0), 4);
                    } else {
                       $product_total_price = $product['total'];
                    }
Then change the json array so it reads:

Code: Select all

                   $json['order_product'][] = array(
                      'product_id' => $product['product_id'],
                      'name'       => $product['name'],
                      'model'      => $product['model'],
                      'option'     => $option_data,
                      'download'   => $download_data,
                      'quantity'   => $product['quantity'],
                      'price'      => $product['price'],   
                            'total'      => $product_total_price,
                      'tax'        => $this->tax->getTax($product['price'], $product['tax_class_id']),
                      'reward'     => $product['reward']            
                   );

--- With the above code intact, When I pressed the update totals, it became :

Unit Price : $100 || Total : $107

Subtotal : $ 100

So it became another problem again!

Edit : Managed to make the Unit Price and the Total same after adjusting the code in the vqmod for catalog/controller/checkout/manual.php

Below is after Pressing update totals:

[attachment=0]Image - 5.jpg[/attachment]

But am unable to define Subtotals with tax, how can I do that?


Saving the above doesn't help in removing the additional tax $7, so other places still -- Item U. Price & Item Total : $114

Attachments

Image - 5.jpg

Image - 5.jpg (42.61 KiB) Viewed 593 times


No more using Apsona, as they are not updated.

  • Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC


Active Member

Posts

Joined
Tue Nov 02, 2010 10:24 am
Who is online

Users browsing this forum: No registered users and 16 guests