1. Go to this page and download the library: Download davidiwezulu/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/ */
davidiwezulu / ecommerce example snippets
use Davidiwezulu\Ecommerce\Facades\Cart;
Cart::addOrUpdate($productId, $quantity);
namespace App\Models;
use Davidiwezulu\Ecommerce\Models\Product as BaseProduct;
class Product extends BaseProduct
{
// Add your customizations here
/**
* Example of adding a new relationship.
*/
public function categories()
{
return $this->belongsToMany(Category::class);
}
/**
* Example of adding a custom method.
*/
public function calculateDiscountedPrice()
{
// Implement your discount logic here
}
}