本文整理汇总了PHP中Varien_Object::getMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getMethod方法的具体用法?PHP Varien_Object::getMethod怎么用?PHP Varien_Object::getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPaymentHtml
public function getPaymentHtml(Varien_Object $payment)
{
if ($block = $this->getPaymentRenderer($payment->getMethod())) {
$block->setPayment($payment);
return $block->toHtml();
}
return '';
}
示例2: importData
/**
* Import data
*
* @param array $data
* @return Mage_Sales_Model_Quote_Payment
*/
public function importData(array $data)
{
$data = new Varien_Object($data);
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
$method->assignData($data);
/*
* validating the payment data
*/
$method->validate();
return $this;
}
示例3: importData
/**
* Import data
*
* @param array $data
* @return Mage_Sales_Model_Quote_Payment
*/
public function importData(array $data)
{
$data = new Varien_Object($data);
Mage::dispatchEvent($this->_eventPrefix . '_import_data_before', array($this->_eventObject => $this, 'input' => $data));
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
$method->assignData($data);
/*
* validating the payment data
*/
$method->validate();
return $this;
}
示例4: importData
/**
* Import data
*
* @param array $data
* @throws Mage_Core_Exception
* @return Mage_Sales_Model_Quote_Payment
*/
public function importData(array $data)
{
$data = new Varien_Object($data);
Mage::dispatchEvent($this->_eventPrefix . '_import_data_before', array($this->_eventObject => $this, 'input' => $data));
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
if (!$method->isAvailable($this->getOrder())) {
Mage::throwException(Mage::helper('sales')->__('Requested Payment Method is not available'));
}
$method->assignData($data);
/**
* validating the payment data
*/
$method->validate();
return $this;
}
示例5: importData
/**
* Import data array to payment method object,
* Method calls quote totals collect because payment method availability
* can be related to quote totals
*
* @param array $data
* @throws Mage_Core_Exception
* @return Mage_Sales_Model_Quote_Payment
*/
public function importData(array $data)
{
$data = new Varien_Object($data);
Mage::dispatchEvent($this->_eventPrefix . '_import_data_before', array($this->_eventObject => $this, 'input' => $data));
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
/**
* Payment avalability related with quote totals.
* We have recollect quote totals before checking
*/
$this->getQuote()->collectTotals();
if (!$method->isAvailable($this->getQuote())) {
Mage::throwException(Mage::helper('sales')->__('The requested Payment Method is not available.'));
}
$method->assignData($data);
/*
* validating the payment data
*/
$method->validate();
return $this;
}
示例6: getShippingRates
public function getShippingRates($order)
{
$request = $this->prepareShippingRequest($order);
$shipping = Mage::getModel('shipping/shipping');
$result = $shipping->collectRates($request)->getResult();
if ($result) {
$rates = array();
foreach ($result->getAllRates() as $_rate) {
$rate = new Varien_Object();
$rate->setData($_rate->getData());
$carrier = $rate->getCarrier();
if (!isset($rates[$carrier])) {
$rates[$carrier] = array();
}
$rate->setCode($carrier . '_' . $rate->getMethod());
$rates[$carrier][$rate->getCode()] = $rate;
}
return $rates;
}
return null;
}
示例7: _getAllowedContainers
/**
* Get allowed containers of carrier
*
* @param Varien_Object|null $params
* @return array|bool
*/
protected function _getAllowedContainers(Varien_Object $params = null)
{
$containersAll = $this->getContainerTypesAll();
if (empty($containersAll)) {
return array();
}
if (empty($params)) {
return $containersAll;
}
$containersFilter = $this->getContainerTypesFilter();
$containersFiltered = array();
$method = $params->getMethod();
$countryShipper = $params->getCountryShipper();
$countryRecipient = $params->getCountryRecipient();
if (empty($containersFilter)) {
return $containersAll;
}
if (!$params || !$method || !$countryShipper || !$countryRecipient) {
return $containersAll;
}
if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID) {
$direction = 'within_us';
} else {
if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
$direction = 'from_us';
} else {
return $containersAll;
}
}
foreach ($containersFilter as $dataItem) {
$containers = $dataItem['containers'];
$filters = $dataItem['filters'];
if (!empty($filters[$direction]['method']) && in_array($method, $filters[$direction]['method'])) {
foreach ($containers as $container) {
if (!empty($containersAll[$container])) {
$containersFiltered[$container] = $containersAll[$container];
}
}
}
}
return !empty($containersFiltered) ? $containersFiltered : $containersAll;
}
示例8: getContainerTypes
/**
* Return container types of carrier
*
* @param Varien_Object|null $params
* @return array
*/
public function getContainerTypes(Varien_Object $params = null)
{
$method = $params->getMethod();
$countryRecipient = $params->getCountryRecipient();
$serviceLevel = $this->getDeliveryServiceLevel($countryRecipient);
if (!$this->getCode('method', $method)) {
$method = Mage::getStoreConfig('carriers/wsaendicia/default_domestic');
}
$allContainers = $this->getCode('container');
$allowedContainers = $allContainers['All'];
if ($serviceLevel) {
if (array_key_exists($method, $allContainers[$serviceLevel])) {
$allowedContainers = $allContainers[$serviceLevel][$method];
}
}
return $allowedContainers;
}
示例9: _paymentDataImport
/**
* Prepare and set to quote reward balance instance,
* set zero subtotal checkout payment if need
*
* @param Mage_Sales_Model_Quote $quote
* @param Varien_Object $payment
* @param boolean $useRewardPoints
* @return Enterprise_Reward_Model_Observer
*/
protected function _paymentDataImport($quote, $payment, $useRewardPoints)
{
if (!$quote || !$quote->getCustomerId() || $quote->getBaseGrandTotal() + $quote->getBaseRewardCurrencyAmount() <= 0) {
return $this;
}
$quote->setUseRewardPoints((bool) $useRewardPoints);
if ($quote->getUseRewardPoints()) {
/* @var $reward Enterprise_Reward_Model_Reward */
$reward = Mage::getModel('enterprise_reward/reward')->setCustomer($quote->getCustomer())->setWebsiteId($quote->getStore()->getWebsiteId())->loadByCustomer();
$minPointsBalance = (int) Mage::getStoreConfig(Enterprise_Reward_Model_Reward::XML_PATH_MIN_POINTS_BALANCE, $quote->getStoreId());
if ($reward->getId() && $reward->getPointsBalance() >= $minPointsBalance) {
$quote->setRewardInstance($reward);
if (!$payment->getMethod()) {
$payment->setMethod('free');
}
} else {
$quote->setUseRewardPoints(false);
}
}
return $this;
}
示例10: getCashOnDeliverySurcharge
/**
* Return CashOnDelivery Surcharge Value
*
* @param Varien_Object
*
* @return float
*/
public function getCashOnDeliverySurcharge(Varien_Object $request)
{
$adapter = $this->_getReadAdapter();
$bind = array(':website_id' => (int) $request->getWebsiteId(), ':country_id' => $request->getDestCountryId(), ':region_id' => $request->getDestRegionId(), ':postcode' => $request->getDestPostcode(), ':weight' => (double) $request->getPackageWeight(), ':price' => (double) $request->getData('zitec_table_price'), ':method' => $request->getMethod());
$select = $adapter->select()->from($this->getMainTable(), array('cashondelivery_surcharge', 'cod_min_surcharge'))->where('website_id=:website_id')->order(array('dest_country_id DESC', 'dest_region_id DESC', 'dest_zip DESC', 'method DESC', 'price_vs_dest DESC', 'weight DESC'));
// render destination condition
$orWhere = '(' . implode(') OR (', array("dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode", "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''", "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''", "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode", "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = ''")) . ')';
$select->where($orWhere);
$select->where('((weight <= :weight and price_vs_dest = 0) or (weight <= :price and price_vs_dest = 1))');
$select->where('method = :method');
$rate = $adapter->fetchRow($select, $bind);
if (empty($rate) && $this->isRateDefinedForMethod($request)) {
$rate = null;
}
return $rate;
}
示例11: _paymentImportData
private function _paymentImportData($data)
{
$payment = $this->getQuote()->getPayment();
$data = new Varien_Object($data);
// magento does not re-instanciate
// payment method if it was already set
// and changed
if ($data->getMethod() != $payment->getMethod()) {
$payment->unsMethodInstance();
}
$payment->setMethod($data->getMethod());
$method = $payment->getMethodInstance();
$this->getQuote()->collectTotals();
if (!$method->isAvailable($this->getQuote())) {
Mage::throwException(Mage::helper('sales')->__('The requested Payment Method is not available.'));
}
$method->assignData($data);
}
示例12: assignData
/**
* Assign data to info model instance
*
* @param mixed $data
* @return Mage_Payment_Model_Info
*/
public function assignData($data)
{
if (!$data instanceof Varien_Object) {
$data = new Varien_Object($data);
}
$info = $this->getInfoInstance();
if (!$this->_isBackendOrder && $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
//Mage::getSingleton('core/session')->setData('sharedpagePaypal', $data->getSharedpageNotsaved());
Mage::getSingleton('core/session')->setData('sharedpagePaypal', 'paypal');
} elseif (!$this->_isBackendOrder && $this->_connectionType === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT) {
$info->setTransparentNotsaved($data->getTransparentNotsaved());
//Option choice
if ($data->getMethod() == 'ewayrapid_saved' && !$data->getTransparentSaved()) {
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for eWay saved'));
} elseif ($data->getMethod() == 'ewayrapid_notsaved' && !$data->getTransparentNotsaved()) {
Mage::throwException(Mage::helper('payment')->__('Please select an option payment for eWay not saved'));
}
//New Token
if ($data->getMethod() == 'ewayrapid_saved' && $data->getTransparentSaved() == Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD && $data->getSavedToken() == Eway_Rapid31_Model_Config::TOKEN_NEW && Mage::helper('ewayrapid/customer')->checkTokenListByType(Eway_Rapid31_Model_Config::PAYPAL_STANDARD_METHOD)) {
Mage::throwException(Mage::helper('payment')->__('You could only save one PayPal account, please select PayPal account existed to payent.'));
}
if ($data->getTransparentNotsaved()) {
Mage::getSingleton('core/session')->setTransparentNotsaved($data->getTransparentNotsaved());
}
if ($data->getTransparentSaved()) {
Mage::getSingleton('core/session')->setTransparentSaved($data->getTransparentSaved());
}
if ($data->getMethod()) {
Mage::getSingleton('core/session')->setMethod($data->getMethod());
}
if ($data->getSavedToken()) {
Mage::getSingleton('core/session')->setSavedToken($data->getSavedToken());
if (is_numeric($data->getSavedToken())) {
$token = Mage::helper('ewayrapid/customer')->getTokenById($data->getSavedToken());
/* @var Eway_Rapid31_Model_Request_Token $model */
$model = Mage::getModel('ewayrapid/request_token');
$type = $model->checkCardName($token);
Mage::getSingleton('core/session')->setTransparentSaved($type);
unset($model);
unset($token);
}
}
$infoCard = new Varien_Object();
Mage::getSingleton('core/session')->setInfoCard($infoCard->setCcType($data->getCcType())->setOwner($data->getCcOwner())->setLast4($this->_isClientSideEncrypted($data->getCcNumber()) ? 'encrypted' : substr($data->getCcNumber(), -4))->setCard($data->getCcNumber())->setNumber($data->getCcNumber())->setCid($data->getCcCid())->setExpMonth($data->getCcExpMonth())->setExpYear($data->getCcExpYear()));
} else {
$info->setCcType($data->getCcType())->setCcOwner($data->getCcOwner())->setCcLast4($this->_isClientSideEncrypted($data->getCcNumber()) ? 'encrypted' : substr($data->getCcNumber(), -4))->setCcNumber($data->getCcNumber())->setCcCid($data->getCcCid())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear());
}
return $this;
}
示例13: _paymentDataImport
/**
* Prepare and set to quote reward balance instance,
* set zero subtotal checkout payment if need
*
* @param Mage_Sales_Model_Quote $quote
* @param Varien_Object $payment
* @param boolean $useRewardPoints
* @return Enterprise_Reward_Model_Observer
*/
protected function _paymentDataImport($quote, $payment, $useRewardPoints)
{
if (!$quote || !$quote->getCustomerId()) {
return $this;
}
$quote->setUseRewardPoints((bool) $useRewardPoints);
if ($quote->getUseRewardPoints()) {
/* @var $reward Enterprise_Reward_Model_Reward */
$reward = Mage::getModel('enterprise_reward/reward')->setCustomer($quote->getCustomer())->setWebsiteId($quote->getStore()->getWebsiteId())->loadByCustomer();
if ($reward->getId()) {
$quote->setRewardInstance($reward);
if (!$payment->getMethod()) {
$payment->setMethod('free');
}
} else {
$quote->setUseRewardPoints(false);
}
}
return $this;
}
示例14: _importPaymentData
/**
* Analyze payment data for quote and set free shipping if grand total is covered by balance
*
* @param Mage_Sales_Model_Quote $quote
* @param Varien_Object|Mage_Sales_Model_Quote_Payment $payment
* @param bool $shouldUseBalance
*/
protected function _importPaymentData($quote, $payment, $shouldUseBalance)
{
$store = Mage::app()->getStore($quote->getStoreId());
if (!$quote || !$quote->getCustomerId() || $quote->getBaseGrandTotal() + $quote->getBaseCustomerBalanceAmountUsed() <= 0) {
return;
}
$quote->setUseCustomerBalance($shouldUseBalance);
if ($shouldUseBalance) {
$balance = Mage::getModel('enterprise_customerbalance/balance')->setCustomerId($quote->getCustomerId())->setWebsiteId($store->getWebsiteId())->loadByCustomer();
if ($balance) {
$quote->setCustomerBalanceInstance($balance);
if (!$payment->getMethod()) {
$payment->setMethod('free');
}
} else {
$quote->setUseCustomerBalance(false);
}
}
}
示例15: paymentImportData
public function paymentImportData(&$payment, array $data)
{
$data = new Varien_Object($data);
//COMMENTED OUT FOR 1.11.x EE or any EE with customer balance solves
//Fatal error: Call to a member function getQuote() on a non-object in app/code/core/Enterprise/CustomerBalance/Model/Observer.php on line 89
/*
Mage::dispatchEvent(
'sales_quote_payment_import_data_before',
array(
$payment->_eventObject=>$payment,
'input'=>$payment,
)
);
*/
$payment->setMethod($data->getMethod());
$method = $payment->getMethodInstance();
$method->assignData($data);
return $payment;
}
开发者ID:ankita-parashar,项目名称:magento,代码行数:19,代码来源:Intersec_Orderimportexport_Model_Convert_Adapter_1.12.x+EE_Ordercreate.php