Reputation: 596
Sorry that I'm a total newbie in magento.
I have a multi-vendor magento site where vendors can create product. But when setting product price some users often do some mistakes. Some times special prices are higher than original price. I like to check this mistake. I want a validation script so that when vendors (who have limited admin access) create a new product then they should keep a minimum difference between special price and original price where special price is always lower than original price.
Can any body give some hints?
Thanks
Upvotes: 0
Views: 1956
Reputation: 11
Hope following code will help you
<?php
$product= Mage::getModel('catalog/product')->load(product_id);
$price = $product->getPrice();
$webprice = $product->getwebprice();
$specialprice = $product->getFinalPrice();
if($specialprice==$price)
{?>
<span>$<?php echo number_format($price,2);?></span>
<?php } else if($specialprice<$price) { ?>
<div>
<span>Regular Price:</span>
<span>$ <?php echo number_format($price,2); ?></span>
</div>
<div>
<span>Web Special:</span>
<span>$ <?php echo number_format($specialprice,2); ?> </span>
</div>
<?php } ?>
Upvotes: 1
Reputation: 2373
Even if the user set special prices more than original price,Magento takes cares of it by not displaying that special price .
However if you want to do some customization ,the path for price display is :app/design/frontend/default/default/template/catalog/product/price.phtml
It would be wise if you copy the structure, paste it on your custom theme and continue with your modification.
can add your javascript in list.phtml (same product folder).
Hope it gives some hint.
Upvotes: 0