Jump to content

Adding price to variable


ziolo94

Recommended Posts

Hello,

I have special offer, if customer bought product of manufacturer (id=54) for a minimum 400 usd, then customer get the limited t-shirt.

I would to show the special box in summary cart, when customer spent 400 usd.

I added my short code in classes/Cart.php (getProducts() function), like this:


$promotion = 0;
            if($row['id_manufacturer'] == 54)
            {
                $promotion= $promotion+ $row['total_wt'];
            }
            $row['prom'] = $promotion;

It's works, but script save this to the array and displays this like this:

422.22 435.22 534.55 0

Where first three positions are products of manufacturer id=54 and the last position is product of other manufacturer.

I would like to sum this array, i tried to use array_sum, but it doesn't work.

 

Maybe i wrote this chaotic, so here is scheme how it should work

1. Check if manufacturer id == 54

2. If YES, add prodcuct price to $promotion variable.

3. In .TPL file check if $promotion >= 400

4. If YES, show special box

 

Link to comment
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
×
×
  • Create New...