')
{
return $this->displayPrices(
$dataObject,
$dataObject->getData('base_'.$code),
$dataObject->getData($code),
$strong,
$separator
);
}
/**
* Get "double" prices html (block with base and place currency)
*
* @param Varien_Object $dataObject
* @param float $basePrice
* @param float $price
* @param bool $strong
* @param string $separator
* @return string
*/
public function displayPrices($dataObject, $basePrice, $price, $strong = false, $separator = '
')
{
$order = false;
if ($dataObject instanceof Mage_Sales_Model_Order) {
$order = $dataObject;
} else {
$order = $dataObject->getOrder();
}
if ($order && $order->isCurrencyDifferent()) {
$res = '';
$res.= $order->formatBasePrice($basePrice);
$res.= ''.$separator;
$res.= '['.$order->formatPrice($price).']';
} elseif ($order) {
$res = $order->formatPrice($price);
if ($strong) {
$res = ''.$res.'';
}
} else {
$res = Mage::app()->getStore()->formatPrice($price);
if ($strong) {
$res = ''.$res.'';
}
}
return $res;
}
/**
* Filter collection by removing not available product types
*
* @param Mage_Core_Model_Mysql4_Collection_Abstract $collection
* @return Mage_Core_Model_Mysql4_Collection_Abstract
*/
public function applySalableProductTypesFilter($collection)
{
$productTypes = Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray();
$productTypes = array_keys($productTypes);
foreach($collection->getItems() as $key => $item) {
if ($item instanceof Mage_Catalog_Model_Product) {
$type = $item->getTypeId();
} else if ($item instanceof Mage_Sales_Model_Order_Item) {
$type = $item->getProductType();
} else if ($item instanceof Mage_Sales_Model_Quote_Item) {
$type = $item->getProductType();
} else {
$type = '';
}
if (!in_array($type, $productTypes)) {
$collection->removeItemByKey($key);
}
}
return $collection;
}
}