PHP code example of divineomega / exiguous-ecommerce
1. Go to this page and download the library: Download divineomega/exiguous-ecommerce library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$product = \DivineOmega\ExiguousEcommerce\Product::findBySlug("teddy-bear");
$basket = \DivineOmega\ExiguousEcommerce\Basket::findCurrent();
$basket->addProduct($product); // Add one Teddy Bear
$basket->addProduct($product, 2); // Add another two Teddy Bears!
var_dump($basket->items); // Outputs an array of, you guessed it, basket items! ^_^
// ^ This would show 1 basket item with a quantity of 3 teddy bears.
$product = \DivineOmega\ExiguousEcommerce\Product::findBySlug("teddy-bear");
$basket = \DivineOmega\ExiguousEcommerce\Basket::findCurrent();
$basket->removeProduct($product); // Removes all teddy bears from the basket
$product = \DivineOmega\ExiguousEcommerce\Product::findBySlug("teddy-bear");
$basket = \DivineOmega\ExiguousEcommerce\Basket::findCurrent();
$basket->addProduct($product); // Add one Teddy Bear
$basket->setProductQuantity($product, 10); // Set the number of Teddy Bears in the basket to ten
$basket->offsetProductQuantity($product, 10); // Add ten more Teddy Bears
$basket->offsetProductQuantity($product, -5); // Remove five of those Teddy Bears
// Retrieves settings from the core.json file within the .settings directory
$coreSettings = \DivineOmega\ExiguousEcommerce\Settings::find('core');
echo $coreSettings->data->primaryCurrency; // Output the ecommerce's primary currency setting
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.