Why does the same variable <?php echo $product_price ? show different values on two different pages?

I have two layouts one here:
and one here

They are using different layouts to display content..

The thing is they both use
<?php echo $product_price ?>

to show the price

I can't figure out what makes the value different...in particular one layouts shows discounted price even if there is none, where as the other won't show the discounted price if there is none...I want to figure that out.

Can anyone helpl?
LVL 11
Amanda WatsonWeb DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You're probably going to have to post the php code for each page.
Amanda WatsonWeb DeveloperAuthor Commented:
ok, this is the one that doesn't show the ADD TO CART button, and the one that shows the discounted price ONLY if there is one
Amanda WatsonWeb DeveloperAuthor Commented:
These ones are for the main page that shows the add to cart, and both full price and discounted price no matter if there is one or not
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Amanda WatsonWeb DeveloperAuthor Commented:
This one may help too?

This is all virtuemart files too..does that help?
Andyc75Software ArchitectCommented:
Hey snowball77,

The product price is being calculated in one of your classes.

In browse.txt file, the $product_price variable gets set on this line:
$product_price=$prod->price;    //calculate and returns the price

A few lines above that you are looping through the products array in the $this object:
foreach ($this->products as $prod){

Each product has its own id and price, so when you are looping through each product ($prod) the $product_price gets set to the appropriate price, and your code just echos the value in $product_price.

The class is probably looking up the product info/price from your database.  To actually see how its calculated you would need to take a look at that product class code.

It looks like the price is determined by a combination of 3 things:
Product_ID, Category_ID, and Item_ID

Which item in particular were you looking at ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amanda WatsonWeb DeveloperAuthor Commented:
This thread explains where the product display comes from but Andy your explanation is beautiful, thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.