本文整理汇总了PHP中Tienda::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Tienda::dump方法的具体用法?PHP Tienda::dump怎么用?PHP Tienda::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tienda
的用法示例。
在下文中一共展示了Tienda::dump方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrate_data
function migrate_data()
{
return Tienda::dump($this->data);
}
示例2: _process
function _process($data)
{
Tienda::load('TiendaModelOrders', 'models.orders');
$model = new TiendaModelOrders();
if (!$data['vs']) {
// order is not valid
return JText::_('TIENDA CARDPAY MESSAGE INVALID ORDER') . $this->_generateSignature($data, 2);
}
$errors = array();
$send_email = false;
if ($this->_generateSignature($data, 2) == $data['sign']) {
switch ($data['res']) {
case 'OK':
// OK
break;
case 'TOUT':
// Time out
$errors[] = JText::_('TIENDA CARDPAY MESSAGE PAYMENT TIMEOUT');
break;
default:
// something went wrong
// something went wrong
case 'FAIL':
// transaction failed
$errors[] = JText::_('TIENDA CARDPAY MESSAGE PAYMENT FAIL');
break;
}
$send_email = true;
// send email!
} else {
$errors[] = JText::_('Tienda CARDPAY Message Invalid Signature');
}
// check that payment amount is correct for order_id
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load(array('order_id' => $data['vs']));
unset($data['secure_key']);
$orderpayment->transaction_details = Tienda::dump($data);
$orderpayment->transaction_id = $data['vs'];
$orderpayment->transaction_status = $data['res'];
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($data['vs']);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
if (empty($errors)) {
$return = JText::_('TIENDA CARDPAY MESSAGE PAYMENT SUCCESS');
return $return;
}
return count($errors) ? implode("\n", $errors) : '';
}
示例3: getRate
function getRate()
{
try {
$this->response = $this->getClient()->getRates($this->getRequest());
if ($this->response->HighestSeverity != 'FAILURE' && $this->response->HighestSeverity != 'ERROR') {
$this->processResponse($this->response);
return true;
} else {
$this->setError(Tienda::dump($this->response));
return false;
}
} catch (SoapFault $exception) {
$this->response = array();
$this->setError('E2', (string) $exception);
return false;
}
}
示例4: parseErrors
protected function parseErrors($code, $response, &$errors)
{
// Error!
if ($code != '200' || $code != '201') {
$result = simplexml_load_string($response);
foreach ($result as $r) {
$errors[] = $r->internalReason . ' (' . $r->code . ' : ' . $r->location . ' )';
}
echo Tienda::dump($errors);
die;
return false;
}
return true;
}
示例5: getRate
function getRate()
{
try {
$this->response = $this->getClient()->ProcessRate($this->getRequest());
if ($this->response->Response->ResponseStatus->Code != '0') {
$this->processResponse($this->response);
return true;
} else {
$this->setError(Tienda::dump($this->response));
return false;
}
} catch (SoapFault $exception) {
$this->response = $this->getClient()->__getLastResponse();
$this->setError((string) $exception . $this->getClient()->__getLastRequest());
return false;
}
}
示例6: toXml
/**
* The main function for converting to an XML document.
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
*
* @param array $data
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
* @param SimpleXMLElement $xml - should only be used recursively
* @param array $namespaces - the namespaces (like $namespace[] = array('url' => 'http://....', 'name' => 'xmlns:g')
*/
public function toXml($data, $rootNodeName = 'data', &$xml = null, $namespaces = null, $root_ns = null)
{
// First call: create document and root node
if (is_null($xml)) {
$this->doc = new DOMDocument('1.0', 'utf8');
// Root namespace
if ($root_ns) {
$root = $this->doc->createElementNS($root_ns, $rootNodeName);
}
$xml =& $root;
$this->doc->appendChild($root);
// Namespaces
foreach (@$namespaces as $ns) {
$root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:' . $ns['name'], $ns['url']);
}
}
// loop though the array
foreach ($data as $key => $value) {
// normal list of nodes
if (is_numeric($key)) {
$key = $rootNodeName;
}
// Attributes support
if ($key == $this->attr_arr_string) {
// Add attributes to node
foreach ($value as $attr_name => $attr_value) {
$att = $this->doc->createAttribute($attr_name);
$xml->appendChild($att);
$att->appendChild($this->doc->createTextNode($attr_value));
}
} else {
// Add the value if there was a value together with the att
if ($key == $this->value_string) {
// Add value to node
$xml->appendChild($this->doc->createTextNode($value));
} else {
// delete any char not allowed in XML element names
$key = preg_replace('/[^a-z0-9\\-\\_\\.\\:]/i', '', $key);
// if there is another array found recrusively call this function
if (is_array($value)) {
// create a new node unless this is an array of elements
if ($this->isAssoc($value)) {
$node = $this->doc->createElement($key);
$xml->appendChild($node);
} else {
$node = $xml;
}
// recrusive call - pass $key as the new rootNodeName
$this->toXml($value, $key, $node);
} else {
// Add a single value
$value = htmlentities($value);
$t = $this->doc->createElement($key);
$xml->appendChild($t);
$v = $this->doc->createTextNode($value);
$t->appendChild($v);
}
}
}
}
$this->doc->formatOutput = true;
echo Tienda::dump($this->doc->saveXML());
return $this->doc->saveXML();
}
示例7: _evaluateSimplePaymentResponse
//.........这里部分代码省略.........
default:
//
break;
}
break;
case 'risk_indicator':
switch ($value) {
default:
//
break;
}
break;
// case 'avs_indicator': // Response Code
// switch ($value)
// {
// case "INVALID":
// case "MALFORMED":
// case "ERROR":
// // Error
// $payment_status = '0';
// $order_status = '0';
// $errors[] = JText::_('Tienda Sagepayments Error processing payment');
// break;
// case "REJECTED":
// // Declined
// $payment_status = '0';
// $order_status = '0';
// $errors[] = JText::_('Tienda Sagepayments Card was declined');
// break;
// case "REGISTERED":
// case "OK":
// // Approved
// $payment_status = '1';
// break;
// default:
// break;
// }
// break;
}
}
if ($posted) {
// if the payment has been already processed, show the message only
return count($errors) ? implode("\n", $errors) : '';
}
// =======================
// verify & create payment
// =======================
// check that payment amount is correct for order_id
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load(array('order_id' => $submitted_values['T_ordernum']));
$orderpayment->transaction_details = Tienda::dump($resp);
$orderpayment->transaction_id = $exploded["reference"];
$orderpayment->transaction_status = $exploded["approval_message"];
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($submitted_values['T_ordernum']);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
if (empty($errors)) {
$return = JText::_('TIENDA SAGEPAYMENTS MESSAGE PAYMENT SUCCESS');
return $return;
}
$vars = new JObject();
$vars->message = implode("\n", $errors);
$html = $this->_getLayout('fail', $vars);
return $html;
}
示例8: getRates
/**
*
* Enter description here ...
* @param $address
* @param $orderItems
* @return unknown_type
*/
function getRates($address, $orderItems)
{
$rates = array();
if (empty($address->postal_code)) {
return $rates;
}
require_once dirname(__FILE__) . '/shipping_usps/usps.php';
// Use params to determine which of these is enabled
$services = $this->getServices();
$server_test = "http://testing.shippingapis.com/ShippingAPITest.dll";
$server = "http://production.shippingapis.com/ShippingAPI.dll";
$username = $this->params->get('username');
$password = $this->params->get('password');
$origin_zip = $this->shopAddress->zip;
$container = $this->params->get('packaging');
$country = $address->country_name;
$totalWeight = 0;
$packageCount = 0;
$packages = array();
foreach ($orderItems as $item) {
$product = JTable::getInstance('Products', 'TiendaTable');
$product->load($item->product_id);
if ($product->product_ships) {
$totalWeight = $totalWeight + $product->product_weight * $item->orderitem_quantity;
$packageCount = $packageCount + 1 * $item->orderitem_quantity;
}
}
//tienda bug 3207: the USPS API v2 only takes whole figures for the pounds field.
// fix: calculate the pounds and ounces based on the total weight in pounds (LB)
$totalPounds = floor($totalWeight);
$totalOunces = ceil(($totalWeight - $totalPounds) * 16);
foreach ($services as $service => $serviceName) {
$usps = new TiendaUSPS();
$usps->address = $address;
$usps->setServer($server);
$usps->setUserName($username);
$usps->setPass($password);
$usps->setService($service);
$usps->setDestZip($address->postal_code);
$usps->setOrigZip($origin_zip);
$usps->setWeight($totalPounds, $totalOunces);
$usps->setContainer($container);
$usps->setCountry($country);
$usps->setDebug($this->params->get('show_debug'));
$price = $usps->getPrice();
if (!empty($price->error) && is_object($price->error)) {
if ($this->params->get('show_debug')) {
echo Tienda::dump($price->error);
}
} else {
if (!empty($price->list)) {
foreach ($price->list as $p) {
if (get_class($p) == 'TiendaUSPSIntPrice') {
if ($totalWeight < $p->maxweight) {
$rate = array();
$rate['name'] = htmlspecialchars_decode($p->svcdescription . " (" . $p->svccommitments . ")");
$rate['code'] = $service;
$rate['price'] = $p->rate;
$rate['extra'] = "0.00";
$rate['total'] = $p->rate;
$rate['tax'] = "0.00";
$rate['element'] = $this->_element;
$rates[] = $rate;
}
} else {
$rate = array();
$rate['name'] = htmlspecialchars_decode($p->mailservice);
$rate['code'] = $service;
$rate['price'] = $p->rate;
$rate['extra'] = "0.00";
$rate['total'] = $p->rate;
$rate['tax'] = "0.00";
$rate['element'] = $this->_element;
$rates[] = $rate;
}
}
}
}
}
return $rates;
}
示例9: saveattributeoptionvalues
/**
* Saves the properties for all attribute option values in list
*
* @return unknown_type
*/
function saveattributeoptionvalues()
{
$error = false;
$this->messagetype = '';
$this->message = '';
$model = $this->getModel('productattributeoptionvalues');
$row = $model->getTable();
$id = JRequest::getInt('id', 0, 'request');
$cids = JRequest::getVar('cid', array(0), 'request', 'array');
$field = JRequest::getVar('field', array(0), 'request', 'array');
$operator = JRequest::getVar('operator', array(0), 'request', 'array');
$value = JRequest::getVar('value', array(0), 'request', 'array');
foreach (@$cids as $cid) {
$row->load($cid);
$row->productattributeoptionvalue_field = $field[$cid];
$row->productattributeoptionvalue_operator = $operator[$cid];
$row->productattributeoptionvalue_value = $value[$cid];
echo Tienda::dump($row);
if (!$row->check() || !$row->store()) {
$this->message .= $row->getError();
$this->messagetype = 'notice';
$error = true;
}
}
$row->reorder();
$productModel = $this->getModel('products');
$productModel->clearCache();
if ($error) {
$this->message = JText::_('COM_TIENDA_ERROR') . " - " . $this->message;
} else {
$this->message = "";
}
$redirect = "index.php?option=com_tienda&view=products&task=setattributeoptionvalues&id={$id}&tmpl=component";
$redirect = JRoute::_($redirect, false);
$this->setRedirect($redirect, $this->message, $this->messagetype);
}
示例10: defined
<?php
defined('_JEXEC') or die('Restricted access');
JHTML::_('script', 'tienda.js', 'media/com_tienda/js/');
$labels = @$vars->labels;
$order_id = @$vars->order_id;
echo Tienda::dump($vars->debug);
?>
<?php
foreach ($labels as $item) {
?>
<div class="productfile">
<span class="productfile_image">
<a href="<?php
echo JRoute::_('index.php?option=com_tienda&task=doTask&element=shipping_unex&elementTask=downloadfile&format=raw&id=' . $order_id . "&filename=" . $item);
?>
">
<img src="<?php
echo Tienda::getURL('images') . "download.png";
?>
" alt="<?php
echo JText::_('COM_TIENDA_DOWNLOAD');
?>
" style="height: 24px; padding: 5px; vertical-align: middle;" />
</a>
</span>
<span class="productfile_link" style="vertical-align: middle;" >
<a href="<?php
echo JRoute::_('index.php?option=com_tienda&task=doTask&element=shipping_unex&elementTask=downloadfile&format=raw&id=' . $order_id . "&filename=" . $item);
?>
示例11: getPrice
function getPrice()
{
$countries = array('USA', 'United States', 'United States Minor Outlying Islands');
if (in_array($this->country, $countries)) {
// may need to urlencode xml portion
$str = $this->server . "?API=RateV4&XML=<RateV4Request%20USERID=\"";
$str .= $this->user . "\"%20PASSWORD=\"" . $this->pass . "\"><Package%20ID=\"0\"><Service>";
if (strtolower($this->service) == 'first class') {
$str .= "ONLINE</Service>";
$str .= "<FirstClassMailType>" . $this->fcmailtype . "</FirstClassMailType>";
$myFirstClass = 1;
} else {
$str .= $this->service . "</Service>";
}
$str .= "<ZipOrigination>" . $this->orig_zip . "</ZipOrigination>";
$str .= "<ZipDestination>" . $this->dest_zip . "</ZipDestination>";
$str .= "<Pounds>" . $this->pounds . "</Pounds><Ounces>" . $this->ounces . "</Ounces>";
$str .= "<Container>" . urlencode($this->container) . "</Container><Size>" . $this->size . "</Size>";
$str .= "<Machinable>" . $this->machinable . "</Machinable></Package></RateV4Request>";
} else {
$str = $this->server . "?API=IntlRate&XML=<IntlRateRequest%20USERID=\"";
$str .= $this->user . "\"%20PASSWORD=\"" . $this->pass . "\"><Package%20ID=\"0\">";
$str .= "<Pounds>" . $this->pounds . "</Pounds><Ounces>" . $this->ounces . "</Ounces>";
$str .= "<MailType>Package</MailType><Country>" . urlencode($this->country) . "</Country></Package></IntlRateRequest>";
}
if ($this->show_debug) {
$sendStr = JText::_('COM_TIENDA_SENT_REQUEST') . ": ";
echo Tienda::dump($sendStr . $str);
}
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $str);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// grab URL and pass it to the browser
$ats = curl_exec($ch);
// close curl resource, and free up system resources
curl_close($ch);
$xmlParser = new TiendaUSPSXmlParser();
$array = $xmlParser->GetXMLTree($ats);
//debug(222222, $array);
//$xmlParser->printa($array);
if (!empty($array['ERROR'])) {
// If it is error
$error = new TiendaUSPSError();
$error->str = $str;
$error->level = "1";
$error->number = $array['ERROR'][0]['NUMBER'][0]['VALUE'];
$error->source = $array['ERROR'][0]['SOURCE'][0]['VALUE'];
$error->description = $array['ERROR'][0]['DESCRIPTION'][0]['VALUE'];
$error->helpcontext = $array['ERROR'][0]['HELPCONTEXT'][0]['VALUE'];
$error->helpfile = $array['ERROR'][0]['HELPFILE'][0]['VALUE'];
$this->error = $error;
$this->setError($error);
} else {
if (!empty($array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'])) {
$error = new TiendaUSPSError();
$error->str = $str;
$error->level = "2";
$error->number = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['NUMBER'][0]['VALUE'];
$error->source = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['SOURCE'][0]['VALUE'];
$error->description = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['DESCRIPTION'][0]['VALUE'];
$error->helpcontext = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPCONTEXT'][0]['VALUE'];
$error->helpfile = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPFILE'][0]['VALUE'];
$this->error = $error;
$this->setError($error);
} else {
if (!empty($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'])) {
//if it is international shipping error
$error = new TiendaUSPSError();
$error->str = $str;
$error->level = "3";
$error->number = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['NUMBER'][0]['VALUE'];
$error->source = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['SOURCE'][0]['VALUE'];
$error->description = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['DESCRIPTION'][0]['VALUE'];
$error->helpcontext = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPCONTEXT'][0]['VALUE'];
$error->helpfile = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPFILE'][0]['VALUE'];
$this->error = $error;
$this->setError($error);
} else {
if (!empty($array['RATEV4RESPONSE'])) {
// if everything OK
$this->zone = $array['RATEV4RESPONSE'][0]['PACKAGE'][0]['ZONE'][0]['VALUE'];
foreach ($array['RATEV4RESPONSE'][0]['PACKAGE'][0]['POSTAGE'] as $value) {
//debug(99999992, $value);
/* $curMailSvc = $value['MAILSERVICE'][0]['VALUE'];
echo "<script language=javascript>alert('".$curMailSvc."')</script>";*/
if (empty($myFirstClass) || $value['MAILSERVICE'][0]['VALUE'] == "First-Class Mail<sup>&reg;</sup> Package") {
$price = new TiendaUSPSPrice();
$price->mailservice = $value['MAILSERVICE'][0]['VALUE'];
$price->rate = $value['RATE'][0]['VALUE'];
$this->list[] = $price;
}
}
} else {
if (!empty($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['SERVICE'])) {
// if it is international shipping and it is OK
foreach ($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['SERVICE'] as $value) {
$price = new TiendaUSPSIntPrice();
$price->id = $value['ATTRIBUTES']['ID'];
//.........这里部分代码省略.........