本文整理汇总了PHP中Mage_Sales_Model_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Abstract类的具体用法?PHP Mage_Sales_Model_Abstract怎么用?PHP Mage_Sales_Model_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Abstract类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: extractAdditionalParams
/**
* @param Mage_Sales_Model_Abstract $itemContainer
* @return array
*/
public function extractAdditionalParams(Mage_Sales_Model_Abstract $itemContainer = null)
{
$invoice = null;
if ($itemContainer instanceof Mage_Sales_Model_Order_Invoice && $itemContainer) {
$invoice = $itemContainer;
} else {
if ($itemContainer instanceof Mage_Sales_Block_Order_Creditmemo && $itemContainer) {
$invoice = Mage::getModel('sales/order_invoice')->load($itemContainer->getInvoiceId());
}
}
if ($invoice == null) {
// if invoice is not set we load id hard from the request params
$invoice = $this->getRefundHelper()->getInvoiceFromCreditMemoRequest();
}
$this->creditmemo = $this->getRefundHelper()->getCreditMemoFromRequest();
if ($invoice instanceof Mage_Sales_Model_Order_Invoice) {
$this->extractFromCreditMemoItems($invoice);
// We dont extract from discount data for the moment, because partial refunds are a problem
// $this->extractFromDiscountData($invoice);
$this->extractFromInvoicedShippingMethod($invoice);
$this->extractFromAdjustments($invoice);
// Overwrite amount to fix Magentos rounding problems (eg +1ct)
$this->additionalParams['AMOUNT'] = $this->amount;
}
return $this->additionalParams;
}
开发者ID:roshu1980,项目名称:add-computers,代码行数:30,代码来源:OpenInvoiceNl.php
示例2: getAllOrderItems
/**
* @param Mage_Sales_Model_Abstract $entity
* @param Mage_Sales_Model_Order $order
* @param string $context
*
* @return mixed
*/
protected function getAllOrderItems($entity, $order, $context)
{
$this->_order = $order;
if ($context == self::TYPE_RS) {
return $entity->getAllItems();
}
return $order->getAllItems();
}
开发者ID:buttasg,项目名称:cowgirlk,代码行数:15,代码来源:Order.php
示例3: _getTotalsList
/**
* Return total list
*
* @param Mage_Sales_Model_Abstract $source
* @return array
*/
protected function _getTotalsList($source)
{
$nodeName = Mage::helper('zab_billing')->getTotalConfigPath($source->getTipo());
$totals = Mage::getConfig()->getNode($nodeName)->asArray();
usort($totals, array($this, '_sortTotalsList'));
$totalModels = array();
foreach ($totals as $index => $totalInfo) {
if (!empty($totalInfo['model'])) {
$totalModel = Mage::getModel($totalInfo['model']);
if ($totalModel instanceof Mage_Sales_Model_Order_Pdf_Total_Default) {
$totalInfo['model'] = $totalModel;
} else {
Mage::throwException(Mage::helper('sales')->__('PDF total model should extend Mage_Sales_Model_Order_Pdf_Total_Default'));
}
} else {
$totalModel = Mage::getModel($this->_defaultTotalModel);
}
$totalModel->setData($totalInfo);
$totalModels[] = $totalModel;
}
return $totalModels;
}
开发者ID:becchius,项目名称:fiordivaniglia,代码行数:28,代码来源:Abstract.php
示例4: insertAddressesAndHeader
/**
* insert customer address and all header like customer number, etc.
*
* @param Zend_Pdf_Page $page current Zend_Pdf_Page
* @param Mage_Sales_Model_Abstract $source source for the address information
* @param Mage_Sales_Model_Order $order order to print the document for
*/
protected function insertAddressesAndHeader(Zend_Pdf_Page $page, Mage_Sales_Model_Abstract $source, Mage_Sales_Model_Order $order)
{
// Add logo
$this->insertLogo($page, $source->getStore());
// Add billing address
$this->y = 692 - $this->_marginTop;
$this->_insertCustomerAddress($page, $order);
// Add sender address
$this->y = 705 - $this->_marginTop;
$this->_insertSenderAddessBar($page);
// Add head
$this->y = 592 - $this->_marginTop;
$this->insertHeader($page, $order, $source);
/* Add table head */
// make sure that item table does not overlap heading
if ($this->y > 575 - $this->_marginTop) {
$this->y = 575 - $this->_marginTop;
}
}
开发者ID:riker09,项目名称:firegento-pdf,代码行数:26,代码来源:Abstract.php
示例5: _addTransaction
/**
* Create transaction,
* prepare its insertion into hierarchy and add its information to payment and comments
*
* To add transactions and related information,
* the following information should be set to payment before processing:
* - transaction_id
* - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
* - parent_transaction_id (optional)
* - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
*
* If the sales document is specified, it will be linked to the transaction as related for future usage.
* Currently transaction ID is set into the sales object
* This method writes the added transaction ID into last_trans_id field of the payment object
*
* To make sure transaction object won't cause trouble before saving, use $failsafe = true
*
* @param string $type
* @param Mage_Sales_Model_Abstract $salesDocument
* @param bool $failsafe
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
{
if ($this->getSkipTransactionCreation()) {
$this->unsTransactionId();
return null;
}
// look for set transaction ids
$transactionId = $this->getTransactionId();
if (null !== $transactionId) {
// set transaction parameters
$transaction = false;
if ($this->getOrder()->getId()) {
$transaction = $this->_lookupTransaction($transactionId);
}
if (!$transaction) {
$transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
}
$transaction->setOrderPaymentObject($this)->setTxnType($type)->isFailsafe($failsafe);
if ($this->hasIsTransactionClosed()) {
$transaction->setIsClosed((int) $this->getIsTransactionClosed());
}
//set transaction addition information
if ($this->_transactionAdditionalInfo) {
foreach ($this->_transactionAdditionalInfo as $key => $value) {
$transaction->setAdditionalInformation($key, $value);
}
}
// link with sales entities
$this->setLastTransId($transactionId);
$this->setCreatedTransaction($transaction);
$this->getOrder()->addRelatedObject($transaction);
if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
$salesDocument->setTransactionId($transactionId);
// TODO: linking transaction with the sales document
}
// link with parent transaction
$parentTransactionId = $this->getParentTransactionId();
if ($parentTransactionId) {
$transaction->setParentTxnId($parentTransactionId);
if ($this->getShouldCloseParentTransaction()) {
$parentTransaction = $this->_lookupTransaction($parentTransactionId);
if ($parentTransaction) {
if (!$parentTransaction->getIsClosed()) {
$parentTransaction->isFailsafe($failsafe)->close(false);
}
$this->getOrder()->addRelatedObject($parentTransaction);
}
}
}
return $transaction;
}
}
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:74,代码来源:Lpayment.php
示例6: insertTotals
/**
* Insert totals to pdf page
*
* @param Zend_Pdf_Page $page
* @param Mage_Sales_Model_Abstract $source
* @return Zend_Pdf_Page
*/
protected function insertTotals($page, $source)
{
$order = $source->getOrder();
$totals = $this->_getTotalsList($source);
$lineBlock = array('lines' => array(), 'height' => 15);
foreach ($totals as $total) {
$total->setOrder($order)->setSource($source);
if ($total->canDisplay()) {
$total->setFontSize(10);
foreach ($total->getTotalsForDisplay() as $totalData) {
$lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 565, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'));
}
}
}
$this->y -= 20;
$page = $this->drawLineBlocks($page, array($lineBlock));
return $page;
}
开发者ID:blazeriaz,项目名称:youguess,代码行数:25,代码来源:Abstract.php
示例7: salesOrderEntitySaveBefore
/**
* Check whether order entity may be saved
*
* Invoice, shipment, creditmemo (address & item?)
*
* @param Mage_Sales_Model_Abstract $model
*/
public function salesOrderEntitySaveBefore($model)
{
$this->_salesEntitySaveBefore(Mage::app()->getStore($model->getOrder()->getStoreId())->getWebsiteId());
}
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:11,代码来源:Models.php
示例8: insertTotals
/**
* Insert totals to pdf page
*
* @param Zend_Pdf_Page $page
* @param Mage_Sales_Model_Abstract $source
* @return Zend_Pdf_Page
*/
protected function insertTotals($page, $source)
{
// remvoeme
$this->y += 40;
if ($this->y - 150 < 15) {
$page = $this->newPage($pageSettings);
}
$order = $source->getOrder();
$totals = $this->_getTotalsList($source);
$lineBlock = array('lines' => array(), 'height' => 20);
$this->y -= 30;
$page->setFillColor(new Zend_Pdf_Color_Html("#58a300"));
$page->setLineColor(new Zend_Pdf_Color_GrayScale(1));
$page->setLineWidth(0.5);
$page->drawRectangle(275, $this->y, 570, $this->y - 30);
$this->_setFontBold($page, 12);
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
$page->drawText(Mage::helper('sales')->__('Betrag'), 285, $this->y - 20, 'UTF-8');
$this->sy = $this->y;
$page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$this->y -= 30;
foreach ($totals as $total) {
$total->setOrder($order)->setSource($source);
if ($total->canDisplay()) {
$total->setFontSize(10);
foreach ($total->getTotalsForDisplay() as $totalData) {
$fontSize = 7;
if ("Gesamt (inkl. Steuern):" === $totalData["label"]) {
$fontSize = 10;
}
if (false !== strpos($totalData["label"], "Produkte zu 19")) {
continue;
}
if ("Steuer:" === $totalData["label"]) {
$totalData["label"] = "19% MwSt.";
}
$totalData["label"] = str_replace("Steuern", "MwSt.", $totalData["label"]);
$lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', "font_size" => 7, 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 525, 'align' => 'right', "font_size" => $fontSize, 'font' => 'bold'));
}
}
}
$this->y -= 20;
$page = $this->drawLineBlocks($page, array($lineBlock));
return $page;
}
开发者ID:vberzsin,项目名称:shop,代码行数:52,代码来源:Abstract.php
示例9: insertTotals
/**
* Insert totals to pdf page
*
* @param Zend_Pdf_Page $page
* @param Mage_Sales_Model_Abstract $source
* @return Zend_Pdf_Page
*/
protected function insertTotals($page, $source)
{
$order = $source->getOrder();
$totals = $this->_getTotalsList($source);
$lineBlock = array('lines' => array(), 'height' => 15);
foreach ($totals as $total) {
$total->setOrder($order)->setSource($source);
if ($total->canDisplay()) {
$total->setFontSize(10);
foreach ($total->getTotalsForDisplay() as $totalData) {
if (isset($totalData['title']) && strpos($totalData['title'], '%') !== false) {
$origLabel = $totalData['label'];
$totalData['label'] = trim(preg_replace('/\\s*\\([^)]*\\)/', '', $origLabel));
#echo "<pre/>";print_r($totalData);die;
}
Mage::log(print_r($totalData, true), NULL, 'developerTotalAfter.log');
$lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 565, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'));
}
}
}
$this->y -= 20;
$page = $this->drawLineBlocks($page, array($lineBlock));
return $page;
}
开发者ID:VIVEKLUCKY1848,项目名称:generalutils,代码行数:31,代码来源:(Local)Abstract.php
示例10: _addTransaction
/**
* Create transaction, prepare its insertion into hierarchy and add its information to payment and comments
*
* To add transactions and related information, the following information should be set to payment before processing:
* - transaction_id
* - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
* - parent_transaction_id (optional)
* - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
*
* If the sales document is specified, it will be linked to the transaction as related for future usage.
* Currently transaction ID is set into the sales object
* This method writes the added transaction ID into last_trans_id field of the payment object
*
* To make sure transaction object won't cause trouble before saving, use $failsafe = true
*
* @param Mage_Sales_Model_Order_Payment
* @param string $type
* @param Mage_Sales_Model_Abstract $salesDocument
* @param bool $failsafe
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
protected function _addTransaction($payment, $type, $salesDocument = null, $failsafe = false)
{
// look for set transaction ids
$transactionId = $payment->getTransactionId();
if (null !== $transactionId) {
// set transaction parameters
/*$transaction = Mage::getModel('sales/order_payment_transaction')
->setOrderPaymentObject($payment)
->setTxnType($type)
->setTxnId($transactionId)
->isFailsafe($failsafe)
;*/
// set transaction parameters
//$transaction = false;
$transaction = $this->_lookupTransaction($payment, $transactionId);
if (!$transaction) {
$transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
}
$transaction->setOrderPaymentObject($payment)->setTxnType($type)->isFailsafe($failsafe);
if ($payment->hasIsTransactionClosed()) {
$transaction->setIsClosed((int) $payment->getIsTransactionClosed());
}
// link with sales entities
$payment->setLastTransId($transactionId);
$payment->setCreatedTransaction($transaction);
$payment->getOrder()->addRelatedObject($transaction);
if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
$salesDocument->setTransactionId($transactionId);
// TODO: linking transaction with the sales document
}
// link with parent transaction Not used because transaction Id is the same
$parentTransactionId = $payment->getParentTransactionId();
if ($parentTransactionId) {
$transaction->setParentTxnId($parentTransactionId);
if ($payment->getShouldCloseParentTransaction()) {
$parentTransaction = $this->_lookupTransaction($payment, $parentTransactionId);
//
if ($parentTransaction) {
$parentTransaction->isFailsafe($failsafe)->close(false);
$payment->getOrder()->addRelatedObject($parentTransaction);
}
}
}
return $transaction;
}
}
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:67,代码来源:Abstract.php
示例11: fetchNewIncrementId
/**
* @param Mage_Sales_Model_Abstract $object
* @return string
*/
protected function fetchNewIncrementId(Mage_Sales_Model_Abstract $object)
{
$entityTypeModel = $this->getFactory()->getModelEavEntityType();
$code = '';
if ($object instanceof Mage_Sales_Model_Order_Invoice) {
$code = 'invoice';
} elseif ($object instanceof Mage_Sales_Model_Order_Creditmemo) {
$code = 'creditmemo';
}
$entityType = $entityTypeModel->loadByCode($code);
$newIncrementId = $entityType->fetchNewIncrementId($this->getStoreId());
if ($newIncrementId !== false) {
$object->setIncrementId($newIncrementId);
}
return $newIncrementId;
}
开发者ID:romfr,项目名称:payone-magento,代码行数:20,代码来源:Abstract.php
示例12: setCustomFields
/**
* @param Mage_Customer_Model_Address_Abstract|Mage_Sales_Model_Abstract $magentoObject
* @param ShopgateOrder|ShopgateAddress|ShopgateCustomer $shopgateObject
* @return mixed
*/
public function setCustomFields($magentoObject, $shopgateObject)
{
foreach ($shopgateObject->getCustomFields() as $field) {
$magentoObject->setData($field->getInternalFieldName(), $field->getValue());
}
return $magentoObject;
}
开发者ID:buttasg,项目名称:cowgirlk,代码行数:12,代码来源:Data.php
示例13: _beforeSave
/**
* Before object save
*
* @return Mage_Sales_Model_Order_Creditmemo_Comment
*/
protected function _beforeSave()
{
parent::_beforeSave();
if (!$this->getParentId() && $this->getCreditmemo()) {
$this->setParentId($this->getCreditmemo()->getId());
}
return $this;
}
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:13,代码来源:Comment.php
示例14: _afterSave
/**
* After object save manipulation
*
* @return Mage_Sales_Model_Order_Shipment
*/
protected function _afterSave()
{
if (null !== $this->_items) {
/**
* Save invoice items
*/
foreach ($this->_items as $item) {
$item->setOrderItem($item->getOrderItem());
$item->save();
}
}
if (null !== $this->_comments) {
foreach ($this->_comments as $comment) {
$comment->save();
}
}
return parent::_afterSave();
}
开发者ID:nemphys,项目名称:magento2,代码行数:23,代码来源:Invoice.php
示例15: addData
/**
* Add data to the object.
*
* Retains previous data in the object.
*
* @param array $data
* @return Mage_Sales_Model_Order_Shipment_Track
*/
public function addData(array $data)
{
if (array_key_exists('number', $data)) {
$this->setNumber($data['number']);
unset($data['number']);
}
return parent::addData($data);
}
开发者ID:natxetee,项目名称:magento2,代码行数:16,代码来源:Track.php
示例16: _beforeDelete
/**
* Protect order delete from not admin scope
* @return Mage_Sales_Model_Order
*/
protected function _beforeDelete()
{
$this->_protectFromNonAdmin();
return parent::_beforeDelete();
}
开发者ID:blazeriaz,项目名称:youguess,代码行数:9,代码来源:Order.php
示例17: _afterSave
/**
* After object save manipulations
*
* @return Mage_Sales_Model_Order_Shipment
*/
protected function _afterSave()
{
if (null !== $this->_items) {
foreach ($this->_items as $item) {
$item->save();
}
}
if (null !== $this->_tracks) {
foreach ($this->_tracks as $track) {
$track->save();
}
}
if (null !== $this->_comments) {
foreach ($this->_comments as $comment) {
$comment->save();
}
}
return parent::_afterSave();
}
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:24,代码来源:Shipment.php
示例18: _beforeSave
/**
* Before object save manipulations
*
* @return Mage_Sales_Model_Order_Creditmemo
*/
protected function _beforeSave()
{
parent::_beforeSave();
if (!$this->getOrderId() && $this->getOrder()) {
$this->setOrderId($this->getOrder()->getId());
$this->setBillingAddressId($this->getOrder()->getBillingAddress()->getId());
}
return $this;
}
开发者ID:hirentricore,项目名称:devmagento,代码行数:14,代码来源:Creditmemo.php
示例19: _beforeSave
/**
* Set order again if required
* @return Mage_Sales_Model_Order_Status_History
*/
protected function _beforeSave()
{
if ($this->_shouldSetOrderBeforeSave) {
$this->setOrder($this->_order);
}
return parent::_beforeSave();
}
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:11,代码来源:History.php
注:本文中的Mage_Sales_Model_Abstract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论