I want to display minimal price of grouped product in our magento online shop. I used
<?php echo $this->getPriceHtml($_product, true) ?>
But it does not work for grouped product. It only works for simple product.
$_product->getMinimalPrice () ;
Related
I had a similar problem last time, but the solution just helps with my test-product, whre I can add price +/- in my configurable product. Price in Cart is not correct Magento 1.8
Is it possible to take the price of the simple product, without adding some prices +/- at the configurable one?
On cart I get the SKU of the simple-product, but with $_item->getPrice() I only get the Price of the configurable product.
Thanks for help!
Use the sku of the item to load the simple product, for example:
$_productSku = $_item->getSku();
$_product = Mage::getModel('catalog/product');
$_productId = $_product->getIdBySku($_productSku);
$_product->load($_productId);
then use
$_product->getPrice();
Regards
Hans
Shorter solution is:
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku());
$_product->getPrice();
I am using following tutorial to display the most sold product sort by option(Filtering) to display on product listing page in magento?
Tutorial
/app/code/local/Mage/Catalog/Model/Resource/Product/collection.php
<?php
public function sortByReview($dir){
$table = $this->getTable('review/review');
$entity_code_id = Mage::getModel('review/review')->getEntityIdByCode(Mage_Rating_Model_Rating::ENTITY_PRODUCT_CODE);
$cond = $this->getConnection()->quoteInto('t2.entity_pk_value = e.entity_id and ','').$this->getConnection()->quoteInto('t2.entity_id = ? ',$entity_code_id);
$this->getSelect()->joinLeft(array('t2'=>$table), $cond,array('review' => new Zend_Db_Expr('count(review_id)')))
->group('e.entity_id')->order("review $dir");
}
?>
But I want to sort products which are most sold from every category.
How can I do this?
Is there any free extension available for this?
I did the following thing as the client did not want automatically filter most sold product.
I created an attribute "popular" as drop down and give values from 1 to 5.Then marked "Used for Sorting in Product Listing" to Yes.
After this the attribute was visible under sorting options.
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;
?>
I'm trying to add the number of backorder products to the email template that comes out in the new order email.
So far I've managed to get the product but I just can't seem to get it's quantity. I've tried a variety of methods but nothing seems to work. Here is my latest attempt:
The file is app/design/frontend/base/default/template/email/order/items/order/default/phtml
<?php
// 1. Get Qty of Product in Store.
// 2. Get Qty of product from order
// 3. IF qty from order > qty in store then get number over
// 4. Display number over
$_sku = $this->getItem()->getSku();
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_sku);
//print_r($_product);
echo 'qty in shop: '.$qtyInStock = $_product->getStockItem()->getQty(); //debugging
echo 'qty ordered: '.$qtyOrdered = $_item->getQtyOrdered()*1; //debugging
?>
<?php if($qtyOrdered > $qtyInStock): $back_order = $qtyOrdered - $qtyInStock; ?>
<p>* This product is not available in the requested quantity. <?php echo $back_order; ?> of the item(s) will be backordered.</p>
<?php endif; ?>
I'm not finished with the logic yet. I'm just stuck on getting the products quantity.
$_product->getStockItem()->getQty();
Any help most appreciated.
Billy
Found a solution:
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_sku);
$stock_count = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
Seems quite roundabout but it does the job.
Feel free to suggest better...
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(); ?>