本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getChildrenItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getChildrenItems方法的具体用法?PHP Mage_Sales_Model_Order_Item::getChildrenItems怎么用?PHP Mage_Sales_Model_Order_Item::getChildrenItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getChildrenItems方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemHtml
public function getItemHtml(Mage_Sales_Model_Order_Item $item)
{
$warehouseData = $this->getWarehouseFlatArray();
$html = '';
$children = $item->getChildrenItems();
if (empty($children)) {
$children = array($item);
}
/** @var Mage_Sales_Model_Order_Item $childItem */
foreach ($children as $childItem) {
$serializedAdditionalData = $childItem->getAdditionalData();
if (empty($serializedAdditionalData)) {
continue;
}
$additionalData = unserialize($serializedAdditionalData);
$tmpHtml = sprintf('<tr class="border"><td><strong>%s</strong><br/><strong>SKU:</strong> %s</td>', $childItem->getName(), $childItem->getSku());
$tmpCount = 0;
foreach ($warehouseData as $wid => $wdata) {
$qty = 0;
if (array_key_exists($wid, $additionalData)) {
$qty = $additionalData[$wid];
}
$tmpCount += $qty;
$qty = $this->_formatQty($qty, $childItem->getIsQtyDecimal());
$tmpHtml .= '<td class="a-center" style="vertical-align:middle;">' . $qty . '</td>';
}
if ($tmpCount) {
$html .= $tmpHtml;
}
$html .= '</tr>';
}
return $html;
}
示例2: _needToAddDummyForShipment
/**
* Decides if we need to create dummy shipment item or not
* for eaxample we don't need create dummy parent if all
* children are not in process
*
* @deprecated after 1.4, Mage_Sales_Model_Service_Order used
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _needToAddDummyForShipment($item, $qtys)
{
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if ($child->getIsVirtual()) {
continue;
}
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
if ($item->isShipSeparately()) {
return true;
}
return false;
} else {
if ($item->getParentItem()) {
if ($item->getIsVirtual()) {
return false;
}
if (isset($qtys[$item->getParentItem()->getId()]) && $qtys[$item->getParentItem()->getId()] > 0) {
return true;
}
return false;
}
}
}
示例3: _needToAddDummy
/**
* Decides if we need to create dummy shipment item or not
* for eaxample we don't need create dummy parent if all
* children are not in process
*
* @deprecated after 1.4, Mage_Sales_Model_Service_Order used
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _needToAddDummy($item, $qtys)
{
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if ($child->getIsVirtual()) {
continue;
}
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0 || !isset($qtys[$child->getId()]) && $child->getQtyToShip()) {
return true;
}
}
return false;
} else {
if ($item->getParentItem()) {
if ($item->getIsVirtual()) {
return false;
}
if (isset($qtys[$item->getParentItem()->getId()]) && $qtys[$item->getParentItem()->getId()] > 0 || !isset($qtys[$item->getParentItem()->getId()]) && $item->getParentItem()->getQtyToShip()) {
return true;
}
return false;
}
}
}
示例4: _needToAddDummy
/**
* Decides if we need to create dummy invoice item or not
* for eaxample we don't need create dummy parent if all
* children are not in process
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _needToAddDummy($item, $qtys = array())
{
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if (empty($qtys)) {
if ($child->getQtyToInvoice() > 0) {
return true;
}
} else {
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
}
return false;
} else {
if ($item->getParentItem()) {
if (empty($qtys)) {
if ($item->getParentItem()->getQtyToInvoice() > 0) {
return true;
}
} else {
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
return false;
}
}
}
示例5: _needToAddDummy
/**
* Decides if we need to create dummy invoice item or not
* for eaxample we don't need create dummy parent if all
* children are not in process
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _needToAddDummy($item, $qtys)
{
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if (isset($qtys[$child->getId()]) && isset($qtys[$child->getId()]['qty']) && $qtys[$child->getId()]['qty'] > 0) {
return true;
}
}
return false;
} else {
if ($item->getParentItem()) {
if (isset($qtys[$item->getParentItem()->getId()]) && isset($qtys[$item->getParentItem()->getId()]['qty']) && $qtys[$item->getParentItem()->getId()]['qty'] > 0) {
return true;
}
return false;
}
}
}
示例6: _canRefundItem
/**
* Check if order item can be refunded
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @param array $invoiceQtysRefundLimits
* @return bool
*/
protected function _canRefundItem($item, $qtys = array(), $invoiceQtysRefundLimits = array())
{
if ($item->isDummy()) {
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if (empty($qtys)) {
if ($this->_canRefundNoDummyItem($child, $invoiceQtysRefundLimits)) {
return true;
}
} else {
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
}
return false;
} else {
if ($item->getParentItem()) {
$parent = $item->getParentItem();
if (empty($qtys)) {
return $this->_canRefundNoDummyItem($parent, $invoiceQtysRefundLimits);
} else {
return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0;
}
}
}
} else {
return $this->_canRefundNoDummyItem($item, $invoiceQtysRefundLimits);
}
}
示例7: _canRefundItem
/**
* Check if order item can be refunded
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _canRefundItem($item, $qtys = array())
{
if ($item->isDummy()) {
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if (empty($qtys)) {
if ($child->getQtyToRefund() > 0) {
return true;
}
} else {
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
}
return false;
} else {
if ($item->getParentItem()) {
$parent = $item->getParentItem();
if (empty($qtys)) {
return $parent->getQtyToRefund() > 0;
} else {
return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0;
}
}
}
} else {
return $item->getQtyToRefund() > 0;
}
}
示例8: _cancelItem
/**
* deletes item with all children
*
* @param Mage_Sales_Model_Order_Item $item
*/
private function _cancelItem($item)
{
$childItems = $item->getChildrenItems();
foreach ($childItems as $child) {
$this->_cancelItem($child);
}
$item->delete();
}
示例9: getItemProduct
/**
* Get the product the item represents.
*
* @param Mage_Sales_Model_Order_Item
* @return Mage_Catalog_Model_Product
*/
protected function getItemProduct(Mage_Sales_Model_Order_Item $item)
{
// When dealing with configurable items, need to get tax data from
// the child product and not the parent.
if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
$sku = $item->getSku();
$children = $item->getChildrenItems();
if ($children) {
/** @var Mage_Sales_Model_Order_Item $childItem */
foreach ($children as $childItem) {
$childProduct = $childItem->getProduct();
// If the SKU of the child product matches the SKU of the
// item, the simple product being ordered was found and should
// be used.
if ($childProduct->getSku() === $sku) {
return $childProduct;
}
}
}
}
return $item->getProduct() ?: Mage::getModel('catalog/product')->load($item->getProductId());
}