Checking additional conditions for product price in magento - magento

In my magento site i added number of products with price as 0.00.
Now that products are displayed with price as $0.00.
so i want to display the price as not mentioned instead of $0.00.
How can i do this?
the price.phtml what is the condition i need to write for that?
My condition is:
if price == 0.00 display the text 'not mentioned'

try this.
<?php
if ((int)$this->getPrice()){
echo $this->getPrice();
}else {
echo "not mentioned";
}
?>
correct me if i am wrong.
^^

Related

Magento - Add attribute if the product qty is zero

I want to insert this attrribute that I have created into the product page above the add to cart button but only if the qty is ZERO. Basically an estimated arrival date. Items that are available on back order only have a note above the add to cart button of when the product will actually be available from. I have put the below in and it works but I don't want it to show for products already available.
<p><font color="red">AVAILABLE FROM: <?php echo $_product->getResource()->getAttribute('due_date')->getFrontend()->getValue($_product); ?></font></p>
Can someone let me know what I need to add please.
Most appreciated
Anthony
You should be able to get the stock quantity on the product page by using:
Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()
You can then use that in a conditional to show the piece of code that you want. However, I'm not sure you need all of that to show the due date. Because you're already loading the product when you are on the product page, you should just be able to use:
<p class="red">AVAILABLE FROM: <?php echo $_product->getDueDate(); ?></p>
If that doesn't work, make sure that you have your due date attribute set to be visible on the product page. It'll be the one called, "Visible on Product View Page on Front-end".
Full code block could look something like this:
<?php
$qty = Mage::getModel(cataloginventory/stock_item)->loadByProduct($_product)->getQty();
if ($qty <= 0): ?>
<p class="red">AVAILABLE FROM: <?php echo $_product->getDueDate(); ?></p>
<?php endif; ?>
If you allow backorders, it's important you check for <= 0, rather than == 0. This is because if someone backorders it, your stock will go negative.
Also, it's more clean to remove the font tag and use CSS to style the text.

magento i need to apply discount 20% for the total if above 50euros but not to the discounted items

magento i need to apply discount 20% for the total if above 50euros but not to the discounted items if customers selects some already discounted items that should not include in the total can any one help
Thanks in advance
You need to create a custom module or say shopping cart price rule and an event observer to check whether the "special price" is zero or not. If it is "Zero" that means it is not a already discounted product or you can even check the "final price" with the "price" , if the final price is lesser than price it is already discounted.
If these conditions are satisfied get the prices of remaining products prices and discount them then add the already discounted products price to make the total amount.
I hope You understood this concept and write your own module.
you have to use a check in view page.
for example
$price = $product->getPrice();
$specialprice = $product->getFinalPrice();
if(!empty($specialprice)){
//then your price would be same
}
elseif(empty($specialprice)){
then price would be = $price*20/100;
}
hope this would help you and don't forget to like if it was helpful

magento add tax on custom attribute based price

we sell bunch of product and we need to display each price product and entire box price.For that reason i have created attribute with each price and calling it on product page.So main price of product will be box price and each price will be display from attribute.but now i when i add tax i can see the main price with excluding and including tax but how to apply that tax on attribute based price?
this would be each product price
<?php echo $_product->getResource()->getAttribute('each_price')->getFrontend()- >getValue($_product)?>
this would be whole box price
<?php echo $this->getPriceHtml($_product, true);?>
some thing like this can be done to achive this.please look the code below
<?php $txrate= $_product->getData('tax_percent');
if($txrate!=""):
echo '<div class="each-inc-tax">';
$ech_price= $_product->getResource()->getAttribute('each_price')->getFrontend()->getValue($_product);
$tx=($txrate*$ech_price)/100;
$each_tax=$ech_price+$tx;
echo ' <b>Each Price Including Tax:</b> <b>'. $each_tax.'</b>';
echo '</div>';
endif;
I was using the MSRP attribute in my magento and storing the value excluding Tax, but wishing to display on the frontend including Tax.
I used the following code...
<?php
$_finalPriceExclTax = $this->helper('tax')->getPrice($_product, $_product->getPrice(), false);
$_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);
$_taxpercent = $_finalPriceInclTax / $_finalPriceExclTax;
$_msrpPrice = $_product->getMsrp() * $_taxpercent;
?>

Subtotal less coupons/discounts on order confirmation page of Magento

On the Order Confirmation page of Magento 1.5 (using the template , I have the a number of analytics conversion code scripts (like Google AdWords Conversion tracking).
The code that is currently used to get the subtotal is
<?php $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId(); ?>
<?php $order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id); ?>
<?php $subtotal = $order_details->subtotal; ?>
And then the $subtotal variable is used throughout. The problem is that this is the subtotal BEFORE any coupons or discounts are applied. I need it to be the total AFTER coupons or discounts.
Can anyone help me with the code to get at that value?
You can call var_dump($order_details->debug()) to see all the data fields of the order object. I don't see anything that matches the subtotal with discount, but I do see a discount_amount field, which has the total discount amount (as a negative number); add this to your subtotal.
If you want the grand total, with discounts and shipping included, use the grand_total field.

Magento - show the stock indicator on product list

how can I show the stock indicator on Magento product list ?
Thanks a lot.
To show the quantity of items left in stock use this:
<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); ?>

Resources