1. Go to this page and download the library: Download beeralex/beeralex.catalog 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/ */
beeralex / beeralex.catalog example snippets
use Beeralex\Catalog\Service\CatalogService;
use Beeralex\Catalog\Service\Basket\BasketFactory;
// Получение товаров с предложениями и скидками
$catalogService = service(CatalogService::class);
$products = $catalogService->getProductsWithOffers([1, 2, 3], true, true);
// Работа с корзиной
$basketFactory = service(BasketFactory::class);
$basketService = $basketFactory->createBasketServiceForCurrentUser();
$basketService->increment($offerId = 123, $quantity = 2);
namespace App\Repository;
use Beeralex\Catalog\Repository\ProductsRepository as BaseRepository;
class ProductsRepository extends BaseRepository
{
public function getProducts(array $productIds, bool $onlyActive = true): array
{
$products = parent::getProducts($productIds, $onlyActive);
// Ваша дополнительная логика
return $products;
}
}
use Beeralex\Catalog\Enum\DIServiceKey;
use App\Repository\ProductsRepository;
return [
'services' => [
'value' => [
DIServiceKey::PRODUCT_REPOSITORY->value => [
'constructor' => static function () {
return new ProductsRepository(...);
}
],
]
]
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.