E-commerce solution for October CMS
This plugin is under heavy development. Don't use it in production yet. A first production ready version is
planned to be released towards the end of 2019.
# All your existing data will be erased!
php artisan mall:seed-demo
The price for a Product
or Variant
model is stored as an array of currency values.
The following accessors and
methods are also available for alternative price columns such as old_price
. Simply modify the property/method names
accordingly.
You can access the pricing information by accessing the price
property directly:
print_r($product->price);
[
"CHF" => 20.50,
"EUR" => 21.50
]
You can get all prices as a formatted string by accessing the price_formatted
property:
print_r($product->price_formatted);
[
"CHF" => 'CHF 20.50',
"EUR" => '21.50 €'
]
You can get the price in a specific currency by calling the priceInCurrency
, priceInCurrencyFormatted
or
priceInCurrencyInteger
methods.
echo $product->priceInCurrency();
> 20.50
echo $product->priceInCurrency('EUR');
> 21.50
echo $product->priceInCurrencyInteger();
> 2050
echo $product->priceInCurrencyFormatted();
> 'CHF 20.50'
echo $product->priceInCurrencyFormatted('EUR');
> '21.50 €'
You can use the following methods to access product images:
// Get the first image of the main image set
$product->main_image;
// Get all images except the main image
$product->images;
// Get all available images, including the main image
$product->all_images;