|
Shop_OrderItem class
Represents an item of an order.
Objects of this class are created by LemonStand when a new order is placed. You may need to work
with order item objects on Order Details page and
Payment Receipt pages.
Public propertiesShow inherited properties.
Public methodsShow inherited methods.
Events
Property details¶ bundle_item_total propertypublic float $bundle_item_total;
Specifies a total price of a bundle item (total price of the bundle item in a single base product). If the order item does not represent a bundle item product, the field value matches the $total_price field value.
¶ bundle_item_total_tax_incl propertypublic float $bundle_item_total_tax_incl;
Specifies a total price of a bundle item, tax inclusive.
¶ bundle_master_order_item_id propertypublic integer $bundle_master_order_item_id;
Specifies an identifier of an order item representing base bundle product for this order item. This field is not empty for bundle item products.
¶ discount propertypublic float $discount;
Specifies the item discount value.
¶ discount_tax_included propertypublic float $discount_tax_included;
Specifies the the item discount amount, tax inclusive.
¶ price propertypublic float $price;
Specifies a price of a unit item without a price of extra options and without the discount applied.
¶ price_tax_included propertypublic float $price_tax_included;
Specifies the item price (including extras), tax inclusive.
¶ product propertypublic Shop_Product $product;
A product object associated with the order item.
¶ product_name propertypublic string $product_name;
Specifies a name of a product associated with the order item.
¶ product_sku propertypublic string $product_sku;
Specifies a SKU of a product associated with the order item.
¶ quantity propertypublic integer $quantity;
Specifies a quantity of the order item.
¶ single_price propertypublic float $single_price;
Specifies a price of a unit item, including a price of extra options. To get a total unit item price subtract the discount value from this property value.
¶ subtotal propertypublic float $subtotal;
Specifies the subtotal: (item price - discount)*quantity.
¶ subtotal_tax_incl propertypublic float $subtotal_tax_incl;
Specifies the subtotal, tax inclusive.
¶ tax propertypublic float $tax;
Specifies a sales tax value calculated for a unit item (ignoring the item quantity). The tax is calculated as the unit price + extra options prices.
¶ tax_2 propertypublic float $tax_2;
Specifies a second sales tax value, if applicable.
¶ tax_name_1 propertypublic string $tax_name_1;
Specifies a name of the first sales tax applied.
¶ tax_name_2 propertypublic string $tax_name_2;
Specifies a name of the second sales tax applied.
¶ uploaded_files propertypublic Db_DataCollection $uploaded_files;
A collection of files uploaded by the customer on the Product Details page. Each element in the collection is an object of the Db_File class.
Method details¶ convert_to_cart_item() methodpublic Shop_CartItem convert_to_cart_item()
Returns a cart item object with property values based on the order item properties.
A reference to the original order item is stored in the $order_item property of the
new cart item object.
¶ get_bundle_discount() methodpublic float get_bundle_discount()
Returns total discount of a bundle.
The discount includes discounts of all bundle items.
¶ get_bundle_item_quantity() methodpublic integer get_bundle_item_quantity()
Returns quantity of the bundle item product in each bundle.
If the order item does not represent a bundle item, returns the $quantity property value.
¶ get_bundle_single_price() methodpublic float get_bundle_single_price()
Returns unit price of a bundle. The price includes prices of all bundle items.
¶ get_bundle_total_price() methodpublic float get_bundle_total_price()
Returns total bundle price.
¶ get_extra_options() methodpublic array get_extra_options()
Returns an array of extra options selected by the customer.
Each element of the array is another array with 2 elements. The first elements corresponds
an option price, and the second element corresponds the option name. For example: array(12.5, 'Extra 125 Mb RAM')
If you need to extract a list of Shop_ExtraOption objects use
get_extra_option_objects() method.
¶ get_extra_option_objects() methodpublic array get_extra_option_objects()
Returns a list of extra options selected by the customer.
¶ get_master_bundle_order_item() methodpublic Shop_OrderItem get_master_bundle_order_item()
Returns order item representing a master bundle product for this item.
¶ get_om_record() methodpublic Shop_OptionMatrixRecord get_om_record()
Returns an Option Matrix record basing on selected product options.
¶ get_options() methodpublic array get_options()
Returns an array of product options selected by the customer.
Each element of the array is another array with keys corresponding option names and values
corresponding option values, for example: array('color'=>'yellow', 'size'=>'small')
¶ list_bundle_items() methodpublic array list_bundle_items()
Returns a list of order items representing bundle items which master product is represented by this item.
¶ om() methodpublic mixed om(string $property_name, mixed $options=NULL)
Returns Option Matrix product property.
If Option Matrix product is not associated with the order item, returns property value of
the base product. Specify the property name in the first parameter. Use the method on the
Order Details page or
Payment Receipt page to output
Option Matrix specific parameters, for example product images. The following example outputs a product
image in the order item list.
<? $images = $item->om('images'); $image_url = $images->count ? $images->first->getThumbnailPath(60, 'auto') : null; ?> <? if ($image_url): ?> <img class="product_image" src="<?= $image_url ?>" alt="<?= h($item->product->name) ?>"/> <? endif ?> See Also¶ output_product_name() methodpublic string output_product_name(boolean $output_name=true, boolean $as_plain_text=false, boolean $no_tax_incl=false, boolean $extra_details=false, string $options_delimiter='; ', boolean $lowercase_options=NULL)
Returns a string describing the order item.
The string contains the product name, options and extra options.
The result of this method can be customized with shop:onGetOrderItemDisplayDetails event.
See Also¶ total_depth() methodpublic float total_depth()
Returns the total depth of the order item.
The total depth is unit depth * quantity.
¶ total_height() methodpublic float total_height()
Returns the total width of the order item.
The total height is unit height * quantity.
¶ total_volume() methodpublic float total_volume()
Returns the total volume of the order item.
The total depth is unit volume * quantity.
¶ total_weight() methodpublic float total_weight()
Returns the total weight of the order item.
The total depth is unit weight * quantity.
¶ total_width() methodpublic float total_width()
Returns the total width of the order item.
The total depth is unit depth * quantity.
|