Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What code print price in "shopping cart"


david_w

Recommended Posts

Hello,

 

Has anybody worked on the code that prints the price in the "shopping cart" area? This "shopping cart"

is a small window located at the upper right corner.

 

I think this code is in the "shopping_cart.php", but I just can not find it.

 

Any suggestions are highly appreciated!

Link to comment
Share on other sites

I thoroughly checked catalog/shopping_cart.php but I could not find it. Therefore I think it must be in somewhere else.

 

That "shopping cart" is always there when the webpage transfers from catalog/index.php -> catalog/product_info.php -> catalog/shopping_cart.php -> checkout_payment.php and -> checkout_confirmation.php.

 

Any more ideas where I can find the code of the "shopping cart?"

Link to comment
Share on other sites

Hi Vger,

 

Yes, you are right. It is includes/boxes/shipping_cart.php.

 

Many thanks! and thanks to Enigma 1 and Lewis!

 

includes/boxes/shipping_cart.php, but if you just want to change the name of the Shopping Cart then that's in includes/languages/english.php

 

Vger

Link to comment
Share on other sites

HI Vger,

 

Actually I am trying to find why the price in the "shopping cart" area can not be updated automatically after two items have been put into the shopping cart. In this case the price shown here is not correct.

 

I found that the price would get updated if I change to another webpage.

 

I replaced the "$info_box_contents[] = array('align' => 'right',

'text' => $currencies->format($cart->show_total()));" in inclues/boxes/shipping_cart.php with my own code, but the problem is still the same as before.

 

 

Do you have any idea how to fix this?

 

 

 

Hi Vger,

 

Yes, you are right. It is includes/boxes/shipping_cart.php.

 

Many thanks! and thanks to Enigma 1 and Lewis!

Link to comment
Share on other sites

Hi Enigma 1,

 

Thanks for your reply.

 

Probably I did not say it clearly.

 

At present both my code and the original code all calculate the prices correctly, but the problem is that the price can not be shown in time.

 

My code traverses all the products with a for-loop, and call the display_price(...) in includes/classes/currencies and get the sum of each price.

 

For the first 2 items that I put into the shopping cart, the price can be updated in time. Starting from the 3rd item, the price can not be updated unless I change the Webpage.

 

What puzzles me is why for the first 2 itmes the price gets updated instantly and for more items it can not.

 

 

 

the code flow goes through the show_total()->calculate() So you should see the total value of all items+tax

Link to comment
Share on other sites

well at least the default code should worked as it parses the cart contents before displaying so once you click the add to cart it switches to the shopping cart page where all items should be present and the total value, tax, shipping.

 

At the same time the cart box should be updated and display all items with the total ex-tax. So whether you have 1 or more items shouldnt matter. Is there a difference if you're loged in as a customer or not?

Link to comment
Share on other sites

Hi Enigma 1,

 

Thanks again for your reply. I do appreciate your time.

 

I have fixed that problem. I needed to initialize a variable to be 0. That's it.

 

Now another problem comes. When the Webpage transfers from catalog/checkout_payment.php to catalog/checkout_confirmation.php, the system calls the "shopping cart" module again and the price gets doubled.

 

Is there a way to handle this?

 

 

 

well at least the default code should worked as it parses the cart contents before displaying so once you click the add to cart it switches to the shopping cart page where all items should be present and the total value, tax, shipping.

 

At the same time the cart box should be updated and display all items with the total ex-tax. So whether you have 1 or more items shouldnt matter. Is there a difference if you're loged in as a customer or not?

Link to comment
Share on other sites

look in catalog\includes\classes\order.php near the end of function cart() its this:

        $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;
       $products_tax = $this->products[$index]['tax'];

 

there is the subtotal adjustment with the shown price. The subtotal field should be initialized at the beginning of the function. ('subtotal' => 0) but if you made customizations I dont know the total is also adjusted with tax and shipping at the end of the cart()

 

And check the order class where its instantiated with the customizations you have.

 

or alternatively you could leave it as is :lol: doubles your profit :D

Link to comment
Share on other sites

Think about it...I got my profit doubled! j :D

 

I fixed that problem by moving the price-calculation module to currencies.php. Everything is ok now.

 

Thanks for your replies! Highly appreciated!

 

 

 

look in catalog\includes\classes\order.php near the end of function cart() its this:

        $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;
       $products_tax = $this->products[$index]['tax'];

 

there is the subtotal adjustment with the shown price. The subtotal field should be initialized at the beginning of the function. ('subtotal' => 0) but if you made customizations I dont know the total is also adjusted with tax and shipping at the end of the cart()

 

And check the order class where its instantiated with the customizations you have.

 

or alternatively you could leave it as is  :lol: doubles your profit  :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...