Post by wurzelsepp » Tue Feb 10, 2015 8:15 pm

hi,
if the quantity of a product in front-end is changed, the total price is calculated,
could anybody give me a hint in what file this calculation is done?
regards Wolfgang

Newbie

Posts

Joined
Mon Dec 15, 2014 5:44 pm

Post by MarketInSG » Wed Feb 11, 2015 4:59 pm

You can use this: http://www.opencart.com/index.php?route ... n_id=20150

It isn't something simple that can be done by modifying one single file. You need to take into account for various factors such as taxes, currencies etc. So best to get an extension that just does that.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by wurzelsepp » Wed Feb 11, 2015 9:11 pm

thanks for your reply,
but the extension is not doing what i want to do!

short explanation of what i want to do:

if i change the quantity of a product on the productpage in the frontend, the total price is calculated,
there i would like to do a modification, if the quantity is from 1 to 10 the total should be +10%, if the
quantity is from 11 to 100 pieces the total should be as it is, and above 100 pieces the total should be -10%

therefore i need to know where the price*quantity is calculated to add the mentioned calculation there!

this can't be done in the adminarea because the basic price of the product is 0,- and the ral price is calculated on some options.

any ideas to that?

regards

Newbie

Posts

Joined
Mon Dec 15, 2014 5:44 pm

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by wurzelsepp » Wed Feb 11, 2015 10:11 pm

thanks,
that helped a little bit!

now the price and total in cart is ok, as expected!

BUT the price displayed is wrong, it seems that this cart.php is only called once when starting with
quantity=1, when quantity is changed in the frontend the display only calculates with the price of one
piece, but when i press "add to cart" the price is calculated right!

i added some:

Code: Select all

if ( $quantity < 10 ) {
	$add_scale = 1.1;
} else {
        $add_scale = 0.9;
}
and than:

Code: Select all

	'price'                     => ($price + $option_price) * $add_scale,
		'total'                     => ($price + $option_price) * $quantity * $add_scale,
into the cart.php

have you got any ideas what could be wrong there???

regards

Newbie

Posts

Joined
Mon Dec 15, 2014 5:44 pm

Post by MarketInSG » Wed Feb 11, 2015 10:50 pm

cart.php is only for items in cart. For the rest, look within the individual controller files for calculations.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore
Who is online

Users browsing this forum: Baidu [Spider] and 3 guests