ProductManager
class ProductManager implements BasicEntityManagerInterface, ProductManagerInterface, CSVManagerInterface, JQGridInterface
Class ProductManager is injected as alligator.product_manager service. ProductManager handles the logic for managed entity.
Traits
Constants
| WEB_UPLOADS_DIR |
Path to images location |
| TEMP_FOLDER_DIR |
Path to tmp images location |
Properties
| protected ProductRepository | $repository | ||
| protected ProductEventContainer | $eventContainer |
Methods
No description
No description
No description
Find products for provided array of ids
ProductManager constructor.
Find all product id, erpCode and productSearchString fields
Find id of products in database for provided array of ids
Check for all preconditions, create references to all foreign entities and persist new product. Editing only "Basic info" and "Price"
Remove products from array
This method sends signal for cashing html tree of categories
Dispatch signal to generate product translations for specific product
This method sends signal for cashing html tree of categories
Find featured products
Find products on action with pagination
Find collection of products
Main product search. Sets all preconditions and do database search
Simple convert price
Do product search count and calculate min and max price
Update product quantities on simple product for specific product attribute values
Get logged username, returns '' if user not logged
Get logged user, null otherwise
Has logged user admin privileges
Get current locale from request
No description
Export products to csv file
Find custom product fields for export
No description
Persist entities to database
Import images from zip archive
Import products from csv file
Import products from csv file
Find all ids of attribute value, brand and category for provided array of products
Dispatch product exclude filter event
Find product by id
Find and prepare product information by id
Find all product for provided array of ids
Find product by slug
Find images for specific product attribute values
Dispatch all signals to cache elements after product has been deleted
Dispatch promo products cache remove
Convert custom price to default currency
Used when plugins need to change availability of products For example: not all products are available for different payment types
Dispatch remove product translations for array of keys
Find product import settings
Get product, simple product, brand, category and attribute metadata
Find import-export settings
No description
Check for all preconditions, create references to all foreign entities and save bundle product
Find group product with all related products by group product id
Find group product with all related products by related product id
Dispatch re-cache featured categories
Get product information with additional params (Brand name and Category Name concat)
Find all products on action
Find reference for array of products
Find product attribute value by product id
Find product attribute values by id
Find all product filters data and format for easier twig manipulation
Delete cache for products on action page
Find search settings
Find all products and their attribute sets
Get product codes
Get all ids of product and simple product codes
Find all products main information
Get ids of products without price
Get ids of products without simple product
Persist collection of products with custom id
Find products by category id
Find products by category id with pagination or count them
Dispatch signal to re-cache menu items
Remove products from array
Find products for product search update
Find product by erp code
Find products for provided array of ids
Find cached product groups
Find search fields
Get default sort field
Find additional search data
Dispatch product filter signal
Dispatch save product search signal
Find all products prices
Find products based on algorithm type
Find and cache prices from ERP for provided array of products
Find price from ERP for provided product
Check role permission
Find all erpCodes of products and product attribute values
Check user permissions on product
Re-cache product price list items array field
Find brand by slug
Update product customProductLinks property
No description
Get product prices from ERP
Prevent product add to cart
Find products prices
Find buy x get y offer for product by id
Update products with custom labels
Update product rating for provided array of brands
Details
in JQGridManagerTrait at line 26
mixed
searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
in JQGridManagerTrait at line 40
mixed
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
in JQGridManagerTrait at line 53
mixed
getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)
at line 2012
array
getEntitiesForBlockElementsExtension(array $ids)
Find products for provided array of ids
in BlockElementManagerTrait at line 40
array
getEntityNamesForIds(array $ids)
Get id and name of entity
at line 119
__construct(ProductRepository $repository, ProductEventContainer $eventContainer)
ProductManager constructor.
at line 129
array
findAllProductErpCodeSearchString()
Find all product id, erpCode and productSearchString fields
at line 140
array
findProductsMissingFromDbCSVImport(array $productArray)
Find id of products in database for provided array of ids
at line 148
Product
editProduct(Product $product)
Check for all preconditions, create references to all foreign entities and persist new product. Editing only "Basic info" and "Price"
at line 277
bool|stdClass
deleteProduct(array $array)
Remove products from array
at line 315
dispatchTeeGenerateSignal()
This method sends signal for cashing html tree of categories
at line 324
dispatchGenerateProductTranslationSignal(Product $productDB)
Dispatch signal to generate product translations for specific product
at line 333
dispatchProductRemovedSignal(ArrayCollection $products)
This method sends signal for cashing html tree of categories
at line 367
array
getFeatureProducts()
Find featured products
at line 379
array
findProductsOnAction(int $page, int $offset)
Find products on action with pagination
at line 389
array
getProductsCollection(array $products)
Find collection of products
at line 400
array
doProductSearch(ProductSearchWrapper $searchWrapper)
Main product search. Sets all preconditions and do database search
at line 441
float|int
simpleCovertMoney(float $amount, string|null $from = null, string|null $to = null)
Simple convert price
at line 452
array
doProductSearchCount(ProductSearchWrapper $searchWrapper)
Do product search count and calculate min and max price
at line 475
updateQty(Product $product)
Update product quantities on simple product for specific products
at line 486
updateProductQtyAfterPAV(ProductAttributeValues $pav)
Update product quantities on simple product for specific product attribute values
at line 497
mixed
findBrand(Brand $brand)
Find brand
at line 506
string
getLoggedUsername()
Get logged username, returns '' if user not logged
at line 515
User|null
getLoggedUser()
Get logged user, null otherwise
at line 524
bool
hasRoleAdmin()
Has logged user admin privileges
at line 533
string
getCurrentLocale()
Get current locale from request
at line 541
mixed|void
exportToCSV()
at line 553
mixed|void
exportCustom(array $data)
Export products to csv file
at line 565
array
getCustomProductFieldsForExport(array $fields)
Find custom product fields for export
at line 573
CSVEntityInterface
getEntityObject()
at line 583
mixed
saveObjectsFromCSV(ArrayCollection $objectList, array $csvRow, array $entityCSVHeaders, array $propertyMappings = array())
Persist entities to database
at line 759
bool
importImagesForProduct(string $base64)
Import images from zip archive
at line 833
mixed
importFromCSVWithFileName(string $base64Content, string $locale, string $fileName, array $propertyMappings = array())
Import products from csv file
at line 862
mixed
importFromCSV(mixed $base64Content, mixed $locale, array $propertyMappings = array())
Import products from csv file
at line 906
array
getAttrValsForFilter(ProductSearchWrapper $searchWrapper)
Find all ids of attribute value, brand and category for provided array of products
at line 921
array
dispatchProductCustomExcludeFilter(array $possibleAttrs, ProductSearchWrapper $searchWrapper)
Dispatch product exclude filter event
at line 935
mixed
getDBProductForProductPage(int $productId)
Find product by id
at line 951
mixed
getProductQuickInformation(int $productId)
Find and prepare product information by id
at line 1006
array|null
isProductOnSpecialOffer(Product $product)
Check if product is on special offer
at line 1027
array
getAllProductsFromArray(array $productsArray)
Find all product for provided array of ids
at line 1041
Product
getDBProductBySlugForProductPage(string $productSlug)
Find product by slug
at line 1056
mixed
saveProductCollectionFromCMD(Product $array)
Persist collection of products
at line 1067
ArrayCollection
getImagesForProductAttributeValue(int $pavId)
Find images for specific product attribute values
at line 1083
cacheAfterProductDelete()
Dispatch all signals to cache elements after product has been deleted
at line 1093
dispatchPromoProductsReCache()
Dispatch promo products cache remove
at line 1106
Money
convertToDefaultCurrency(float $price, bool $toDefault = false)
Convert custom price to default currency
at line 1116
array
dispatchProductAvailabilityChangeEvent()
Used when plugins need to change availability of products For example: not all products are available for different payment types
at line 1127
dispatchRemoveProductTranslation(array $ids)
Dispatch remove product translations for array of keys
at line 1148
array
getProductImportSettings()
Find product import settings
at line 1163
array
getAllProductFields()
Get product, simple product, brand, category and attribute metadata
at line 1181
ImportExportSettings
getDBSettingsFields()
Find import-export settings
at line 1194
Product|Proxy|null|object
getReference(int $id, string $class = null)
at line 1209
array
saveBundleProduct(int $groupProductId, int $productId, array $products, bool $generatePrice, double $productAdjustPrice)
Check for all preconditions, create references to all foreign entities and save bundle product
at line 1252
GroupProduct
getBundledProductsForGroupProduct(int $groupId)
Find group product with all related products by group product id
at line 1266
GroupProduct
getBundleProductForProductId(int $productId)
Find group product with all related products by related product id
at line 1274
dispatchFeaturedCategoriesSignal()
Dispatch re-cache featured categories
at line 1285
array
getAllProductsWithBrandNameAndCategoryConcatFromArray(array $productsArray)
Get product information with additional params (Brand name and Category Name concat)
at line 1294
array
getAllProductsOnAction()
Find all products on action
at line 1307
array
getProductReferencesForArrayIds(array $ids)
Find reference for array of products
at line 1320
Product
getProductAttributeValues(int $productId)
Find product attribute value by product id
at line 1334
ProductAttributeValues
getProductAttributeValuesById(int $id)
Find product attribute values by id
at line 1351
array
getAttrsForProducts(ProductSearchWrapper $searchWrapper, bool $includeBrands = true, array|null $attributesOrder = null, array|null $disabledAttrs = null, array|null $customDql = null)
Find all product filters data and format for easier twig manipulation
at line 1438
deleteProductsOnActionCache()
Delete cache for products on action page
at line 1447
SearchSettings
getSearchSettings()
Find search settings
at line 1461
array
getAllAvailableProductAndAttributeSet(array $prodArray)
Find all products and their attribute sets
at line 1472
array
getAllProductsErpCodes(array $adittionalFields = [])
Get product codes
at line 1484
array
getAllSimpleProductErpCodes()
Get all ids of product and simple product codes
at line 1496
array
getAllProductsIdAndNameDescription()
Find all products main information
at line 1507
array
getAllProductsWithoutPrice()
Get ids of products without price
at line 1519
array
getAllProductsWithoutSimpleProduct()
Get ids of products without simple product
at line 1531
bool|string
saveMultiple(array $products, int $flushNumber = 30)
Persist collection of products with custom id
at line 1542
array
getProductsByCategorySimple(int $id)
Find products by category id
at line 1559
array
getProductsByCategoryWithPaginationSimple(int $id, int $page, int $offset, bool $count = false, array|null $searchParams = null)
Find products by category id with pagination or count them
at line 1577
dispatchMenuUpdateRemoveSignal(int $id, string $slug, string|null $productName = null)
Dispatch signal to re-cache menu items
at line 1588
bool
deleteMultiple(array $products)
Remove products from array
at line 1600
array
getProductsForProductSearchUpdate(array $ids, bool $isProductSearch = true)
Find products for product search update
at line 1612
Product|PrimaryKeyInterface|int
saveCategorizationForProduct(Product $product)
Saving product categorization
at line 1666
PrimaryKeyInterface|int
saveFeaturesForProduct(Product $product)
Saving product attribute values features of product
at line 1699
PrimaryKeyInterface|int
savePavsForProductBackendEdit(Product $product)
Saving product attribute values of product
at line 1842
int
saveImagesForProduct(Product $product)
Saving images on product
at line 1897
PrimaryKeyInterface|int
saveFilesForProduct(Product $product)
Handles product files changes
at line 1943
Product
findByErpCode(string $code)
Find product by erp code
at line 1954
array
findMultipleByErpCode(array $arrayCodes)
Find products for provided array of ids
at line 1963
array
getCachedProductGroups()
Find cached product groups
at line 1972
array
getSearchFields()
Find search fields
at line 1981
array
getDefaultSortField()
Get default sort field
at line 1990
array
getAdditionalSearchData()
Find additional search data
at line 2001
mixed
dispatchProductFiltersSignal(array $products)
Dispatch product filter signal
at line 2025
bool|Exception
updateProductSalesCount(DateTime $date = null)
Increment product salesCount property
at line 2036
updateProductViewCount(Product $product)
Increment product viewCount filed
at line 2046
dispatchProductSearchEvent(string $searchParam, bool $hasResults)
Dispatch save product search signal
at line 2057
array
getCurrentPrices()
Find all products prices
at line 2069
array
getProductsByAlgorithm(string $algorithm, int $numberOfProducts)
Find products based on algorithm type
at line 2099
getErpPrices(array $products)
Find and cache prices from ERP for provided array of products
at line 2112
int
getErpPrice(mixed $product)
Find price from ERP for provided product
at line 2123
bool
checkRolePermissions(string $permission)
Check role permission
at line 2136
array
getErpCodesOfProductAndPav()
Find all erpCodes of products and product attribute values
at line 2148
bool
checkUserAndProductPermissions(array $productPermissions, string $permission = RolePermissionTypes::CAN_SEE_QUANTITY_LIGHT_UNDERSCORE)
Check user permissions on product
at line 2157
onPricelistChanged(EventWithResult $event)
Re-cache product price list items array field
at line 2166
bool|string
reCacheProductPricelistItemsArray()
Re-cache product price list items array field
at line 2179
PrimaryKeyInterface|int
updateProductSeo(Product $product)
Update product SEO informations
at line 2198
PrimaryKeyInterface|int
updateProductFields(Product $product)
Update main product fields
at line 2218
Brand
getBrandBySlug(string $slug)
Find brand by slug
at line 2229
bool|Exception
updateCustomProductLinks(array $customProductLinks)
Update product customProductLinks property
at line 2236
UserSettings
getUserSettings()
at line 2248
EventWithResult|Event
dispatchCustomErpPriceLogic(string $userCode, array $products)
Get product prices from ERP
at line 2259
updatePreventDirectAddToCartField()
Prevent product add to cart
at line 2272
array
getPricesForProducts(array $productIds)
Find products prices
at line 2303
array
getOfferForProductPage(int $id)
Find buy x get y offer for product by id
at line 2315
boolean|Exception
updateProductsWithCustomLabels(string $label, array $productIds)
Update products with custom labels
at line 2327
bool
updateMultipleProductsRatings(float $newRating, array $brandsArray)
Update product rating for provided array of brands