---
# System prepended metadata

title: Untitled

---

```js
function addProduct(product, name, details ,price , img ,category)

```

### parameters
- array
- name
- details

### return
- new array of objects

------

### global
- products (array)
- cart (array)


### product (seller)
- addProduct //Adham ,Alaa
- deleteProduct // Khamis
- updateProduct // Israa

### cart (buyer)
- addToCart(array, name, price, quantity) //Khamis , Israa
- deleteFromCart //Alaa
- clearCart // Adham

```js
products = addProduct(products, name, ...)
```

### search
- searchByName(array, text) => array // Adham ,Khamis
- `searchByName(array, text) => array`
- `searchByPrice(array, min, max) => array`
- `searchByCategory(array, cat) => array`
- `limitProducts(array, limit, page) => array`
- filterByPrice filterByCategory // Israa,Alaa 
- sortByPrice(array) => array //

## storage
- `saveToLocal(array)` //Adham,khamis 
- `loadFromLocal(array)` // Alaa , Israa
- `saveCartToLocal(array)` // 
-
```js
//save
saveLocal( JSON.stringify(products) )

//load
products = JSON.parse(productsFromLocal)

```
producs
cart


## display
- renderGrid(array)//alaa , Adham 
- renderList(array)
```js
function search(products, name='', minPrice=0, maxPrice=9999, category='all', limit=10, page=1 {

}



let results = searchByName(products, 'car')
results = searchByPrice(results, 0, 100)
results = searchByCategory(results, 'all')
results = limitProducts(results, 10, 1)

```