Interchange6::Schema::ResultSet::Product
Provides extra accessor methods for Interchange6::Schema::Result::Product
See also DBIx::Class::Helper::ResultSet::Shortcut which is loaded by this result set.
Returns all rows where "active" in Interchange6::Schema::Result::Product is true.
Returns all rows where "canonical_sku" in Interchange6::Schema::Result::Product is null, i.e. only canonical products.
This is just a shortcut for:
$self->columns( [ 'sku', 'name', 'uri', 'price', 'short_description' ] ) ->with_average_rating ->with_lowest_selling_price ->with_highest_price ->with_quantity_in_stock ->with_variant_count
Though in addition if you pass in arguments these are passed through to the appropriate with_* method so you can do:
$self->listing({ quantity => 10 })
And the result will be:
$self->columns( [ 'sku', 'name', 'uri', 'price', 'short_description' ] ) ->with_average_rating ->with_lowest_selling_price({ quantity => 10 }) ->with_highest_price ->with_quantity_in_stock ->with_variant_count
Adds average_rating column which is available to order_by clauses and whose value can be retrieved via "average_rating" in Interchange6::Schema::Result::Product.
average_rating
This is the average rating across all public and approved product reviews or undef if there are no reviews. Product reviews are only related to canonical products so for variants the value returned is that of the canonical product.
Prefetch related active Interchange6::Schema::Result::Media where "type" in Interchange6::Schema::Result::MediaType is $type.
$type
$type defaults to image if not provided.
image
Adds quantity_in_stock column which is available to order_by clauses and whose value can be retrieved via "quantity_in_stock" in Interchange6::Schema::Result::Product.
quantity_in_stock
The value is retrieved is "quantity" in Interchange6::Schema::Result::Inventory.
For a product variant and for a canonical product with no variants the quantity returned is for the product itself.
For a canonical (parent) product the quantity returned is the total for all its variants.
Arguments should be given as a hash reference with the following keys/values:
quantity => $quantity
quantity defaults to 1 if not supplied.
quantity
The lowest of "price" in Interchange6::Schema::Result::PriceModifier and "price" in Interchange6::Schema::Result::Product.
For products with variants this is the lowest variant selling_price.
Value is placed in the column selling_price.
selling_price
If "current_user" in Schema is defined then any roles assigned to that user will be included in the search of Interchange6::Schema::Result::PriceModifier.
For canonical products with no variants and for variant products highest_price is always undef. For canonical products that have variants this is the highest of "price" in Interchange6::Schema::Result::Product of the variants.
highest_price
Adds column variant_count which is a count of variants of each product.
variant_count
To install Interchange6::Schema, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Interchange6::Schema
CPAN shell
perl -MCPAN -e shell install Interchange6::Schema
For more information on module installation, please visit the detailed CPAN module installation guide.