Returns the sku of the given item dependant on the product type.

@param Mage_Sales_Model_Order_Item $item The item to return info from
@return String The sku
14501
protected function getItemSku($item)
    {
        if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
            return $item->getProductOptionByCode('simple_sku');
        }
        return $item->getSku();
    }
1315649
public function setProductWarehouseStockAction(InventoryItem $item)
    {
        $em = $this->getDoctrine()->getManager();
        /* @var WarehouseProductService $warehouseProductService */
        $warehouseProductService = $this->get('flower.stock.service.warehouse_product');
        $warehouseProduct = $warehouseProductService->getByWarehouseProduct($item->getInventory()->getWarehouse(), $item->getProduct());
        $item->setStock($warehouseProduct->getStock());
        $em->flush();
        return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $item->getInventory()->getId())));
    }
522056
public function item($item)
    {
        if (!$this->model) {
            $this->model = get_class($item);
        }

        $this->item = $item;

        return $this;
    }
290061
public function addItem($item){
		$itemO=$this->getItemToAdd($item);
		$this->addContent($itemO);
		return $itemO;
	}
509880
protected function getArrayItemsSeparator($item)
    {
        $cfg = $this->file->getRequire($this->configFile);

        if (!$cfg) {
            return $this->defaultSeparator;
        }

        $file = $this->getFileContents();

        $arr = array_get($cfg, $item);

        $lastItem = end($arr);
        $preLastItem = prev($arr);

        if (!$lastItem or !$preLastItem) {
            return $this->defaultSeparator;
        }

        preg_match('/\,/', $file, $matchStart, PREG_OFFSET_CAPTURE, strpos($file, $preLastItem));
        $start = array_get(reset($matchStart), 1);

        $searchEnd = preg_match('/[\'"]/', $file, $matchEnd, PREG_OFFSET_CAPTURE, $start);
        $end = array_get(reset($matchEnd), 1);

        $separator = substr($file, $start, $end - $start);

        // remove comments
        $separator = preg_replace('/\/\/.*/ui', '', $separator);
        $separator = preg_replace('/#.*/ui', '', $separator);
        $separator = preg_replace('/\/\*(.*)\*\//ui', '', $separator);

        return $separator;
    }
456158
public function getQty(StockItemInterface $item): UomQty
    {
        $units = $this->stockUnitRepository
            ->findByStockItem($item);

        return $this->computeQtyForUnits($item->getUom(), $units);
    }
280922
public function forItem(CartItem $item)
    {
        if (config('laracart.tax_item_before_discount')) {
            return $item->subTotal(false, false, false, true) * $this->value;
        }

        return $item->price * $this->value;
    }
337866
protected function getRenderedItem($item) {

        //@todo make getRenderedItem language dependent
        $lang = \common_session_SessionManager::getSession()->getDataLanguage();
        $qtiItem = Service::singleton()->getDataItemByRdfItem($item, $lang, true);
        if ($qtiItem) {
            $contentVariableElements = array_merge($this->getModalFeedbacks($qtiItem), $this->getRubricBlocks($qtiItem));

            /** @var AssetService $assetService */
            $assetService = ServiceManager::getServiceManager()->get(AssetService::SERVICE_ID);

            $taoBaseUrl = $assetService->getJsBaseWww( 'tao' );
            $qtiBaseUrl = $assetService->getJsBaseWww( 'taoQtiItem' );

            $taoLibUrl = $taoBaseUrl.'js/';
            $taoQtiItemLibUrl = $qtiBaseUrl.'js/';

            $xhtml = $qtiItem->toXHTML(array(
                'contentVariableElements' => $contentVariableElements,
                //  'js' => array($qtiBaseUrl.'js/preview/qtiViewSelector.js'),
                'js_var' => array('view' => $this->getRequestView()),
                // 'css' => array($qtiBaseUrl.'css/preview/qtiViewSelector.css'),
                'path' => array(
                    'tao' => $taoLibUrl,
                    'taoQtiItem' => $taoQtiItemLibUrl
                ),
                'client_config_url' => $this->getClientConfigUrl()

            ));
        } else {
            \common_Logger::i('Try to preview an empty item', [$item->getUri()]);
            $xhtml = '';
        }

        return $xhtml;
    }
1157920
public function deleteItemAction(Item $item) {
        $em = $this->getDoctrine()->getManager();
        $em->remove($item);
        $em->flush();

        $view = $this->view();

        return $this->handleView($view);
    }
674753
protected function getItemLineCreditNote(\Mage_Sales_Model_Order_Creditmemo_Item $item)
    {
        $result = array();

        $this->addPropertySource('item', $item);

        $this->addProductInfo($result);

        $productPriceEx = -((float) $item->getBasePrice());
        $productPriceInc = -((float) $item->getBasePriceInclTax());
        $lineVat = -((float) $item->getBaseTaxAmount() + (float) $item->getBaseHiddenTaxAmount());

        // Check for cost price and margin scheme.
        if (!empty($line['costPrice']) && $this->allowMarginScheme()) {
            // Margin scheme:
            // - Do not put VAT on invoice: send price incl VAT as unitprice.
            // - But still send the VAT rate to Acumulus.
            $result[Tag::UnitPrice] = $productPriceInc;
        } else {
            // Add price info.
            $result += array(
                Tag::UnitPrice => $productPriceEx,
                Meta::UnitPriceInc => $productPriceInc,
                Meta::RecalculatePrice => $this->productPricesIncludeTax() ? Tag::UnitPrice : Meta::UnitPriceInc,
                Meta::LinesVatAmount => $lineVat,
            );
        }
        $result[Tag::Quantity] = $item->getQty();

        // Add VAT related info.
        $orderItemId = $item->getOrderItemId();
        if (!empty($orderItemId)) {
            $orderItem = $item->getOrderItem();
            $result += array(
                Tag::VatRate => $orderItem->getTaxPercent(),
                Meta::VatRateSource => static::VatRateSource_Exact,
            );
        } else {
            $result += $this->getVatRangeTags($lineVat / $item->getQty(), $productPriceEx, 0.02, $this->productPricesIncludeTax() ? 0.02 : 0.01);
            $result[Meta::FieldsCalculated][] = Meta::VatAmount;
        }

        // Add vat meta data.
        /** @var \Mage_Catalog_Model_Product $product */
        $product = \Mage::getModel('catalog/product');
        $product->getResource()->load($product, $item->getProductId());
        if ($product->getId()) {
            /** @noinspection PhpUndefinedMethodInspection */
            $result += $this->getTaxClassMetaData((int) $product->getTaxClassId());
        }

        // Add discount related info.
        if (!Number::isZero($item->getBaseDiscountAmount())) {
            // Credit note: discounts are cancelled, thus amount is positive.
            $result[Meta::LineDiscountAmountInc] = $item->getBaseDiscountAmount();
        }

        // On a credit note we only have single lines, no compound lines, thus
        // no children that might have to be added.

        $this->removePropertySource('item');

        return $result;
    }
677814
protected function get_item_title( array $item ) {

		if ( isset( $item['taxonomy'] ) ) {
			$tax = get_taxonomy( $item['taxonomy'] );
			if ( $tax ) {
				if ( ! empty( $tax->exclusive ) ) {
					return $tax->labels->singular_name;
				} else {
					return $tax->labels->name;
				}
			} else {
				return $item['taxonomy'];
			}
		} elseif ( isset( $item['post_field'] ) ) {
			return ucwords( trim( str_replace( [
				'post_',
				'_',
			], ' ', $item['post_field'] ) ) );
		} elseif ( isset( $item['meta_key'] ) ) {
			return ucwords( trim( str_replace( [
				'_',
				'-',
			], ' ', $item['meta_key'] ) ) );
		} elseif ( isset( $item['connection'] ) && isset( $item['field'] ) && isset( $item['value'] ) ) {

			$fallback = ucwords( trim( str_replace( [
				'_',
				'-',
			], ' ', $item['value'] ) ) );

			if ( ! function_exists( 'p2p_type' ) || ! $this->p2p_connection_exists( $item['connection'] ) ) {
				return $fallback;
			}

			$ctype = p2p_type( $item['connection'] );
			if ( ! $ctype ) {
				return $fallback;
			}

			if ( isset( $ctype->fields[ $item['field'] ]['values'][ $item['value'] ] ) ) {
				if ( '' === trim( $ctype->fields[ $item['field'] ]['values'][ $item['value'] ] ) ) {
					return $ctype->fields[ $item['field'] ]['title'];
				} else {
					return $ctype->fields[ $item['field'] ]['values'][ $item['value'] ];
				}
			}

			return $fallback;

		} elseif ( isset( $item['connection'] ) ) {
			if ( function_exists( 'p2p_type' ) && $this->p2p_connection_exists( $item['connection'] ) ) {
				$ctype = p2p_type( $item['connection'] );
				if ( $ctype ) {
					$other = ( 'from' === $ctype->direction_from_types( 'post', $this->cpt->post_type ) ) ? 'to' : 'from';
					return $ctype->side[ $other ]->get_title();
				}
			}
			return $item['connection'];
		}

	}
140893
protected function htmlEntityEncode($item)
    {
        if (is_array($item)) {
            array_walk_recursive($item, function (&$value) {
                $value = htmlentities($value);
            });
        } else {
            $item = htmlentities($item);
        }

        return $item;
    }
469600
public function get_item_value($item) {
        if ($this->structure instanceof mod_feedback_completion) {
            return $this->structure->get_item_value($item);
        }
        return null;
    }
325896
public function __item($item = null)
    {
        $result['name'] = $this->getName();
        $result['content'] = '0';
        $result['active'] = is_null($item) ? true : $item['active'];
        $result['settings'] = Eresus_CMS::getLegacyKernel()->db->
            escape(is_null($item) ? encodeOptions($this->settings) : $item['settings']);
        $result['title'] = $this->title;
        $result['version'] = $this->version;
        $result['description'] = $this->description;
        return $result;
    }
1254852
public function getType($item)
    {
        switch ($this->getProductType($item)) {
            case Bundle::TYPE_CODE:
                return $this->bundle->create()->setItem($item);
            case Grouped::TYPE_CODE:
                return $this->grouped->create()->setItem($item);
            case Configurable::TYPE_CODE:
                return $this->configurable->create()->setItem($item);
            default:
                return $this->generic->create()->setItem($item);
        }
    }
1312353
public function compare( MShop_Order_Item_Base_Product_Interface $item )
	{
		if( $this->getFlags() === $item->getFlags()
			&& $this->getName() === $item->getName()
			&& $this->getProductCode() === $item->getProductCode()
			&& $this->getSupplierCode() === $item->getSupplierCode()
			&& $this->getPrice()->compare( $item->getPrice() ) === true
		) {
			return true;
		}

		return false;
	}
423516
protected function getItemLine(array $item)
    {
        $result = array();

        $this->addPropertySource('item', $item);

        $this->addProductInfo($result);
        $sign = $this->invoiceSource->getSign();

        // Check for cost price and margin scheme.
        if (!empty($line['costPrice']) && $this->allowMarginScheme()) {
            // Margin scheme:
            // - Do not put VAT on invoice: send price incl VAT as unitprice.
            // - But still send the VAT rate to Acumulus.
            $result[Tag::UnitPrice] = $sign * $item['unit_price_tax_incl'];
        } else {
            $result[Tag::UnitPrice] = $sign * $item['unit_price_tax_excl'];
            $result[Meta::UnitPriceInc] = $sign * $item['unit_price_tax_incl'];
            $result[Meta::LineAmount] = $sign * $item['total_price_tax_excl'];
            $result[Meta::LineAmountInc] = $sign * $item['total_price_tax_incl'];
            if (!Number::floatsAreEqual($item['unit_amount'], $result[Meta::UnitPriceInc] - $result[Tag::UnitPrice])) {
                $result[Meta::LineDiscountVatAmount] = $item['unit_amount'] - ($result[Meta::UnitPriceInc] - $result[Tag::UnitPrice]);
            }
        }
        $result[Tag::Quantity] = $item['product_quantity'];

        // Get vat rate:
        // The field 'rate' comes from order->getOrderDetailTaxes() and is only
        // defined for orders and was not filled in before PS1.6.1.1. So, check
        // if the field is available.
        // The fields 'unit_amount' and 'total_amount' (table order_detail_tax)
        // are based on the discounted product price and thus cannot be used to
        // get the vat rate.
        if (isset($item['rate'])) {
            $result[Tag::VatRate] = $item['rate'];
            $result[Meta::VatRateSource] = Creator::VatRateSource_Exact;
        } else {
            // Precision: 1 of the amounts, probably the prince incl tax, is
            // entered by the admin and can thus be considered exact. The other
            // is calculated by the system and not rounded and can thus be
            // considered to have a precision better than 0.0001
            $result += $this->getVatRangeTags($sign * ($item['unit_price_tax_incl'] - $item['unit_price_tax_excl']),
                $sign * $item['unit_price_tax_excl'],
                $this->precision, $this->precision);
        }
        $result += $this->getVatRateLookupMetadata($this->order->id_address_invoice, $this->getItemLineTaxRuleGroupId($item));

        $result[Meta::FieldsCalculated][] = Meta::VatAmount;

        $this->removePropertySource('item');
        return $result;
    }