本文整理汇总了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;
}