close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

ProductPrice & Product MRP

Thread began 12/30/2014 1:42 pm by Kumel | Last modified 12/30/2014 5:18 pm by Ray Borduin | 418 views | 5 replies |

Kumel

ProductPrice & Product MRP

I got a Products table which contain many columns. Two of which are ProductPrice & ProductMRP
ProductPrice is selling price or discounted rate.
ProductMRP is actual product price.

Lets call a product as 'x'

x ProductPrice is 100 - selling price
x ProductMRP is 200

ProductPrice & ProductMRP are of type: float(12,2)

All products have ProductPrice & not necessarily ProductMRP. So ProductMRP data is stored as 'NULL'

So now if Product 'x' has ProductPrice as well as ProductMRP displays perfect.

But when Product 'y' has only ProductPrice and ProductMRP has no value which is as 'Null' how do we show only ProductPrice & not shown ProductMRP?

Regards

Sign in to reply to this post

Ray BorduinWebAssist

You can use a simple IF statement in php.

<?php if ($row_Recordset['ProductMRP']) { echo($row_Recordset['ProductMRP']); } ?>

or the shorthand version:
<?php echo($row_Recordset['ProductMRP']?$row_Recordset['ProductMRP']:""); } ?>

Sign in to reply to this post

Kumel

Well thats good.
But there's a problem here in my design layout.

Code is :
<li><a href="#">
<img src="images/small_product_list_08.jpg" alt="" />
<div class="product-list-desc">lol <i>$29.00<b>$19.00</b></i></div>
</a></li>

$29.00 is ProductMRP
$19.00 is ProductPrice

Screenshot attached.

When there's no ProductMRP then there's a slight change in code ie:
<li><a href="#">
<img src="images/small_product_list_01.jpg" alt="" />
<div class="product-list-desc">Canvas Backpack <i>$59.00</i></div>
</a></li>

Here only one price is there ie. ProductPrice($59.00) and no ProductMRP

Sign in to reply to this post

Kumel

so if there's a way to show things like this if ProductMRP is NULL then display:
<div class="product-list-desc">Canvas Backpack <i>$59.00</i></div>

else (if ProductMRP has value)

<div class="product-list-desc">lol <i>$29.00<b>$19.00</b></i></div>

Sign in to reply to this post

Ray BorduinWebAssist

<?php if ($row_Recordset['ProductMRP']) {
<div class="product-list-desc">lol <i>$29.00<b>$19.00</b></i></div>
<?php } else { ?>
<div class="product-list-desc">Canvas Backpack <i>$59.00</i></div>
<?php } ?>

Sign in to reply to this post

Kumel

Thanks a lot

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...