An open API service indexing awesome lists of open source software.

https://github.com/stnc/shopping-cart

Php Shopping Cart Class (easy and flexible)
https://github.com/stnc/shopping-cart

php php-shopping-cart shopping-cart

Last synced: 3 months ago
JSON representation

Php Shopping Cart Class (easy and flexible)

Awesome Lists containing this project

README

          

# PHP SHOPPING CART

php simple shopping cart class and html ajax example

# Install
```php
composer require stnc/shopping-cart
```


SCREENSHOT


## init
```php


// use use \Stnc\ShoppingCart\Cart;
$cart_name = 'stnc'; // sepetin session değerine bir değer atadık
$cart = new Cart($cart_name);
$cart->groups=false;
```
## ADDTOCART function

add to cart

```php
$data = array(
'productID' => 100,
'productName' => "ice cream",
'productImageURL' => "https://example.org/icecream.jpg",
'URL' => "https://example.org/product/100",
'price' => 40.99,
"totalEach" => 1,
'stockUnit'=>'unit',
"totalPrice" => 40.99
);
$cart->addToCart("100", $data);
echo '

';

print_r($cart->getArray());
echo '
';
```
## removeCart function

cart to remove

```php
$cart->removeCart(100);
echo '

';

print_r($cart->getArray());
echo '
';
```

## getJson function

cart json info

```php
$cart->getJson();
```

## viewCart function

## emptyCart function

cart empty
```php
$cart->emptyCart();
echo '

';

print_r($cart->getArray());
echo '
';
```

## getArray function

cart to result array
```php
echo '

';

print_r($cart->getArray());
echo '
';
```

//
print_r( $cart->cartCount());

## cartCount fonksiyonu

gives information about the total of items in the basket

```php
print_r($cart->cartCount());
```

## cartInfo fonksiyonu

Cart information
```php
print_r($cart->cartInfo());
```

```
demo page thx
https://startbootstrap.com/templates/heroic-features/