本文整理匯總了PHP中Varien_Simplexml_Element::setNode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Simplexml_Element::setNode方法的具體用法?PHP Varien_Simplexml_Element::setNode怎麽用?PHP Varien_Simplexml_Element::setNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Simplexml_Element
的用法示例。
在下文中一共展示了Varien_Simplexml_Element::setNode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDeliveryDateAll
public function getDeliveryDateAll($vendor, $address, $weight, $value, $shipDate)
{
$reqKey = implode('-', array($vendor->getId(), $address->getId(), $weight, $value, $shipDate));
if (isset($this->_deliveryDatesCache[$reqKey])) {
return $this->_deliveryDatesCache[$reqKey];
}
$this->setVendor($vendor);
$currencyCode = $address->getQuote()->getBaseCurrencyCode();
$request = new Varien_Simplexml_Element('<TimeInTransitRequest/>');
$request->setNode('Request/TransactionReference/CustomerContext', '1');
$request->setNode('Request/TransactionReference/XpciVersion', '1.0');
$request->setNode('Request/RequestAction', 'TimeInTransit');
$request->setNode('TransitFrom/AddressArtifactFormat/PoliticalDivision1', $vendor->getRegionCode());
$request->setNode('TransitFrom/AddressArtifactFormat/PoliticalDivision2', $vendor->getCity());
$request->setNode('TransitFrom/AddressArtifactFormat/PostcodePrimaryLow', $vendor->getZip());
$request->setNode('TransitFrom/AddressArtifactFormat/CountryCode', $vendor->getCountryId());
$request->setNode('TransitTo/AddressArtifactFormat/PoliticalDivision1', $address->getRegionCode());
$request->setNode('TransitTo/AddressArtifactFormat/PoliticalDivision2', $address->getCity());
$request->setNode('TransitTo/AddressArtifactFormat/PostcodePrimaryLow', $address->getPostcode());
$request->setNode('TransitTo/AddressArtifactFormat/CountryCode', $address->getCountryId());
$request->setNode('PickupDate', date('Ymd', strtotime($shipDate)));
$request->setNode('InvoiceLineTotal/CurrencyCode', $currencyCode);
$request->setNode('InvoiceLineTotal/MonetaryValue', round($value, 2));
$request->setNode('ShipmentWeight/UnitOfMeasurement/Code', $address->getQuote()->getStore()->getConfig('carriers/ups/unit_of_measure'));
$request->setNode('ShipmentWeight/Weight', $weight);
$xmlRequest = '<?xml version="1.0"?>' . $request->asNiceXml();
$this->setXMLAccessRequest();
$xmlResponse = $this->_callShippingXml('TimeInTransit', $xmlRequest);
$response = new Varien_Simplexml_Element($xmlResponse);
$result = array();
try {
$this->_validateResponse($response, false);
$arr = $response->xpath("//TimeInTransitResponse/TransitResponse/ServiceSummary");
foreach ($arr as $a) {
if (isset($a->Service->Code) && isset($a->EstimatedArrival->Date)) {
$result[(string) $a->Service->Code] = (string) $a->EstimatedArrival->Date;
}
}
} catch (Exception $e) {
$result = array();
}
$this->_deliveryDatesCache[$reqKey] = $result;
return $result;
}
示例2: setNode
/**
* Create node by $path and set its value.
*
* @param string $path separated by slashes
* @param string $value
* @param boolean $overwrite
* @return Varien_Simplexml_Config
*/
public function setNode($path, $value, $overwrite = true)
{
$xml = $this->_xml->setNode($path, $value, $overwrite);
return $this;
}
示例3: voidLabel
public function voidLabel($track)
{
if (!Mage::getStoreConfig('udropship/vendor/void_labels')) {
return $this;
}
$request = new Varien_Simplexml_Element('<VoidShipmentRequest/>');
$request->setNode('Request/TransactionReference/CustomerContext', $orderId);
$request->setNode('Request/TransactionReference/XpciVersion', '1.0');
$request->setNode('Request/RequestAction', '1');
$request->setNode('Request/RequestOption', '1');
$request->setNode('ShipmentIdentificationNumber', $track->getNumber());
$xmlRequest = '<?xml version="1.0"?>' . $request->asNiceXml();
$this->setXMLAccessRequest();
$xmlResponse = $this->_callShippingXml('Void', $xmlRequest);
$response = new Varien_Simplexml_Element($xmlResponse);
$this->_validateResponse($response, false);
return $this;
}