getTrackSales('javascript')) {
return ''; // not allowed to track via Javascript
}
// Get the quote
$quote = $this->getQuote();
if ($quote)
{
// from there, get the quote ID
if ($quote instanceof Mage_Sales_Model_Quote) {
$quoteId = $quote->getId();
} else {
$quoteId = $quote;
}
}
else
{
// Shouldn't happen, but Magento 1.4 has a bug that can cause problems
// if the customer registers an account at checkout, so this will help
// work around the problem.
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
}
if (!$quoteId) {
return '';
}
// Get the order(s) for the quote
$orders = Mage::getResourceModel('sales/order_collection')
->addAttributeToFilter('quote_id', $quoteId)
->load();
// get raw data to submit from the collection of orders
$items = array();
foreach ($orders as $order)
{
if (!$order){continue;}
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order')->load($order);
}
if (!$order){continue;}
$order = Mage::getModel('pap/pap')->getOrderSaleDetails($order);
array_splice($items, -1, 0, $order);
}
ob_start();
?>
addText("
".$text."
");
return parent::_toHtml();
}
}