|
NAMEInterchange6::Schema::Result::ProductDESCRIPTIONThe products table contains three product types parent, child and single.
ACCESSORSimageThis simple accessor is available to resultset searches which wish to add column "image" to stash an image in the result.skuSKU used by shop.Primary key. manufacturer_skuManufacturer's sku.Is nullable. nameThe name used to identify the product.short_descriptionA brief summary of the product.descriptionFull product description.priceNumeric value representing product cost.Defaults to 0. When "price" is updated and product has related "discount" in Interchange6::Schema::Result::PriceModifier then also update the related "price" in Interchange6::Schema::Result::PriceModifier. This is done using the method "update_price_modifiers". uriUnique product uri. Example "acme-pro-dumbbells". Is nullable.weightNumeric weight of the product. Defaults to zero.priorityDisplay order priority.gtinUnique EAN or UPC type data. Is nullable.canonical_skuThe SKU of the main product if this product is a variant of a main product. Is nullable.activeIs this product active? Default is yes.inventory_exemptIs this product exempt from inventory? Default is no.combineIndicate whether products with the same SKU should be combined in the Cart.Defaults to true. createdDate and time when this record was created returned as DateTime object. Value is auto-set on insert.last_modifiedDate and time when this record was last modified returned as DateTime object. Value is auto-set on insert and update.RELATIONScanonicalType: belongs_toRelated object: Interchange6::Schema::Result::Product variantsType: has_manyRelated object: Interchange6::Schema::Result::Product cart_productsType: has_manyRelated object: Interchange6::Schema::Result::CartProduct price_modifiersType: has_manyRelated object: Interchange6::Schema::Result::PriceModifier inventoryType: might_haveRelated object: Interchange6::Schema::Result::Inventory media_productsType: has_manyRelated object: Interchange6::Schema::Result::MediaProduct merchandising_productsType: has_manyRelated object: Interchange6::Schema::Result::MerchandisingProduct merchandising_product_relatedType: has_manyRelated object: Interchange6::Schema::Result::MerchandisingProduct navigation_productsType: has_manyRelated object: Interchange6::Schema::Result::NavigationProduct navigationType: many_to_many with navigationorderlinesType: has_manyRelated object: Interchange6::Schema::Result::Orderline product_attributesType: has_manyRelated object: Interchange6::Schema::Result::ProductAttribute mediaType: many_to_many with mediaproduct_messagesType: has_manyRelated object: Interchange6::Schema::Result::ProductMessage messagesType: many_to_manyAccessor to related Message results. METHODSAttribute methods are provided by the Interchange6::Schema::Base::Attribute class.insertOverride inherited method to call "generate_uri" method in case "name" and "sku" have been supplied as arguments but "uri" has not.update_price_modifiersCalled when "price" is updated.generate_uri($attrs)Called by "new" if no uri is given as an argument.The following steps are taken: 1. Join
"$self->name" and
"$self->uri" with
"-" and stash in
$uri to allow manipulation via filters
2. Remove leading and trailing spaces and replace remaining spaces and "/" with "-" 3. Search for all rows in Interchange6::Schema::Result::Setting where "scope" is "Product" and "name" is <generate_uri_filter> 4. For each row found eval "$row->value" 5. Finally set the value of column "uri" to $uri Filters stored in Interchange6::Schema::Result::Setting are executed via eval and have access to $uri and also the product result held in $self Examples of filters stored in Setting might be: { scope => 'Product', name => 'generate_uri_filter', value => '$uri =~ s/badstuff/goodstuff/gi', }, { scope => 'Product', name => 'generate_uri_filter', value => '$uri = lc($uri)', }, pathProduces navigation path for this product. Returns array reference in scalar context.Uses $type to select specific taxonomy from navigation if present. selling_priceArguments should be given as a hash reference with the following keys/values:
PriceModifier rows which have "roles_id" undefined are always included in the search in addition to any "roles" that belonging to "logger_in_user" in Schema. This enables promotional prices to be specified between fixed dates in "price" in Interchange6::Schema::Result::PriceModifier to apply to all classes of user whether logged in or not. Returns lowest price from "price" and "price" in Interchange6::Schema::Result::PriceModifier. Throws exception on bad arguments though unexpected keys in the hash reference will be silently discarded. If the query was constructed using "with_lowest_selling_price" in Interchange6::Schema::ResultSet::Product then the cached value will be used rather than running a new query UNLESS arguments are supplied in which case a new query is performed. highest_priceIf this is a canonical product without variants or a variant product then this method will return undef. If highest price is the same as "selling_price" then we again return undef.If the query was constructed using "with_highest_price" in Interchange6::Schema::ResultSet::Product then the cached value will be used rather than running a new query. This method calls "variant_count" and "selling_price" so when constructing a resultset query consider also chaining the associated ResultSet methods. find_variant \%input [\%match_info]Find product variant with the given attribute values in $input.Returns variant in case of success. Returns undef in case of failure. You can pass an optional hash reference \%match_info which is filled with attribute matches (only valid in case of failure). attribute_iterator( %args )
Return a hashref of attributes keyed on attribute name instead of an arrayref.
Set the 'selected' SKU. For a child product this is set automatically.
Search condition to use. Default is: { 'attribute.type' => 'variant' }
Ordering to use in query. Default is: [ { -desc => 'attribute.priority' }, { -asc => 'attribute.title' }, { -desc => 'attribute_value.priority' }, { -asc => 'attribute_value.title' }, ] Set the 'selected' SKU. For a child product this is set automatically.
For canonical products, it shows all the attributes of the child products. For a child product, it shows all the attributes of the siblings. Example of returned arrayref: [ { attribute_values => [ { priority => 2, selected => 0, title => "Pink", value => "pink" }, { priority => 1, selected => 0, title => "Yellow", value => "yellow" } ], name => "color", priority => 2, title => "Color" }, { attribute_values => [ { priority => 2, selected => 0, title => "Small", value => "small" }, { priority => 1, selected => 0, title => "Medium", value => "medium" }, ], name => "size", priority => 1, title => "Size" } ] add_variants @variantsAdd variants from a list of hash references.Returns product object. Each hash reference contains attributes and column data which overrides data from the canonical product. The canonical sku of the variant is automatically set. Example for the hash reference (attributes in the first line): {color => 'yellow', size => 'small', sku => 'G0001-YELLOW-S', name => 'Six Small Yellow Tulips', uri => 'six-small-yellow-tulips'} Since there is a risk that attributes names might clash with Product column names (for example "weight") an improved syntax exists to prevent such problems. This is considered to be the preferred syntax: { sku => 'ROD00014-2-6-mid', uri => 'fishingrod-weight-2-length-6-flex-mid', price => 355, attributes => [ { weight => '2' }, { length => '6' }, { action => 'mid' }, ], } discount_percentIf "selling_price" is lower than "price" returns the rounded percentage discount or undef.NOTE: for parent products (products that have variants) this will always return undef. media_by_typeReturn a Media resultset with the related media, filtered by type (e.g. video or image). On the results you can call "display_uri("type")" to get the actual uri.product_reviewsReviews should only be associated with parent products.This method returns the related Interchange6::Schema::Result::ProductMessage records for a parent product where the related Interchange6::Schema::Result::Message has "name" in Interchange6::Schema::Result::MessageType of "product_review". For a child product the ProductReview records for the parent are returned. reviewsReviews should only be associated with parent products. This method returns the related Message (reviews) records for a parent product. For a child product the Message records for the parent are returned.
Arguments are passed as paremeters to search the related reviews. top_reviewsReturns the highest-rated approved public reviews for this product. Argument is max number of reviews to return which defaults to 5.variant_countReturns the number of variants of this product.has_variantsAlias for "variant_count" for backwards-compatibility.average_ratingReturns the average rating across all public and approved product reviews or undef if there are no reviews. Optional argument number of decimal places of precision must be a positive integer less than 10 which defaults to 1.If the query was constructed using "with_average_rating" in Interchange6::Schema::ResultSet::Product then the cached value will be used rather than running a new query. add_to_reviewsReviews should only be associated with parent products. This method returns the related ProductReview records for a parent product. For a child product the ProductReview records for the parent are returned.set_reviews
Similar to "set_$rel" in DBIx::Class::Relationship::Base except that this method DOES delete objects in the table on the right side of the relation. quantity_in_stockReturns undef if inventory_exempt is true and otherwise returns the quantity of the product in the inventory. For a product variant the quantity returned is for the variant itself whereas for a canonical (parent) product the quantity returned is the total for all variants.If the query was constructed using "with_quantity_in_stock" in Interchange6::Schema::ResultSet::Product then the cached value will be used rather than running a new query. deleteOverload delete to force removal of any product reviews. Only parent products should have reviews so in the case of child products no attempt is made to delete reviews.
Visit the GSP FreeBSD Man Page Interface. |