本文整理汇总了PHP中Resource::convertField方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::convertField方法的具体用法?PHP Resource::convertField怎么用?PHP Resource::convertField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource::convertField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertField
/**
* Convert Customer custom values
*
* @param string $name Field name
* @param mixed $value Field value
* @return mixed Converted value
*/
protected function convertField($name, $value)
{
if ($name == 'addresses') {
$addresses = array();
foreach ($value as $address) {
$addresses[] = array('customerAddressID' => $address->customerAddressID, 'customerID' => $address->customerID, 'customerAddressIsDefaultBilling' => $address->customerAddressIsDefaultBilling, 'customerAddressIsDefaultShipping' => $address->customerAddressIsDefaultShipping, 'customerAddressFirstName' => $address->customerAddressFirstName, 'customerAddressLastName' => $address->customerAddressLastName, 'customerAddressCompany' => $address->customerAddressCompany, 'customerAddressLine1' => $address->customerAddressLine1, 'customerAddressLine2' => $address->customerAddressLine2, 'customerAddressCity' => $address->customerAddressCity, 'cityID' => $address->cityID, 'stateCode' => $address->stateCode, 'countryCode' => $address->countryCode, 'customerAddressZip' => $address->customerAddressZip, 'customerAddressPhone' => $address->customerAddressPhone, 'customerAddressFax' => $address->customerAddressFax, 'customerAddressVatNumber' => $address->customerAddressVatNumber, 'customerAddressTaxNumber' => $address->customerAddressTaxNumber, 'customerAddressTaxOffice' => $address->customerAddressTaxOffice, 'customerAddressPersonalNumber' => $address->customerAddressPersonalNumber, 'customerAddressInvoiceContactPerson' => $address->customerAddressInvoiceContactPerson, 'customerAddressIsCompany' => $address->customerAddressIsCompany, 'customerAddressBankName' => $address->customerAddressBankName, 'customerAddressBankAccount' => $address->customerAddressBankAccount);
}
return $addresses;
}
return parent::convertField($name, $value);
}
示例2: convertField
/**
* Convert Order custom values
*
* @param string $name Field name
* @param mixed $value Field value
* @return mixed Converted value
*/
protected function convertField($name, $value)
{
if ($name == 'items') {
$items = array();
foreach ($value as $item) {
$items[] = array('orderItemID' => $item->orderItemID, 'orderID' => $item->orderID, 'parentOrderItemID' => $item->parentOrderItemID, 'productID' => $item->productID, 'productVariantID' => $item->productVariantID, 'productImageID' => $item->productImageID, 'orderItemProductCode' => $item->orderItemProductCode, 'orderItemProductName' => $item->orderItemProductName, 'orderItemCustomerLanguageProductName' => $item->orderItemCustomerLanguageProductName, 'orderItemCategoryName' => $item->orderItemCategoryName, 'orderItemCustomerLanguageCategoryName' => $item->orderItemCustomerLanguageCategoryName, 'orderItemBrandName' => $item->orderItemBrandName, 'orderItemCustomerLanguageBrandName' => $item->orderItemCustomerLanguageBrandName, 'orderItemQty' => $item->orderItemQty, 'orderItemDiscount' => $item->orderItemDiscount, 'orderItemPrice' => $item->orderItemPrice, 'orderItemDistributorPrice' => $item->orderItemDistributorPrice, 'orderItemTotal' => $item->orderItemTotal, 'orderItemTaxesAmount' => $item->orderItemTaxesAmount, 'orderItemTaxesRate' => $item->orderItemTaxesRate, 'orderItemCustomerCurrencyDiscount' => $item->orderItemCustomerCurrencyDiscount, 'orderItemCustomerCurrencyPrice' => $item->orderItemCustomerCurrencyPrice, 'orderItemCustomerCurrencyTotal' => $item->orderItemCustomerCurrencyTotal, 'orderItemCustomerCurrencyTaxesAmount' => $item->orderItemCustomerCurrencyTaxesAmount, 'orderItemBonusPointsSpent' => $item->orderItemBonusPointsSpent, 'shippingModuleID' => $item->shippingModuleID, 'orderItemShippingMethodCode' => $item->orderItemShippingMethodCode, 'orderItemShippingModuleName' => $item->orderItemShippingModuleName, 'orderItemCustomerLanguageShippingModuleName' => $item->orderItemCustomerLanguageShippingModuleName, 'orderItemShippingMethodName' => $item->orderItemShippingMethodName, 'orderItemCustomerLanguageShippingMethodName' => $item->orderItemCustomerLanguageShippingMethodName, 'vendorID' => $item->vendorID, 'orderItemVendorName' => $item->orderItemVendorName, 'vendorOrderID' => $item->vendorOrderID, 'vendorOrderCreateTimestamp' => $item->vendorOrderCreateTimestamp, 'orderItemOriginalProductCode' => $item->orderItemOriginalProductCode);
}
return $items;
}
if ($name == 'totalLines') {
$totalLines = array();
foreach ($value as $totalLine) {
$totalLines[] = array('orderTotalLineID' => $totalLine->orderTotalLineID, 'orderID' => $totalLine->orderID, 'orderTotalLineType' => $totalLine->orderTotalLineType, 'orderTotalLineName' => $totalLine->orderTotalLineName, 'orderTotalLineCustomerLanguageName' => $totalLine->orderTotalLineCustomerLanguageName, 'orderTotalLineAmount' => $totalLine->orderTotalLineAmount, 'orderTotalLineCustomerCurrencyAmount' => $totalLine->orderTotalLineCustomerCurrencyAmount, 'orderTotalLineSort' => $totalLine->orderTotalLineSort);
}
return $totalLines;
}
return parent::convertField($name, $value);
}
示例3: convertField
/**
* Convert Product custom values
*
* @param string $name Field name
* @param mixed $value Field value
* @return mixed Converted value
*/
protected function convertField($name, $value)
{
if ($name == 'categories') {
$categories = array();
foreach ($value as $category) {
$categories[] = array('categoryID' => $category->categoryID);
}
return $categories;
}
if ($name == 'images') {
$images = array();
foreach ($value as $image) {
$images[] = array('productImageID' => $image->productImageID, 'productImage' => $image->productImage, 'productImageWidth' => $image->productImageWidth, 'productImageHeight' => $image->productImageHeight, 'productImageSize' => $image->productImageSize, 'productImageSort' => $image->productImageSort, 'productImageFeaturedStyle' => $image->productImageFeaturedStyle);
}
return $images;
}
return parent::convertField($name, $value);
}