Esempio n. 1
0
function getProducts($categoryID, $mustBeInIDs = array(), $skip = null, $limit = null, $manufacturerIDs = array(), $attributes = array(), $find = '', $findInName = '')
{
    $products = new \cf\ProductsInSubtree($categoryID);
    $products->mustBeIn($mustBeInIDs);
    $products->filterByManufacturers($manufacturerIDs);
    $products->filterByAttributes($attributes);
    $products->filterBySellers($sellerIDs);
    $find = trim($find);
    if (strlen($find)) {
        $products->find($find);
    }
    if (strlen($findInName)) {
        $products->findByNameModel($findInName);
    }
    $prodList = $products->getList($skip, $limit);
    $l = array();
    foreach ($prodList as $product) {
        $l[] = $product->toArray();
    }
    return $l;
}
Esempio n. 2
0
function getProducts($groupID, $mustBeInIDs = array(), $manufacturerIDs = array(), $attributes = array(), $find = '', $tag = '', $sellerIDs = array(), $skip = null, $limit = null)
{
    $products = new \cf\ProductsInSubtree($groupID);
    $products->mustBeIn($mustBeInIDs);
    $products->filterByManufacturers($manufacturerIDs);
    $products->filterByAttributes($attributes);
    $products->filterBySellers($sellerIDs);
    $find = trim($find);
    if (strlen($find)) {
        $products->find($find);
    }
    $prodList = $products->getList($skip, $limit);
    $l = array();
    foreach ($prodList as $product) {
        $l[] = array($product->id(), $product->code(), $product->name(), $product->model(), $product->fullName(), $product->image(), $product->manufacturerName(), $product->manufacturerId(), $product->price(), $product->rating(), $product->sellerId(), $product->sellerName(), $product->sellerLink(), $product->link(), $product->article(), $product->stateId(), $product->state());
    }
    return $l;
}