repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
lovata/oc-shopaholic-plugin
models/Offer.php
Offer.getDiscountPriceValueAttribute
protected function getDiscountPriceValueAttribute() { $obPriceModel = $this->getPriceObject($this->getActivePriceType()); $this->setActivePriceType(null); if (empty($obPriceModel)) { return 0; } $fPrice = $obPriceModel->discount_price_value; $fPrice = Cu...
php
protected function getDiscountPriceValueAttribute() { $obPriceModel = $this->getPriceObject($this->getActivePriceType()); $this->setActivePriceType(null); if (empty($obPriceModel)) { return 0; } $fPrice = $obPriceModel->discount_price_value; $fPrice = Cu...
[ "protected", "function", "getDiscountPriceValueAttribute", "(", ")", "{", "$", "obPriceModel", "=", "$", "this", "->", "getPriceObject", "(", "$", "this", "->", "getActivePriceType", "(", ")", ")", ";", "$", "this", "->", "setActivePriceType", "(", "null", ")"...
Get discount_price_value attribute @return float
[ "Get", "discount_price_value", "attribute" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Offer.php#L383-L396
lovata/oc-shopaholic-plugin
models/Offer.php
Offer.getPriceListAttribute
protected function getPriceListAttribute() { $arResult = []; foreach ($this->price_link as $obPrice) { $arResult[$obPrice->price_type_id] = [ 'price' => $obPrice->price, 'old_price' => $obPrice->old_price, ]; } return $arR...
php
protected function getPriceListAttribute() { $arResult = []; foreach ($this->price_link as $obPrice) { $arResult[$obPrice->price_type_id] = [ 'price' => $obPrice->price, 'old_price' => $obPrice->old_price, ]; } return $arR...
[ "protected", "function", "getPriceListAttribute", "(", ")", "{", "$", "arResult", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "price_link", "as", "$", "obPrice", ")", "{", "$", "arResult", "[", "$", "obPrice", "->", "price_type_id", "]", "=", ...
Get price_list attribute @return array
[ "Get", "price_list", "attribute" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Offer.php#L402-L414
lovata/oc-shopaholic-plugin
models/Offer.php
Offer.setPriceListAttribute
protected function setPriceListAttribute($arPriceList) { if (empty($arPriceList) || !is_array($arPriceList)) { return; } if (isset($arPriceList[0])) { $this->fSavedPrice = array_get($arPriceList[0], 'price'); $this->fSavedOldPrice = array_get($arPriceList...
php
protected function setPriceListAttribute($arPriceList) { if (empty($arPriceList) || !is_array($arPriceList)) { return; } if (isset($arPriceList[0])) { $this->fSavedPrice = array_get($arPriceList[0], 'price'); $this->fSavedOldPrice = array_get($arPriceList...
[ "protected", "function", "setPriceListAttribute", "(", "$", "arPriceList", ")", "{", "if", "(", "empty", "(", "$", "arPriceList", ")", "||", "!", "is_array", "(", "$", "arPriceList", ")", ")", "{", "return", ";", "}", "if", "(", "isset", "(", "$", "arP...
Set price list attribute Create or update Price model object @param string|float $arPriceList
[ "Set", "price", "list", "attribute", "Create", "or", "update", "Price", "model", "object" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Offer.php#L441-L454
lovata/oc-shopaholic-plugin
models/Offer.php
Offer.savePriceValue
protected function savePriceValue($iPriceTypeID, $fPrice, $fOldPrice) { $obPriceModel = $this->getPriceObject($iPriceTypeID); if (empty($obPriceModel)) { $obPriceModel = Price::create([ 'item_id' => $this->id, 'item_type' => static::class, ...
php
protected function savePriceValue($iPriceTypeID, $fPrice, $fOldPrice) { $obPriceModel = $this->getPriceObject($iPriceTypeID); if (empty($obPriceModel)) { $obPriceModel = Price::create([ 'item_id' => $this->id, 'item_type' => static::class, ...
[ "protected", "function", "savePriceValue", "(", "$", "iPriceTypeID", ",", "$", "fPrice", ",", "$", "fOldPrice", ")", "{", "$", "obPriceModel", "=", "$", "this", "->", "getPriceObject", "(", "$", "iPriceTypeID", ")", ";", "if", "(", "empty", "(", "$", "ob...
Create or update main price object @param int|null $iPriceTypeID @param float $fPrice @param float $fOldPrice
[ "Create", "or", "update", "main", "price", "object" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Offer.php#L473-L495
lovata/oc-shopaholic-plugin
models/Offer.php
Offer.savePriceListValue
protected function savePriceListValue() { if (empty($this->arSavedPriceList)) { return; } foreach ($this->arSavedPriceList as $iPriceTypeID => $arPriceData) { if (empty($iPriceTypeID)) { continue; } $this->savePriceValue($iPri...
php
protected function savePriceListValue() { if (empty($this->arSavedPriceList)) { return; } foreach ($this->arSavedPriceList as $iPriceTypeID => $arPriceData) { if (empty($iPriceTypeID)) { continue; } $this->savePriceValue($iPri...
[ "protected", "function", "savePriceListValue", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "arSavedPriceList", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "arSavedPriceList", "as", "$", "iPriceTypeID", "=>", "$", ...
Save additional price list
[ "Save", "additional", "price", "list" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Offer.php#L500-L513
lovata/oc-shopaholic-plugin
classes/item/TaxItem.php
TaxItem.isAvailableForCategory
public function isAvailableForCategory($obCategoryItem) : bool { $arCategoryIDList = (array) $this->category_id_list; if (empty($arCategoryIDList) || empty($obCategoryItem)) { return false; } if (in_array($obCategoryItem->id, $arCategoryIDList)) { return true...
php
public function isAvailableForCategory($obCategoryItem) : bool { $arCategoryIDList = (array) $this->category_id_list; if (empty($arCategoryIDList) || empty($obCategoryItem)) { return false; } if (in_array($obCategoryItem->id, $arCategoryIDList)) { return true...
[ "public", "function", "isAvailableForCategory", "(", "$", "obCategoryItem", ")", ":", "bool", "{", "$", "arCategoryIDList", "=", "(", "array", ")", "$", "this", "->", "category_id_list", ";", "if", "(", "empty", "(", "$", "arCategoryIDList", ")", "||", "empt...
Check tax is available for category @param \Lovata\Shopaholic\Classes\Item\CategoryItem $obCategoryItem @return bool
[ "Check", "tax", "is", "available", "for", "category" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/TaxItem.php#L38-L54
lovata/oc-shopaholic-plugin
classes/item/TaxItem.php
TaxItem.isAvailableForProduct
public function isAvailableForProduct($obProductItem) : bool { $arProductIDList = (array) $this->product_id_list; $bResult = !empty($arProductIDList) && !empty($obProductItem) && in_array($obProductItem->id, $arProductIDList); return $bResult; }
php
public function isAvailableForProduct($obProductItem) : bool { $arProductIDList = (array) $this->product_id_list; $bResult = !empty($arProductIDList) && !empty($obProductItem) && in_array($obProductItem->id, $arProductIDList); return $bResult; }
[ "public", "function", "isAvailableForProduct", "(", "$", "obProductItem", ")", ":", "bool", "{", "$", "arProductIDList", "=", "(", "array", ")", "$", "this", "->", "product_id_list", ";", "$", "bResult", "=", "!", "empty", "(", "$", "arProductIDList", ")", ...
Check tax is available for product @param \Lovata\Shopaholic\Classes\Item\ProductItem $obProductItem @return bool
[ "Check", "tax", "is", "available", "for", "product" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/TaxItem.php#L61-L68
lovata/oc-shopaholic-plugin
classes/item/TaxItem.php
TaxItem.isAvailableForCountry
public function isAvailableForCountry($obCountry) : bool { $arCountryIDList = (array) $this->country_id_list; $bResult = !empty($arCountryIDList) && !empty($obCountry) && in_array($obCountry->id, $arCountryIDList); return $bResult; }
php
public function isAvailableForCountry($obCountry) : bool { $arCountryIDList = (array) $this->country_id_list; $bResult = !empty($arCountryIDList) && !empty($obCountry) && in_array($obCountry->id, $arCountryIDList); return $bResult; }
[ "public", "function", "isAvailableForCountry", "(", "$", "obCountry", ")", ":", "bool", "{", "$", "arCountryIDList", "=", "(", "array", ")", "$", "this", "->", "country_id_list", ";", "$", "bResult", "=", "!", "empty", "(", "$", "arCountryIDList", ")", "&&...
Check tax is available for country @param \RainLab\Location\Models\Country $obCountry @return bool
[ "Check", "tax", "is", "available", "for", "country" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/TaxItem.php#L75-L82
lovata/oc-shopaholic-plugin
classes/item/TaxItem.php
TaxItem.isAvailableForState
public function isAvailableForState($obState) : bool { $arStateIDList = (array) $this->state_id_list; $bResult = !empty($arStateIDList) && !empty($obState) && in_array($obState->id, $arStateIDList); return $bResult; }
php
public function isAvailableForState($obState) : bool { $arStateIDList = (array) $this->state_id_list; $bResult = !empty($arStateIDList) && !empty($obState) && in_array($obState->id, $arStateIDList); return $bResult; }
[ "public", "function", "isAvailableForState", "(", "$", "obState", ")", ":", "bool", "{", "$", "arStateIDList", "=", "(", "array", ")", "$", "this", "->", "state_id_list", ";", "$", "bResult", "=", "!", "empty", "(", "$", "arStateIDList", ")", "&&", "!", ...
Check tax is available for state @param \RainLab\Location\Models\State $obState @return bool
[ "Check", "tax", "is", "available", "for", "state" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/TaxItem.php#L89-L96
lovata/oc-shopaholic-plugin
classes/item/TaxItem.php
TaxItem.getElementData
protected function getElementData() { $arResult = [ 'category_id_list' => $this->obElement->category()->lists('id'), 'product_id_list' => $this->obElement->product()->lists('id'), ]; if (PluginManager::instance()->hasPlugin('RainLab.Location')) { $arResu...
php
protected function getElementData() { $arResult = [ 'category_id_list' => $this->obElement->category()->lists('id'), 'product_id_list' => $this->obElement->product()->lists('id'), ]; if (PluginManager::instance()->hasPlugin('RainLab.Location')) { $arResu...
[ "protected", "function", "getElementData", "(", ")", "{", "$", "arResult", "=", "[", "'category_id_list'", "=>", "$", "this", "->", "obElement", "->", "category", "(", ")", "->", "lists", "(", "'id'", ")", ",", "'product_id_list'", "=>", "$", "this", "->",...
Set model data from object @return mixed
[ "Set", "model", "data", "from", "object" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/TaxItem.php#L102-L115
lovata/oc-shopaholic-plugin
classes/store/brand/ListByCategoryStore.php
ListByCategoryStore.getIDListFromDB
protected function getIDListFromDB() : array { $arElementIDList = (array) Product::getByCategory($this->sValue) ->where('brand_id', '>', 0) ->lists('brand_id', 'id'); $obCategory = Category::find($this->sValue); if (!empty($obCategory)) { $arAdditionalEle...
php
protected function getIDListFromDB() : array { $arElementIDList = (array) Product::getByCategory($this->sValue) ->where('brand_id', '>', 0) ->lists('brand_id', 'id'); $obCategory = Category::find($this->sValue); if (!empty($obCategory)) { $arAdditionalEle...
[ "protected", "function", "getIDListFromDB", "(", ")", ":", "array", "{", "$", "arElementIDList", "=", "(", "array", ")", "Product", "::", "getByCategory", "(", "$", "this", "->", "sValue", ")", "->", "where", "(", "'brand_id'", ",", "'>'", ",", "0", ")",...
Get ID list from database @return array
[ "Get", "ID", "list", "from", "database" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/brand/ListByCategoryStore.php#L22-L38
lovata/oc-shopaholic-plugin
classes/store/brand/ListByCategoryStore.php
ListByCategoryStore.getIDListFromCache
protected function getIDListFromCache() : array { $arElementIDList = parent::getIDListFromCache(); //Get active product list $arActiveProductIDList = ProductListStore::instance()->active->get(); if (empty($arActiveProductIDList) || empty($arElementIDList)) { return []; ...
php
protected function getIDListFromCache() : array { $arElementIDList = parent::getIDListFromCache(); //Get active product list $arActiveProductIDList = ProductListStore::instance()->active->get(); if (empty($arActiveProductIDList) || empty($arElementIDList)) { return []; ...
[ "protected", "function", "getIDListFromCache", "(", ")", ":", "array", "{", "$", "arElementIDList", "=", "parent", "::", "getIDListFromCache", "(", ")", ";", "//Get active product list", "$", "arActiveProductIDList", "=", "ProductListStore", "::", "instance", "(", "...
Get ID list from cache @return array
[ "Get", "ID", "list", "from", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/brand/ListByCategoryStore.php#L44-L66
lovata/oc-shopaholic-plugin
updates/create_table_products.php
CreateTableProducts.up
public function up() { if (Schema::hasTable('lovata_shopaholic_products')) { return; } Schema::create('lovata_shopaholic_products', function (Blueprint $obTable) { $obTable->engine = 'InnoDB'; $obTable->increments('id')->unsigned(); ...
php
public function up() { if (Schema::hasTable('lovata_shopaholic_products')) { return; } Schema::create('lovata_shopaholic_products', function (Blueprint $obTable) { $obTable->engine = 'InnoDB'; $obTable->increments('id')->unsigned(); ...
[ "public", "function", "up", "(", ")", "{", "if", "(", "Schema", "::", "hasTable", "(", "'lovata_shopaholic_products'", ")", ")", "{", "return", ";", "}", "Schema", "::", "create", "(", "'lovata_shopaholic_products'", ",", "function", "(", "Blueprint", "$", "...
Apply migration
[ "Apply", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/create_table_products.php#L16-L45
lovata/oc-shopaholic-plugin
classes/store/BrandListStore.php
BrandListStore.init
protected function init() { $this->addToStoreList('sorting', SortingListStore::class); $this->addToStoreList('category', ListByCategoryStore::class); $this->addToStoreList('active', ActiveListStore::class); }
php
protected function init() { $this->addToStoreList('sorting', SortingListStore::class); $this->addToStoreList('category', ListByCategoryStore::class); $this->addToStoreList('active', ActiveListStore::class); }
[ "protected", "function", "init", "(", ")", "{", "$", "this", "->", "addToStoreList", "(", "'sorting'", ",", "SortingListStore", "::", "class", ")", ";", "$", "this", "->", "addToStoreList", "(", "'category'", ",", "ListByCategoryStore", "::", "class", ")", "...
Init store method
[ "Init", "store", "method" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/BrandListStore.php#L24-L29
lovata/oc-shopaholic-plugin
classes/event/promoblock/PromoBlockModelHandler.php
PromoBlockModelHandler.subscribe
public function subscribe($obEvent) { parent::subscribe($obEvent); PromoBlock::extend(function ($obModel) { /** @var PromoBlock $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->tr...
php
public function subscribe($obEvent) { parent::subscribe($obEvent); PromoBlock::extend(function ($obModel) { /** @var PromoBlock $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->tr...
[ "public", "function", "subscribe", "(", "$", "obEvent", ")", "{", "parent", "::", "subscribe", "(", "$", "obEvent", ")", ";", "PromoBlock", "::", "extend", "(", "function", "(", "$", "obModel", ")", "{", "/** @var PromoBlock $obModel */", "$", "bSlugIsTranslat...
Add listeners @param \Illuminate\Events\Dispatcher $obEvent
[ "Add", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/promoblock/PromoBlockModelHandler.php#L25-L40
lovata/oc-shopaholic-plugin
classes/event/promoblock/PromoBlockModelHandler.php
PromoBlockModelHandler.afterSave
protected function afterSave() { parent::afterSave(); if ($this->isFieldChanged('date_begin')) { PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_DE...
php
protected function afterSave() { parent::afterSave(); if ($this->isFieldChanged('date_begin')) { PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_DE...
[ "protected", "function", "afterSave", "(", ")", "{", "parent", "::", "afterSave", "(", ")", ";", "if", "(", "$", "this", "->", "isFieldChanged", "(", "'date_begin'", ")", ")", "{", "PromoBlockListStore", "::", "instance", "(", ")", "->", "sorting", "->", ...
After save event handler
[ "After", "save", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/promoblock/PromoBlockModelHandler.php#L54-L72
lovata/oc-shopaholic-plugin
classes/event/promoblock/PromoBlockModelHandler.php
PromoBlockModelHandler.afterDelete
protected function afterDelete() { parent::afterDelete(); $this->clearSortingList(); ProductListStore::instance()->promo_block->clear($this->obElement->id); $this->clearCacheNotEmptyValue('hidden', PromoBlockListStore::instance()->hidden); $this->clearCacheEmptyValue('hidde...
php
protected function afterDelete() { parent::afterDelete(); $this->clearSortingList(); ProductListStore::instance()->promo_block->clear($this->obElement->id); $this->clearCacheNotEmptyValue('hidden', PromoBlockListStore::instance()->hidden); $this->clearCacheEmptyValue('hidde...
[ "protected", "function", "afterDelete", "(", ")", "{", "parent", "::", "afterDelete", "(", ")", ";", "$", "this", "->", "clearSortingList", "(", ")", ";", "ProductListStore", "::", "instance", "(", ")", "->", "promo_block", "->", "clear", "(", "$", "this",...
After delete event handler
[ "After", "delete", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/promoblock/PromoBlockModelHandler.php#L77-L88
lovata/oc-shopaholic-plugin
classes/event/promoblock/PromoBlockModelHandler.php
PromoBlockModelHandler.clearSortingList
protected function clearSortingList() { PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DEFAULT); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DAT...
php
protected function clearSortingList() { PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DEFAULT); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DATE_BEGIN_ASC); PromoBlockListStore::instance()->sorting->clear(PromoBlockListStore::SORT_DAT...
[ "protected", "function", "clearSortingList", "(", ")", "{", "PromoBlockListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear", "(", "PromoBlockListStore", "::", "SORT_DEFAULT", ")", ";", "PromoBlockListStore", "::", "instance", "(", ")", "->", "s...
Clear sorting list
[ "Clear", "sorting", "list" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/promoblock/PromoBlockModelHandler.php#L93-L100
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.getMenuTypeInfo
public function getMenuTypeInfo() { $arResult = $this->getDefaultMenuTypeInfo(); if (empty($arResult)) { return $arResult; } $obTheme = Theme::getActiveTheme(); $obPageList = CmsPage::listInTheme($obTheme, true); $arResult['cmsPages'] = $this->filterPage...
php
public function getMenuTypeInfo() { $arResult = $this->getDefaultMenuTypeInfo(); if (empty($arResult)) { return $arResult; } $obTheme = Theme::getActiveTheme(); $obPageList = CmsPage::listInTheme($obTheme, true); $arResult['cmsPages'] = $this->filterPage...
[ "public", "function", "getMenuTypeInfo", "(", ")", "{", "$", "arResult", "=", "$", "this", "->", "getDefaultMenuTypeInfo", "(", ")", ";", "if", "(", "empty", "(", "$", "arResult", ")", ")", "{", "return", "$", "arResult", ";", "}", "$", "obTheme", "=",...
Handler for the pages.menuitem.getTypeInfo event. Returns a menu item type information. The type information is returned as array with the following elements: - references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and ...
[ "Handler", "for", "the", "pages", ".", "menuitem", ".", "getTypeInfo", "event", ".", "Returns", "a", "menu", "item", "type", "information", ".", "The", "type", "information", "is", "returned", "as", "array", "with", "the", "following", "elements", ":", "-", ...
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L52-L65
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.filterPageList
protected function filterPageList($obPageList) { $arCmsPageList = []; if (empty($obPageList) || $obPageList->isEmpty()) { return $arCmsPageList; } /** @var CmsPage $obPage */ foreach ($obPageList as $obPage) { if (!$obPage->hasComponent('CategoryPage'...
php
protected function filterPageList($obPageList) { $arCmsPageList = []; if (empty($obPageList) || $obPageList->isEmpty()) { return $arCmsPageList; } /** @var CmsPage $obPage */ foreach ($obPageList as $obPage) { if (!$obPage->hasComponent('CategoryPage'...
[ "protected", "function", "filterPageList", "(", "$", "obPageList", ")", "{", "$", "arCmsPageList", "=", "[", "]", ";", "if", "(", "empty", "(", "$", "obPageList", ")", "||", "$", "obPageList", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "arCmsP...
Filter page list, add pages with CategoryPage component to result @param \October\Rain\Support\Collection $obPageList @return array
[ "Filter", "page", "list", "add", "pages", "with", "CategoryPage", "component", "to", "result" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L78-L103
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.listSubCategoryOptions
protected function listSubCategoryOptions() { $arResult = []; $obCategoryList = CategoryCollection::make()->tree(); if ($obCategoryList->isEmpty()) { return $arResult; } $arResult = $this->getCategoryMenuOptions($obCategoryList); return $arResult; }
php
protected function listSubCategoryOptions() { $arResult = []; $obCategoryList = CategoryCollection::make()->tree(); if ($obCategoryList->isEmpty()) { return $arResult; } $arResult = $this->getCategoryMenuOptions($obCategoryList); return $arResult; }
[ "protected", "function", "listSubCategoryOptions", "(", ")", "{", "$", "arResult", "=", "[", "]", ";", "$", "obCategoryList", "=", "CategoryCollection", "::", "make", "(", ")", "->", "tree", "(", ")", ";", "if", "(", "$", "obCategoryList", "->", "isEmpty",...
Get subcategories list @return array
[ "Get", "subcategories", "list" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L109-L120
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.getCategoryMenuOptions
protected function getCategoryMenuOptions($obCategoryList) { if (empty($obCategoryList) || $obCategoryList->isEmpty()) { return null; } $arResult = []; foreach ($obCategoryList as $obCategory) { if ($obCategory->children->isEmpty()) { $arResul...
php
protected function getCategoryMenuOptions($obCategoryList) { if (empty($obCategoryList) || $obCategoryList->isEmpty()) { return null; } $arResult = []; foreach ($obCategoryList as $obCategory) { if ($obCategory->children->isEmpty()) { $arResul...
[ "protected", "function", "getCategoryMenuOptions", "(", "$", "obCategoryList", ")", "{", "if", "(", "empty", "(", "$", "obCategoryList", ")", "||", "$", "obCategoryList", "->", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "$", "arResult", "="...
Get option array for category @param CategoryCollection|\Lovata\Shopaholic\Classes\Item\CategoryItem[] $obCategoryList @return null|array|string
[ "Get", "option", "array", "for", "category" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L127-L146
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.getCategoryMenuData
protected function getCategoryMenuData($obCategoryItem, $sPageCode, $sURL) { if (empty($obCategoryItem)) { return []; } $arMenuItem = [ 'title' => $obCategoryItem->name, 'url' => $obCategoryItem->getPageUrl($sPageCode), 'mtime' => $obC...
php
protected function getCategoryMenuData($obCategoryItem, $sPageCode, $sURL) { if (empty($obCategoryItem)) { return []; } $arMenuItem = [ 'title' => $obCategoryItem->name, 'url' => $obCategoryItem->getPageUrl($sPageCode), 'mtime' => $obC...
[ "protected", "function", "getCategoryMenuData", "(", "$", "obCategoryItem", ",", "$", "sPageCode", ",", "$", "sURL", ")", "{", "if", "(", "empty", "(", "$", "obCategoryItem", ")", ")", "{", "return", "[", "]", ";", "}", "$", "arMenuItem", "=", "[", "'t...
Get array for menu item from category item @param \Lovata\Shopaholic\Classes\Item\CategoryItem $obCategoryItem @param string $sPageCode @param string $sURL @return array
[ "Get", "array", "for", "menu", "item", "from", "category", "item", "@param", "\\", "Lovata", "\\", "Shopaholic", "\\", "Classes", "\\", "Item", "\\", "CategoryItem", "$obCategoryItem", "@param", "string", "$sPageCode", "@param", "string", "$sURL" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L156-L172
lovata/oc-shopaholic-plugin
classes/helper/CommonMenuType.php
CommonMenuType.getChildrenCategoryList
protected function getChildrenCategoryList($obCategoryItem, $sPageCode, $sURL) { if (empty($obCategoryItem) || $obCategoryItem->children->isEmpty()) { return []; } $arResult = []; foreach ($obCategoryItem->children as $obChildrenCategory) { $arMenuItem = $thi...
php
protected function getChildrenCategoryList($obCategoryItem, $sPageCode, $sURL) { if (empty($obCategoryItem) || $obCategoryItem->children->isEmpty()) { return []; } $arResult = []; foreach ($obCategoryItem->children as $obChildrenCategory) { $arMenuItem = $thi...
[ "protected", "function", "getChildrenCategoryList", "(", "$", "obCategoryItem", ",", "$", "sPageCode", ",", "$", "sURL", ")", "{", "if", "(", "empty", "(", "$", "obCategoryItem", ")", "||", "$", "obCategoryItem", "->", "children", "->", "isEmpty", "(", ")", ...
Get list of children categories for menu items @param \Lovata\Shopaholic\Classes\Item\CategoryItem $obCategoryItem @param string $sPageCode @param string $sURL @return array
[ "Get", "list", "of", "children", "categories", "for", "menu", "items", "@param", "\\", "Lovata", "\\", "Shopaholic", "\\", "Classes", "\\", "Item", "\\", "CategoryItem", "$obCategoryItem", "@param", "string", "$sPageCode", "@param", "string", "$sURL" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CommonMenuType.php#L182-L199
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.subscribe
public function subscribe($obEvent) { parent::subscribe($obEvent); Product::extend(function ($obModel) { /** @var Product $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->translat...
php
public function subscribe($obEvent) { parent::subscribe($obEvent); Product::extend(function ($obModel) { /** @var Product $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->translat...
[ "public", "function", "subscribe", "(", "$", "obEvent", ")", "{", "parent", "::", "subscribe", "(", "$", "obEvent", ")", ";", "Product", "::", "extend", "(", "function", "(", "$", "obModel", ")", "{", "/** @var Product $obModel */", "$", "bSlugIsTranslatable",...
Add listeners @param \Illuminate\Events\Dispatcher $obEvent
[ "Add", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L28-L39
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.afterCreate
protected function afterCreate() { parent::afterCreate(); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_NEW); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_NO); }
php
protected function afterCreate() { parent::afterCreate(); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_NEW); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_NO); }
[ "protected", "function", "afterCreate", "(", ")", "{", "parent", "::", "afterCreate", "(", ")", ";", "ProductListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear", "(", "ProductListStore", "::", "SORT_NEW", ")", ";", "ProductListStore", "::", ...
After create event handler
[ "After", "create", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L44-L50
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.afterDelete
protected function afterDelete() { $this->processOfferAfterDelete(); parent::afterDelete(); ProductListStore::instance()->category->clear($this->obElement->category_id); BrandListStore::instance()->category->clear($this->obElement->category_id); $this->clearCategoryProductCo...
php
protected function afterDelete() { $this->processOfferAfterDelete(); parent::afterDelete(); ProductListStore::instance()->category->clear($this->obElement->category_id); BrandListStore::instance()->category->clear($this->obElement->category_id); $this->clearCategoryProductCo...
[ "protected", "function", "afterDelete", "(", ")", "{", "$", "this", "->", "processOfferAfterDelete", "(", ")", ";", "parent", "::", "afterDelete", "(", ")", ";", "ProductListStore", "::", "instance", "(", ")", "->", "category", "->", "clear", "(", "$", "th...
After delete event handler
[ "After", "delete", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L71-L99
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.processOfferAfterDelete
protected function processOfferAfterDelete() { $obOfferList = $this->obElement->offer; if ($obOfferList->isEmpty()) { return; } foreach ($obOfferList as $obOffer) { $obOffer->active = false; $obOffer->save(); } }
php
protected function processOfferAfterDelete() { $obOfferList = $this->obElement->offer; if ($obOfferList->isEmpty()) { return; } foreach ($obOfferList as $obOffer) { $obOffer->active = false; $obOffer->save(); } }
[ "protected", "function", "processOfferAfterDelete", "(", ")", "{", "$", "obOfferList", "=", "$", "this", "->", "obElement", "->", "offer", ";", "if", "(", "$", "obOfferList", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", ...
Set active = false in offer list, after product was removed
[ "Set", "active", "=", "false", "in", "offer", "list", "after", "product", "was", "removed" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L136-L147
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.checkActiveField
protected function checkActiveField() { //check product "active" field if (!$this->isFieldChanged('active')) { return; } ProductListStore::instance()->active->clear(); $this->clearCategoryProductCount($this->obElement->category_id); //Get additional cat...
php
protected function checkActiveField() { //check product "active" field if (!$this->isFieldChanged('active')) { return; } ProductListStore::instance()->active->clear(); $this->clearCategoryProductCount($this->obElement->category_id); //Get additional cat...
[ "protected", "function", "checkActiveField", "(", ")", "{", "//check product \"active\" field", "if", "(", "!", "$", "this", "->", "isFieldChanged", "(", "'active'", ")", ")", "{", "return", ";", "}", "ProductListStore", "::", "instance", "(", ")", "->", "acti...
Check offer "active" field, if it was changed, then clear cache
[ "Check", "offer", "active", "field", "if", "it", "was", "changed", "then", "clear", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L152-L172
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.checkCategoryIDField
protected function checkCategoryIDField() { //Check "category_id" field if (!$this->isFieldChanged('category_id')) { return; } //Update product ID cache list for category ProductListStore::instance()->category->clear($this->obElement->category_id); Produc...
php
protected function checkCategoryIDField() { //Check "category_id" field if (!$this->isFieldChanged('category_id')) { return; } //Update product ID cache list for category ProductListStore::instance()->category->clear($this->obElement->category_id); Produc...
[ "protected", "function", "checkCategoryIDField", "(", ")", "{", "//Check \"category_id\" field", "if", "(", "!", "$", "this", "->", "isFieldChanged", "(", "'category_id'", ")", ")", "{", "return", ";", "}", "//Update product ID cache list for category", "ProductListStor...
Check product "category_id" field, if it was changed, then clear cache
[ "Check", "product", "category_id", "field", "if", "it", "was", "changed", "then", "clear", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L177-L193
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.checkBrandIDField
protected function checkBrandIDField() { //Check "brand_id" field if ($this->obElement->getOriginal('brand_id') == $this->obElement->brand_id) { return; } //Update product ID cache list for brand ProductListStore::instance()->brand->clear($this->obElement->brand_...
php
protected function checkBrandIDField() { //Check "brand_id" field if ($this->obElement->getOriginal('brand_id') == $this->obElement->brand_id) { return; } //Update product ID cache list for brand ProductListStore::instance()->brand->clear($this->obElement->brand_...
[ "protected", "function", "checkBrandIDField", "(", ")", "{", "//Check \"brand_id\" field", "if", "(", "$", "this", "->", "obElement", "->", "getOriginal", "(", "'brand_id'", ")", "==", "$", "this", "->", "obElement", "->", "brand_id", ")", "{", "return", ";", ...
Check product "brand_id" field, if it was changed, then clear cache
[ "Check", "product", "brand_id", "field", "if", "it", "was", "changed", "then", "clear", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L198-L208
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.clearCategoryProductCount
protected function clearCategoryProductCount($iCategoryID) { $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isNotEmpty()) { $obCategoryItem->clearProductCount(); } }
php
protected function clearCategoryProductCount($iCategoryID) { $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isNotEmpty()) { $obCategoryItem->clearProductCount(); } }
[ "protected", "function", "clearCategoryProductCount", "(", "$", "iCategoryID", ")", "{", "$", "obCategoryItem", "=", "CategoryItem", "::", "make", "(", "$", "iCategoryID", ")", ";", "if", "(", "$", "obCategoryItem", "->", "isNotEmpty", "(", ")", ")", "{", "$...
Clear product count cache in category item @param int $iCategoryID
[ "Clear", "product", "count", "cache", "in", "category", "item" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L214-L220
lovata/oc-shopaholic-plugin
classes/event/product/ProductModelHandler.php
ProductModelHandler.clearProductSortingByPrice
protected function clearProductSortingByPrice() { ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_ASC); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_DESC); //Get price types $obPriceTypeList = PriceType::active()->get(); ...
php
protected function clearProductSortingByPrice() { ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_ASC); ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_DESC); //Get price types $obPriceTypeList = PriceType::active()->get(); ...
[ "protected", "function", "clearProductSortingByPrice", "(", ")", "{", "ProductListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear", "(", "ProductListStore", "::", "SORT_PRICE_ASC", ")", ";", "ProductListStore", "::", "instance", "(", ")", "->", ...
Clear offer sorting cache by price
[ "Clear", "offer", "sorting", "cache", "by", "price" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductModelHandler.php#L225-L240
lovata/oc-shopaholic-plugin
classes/item/CategoryItem.php
CategoryItem.clearProductCount
public function clearProductCount() { $arCacheTag = [static::class]; $sCacheKey = 'product_count_'.$this->id; CCache::clear($arCacheTag, $sCacheKey); ItemStorage::clear(static::class, $this->id); $obParentItem = $this->parent; if ($obParentItem->isEmpty()) { ...
php
public function clearProductCount() { $arCacheTag = [static::class]; $sCacheKey = 'product_count_'.$this->id; CCache::clear($arCacheTag, $sCacheKey); ItemStorage::clear(static::class, $this->id); $obParentItem = $this->parent; if ($obParentItem->isEmpty()) { ...
[ "public", "function", "clearProductCount", "(", ")", "{", "$", "arCacheTag", "=", "[", "static", "::", "class", "]", ";", "$", "sCacheKey", "=", "'product_count_'", ".", "$", "this", "->", "id", ";", "CCache", "::", "clear", "(", "$", "arCacheTag", ",", ...
Clear product count cache
[ "Clear", "product", "count", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/CategoryItem.php#L79-L93
lovata/oc-shopaholic-plugin
classes/item/CategoryItem.php
CategoryItem.getPageParamList
public function getPageParamList($sPageCode) : array { //Get URL params for page $arParamList = PageHelper::instance()->getUrlParamList($sPageCode, 'CategoryPage'); if (empty($arParamList)) { return []; } $arParamList = array_reverse($arParamList); //Get...
php
public function getPageParamList($sPageCode) : array { //Get URL params for page $arParamList = PageHelper::instance()->getUrlParamList($sPageCode, 'CategoryPage'); if (empty($arParamList)) { return []; } $arParamList = array_reverse($arParamList); //Get...
[ "public", "function", "getPageParamList", "(", "$", "sPageCode", ")", ":", "array", "{", "//Get URL params for page", "$", "arParamList", "=", "PageHelper", "::", "instance", "(", ")", "->", "getUrlParamList", "(", "$", "sPageCode", ",", "'CategoryPage'", ")", "...
Get URL param list by page code @param string $sPageCode @return array
[ "Get", "URL", "param", "list", "by", "page", "code" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/CategoryItem.php#L118-L139
lovata/oc-shopaholic-plugin
classes/item/CategoryItem.php
CategoryItem.getSlugList
protected function getSlugList() : array { $arResult = [$this->slug]; $obParentCategory = $this->parent; while ($obParentCategory->isNotEmpty()) { $arResult[] = $obParentCategory->slug; $obParentCategory = $obParentCategory->parent; } return $arResul...
php
protected function getSlugList() : array { $arResult = [$this->slug]; $obParentCategory = $this->parent; while ($obParentCategory->isNotEmpty()) { $arResult[] = $obParentCategory->slug; $obParentCategory = $obParentCategory->parent; } return $arResul...
[ "protected", "function", "getSlugList", "(", ")", ":", "array", "{", "$", "arResult", "=", "[", "$", "this", "->", "slug", "]", ";", "$", "obParentCategory", "=", "$", "this", "->", "parent", ";", "while", "(", "$", "obParentCategory", "->", "isNotEmpty"...
Get array with categories slugs @return array
[ "Get", "array", "with", "categories", "slugs" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/CategoryItem.php#L145-L156
lovata/oc-shopaholic-plugin
classes/item/CategoryItem.php
CategoryItem.getElementData
protected function getElementData() { $arResult = [ 'nest_depth' => $this->obElement->getDepth(), ]; $arResult['children_id_list'] = $this->obElement->children() ->active() ->orderBy('nest_left', 'asc') ->lists('id'); return $arResult...
php
protected function getElementData() { $arResult = [ 'nest_depth' => $this->obElement->getDepth(), ]; $arResult['children_id_list'] = $this->obElement->children() ->active() ->orderBy('nest_left', 'asc') ->lists('id'); return $arResult...
[ "protected", "function", "getElementData", "(", ")", "{", "$", "arResult", "=", "[", "'nest_depth'", "=>", "$", "this", "->", "obElement", "->", "getDepth", "(", ")", ",", "]", ";", "$", "arResult", "[", "'children_id_list'", "]", "=", "$", "this", "->",...
Set element data from model object @return array
[ "Set", "element", "data", "from", "model", "object" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/CategoryItem.php#L163-L175
lovata/oc-shopaholic-plugin
classes/item/CategoryItem.php
CategoryItem.getProductCountAttribute
protected function getProductCountAttribute() { $iProductCount = $this->getAttribute('product_count'); if ($iProductCount !== null) { return $iProductCount; } //Get product count from cache $arCacheTag = [static::class]; $sCacheKey = 'product_count_'.$thi...
php
protected function getProductCountAttribute() { $iProductCount = $this->getAttribute('product_count'); if ($iProductCount !== null) { return $iProductCount; } //Get product count from cache $arCacheTag = [static::class]; $sCacheKey = 'product_count_'.$thi...
[ "protected", "function", "getProductCountAttribute", "(", ")", "{", "$", "iProductCount", "=", "$", "this", "->", "getAttribute", "(", "'product_count'", ")", ";", "if", "(", "$", "iProductCount", "!==", "null", ")", "{", "return", "$", "iProductCount", ";", ...
Get product count for category @return int
[ "Get", "product", "count", "for", "category" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/item/CategoryItem.php#L181-L217
lovata/oc-shopaholic-plugin
classes/store/product/SortingListStore.php
SortingListStore.getIDListFromDB
protected function getIDListFromDB() : array { if ($this->sValue == ProductListStore::SORT_PRICE_ASC) { $arElementIDList = $this->getByPriceASC(); } elseif ($this->sValue == ProductListStore::SORT_PRICE_DESC) { $arElementIDList = $this->getByPriceDESC(); } elseif ($th...
php
protected function getIDListFromDB() : array { if ($this->sValue == ProductListStore::SORT_PRICE_ASC) { $arElementIDList = $this->getByPriceASC(); } elseif ($this->sValue == ProductListStore::SORT_PRICE_DESC) { $arElementIDList = $this->getByPriceDESC(); } elseif ($th...
[ "protected", "function", "getIDListFromDB", "(", ")", ":", "array", "{", "if", "(", "$", "this", "->", "sValue", "==", "ProductListStore", "::", "SORT_PRICE_ASC", ")", "{", "$", "arElementIDList", "=", "$", "this", "->", "getByPriceASC", "(", ")", ";", "}"...
Get ID list from database @return array
[ "Get", "ID", "list", "from", "database" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/product/SortingListStore.php#L25-L44
lovata/oc-shopaholic-plugin
classes/store/product/SortingListStore.php
SortingListStore.getCustomSortingList
protected function getCustomSortingList() : array { $arEventResult = Event::fire('shopaholic.sorting.get.list', [$this->sValue]); if (empty($arEventResult)) { return []; } $arElementIDList = []; foreach ($arEventResult as $arEventProductIDList) { if (...
php
protected function getCustomSortingList() : array { $arEventResult = Event::fire('shopaholic.sorting.get.list', [$this->sValue]); if (empty($arEventResult)) { return []; } $arElementIDList = []; foreach ($arEventResult as $arEventProductIDList) { if (...
[ "protected", "function", "getCustomSortingList", "(", ")", ":", "array", "{", "$", "arEventResult", "=", "Event", "::", "fire", "(", "'shopaholic.sorting.get.list'", ",", "[", "$", "this", "->", "sValue", "]", ")", ";", "if", "(", "empty", "(", "$", "arEve...
Get product list with custom sorting @return array
[ "Get", "product", "list", "with", "custom", "sorting" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/product/SortingListStore.php#L50-L68
lovata/oc-shopaholic-plugin
classes/store/product/SortingListStore.php
SortingListStore.getByPriceASC
protected function getByPriceASC() : array { //Get product ID list (sort by offer price) //We can not use groupBy() in this place $arElementIDList = (array) DB::table('lovata_shopaholic_prices') ->select('lovata_shopaholic_offers.product_id') ->whereNull('lovata_shopa...
php
protected function getByPriceASC() : array { //Get product ID list (sort by offer price) //We can not use groupBy() in this place $arElementIDList = (array) DB::table('lovata_shopaholic_prices') ->select('lovata_shopaholic_offers.product_id') ->whereNull('lovata_shopa...
[ "protected", "function", "getByPriceASC", "(", ")", ":", "array", "{", "//Get product ID list (sort by offer price)", "//We can not use groupBy() in this place", "$", "arElementIDList", "=", "(", "array", ")", "DB", "::", "table", "(", "'lovata_shopaholic_prices'", ")", "...
Get sorting ID list by offer price (ASC) @return array
[ "Get", "sorting", "ID", "list", "by", "offer", "price", "(", "ASC", ")" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/product/SortingListStore.php#L74-L89
lovata/oc-shopaholic-plugin
classes/store/product/SortingListStore.php
SortingListStore.getByPriceTypeASC
protected function getByPriceTypeASC() : array { $obPriceType = $this->getPriceTypeObject(); if (empty($obPriceType)) { return $this->getByPriceASC(); } //Get product ID list (sort by offer price) //We can not use groupBy() in this place $arElementIDList ...
php
protected function getByPriceTypeASC() : array { $obPriceType = $this->getPriceTypeObject(); if (empty($obPriceType)) { return $this->getByPriceASC(); } //Get product ID list (sort by offer price) //We can not use groupBy() in this place $arElementIDList ...
[ "protected", "function", "getByPriceTypeASC", "(", ")", ":", "array", "{", "$", "obPriceType", "=", "$", "this", "->", "getPriceTypeObject", "(", ")", ";", "if", "(", "empty", "(", "$", "obPriceType", ")", ")", "{", "return", "$", "this", "->", "getByPri...
Get sorting ID list by offer price with filter by price type (ASC) @return array
[ "Get", "sorting", "ID", "list", "by", "offer", "price", "with", "filter", "by", "price", "type", "(", "ASC", ")" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/product/SortingListStore.php#L116-L136
lovata/oc-shopaholic-plugin
classes/event/ExtendMenuHandler.php
ExtendMenuHandler.subscribe
public function subscribe($obEvent) { /* * Register menu items for the RainLab.Pages plugin */ $obEvent->listen('pages.menuitem.listTypes', function () { $arResult = [ CatalogMenuType::MENU_TYPE => 'lovata.shopaholic::lang.menu.shop_catalog', ...
php
public function subscribe($obEvent) { /* * Register menu items for the RainLab.Pages plugin */ $obEvent->listen('pages.menuitem.listTypes', function () { $arResult = [ CatalogMenuType::MENU_TYPE => 'lovata.shopaholic::lang.menu.shop_catalog', ...
[ "public", "function", "subscribe", "(", "$", "obEvent", ")", "{", "/*\n * Register menu items for the RainLab.Pages plugin\n */", "$", "obEvent", "->", "listen", "(", "'pages.menuitem.listTypes'", ",", "function", "(", ")", "{", "$", "arResult", "=", "["...
Add listeners @param \Illuminate\Events\Dispatcher $obEvent
[ "Add", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/ExtendMenuHandler.php#L20-L51
lovata/oc-shopaholic-plugin
classes/event/ExtendMenuHandler.php
ExtendMenuHandler.getMenuTypeObject
protected function getMenuTypeObject($sType) { switch ($sType) { case CategoryMenuType::MENU_TYPE: return new CategoryMenuType(); case CatalogMenuType::MENU_TYPE: return new CatalogMenuType(); case AllCategoriesMenuType::MENU_TYPE: ...
php
protected function getMenuTypeObject($sType) { switch ($sType) { case CategoryMenuType::MENU_TYPE: return new CategoryMenuType(); case CatalogMenuType::MENU_TYPE: return new CatalogMenuType(); case AllCategoriesMenuType::MENU_TYPE: ...
[ "protected", "function", "getMenuTypeObject", "(", "$", "sType", ")", "{", "switch", "(", "$", "sType", ")", "{", "case", "CategoryMenuType", "::", "MENU_TYPE", ":", "return", "new", "CategoryMenuType", "(", ")", ";", "case", "CatalogMenuType", "::", "MENU_TYP...
Get new menu object by type value @param string $sType @return \Lovata\Shopaholic\Classes\Helper\CommonMenuType
[ "Get", "new", "menu", "object", "by", "type", "value" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/ExtendMenuHandler.php#L58-L70
lovata/oc-shopaholic-plugin
classes/event/offer/OfferModelHandler.php
OfferModelHandler.afterCreate
protected function afterCreate() { OfferListStore::instance()->sorting->clear(OfferListStore::SORT_NO); OfferListStore::instance()->sorting->clear(OfferListStore::SORT_NEW); }
php
protected function afterCreate() { OfferListStore::instance()->sorting->clear(OfferListStore::SORT_NO); OfferListStore::instance()->sorting->clear(OfferListStore::SORT_NEW); }
[ "protected", "function", "afterCreate", "(", ")", "{", "OfferListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear", "(", "OfferListStore", "::", "SORT_NO", ")", ";", "OfferListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear...
After save event handler
[ "After", "save", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/offer/OfferModelHandler.php#L29-L33
lovata/oc-shopaholic-plugin
classes/event/offer/OfferModelHandler.php
OfferModelHandler.afterDelete
protected function afterDelete() { parent::afterDelete(); if ($this->obElement->active) { $this->clearProductActiveList(); $this->clearProductItemCache($this->obElement->product_id); OfferListStore::instance()->active->clear(); $this->clearOfferSorti...
php
protected function afterDelete() { parent::afterDelete(); if ($this->obElement->active) { $this->clearProductActiveList(); $this->clearProductItemCache($this->obElement->product_id); OfferListStore::instance()->active->clear(); $this->clearOfferSorti...
[ "protected", "function", "afterDelete", "(", ")", "{", "parent", "::", "afterDelete", "(", ")", ";", "if", "(", "$", "this", "->", "obElement", "->", "active", ")", "{", "$", "this", "->", "clearProductActiveList", "(", ")", ";", "$", "this", "->", "cl...
After delete event handler
[ "After", "delete", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/offer/OfferModelHandler.php#L50-L67
lovata/oc-shopaholic-plugin
classes/event/offer/OfferModelHandler.php
OfferModelHandler.checkProductIDField
protected function checkProductIDField() { //Clear product cache /** @var int $iOriginalProductID */ $iOriginalProductID = $this->obElement->getOriginal('product_id'); /** @var int $iProductID */ $iProductID = $this->obElement->getAttribute('product_id'); if ($iOrig...
php
protected function checkProductIDField() { //Clear product cache /** @var int $iOriginalProductID */ $iOriginalProductID = $this->obElement->getOriginal('product_id'); /** @var int $iProductID */ $iProductID = $this->obElement->getAttribute('product_id'); if ($iOrig...
[ "protected", "function", "checkProductIDField", "(", ")", "{", "//Clear product cache", "/** @var int $iOriginalProductID */", "$", "iOriginalProductID", "=", "$", "this", "->", "obElement", "->", "getOriginal", "(", "'product_id'", ")", ";", "/** @var int $iProductID */", ...
Clear cache, if product ID field changed
[ "Clear", "cache", "if", "product", "ID", "field", "changed" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/offer/OfferModelHandler.php#L103-L123
lovata/oc-shopaholic-plugin
classes/event/offer/OfferModelHandler.php
OfferModelHandler.checkActiveField
protected function checkActiveField() { //check offer "active" field if ($this->obElement->getOriginal('active') == $this->obElement->active) { return; } $this->clearProductActiveList(); OfferListStore::instance()->active->clear(); $this->clearProductSor...
php
protected function checkActiveField() { //check offer "active" field if ($this->obElement->getOriginal('active') == $this->obElement->active) { return; } $this->clearProductActiveList(); OfferListStore::instance()->active->clear(); $this->clearProductSor...
[ "protected", "function", "checkActiveField", "(", ")", "{", "//check offer \"active\" field", "if", "(", "$", "this", "->", "obElement", "->", "getOriginal", "(", "'active'", ")", "==", "$", "this", "->", "obElement", "->", "active", ")", "{", "return", ";", ...
Check offer "active" field, if it was changed, then clear cache
[ "Check", "offer", "active", "field", "if", "it", "was", "changed", "then", "clear", "cache" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/offer/OfferModelHandler.php#L128-L153
lovata/oc-shopaholic-plugin
classes/event/offer/OfferModelHandler.php
OfferModelHandler.clearOfferSortingByPrice
protected function clearOfferSortingByPrice() { OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_ASC); OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_DESC); //Get price types $obPriceTypeList = PriceType::active()->get(); if ($obPr...
php
protected function clearOfferSortingByPrice() { OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_ASC); OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_DESC); //Get price types $obPriceTypeList = PriceType::active()->get(); if ($obPr...
[ "protected", "function", "clearOfferSortingByPrice", "(", ")", "{", "OfferListStore", "::", "instance", "(", ")", "->", "sorting", "->", "clear", "(", "OfferListStore", "::", "SORT_PRICE_ASC", ")", ";", "OfferListStore", "::", "instance", "(", ")", "->", "sortin...
Clear offer sorting cache by price
[ "Clear", "offer", "sorting", "cache", "by", "price" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/offer/OfferModelHandler.php#L170-L185
lovata/oc-shopaholic-plugin
classes/store/product/ListByCategoryStore.php
ListByCategoryStore.getIDListFromDB
protected function getIDListFromDB() : array { $arElementIDList = (array) Product::getByCategory($this->sValue)->lists('id'); //Get product ID list for additional category relation $arAdditionalElementIDList = (array) DB::table('lovata_shopaholic_additional_categories')->where('category_id'...
php
protected function getIDListFromDB() : array { $arElementIDList = (array) Product::getByCategory($this->sValue)->lists('id'); //Get product ID list for additional category relation $arAdditionalElementIDList = (array) DB::table('lovata_shopaholic_additional_categories')->where('category_id'...
[ "protected", "function", "getIDListFromDB", "(", ")", ":", "array", "{", "$", "arElementIDList", "=", "(", "array", ")", "Product", "::", "getByCategory", "(", "$", "this", "->", "sValue", ")", "->", "lists", "(", "'id'", ")", ";", "//Get product ID list for...
Get ID list from database @return array
[ "Get", "ID", "list", "from", "database" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/product/ListByCategoryStore.php#L33-L43
lovata/oc-shopaholic-plugin
updates/seeder_transfer_offer_prices.php
SeederTransferOfferPrices.run
public function run() { $obPriceList = DB::table('lovata_shopaholic_offers')->get(); //Get offer list $obOfferList = Offer::withTrashed()->get(); if ($obOfferList->isEmpty()) { return; } foreach ($obOfferList as $obOffer) { $obOfferModel = $o...
php
public function run() { $obPriceList = DB::table('lovata_shopaholic_offers')->get(); //Get offer list $obOfferList = Offer::withTrashed()->get(); if ($obOfferList->isEmpty()) { return; } foreach ($obOfferList as $obOffer) { $obOfferModel = $o...
[ "public", "function", "run", "(", ")", "{", "$", "obPriceList", "=", "DB", "::", "table", "(", "'lovata_shopaholic_offers'", ")", "->", "get", "(", ")", ";", "//Get offer list", "$", "obOfferList", "=", "Offer", "::", "withTrashed", "(", ")", "->", "get", ...
Run seeder
[ "Run", "seeder" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/seeder_transfer_offer_prices.php#L16-L32
lovata/oc-shopaholic-plugin
Plugin.php
Plugin.addEventListener
protected function addEventListener() { Event::subscribe(ExtendMenuHandler::class); //Brand events Event::subscribe(BrandModelHandler::class); //Category events Event::subscribe(CategoryModelHandler::class); //Currency events Event::subscribe(CurrencyModelHand...
php
protected function addEventListener() { Event::subscribe(ExtendMenuHandler::class); //Brand events Event::subscribe(BrandModelHandler::class); //Category events Event::subscribe(CategoryModelHandler::class); //Currency events Event::subscribe(CurrencyModelHand...
[ "protected", "function", "addEventListener", "(", ")", "{", "Event", "::", "subscribe", "(", "ExtendMenuHandler", "::", "class", ")", ";", "//Brand events", "Event", "::", "subscribe", "(", "BrandModelHandler", "::", "class", ")", ";", "//Category events", "Event"...
Add event listeners
[ "Add", "event", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/Plugin.php#L138-L161
lovata/oc-shopaholic-plugin
updates/create_table_additional_categories.php
CreateTableAdditionalCategories.up
public function up() { if (Schema::hasTable('lovata_shopaholic_additional_categories')) { return; } Schema::create('lovata_shopaholic_additional_categories', function (Blueprint $obTable) { $obTable->engine = 'InnoDB'; $obTable->integer('category_...
php
public function up() { if (Schema::hasTable('lovata_shopaholic_additional_categories')) { return; } Schema::create('lovata_shopaholic_additional_categories', function (Blueprint $obTable) { $obTable->engine = 'InnoDB'; $obTable->integer('category_...
[ "public", "function", "up", "(", ")", "{", "if", "(", "Schema", "::", "hasTable", "(", "'lovata_shopaholic_additional_categories'", ")", ")", "{", "return", ";", "}", "Schema", "::", "create", "(", "'lovata_shopaholic_additional_categories'", ",", "function", "(",...
Apply migration
[ "Apply", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/create_table_additional_categories.php#L16-L29
lovata/oc-shopaholic-plugin
updates/update_table_users_add_currency_field.php
UpdateTableUsersAddCurrencyField.up
public function up() { if (Schema::hasTable('lovata_buddies_users') && !Schema::hasColumn('lovata_buddies_users', 'active_currency_code')) { Schema::table('lovata_buddies_users', function (Blueprint $obTable) { $obTable->string('active_currency_code')->nullable(); ...
php
public function up() { if (Schema::hasTable('lovata_buddies_users') && !Schema::hasColumn('lovata_buddies_users', 'active_currency_code')) { Schema::table('lovata_buddies_users', function (Blueprint $obTable) { $obTable->string('active_currency_code')->nullable(); ...
[ "public", "function", "up", "(", ")", "{", "if", "(", "Schema", "::", "hasTable", "(", "'lovata_buddies_users'", ")", "&&", "!", "Schema", "::", "hasColumn", "(", "'lovata_buddies_users'", ",", "'active_currency_code'", ")", ")", "{", "Schema", "::", "table", ...
Apply migration
[ "Apply", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/update_table_users_add_currency_field.php#L16-L31
lovata/oc-shopaholic-plugin
updates/update_table_users_add_currency_field.php
UpdateTableUsersAddCurrencyField.down
public function down() { if (Schema::hasTable('lovata_buddies_users') && Schema::hasColumn('lovata_buddies_users', 'active_currency_code')) { Schema::table('lovata_buddies_users', function (Blueprint $obTable) { $obTable->dropColumn(['active_currency_code']); });...
php
public function down() { if (Schema::hasTable('lovata_buddies_users') && Schema::hasColumn('lovata_buddies_users', 'active_currency_code')) { Schema::table('lovata_buddies_users', function (Blueprint $obTable) { $obTable->dropColumn(['active_currency_code']); });...
[ "public", "function", "down", "(", ")", "{", "if", "(", "Schema", "::", "hasTable", "(", "'lovata_buddies_users'", ")", "&&", "Schema", "::", "hasColumn", "(", "'lovata_buddies_users'", ",", "'active_currency_code'", ")", ")", "{", "Schema", "::", "table", "("...
Rollback migration
[ "Rollback", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/update_table_users_add_currency_field.php#L36-L49
lovata/oc-shopaholic-plugin
classes/import/ImportProductModel.php
ImportProductModel.prepareImportData
protected function prepareImportData() { $this->setActiveField(); $this->setBrandField(); $this->setCategoryField(); $this->initPreviewImage(); $this->initImageList(); $this->initAdditionalCategoryField(); parent::prepareImportData(); }
php
protected function prepareImportData() { $this->setActiveField(); $this->setBrandField(); $this->setCategoryField(); $this->initPreviewImage(); $this->initImageList(); $this->initAdditionalCategoryField(); parent::prepareImportData(); }
[ "protected", "function", "prepareImportData", "(", ")", "{", "$", "this", "->", "setActiveField", "(", ")", ";", "$", "this", "->", "setBrandField", "(", ")", ";", "$", "this", "->", "setCategoryField", "(", ")", ";", "$", "this", "->", "initPreviewImage",...
Prepare array of import data
[ "Prepare", "array", "of", "import", "data" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/import/ImportProductModel.php#L43-L54
lovata/oc-shopaholic-plugin
classes/import/ImportProductModel.php
ImportProductModel.setBrandField
protected function setBrandField() { $sBrandID = array_get($this->arImportData, 'brand_id'); if ($sBrandID === null) { return; } //Find brand by external ID $obBrand = Brand::getByExternalID($sBrandID)->first(); if (empty($obBrand)) { $this->a...
php
protected function setBrandField() { $sBrandID = array_get($this->arImportData, 'brand_id'); if ($sBrandID === null) { return; } //Find brand by external ID $obBrand = Brand::getByExternalID($sBrandID)->first(); if (empty($obBrand)) { $this->a...
[ "protected", "function", "setBrandField", "(", ")", "{", "$", "sBrandID", "=", "array_get", "(", "$", "this", "->", "arImportData", ",", "'brand_id'", ")", ";", "if", "(", "$", "sBrandID", "===", "null", ")", "{", "return", ";", "}", "//Find brand by exter...
Set brand_id filed value
[ "Set", "brand_id", "filed", "value" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/import/ImportProductModel.php#L70-L84
lovata/oc-shopaholic-plugin
classes/import/ImportProductModel.php
ImportProductModel.setCategoryField
protected function setCategoryField() { $sCategoryID = array_get($this->arImportData, 'category_id'); if ($sCategoryID === null) { return; } //Find category by external ID $obCategory = Category::getByExternalID($sCategoryID)->first(); if (empty($obCatego...
php
protected function setCategoryField() { $sCategoryID = array_get($this->arImportData, 'category_id'); if ($sCategoryID === null) { return; } //Find category by external ID $obCategory = Category::getByExternalID($sCategoryID)->first(); if (empty($obCatego...
[ "protected", "function", "setCategoryField", "(", ")", "{", "$", "sCategoryID", "=", "array_get", "(", "$", "this", "->", "arImportData", ",", "'category_id'", ")", ";", "if", "(", "$", "sCategoryID", "===", "null", ")", "{", "return", ";", "}", "//Find ca...
Set category_id filed value
[ "Set", "category_id", "filed", "value" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/import/ImportProductModel.php#L89-L103
lovata/oc-shopaholic-plugin
classes/import/ImportProductModel.php
ImportProductModel.initAdditionalCategoryField
protected function initAdditionalCategoryField() { $sCategoryList = array_get($this->arImportData, 'additional_category'); if ($sCategoryList === null) { return; } $arCategoryIDList = explode(',', $sCategoryList); foreach ($arCategoryIDList as $iKey => &$iCategor...
php
protected function initAdditionalCategoryField() { $sCategoryList = array_get($this->arImportData, 'additional_category'); if ($sCategoryList === null) { return; } $arCategoryIDList = explode(',', $sCategoryList); foreach ($arCategoryIDList as $iKey => &$iCategor...
[ "protected", "function", "initAdditionalCategoryField", "(", ")", "{", "$", "sCategoryList", "=", "array_get", "(", "$", "this", "->", "arImportData", ",", "'additional_category'", ")", ";", "if", "(", "$", "sCategoryList", "===", "null", ")", "{", "return", "...
Init additional category ID list
[ "Init", "additional", "category", "ID", "list" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/import/ImportProductModel.php#L108-L130
lovata/oc-shopaholic-plugin
classes/import/ImportProductModel.php
ImportProductModel.syncAdditionalCategoryList
protected function syncAdditionalCategoryList() { if ($this->arAdditionalCategoryList === null) { return; } $this->obModel->additional_category()->sync($this->arAdditionalCategoryList); }
php
protected function syncAdditionalCategoryList() { if ($this->arAdditionalCategoryList === null) { return; } $this->obModel->additional_category()->sync($this->arAdditionalCategoryList); }
[ "protected", "function", "syncAdditionalCategoryList", "(", ")", "{", "if", "(", "$", "this", "->", "arAdditionalCategoryList", "===", "null", ")", "{", "return", ";", "}", "$", "this", "->", "obModel", "->", "additional_category", "(", ")", "->", "sync", "(...
Sync link product with additional categories
[ "Sync", "link", "product", "with", "additional", "categories" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/import/ImportProductModel.php#L135-L142
lovata/oc-shopaholic-plugin
components/Breadcrumbs.php
Breadcrumbs.getByCategoryID
public function getByCategoryID($iCategoryID) { if (empty($iCategoryID)) { return []; } //Get category data $this->addCategoryData($iCategoryID, true); $this->arResult = array_reverse($this->arResult); return $this->arResult; }
php
public function getByCategoryID($iCategoryID) { if (empty($iCategoryID)) { return []; } //Get category data $this->addCategoryData($iCategoryID, true); $this->arResult = array_reverse($this->arResult); return $this->arResult; }
[ "public", "function", "getByCategoryID", "(", "$", "iCategoryID", ")", "{", "if", "(", "empty", "(", "$", "iCategoryID", ")", ")", "{", "return", "[", "]", ";", "}", "//Get category data", "$", "this", "->", "addCategoryData", "(", "$", "iCategoryID", ",",...
Get breadcrumbs for category page by category id @param int $iCategoryID @return array
[ "Get", "breadcrumbs", "for", "category", "page", "by", "category", "id" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/components/Breadcrumbs.php#L36-L47
lovata/oc-shopaholic-plugin
components/Breadcrumbs.php
Breadcrumbs.getByTagID
public function getByTagID($iTagID) { //Get tag element if (!PluginManager::instance()->hasPlugin('Lovata.TagsShopaholic') || empty($iTagID)) { return $this->arResult; } $obTagItem = \Lovata\TagsShopaholic\Classes\Item\TagItem::make($iTagID); if ($obTagItem->isEm...
php
public function getByTagID($iTagID) { //Get tag element if (!PluginManager::instance()->hasPlugin('Lovata.TagsShopaholic') || empty($iTagID)) { return $this->arResult; } $obTagItem = \Lovata\TagsShopaholic\Classes\Item\TagItem::make($iTagID); if ($obTagItem->isEm...
[ "public", "function", "getByTagID", "(", "$", "iTagID", ")", "{", "//Get tag element", "if", "(", "!", "PluginManager", "::", "instance", "(", ")", "->", "hasPlugin", "(", "'Lovata.TagsShopaholic'", ")", "||", "empty", "(", "$", "iTagID", ")", ")", "{", "r...
Get breadcrumbs for tag page by tag ID @param int $iTagID @return array
[ "Get", "breadcrumbs", "for", "tag", "page", "by", "tag", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/components/Breadcrumbs.php#L54-L77
lovata/oc-shopaholic-plugin
components/Breadcrumbs.php
Breadcrumbs.getByProductID
public function getByProductID($iProductID) { if (empty($iProductID)) { return $this->arResult; } //Get product data $obProductItem = ProductItem::make($iProductID); if ($obProductItem->isEmpty()) { return $this->arResult; } //Add pro...
php
public function getByProductID($iProductID) { if (empty($iProductID)) { return $this->arResult; } //Get product data $obProductItem = ProductItem::make($iProductID); if ($obProductItem->isEmpty()) { return $this->arResult; } //Add pro...
[ "public", "function", "getByProductID", "(", "$", "iProductID", ")", "{", "if", "(", "empty", "(", "$", "iProductID", ")", ")", "{", "return", "$", "this", "->", "arResult", ";", "}", "//Get product data", "$", "obProductItem", "=", "ProductItem", "::", "m...
Get breadcrumbs by product ID @param int $iProductID @return array
[ "Get", "breadcrumbs", "by", "product", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/components/Breadcrumbs.php#L84-L110
lovata/oc-shopaholic-plugin
components/Breadcrumbs.php
Breadcrumbs.addCategoryData
protected function addCategoryData($iCategoryID, $bActiveCategory = false) { $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isEmpty()) { return; } $this->arResult[] = [ 'id' => $obCategoryItem->id, 'name' => $obCate...
php
protected function addCategoryData($iCategoryID, $bActiveCategory = false) { $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isEmpty()) { return; } $this->arResult[] = [ 'id' => $obCategoryItem->id, 'name' => $obCate...
[ "protected", "function", "addCategoryData", "(", "$", "iCategoryID", ",", "$", "bActiveCategory", "=", "false", ")", "{", "$", "obCategoryItem", "=", "CategoryItem", "::", "make", "(", "$", "iCategoryID", ")", ";", "if", "(", "$", "obCategoryItem", "->", "is...
Add category data @param int $iCategoryID @param bool $bActiveCategory
[ "Add", "category", "data" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/components/Breadcrumbs.php#L117-L135
lovata/oc-shopaholic-plugin
classes/event/tax/TaxModelHandler.php
TaxModelHandler.subscribe
public function subscribe($obEvent) { parent::subscribe($obEvent); $obEvent->listen('shopaholic.tax.update.sorting', function () { $this->clearSortingList(); }); if (PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } Tax::...
php
public function subscribe($obEvent) { parent::subscribe($obEvent); $obEvent->listen('shopaholic.tax.update.sorting', function () { $this->clearSortingList(); }); if (PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } Tax::...
[ "public", "function", "subscribe", "(", "$", "obEvent", ")", "{", "parent", "::", "subscribe", "(", "$", "obEvent", ")", ";", "$", "obEvent", "->", "listen", "(", "'shopaholic.tax.update.sorting'", ",", "function", "(", ")", "{", "$", "this", "->", "clearS...
Add listeners @param \Illuminate\Events\Dispatcher $obEvent
[ "Add", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/tax/TaxModelHandler.php#L24-L41
lovata/oc-shopaholic-plugin
classes/event/tax/TaxModelHandler.php
TaxModelHandler.afterDelete
protected function afterDelete() { parent::afterDelete(); $this->clearSortingList(); if ($this->obElement->active) { TaxListStore::instance()->active->clear(); } }
php
protected function afterDelete() { parent::afterDelete(); $this->clearSortingList(); if ($this->obElement->active) { TaxListStore::instance()->active->clear(); } }
[ "protected", "function", "afterDelete", "(", ")", "{", "parent", "::", "afterDelete", "(", ")", ";", "$", "this", "->", "clearSortingList", "(", ")", ";", "if", "(", "$", "this", "->", "obElement", "->", "active", ")", "{", "TaxListStore", "::", "instanc...
After delete event handler
[ "After", "delete", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/tax/TaxModelHandler.php#L65-L73
lovata/oc-shopaholic-plugin
classes/collection/OfferCollection.php
OfferCollection.getTotalQuantity
public function getTotalQuantity() { $iQuantityCount = 0; $arOfferList = $this->all(); /** @var \Lovata\Shopaholic\Classes\Item\OfferItem $arOfferItem */ foreach ($arOfferList as $arOfferItem) { $iQuantityCount += $arOfferItem->quantity; } return $iQuan...
php
public function getTotalQuantity() { $iQuantityCount = 0; $arOfferList = $this->all(); /** @var \Lovata\Shopaholic\Classes\Item\OfferItem $arOfferItem */ foreach ($arOfferList as $arOfferItem) { $iQuantityCount += $arOfferItem->quantity; } return $iQuan...
[ "public", "function", "getTotalQuantity", "(", ")", "{", "$", "iQuantityCount", "=", "0", ";", "$", "arOfferList", "=", "$", "this", "->", "all", "(", ")", ";", "/** @var \\Lovata\\Shopaholic\\Classes\\Item\\OfferItem $arOfferItem */", "foreach", "(", "$", "arOfferL...
Get the total count of all order positions @return int
[ "Get", "the", "total", "count", "of", "all", "order", "positions" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/OfferCollection.php#L51-L63
lovata/oc-shopaholic-plugin
classes/collection/PromoBlockCollection.php
PromoBlockCollection.sort
public function sort($sSorting) { //Get sorting list $arResultIDList = PromoBlockListStore::instance()->sorting->get($sSorting); return $this->applySorting($arResultIDList); }
php
public function sort($sSorting) { //Get sorting list $arResultIDList = PromoBlockListStore::instance()->sorting->get($sSorting); return $this->applySorting($arResultIDList); }
[ "public", "function", "sort", "(", "$", "sSorting", ")", "{", "//Get sorting list", "$", "arResultIDList", "=", "PromoBlockListStore", "::", "instance", "(", ")", "->", "sorting", "->", "get", "(", "$", "sSorting", ")", ";", "return", "$", "this", "->", "a...
Apply sorting @param string $sSorting @return $this
[ "Apply", "sorting" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/PromoBlockCollection.php#L22-L28
lovata/oc-shopaholic-plugin
models/Price.php
Price.scopeGetByPriceType
public function scopeGetByPriceType($obQuery, $sData) { if (!empty($sData)) { $obQuery->where('price_type_id', $sData); } else { $obQuery->whereNull('price_type_id'); } return $obQuery; }
php
public function scopeGetByPriceType($obQuery, $sData) { if (!empty($sData)) { $obQuery->where('price_type_id', $sData); } else { $obQuery->whereNull('price_type_id'); } return $obQuery; }
[ "public", "function", "scopeGetByPriceType", "(", "$", "obQuery", ",", "$", "sData", ")", "{", "if", "(", "!", "empty", "(", "$", "sData", ")", ")", "{", "$", "obQuery", "->", "where", "(", "'price_type_id'", ",", "$", "sData", ")", ";", "}", "else",...
Get by price type ID @param Offer $obQuery @param int $sData @return Offer
[ "Get", "by", "price", "type", "ID", "@param", "Offer", "$obQuery", "@param", "int", "$sData" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Price.php#L122-L131
lovata/oc-shopaholic-plugin
models/Price.php
Price.getDiscountPriceValueAttribute
protected function getDiscountPriceValueAttribute() { $fPrice = 0; if ($this->old_price_value > 0) { $fPrice = PriceHelper::round($this->old_price_value - $this->price_value); } return $fPrice; }
php
protected function getDiscountPriceValueAttribute() { $fPrice = 0; if ($this->old_price_value > 0) { $fPrice = PriceHelper::round($this->old_price_value - $this->price_value); } return $fPrice; }
[ "protected", "function", "getDiscountPriceValueAttribute", "(", ")", "{", "$", "fPrice", "=", "0", ";", "if", "(", "$", "this", "->", "old_price_value", ">", "0", ")", "{", "$", "fPrice", "=", "PriceHelper", "::", "round", "(", "$", "this", "->", "old_pr...
Get discount_price_value attribute @return float
[ "Get", "discount_price_value", "attribute" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Price.php#L137-L145
lovata/oc-shopaholic-plugin
classes/event/category/CategoryModelHandler.php
CategoryModelHandler.subscribe
public function subscribe($obEvent) { parent::subscribe($obEvent); Category::extend(function ($obModel) { /** @var Category $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->transl...
php
public function subscribe($obEvent) { parent::subscribe($obEvent); Category::extend(function ($obModel) { /** @var Category $obModel */ $bSlugIsTranslatable = Settings::getValue('slug_is_translatable'); if ($bSlugIsTranslatable) { $obModel->transl...
[ "public", "function", "subscribe", "(", "$", "obEvent", ")", "{", "parent", "::", "subscribe", "(", "$", "obEvent", ")", ";", "Category", "::", "extend", "(", "function", "(", "$", "obModel", ")", "{", "/** @var Category $obModel */", "$", "bSlugIsTranslatable...
Add listeners @param \Illuminate\Events\Dispatcher $obEvent
[ "Add", "listeners" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/category/CategoryModelHandler.php#L24-L50
lovata/oc-shopaholic-plugin
classes/event/category/CategoryModelHandler.php
CategoryModelHandler.afterSave
protected function afterSave() { parent::afterSave(); CategoryListStore::instance()->top_level->clear(); $this->checkFieldChanges('active', CategoryListStore::instance()->active); }
php
protected function afterSave() { parent::afterSave(); CategoryListStore::instance()->top_level->clear(); $this->checkFieldChanges('active', CategoryListStore::instance()->active); }
[ "protected", "function", "afterSave", "(", ")", "{", "parent", "::", "afterSave", "(", ")", ";", "CategoryListStore", "::", "instance", "(", ")", "->", "top_level", "->", "clear", "(", ")", ";", "$", "this", "->", "checkFieldChanges", "(", "'active'", ",",...
After save event handler
[ "After", "save", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/category/CategoryModelHandler.php#L55-L61
lovata/oc-shopaholic-plugin
classes/event/category/CategoryModelHandler.php
CategoryModelHandler.afterDelete
protected function afterDelete() { parent::afterDelete(); CategoryListStore::instance()->top_level->clear(); //Clear parent item cache if (!empty($this->obElement->parent_id)) { CategoryItem::clearCache($this->obElement->parent_id); } if ($this->obElemen...
php
protected function afterDelete() { parent::afterDelete(); CategoryListStore::instance()->top_level->clear(); //Clear parent item cache if (!empty($this->obElement->parent_id)) { CategoryItem::clearCache($this->obElement->parent_id); } if ($this->obElemen...
[ "protected", "function", "afterDelete", "(", ")", "{", "parent", "::", "afterDelete", "(", ")", ";", "CategoryListStore", "::", "instance", "(", ")", "->", "top_level", "->", "clear", "(", ")", ";", "//Clear parent item cache", "if", "(", "!", "empty", "(", ...
After delete event handler
[ "After", "delete", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/category/CategoryModelHandler.php#L66-L79
lovata/oc-shopaholic-plugin
classes/event/product/ProductRelationHandler.php
ProductRelationHandler.afterAttach
protected function afterAttach($obModel, $arAttachedIDList, $arInsertData) { $this->clearListByPromoBlock($arAttachedIDList); $this->clearListByCategory($arAttachedIDList); }
php
protected function afterAttach($obModel, $arAttachedIDList, $arInsertData) { $this->clearListByPromoBlock($arAttachedIDList); $this->clearListByCategory($arAttachedIDList); }
[ "protected", "function", "afterAttach", "(", "$", "obModel", ",", "$", "arAttachedIDList", ",", "$", "arInsertData", ")", "{", "$", "this", "->", "clearListByPromoBlock", "(", "$", "arAttachedIDList", ")", ";", "$", "this", "->", "clearListByCategory", "(", "$...
After attach event handler @param \Model $obModel @param array $arAttachedIDList @param array $arInsertData
[ "After", "attach", "event", "handler" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductRelationHandler.php#L25-L29
lovata/oc-shopaholic-plugin
classes/event/product/ProductRelationHandler.php
ProductRelationHandler.clearListByPromoBlock
protected function clearListByPromoBlock($arAttachedIDList) { if ($this->sRelationName != 'promo_block') { return; } foreach ($arAttachedIDList as $iPromoBlockID) { ProductListStore::instance()->promo_block->clear($iPromoBlockID); } }
php
protected function clearListByPromoBlock($arAttachedIDList) { if ($this->sRelationName != 'promo_block') { return; } foreach ($arAttachedIDList as $iPromoBlockID) { ProductListStore::instance()->promo_block->clear($iPromoBlockID); } }
[ "protected", "function", "clearListByPromoBlock", "(", "$", "arAttachedIDList", ")", "{", "if", "(", "$", "this", "->", "sRelationName", "!=", "'promo_block'", ")", "{", "return", ";", "}", "foreach", "(", "$", "arAttachedIDList", "as", "$", "iPromoBlockID", "...
Clear cached product list by promo block ID @param array $arAttachedIDList
[ "Clear", "cached", "product", "list", "by", "promo", "block", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductRelationHandler.php#L46-L55
lovata/oc-shopaholic-plugin
classes/event/product/ProductRelationHandler.php
ProductRelationHandler.clearListByCategory
protected function clearListByCategory($arAttachedIDList) { if ($this->sRelationName != 'additional_category') { return; } foreach ($arAttachedIDList as $iCategoryID) { BrandListStore::instance()->category->clear($iCategoryID); ProductListStore::instance(...
php
protected function clearListByCategory($arAttachedIDList) { if ($this->sRelationName != 'additional_category') { return; } foreach ($arAttachedIDList as $iCategoryID) { BrandListStore::instance()->category->clear($iCategoryID); ProductListStore::instance(...
[ "protected", "function", "clearListByCategory", "(", "$", "arAttachedIDList", ")", "{", "if", "(", "$", "this", "->", "sRelationName", "!=", "'additional_category'", ")", "{", "return", ";", "}", "foreach", "(", "$", "arAttachedIDList", "as", "$", "iCategoryID",...
Clear cached product list by category ID @param array $arAttachedIDList
[ "Clear", "cached", "product", "list", "by", "category", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/event/product/ProductRelationHandler.php#L61-L76
lovata/oc-shopaholic-plugin
updates/seeder_price_format.php
SeederPriceFormat.run
public function run() { Settings::set('decimals', \Lovata\Shopaholic\Models\Settings::getValue('decimals')); Settings::set('dec_point', \Lovata\Shopaholic\Models\Settings::getValue('dec_point')); Settings::set('thousands_sep', \Lovata\Shopaholic\Models\Settings::getValue('thousands_sep')); ...
php
public function run() { Settings::set('decimals', \Lovata\Shopaholic\Models\Settings::getValue('decimals')); Settings::set('dec_point', \Lovata\Shopaholic\Models\Settings::getValue('dec_point')); Settings::set('thousands_sep', \Lovata\Shopaholic\Models\Settings::getValue('thousands_sep')); ...
[ "public", "function", "run", "(", ")", "{", "Settings", "::", "set", "(", "'decimals'", ",", "\\", "Lovata", "\\", "Shopaholic", "\\", "Models", "\\", "Settings", "::", "getValue", "(", "'decimals'", ")", ")", ";", "Settings", "::", "set", "(", "'dec_poi...
Run seeder
[ "Run", "seeder" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/seeder_price_format.php#L15-L20
lovata/oc-shopaholic-plugin
updates/seeder_create_default_currency.php
SeederCreateDefaultCurrency.run
public function run() { $iCurrencyCount = Currency::count(); if ($iCurrencyCount > 0) { return; } $arDefaultCurrencyData = [ 'active' => true, 'is_default' => true, 'name' => 'USD', 'code' => 'USD', ...
php
public function run() { $iCurrencyCount = Currency::count(); if ($iCurrencyCount > 0) { return; } $arDefaultCurrencyData = [ 'active' => true, 'is_default' => true, 'name' => 'USD', 'code' => 'USD', ...
[ "public", "function", "run", "(", ")", "{", "$", "iCurrencyCount", "=", "Currency", "::", "count", "(", ")", ";", "if", "(", "$", "iCurrencyCount", ">", "0", ")", "{", "return", ";", "}", "$", "arDefaultCurrencyData", "=", "[", "'active'", "=>", "true"...
Run seeder
[ "Run", "seeder" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/seeder_create_default_currency.php#L16-L46
lovata/oc-shopaholic-plugin
updates/update_table_offers_remove_price_field.php
UpdateTableOffersRemovePriceField.up
public function up() { if (!Schema::hasTable(self::TABLE_NAME) || !Schema::hasColumn(self::TABLE_NAME, 'price')) { return; } Schema::table(self::TABLE_NAME, function (Blueprint $obTable) { $obTable->dropColumn(['price', 'old_price']); }); }
php
public function up() { if (!Schema::hasTable(self::TABLE_NAME) || !Schema::hasColumn(self::TABLE_NAME, 'price')) { return; } Schema::table(self::TABLE_NAME, function (Blueprint $obTable) { $obTable->dropColumn(['price', 'old_price']); }); }
[ "public", "function", "up", "(", ")", "{", "if", "(", "!", "Schema", "::", "hasTable", "(", "self", "::", "TABLE_NAME", ")", "||", "!", "Schema", "::", "hasColumn", "(", "self", "::", "TABLE_NAME", ",", "'price'", ")", ")", "{", "return", ";", "}", ...
Apply migration
[ "Apply", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/update_table_offers_remove_price_field.php#L18-L27
lovata/oc-shopaholic-plugin
updates/update_table_offers_remove_price_field.php
UpdateTableOffersRemovePriceField.down
public function down() { if (!Schema::hasTable(self::TABLE_NAME) || Schema::hasColumn(self::TABLE_NAME, 'price')) { return; } Schema::table(self::TABLE_NAME, function (Blueprint $obTable) { $obTable->decimal('price', 15, 2)->nullable(); $obTable->...
php
public function down() { if (!Schema::hasTable(self::TABLE_NAME) || Schema::hasColumn(self::TABLE_NAME, 'price')) { return; } Schema::table(self::TABLE_NAME, function (Blueprint $obTable) { $obTable->decimal('price', 15, 2)->nullable(); $obTable->...
[ "public", "function", "down", "(", ")", "{", "if", "(", "!", "Schema", "::", "hasTable", "(", "self", "::", "TABLE_NAME", ")", "||", "Schema", "::", "hasColumn", "(", "self", "::", "TABLE_NAME", ",", "'price'", ")", ")", "{", "return", ";", "}", "Sch...
Rollback migration
[ "Rollback", "migration" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/updates/update_table_offers_remove_price_field.php#L32-L45
lovata/oc-shopaholic-plugin
models/Currency.php
Currency.disableDefaultCurrency
protected function disableDefaultCurrency() { $obCurrencyList = Currency::isDefault()->get(); if ($obCurrencyList->isEmpty()) { return; } /** @var Currency $obCurrency */ foreach ($obCurrencyList as $obCurrency) { if ($obCurrency->id == $this->id) { ...
php
protected function disableDefaultCurrency() { $obCurrencyList = Currency::isDefault()->get(); if ($obCurrencyList->isEmpty()) { return; } /** @var Currency $obCurrency */ foreach ($obCurrencyList as $obCurrency) { if ($obCurrency->id == $this->id) { ...
[ "protected", "function", "disableDefaultCurrency", "(", ")", "{", "$", "obCurrencyList", "=", "Currency", "::", "isDefault", "(", ")", "->", "get", "(", ")", ";", "if", "(", "$", "obCurrencyList", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", ...
Disable default currency, because only one can be an active currency
[ "Disable", "default", "currency", "because", "only", "one", "can", "be", "an", "active", "currency" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Currency.php#L145-L161
lovata/oc-shopaholic-plugin
classes/helper/CatalogMenuType.php
CatalogMenuType.resolveMenuItem
public function resolveMenuItem($obMenuItem, $sURL) { $arResult = [ 'items' => [], ]; //Get category list with sorted by 'nest_left' $obCategoryList = CategoryCollection::make()->tree(); if ($obCategoryList->isEmpty()) { return $arResult; } ...
php
public function resolveMenuItem($obMenuItem, $sURL) { $arResult = [ 'items' => [], ]; //Get category list with sorted by 'nest_left' $obCategoryList = CategoryCollection::make()->tree(); if ($obCategoryList->isEmpty()) { return $arResult; } ...
[ "public", "function", "resolveMenuItem", "(", "$", "obMenuItem", ",", "$", "sURL", ")", "{", "$", "arResult", "=", "[", "'items'", "=>", "[", "]", ",", "]", ";", "//Get category list with sorted by 'nest_left'", "$", "obCategoryList", "=", "CategoryCollection", ...
Handler for the pages.menuitem.resolveItem event. @param \RainLab\Pages\Classes\MenuItem $obMenuItem @param string $sURL @return array|mixed
[ "Handler", "for", "the", "pages", ".", "menuitem", ".", "resolveItem", "event", "." ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/CatalogMenuType.php#L22-L45
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.switchCountry
public function switchCountry($sCountryCode) { if (empty($sCountryCode) || !PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } $this->obActiveCountry = \RainLab\Location\Models\Country::whereCode($sCountryCode)->first(); }
php
public function switchCountry($sCountryCode) { if (empty($sCountryCode) || !PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } $this->obActiveCountry = \RainLab\Location\Models\Country::whereCode($sCountryCode)->first(); }
[ "public", "function", "switchCountry", "(", "$", "sCountryCode", ")", "{", "if", "(", "empty", "(", "$", "sCountryCode", ")", "||", "!", "PluginManager", "::", "instance", "(", ")", "->", "hasPlugin", "(", "'RainLab.Location'", ")", ")", "{", "return", ";"...
Switch active country by code @param string $sCountryCode
[ "Switch", "active", "country", "by", "code" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L44-L51
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.switchState
public function switchState($sStateCode) { if (empty($sStateCode) || !PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } $this->obActiveState = \RainLab\Location\Models\State::whereCode($sStateCode)->first(); }
php
public function switchState($sStateCode) { if (empty($sStateCode) || !PluginManager::instance()->hasPlugin('RainLab.Location')) { return; } $this->obActiveState = \RainLab\Location\Models\State::whereCode($sStateCode)->first(); }
[ "public", "function", "switchState", "(", "$", "sStateCode", ")", "{", "if", "(", "empty", "(", "$", "sStateCode", ")", "||", "!", "PluginManager", "::", "instance", "(", ")", "->", "hasPlugin", "(", "'RainLab.Location'", ")", ")", "{", "return", ";", "}...
Switch active state by code @param string $sStateCode
[ "Switch", "active", "state", "by", "code" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L66-L73
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.getPriceWithoutTax
public function getPriceWithoutTax($fPrice, $fPricePercent) { $fPriceResult = $fPrice; if ($this->bPriceIncludeTax) { $fPriceResult = $this->calculatePriceWithoutTax($fPrice, $fPricePercent); } return $fPriceResult; }
php
public function getPriceWithoutTax($fPrice, $fPricePercent) { $fPriceResult = $fPrice; if ($this->bPriceIncludeTax) { $fPriceResult = $this->calculatePriceWithoutTax($fPrice, $fPricePercent); } return $fPriceResult; }
[ "public", "function", "getPriceWithoutTax", "(", "$", "fPrice", ",", "$", "fPricePercent", ")", "{", "$", "fPriceResult", "=", "$", "fPrice", ";", "if", "(", "$", "this", "->", "bPriceIncludeTax", ")", "{", "$", "fPriceResult", "=", "$", "this", "->", "c...
Get price value without tax @param float $fPrice @param float $fPricePercent @return float
[ "Get", "price", "value", "without", "tax" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L99-L107
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.getPriceWithTax
public function getPriceWithTax($fPrice, $fPricePercent) { $fPriceResult = $fPrice; if (!$this->bPriceIncludeTax) { $fPriceResult = $this->calculatePriceWithTax($fPrice, $fPricePercent); } return $fPriceResult; }
php
public function getPriceWithTax($fPrice, $fPricePercent) { $fPriceResult = $fPrice; if (!$this->bPriceIncludeTax) { $fPriceResult = $this->calculatePriceWithTax($fPrice, $fPricePercent); } return $fPriceResult; }
[ "public", "function", "getPriceWithTax", "(", "$", "fPrice", ",", "$", "fPricePercent", ")", "{", "$", "fPriceResult", "=", "$", "fPrice", ";", "if", "(", "!", "$", "this", "->", "bPriceIncludeTax", ")", "{", "$", "fPriceResult", "=", "$", "this", "->", ...
Get price value with tax @param float $fPrice @param float $fPricePercent @return float
[ "Get", "price", "value", "with", "tax" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L115-L123
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.calculatePriceWithTax
public function calculatePriceWithTax($fPrice, $fTax) { $fPrice = ($fPrice * (100 + $fTax)) / 100; $fPrice = PriceHelper::round($fPrice); return $fPrice; }
php
public function calculatePriceWithTax($fPrice, $fTax) { $fPrice = ($fPrice * (100 + $fTax)) / 100; $fPrice = PriceHelper::round($fPrice); return $fPrice; }
[ "public", "function", "calculatePriceWithTax", "(", "$", "fPrice", ",", "$", "fTax", ")", "{", "$", "fPrice", "=", "(", "$", "fPrice", "*", "(", "100", "+", "$", "fTax", ")", ")", "/", "100", ";", "$", "fPrice", "=", "PriceHelper", "::", "round", "...
Calculate price + tax @param float $fPrice @param float $fTax @return float
[ "Calculate", "price", "+", "tax" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L131-L137
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.calculatePriceWithoutTax
public function calculatePriceWithoutTax($fPrice, $fTax) { $fPrice = ($fPrice * 100) / (100 + $fTax); $fPrice = PriceHelper::round($fPrice); return $fPrice; }
php
public function calculatePriceWithoutTax($fPrice, $fTax) { $fPrice = ($fPrice * 100) / (100 + $fTax); $fPrice = PriceHelper::round($fPrice); return $fPrice; }
[ "public", "function", "calculatePriceWithoutTax", "(", "$", "fPrice", ",", "$", "fTax", ")", "{", "$", "fPrice", "=", "(", "$", "fPrice", "*", "100", ")", "/", "(", "100", "+", "$", "fTax", ")", ";", "$", "fPrice", "=", "PriceHelper", "::", "round", ...
Calculate price - tax @param float $fPrice @param float $fTax @return float
[ "Calculate", "price", "-", "tax" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L145-L151
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.getTaxPercent
public function getTaxPercent($obTaxList) { if (empty($obTaxList) || $obTaxList->isEmpty()) { return 0; } //Calculate tax percent $fTaxPercent = 0; foreach ($obTaxList as $obTaxItem) { $fTaxPercent += $obTaxItem->percent; } $fTaxPerce...
php
public function getTaxPercent($obTaxList) { if (empty($obTaxList) || $obTaxList->isEmpty()) { return 0; } //Calculate tax percent $fTaxPercent = 0; foreach ($obTaxList as $obTaxItem) { $fTaxPercent += $obTaxItem->percent; } $fTaxPerce...
[ "public", "function", "getTaxPercent", "(", "$", "obTaxList", ")", "{", "if", "(", "empty", "(", "$", "obTaxList", ")", "||", "$", "obTaxList", "->", "isEmpty", "(", ")", ")", "{", "return", "0", ";", "}", "//Calculate tax percent", "$", "fTaxPercent", "...
Get tax percent @param \Lovata\Shopaholic\Classes\Collection\TaxCollection|\Lovata\Shopaholic\Classes\Item\TaxItem[] $obTaxList @return float
[ "Get", "tax", "percent" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L158-L173
lovata/oc-shopaholic-plugin
classes/helper/TaxHelper.php
TaxHelper.init
protected function init() { $this->obTaxList = TaxCollection::make()->active()->sort(); $this->bPriceIncludeTax = (bool) Settings::getValue('price_include_tax'); }
php
protected function init() { $this->obTaxList = TaxCollection::make()->active()->sort(); $this->bPriceIncludeTax = (bool) Settings::getValue('price_include_tax'); }
[ "protected", "function", "init", "(", ")", "{", "$", "this", "->", "obTaxList", "=", "TaxCollection", "::", "make", "(", ")", "->", "active", "(", ")", "->", "sort", "(", ")", ";", "$", "this", "->", "bPriceIncludeTax", "=", "(", "bool", ")", "Settin...
Init currency data
[ "Init", "currency", "data" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/helper/TaxHelper.php#L178-L183
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.category
public function category($arCategoryIDList, $bWithChildren = false) { if (!is_array($arCategoryIDList)) { $arCategoryIDList = [$arCategoryIDList]; } $arResultIDList = []; foreach ($arCategoryIDList as $iCategoryID) { $arResultIDList = array_merge($arResultIDL...
php
public function category($arCategoryIDList, $bWithChildren = false) { if (!is_array($arCategoryIDList)) { $arCategoryIDList = [$arCategoryIDList]; } $arResultIDList = []; foreach ($arCategoryIDList as $iCategoryID) { $arResultIDList = array_merge($arResultIDL...
[ "public", "function", "category", "(", "$", "arCategoryIDList", ",", "$", "bWithChildren", "=", "false", ")", "{", "if", "(", "!", "is_array", "(", "$", "arCategoryIDList", ")", ")", "{", "$", "arCategoryIDList", "=", "[", "$", "arCategoryIDList", "]", ";"...
Filter product list by category ID @param int|array $arCategoryIDList @param bool $bWithChildren @return $this
[ "Filter", "product", "list", "by", "category", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L85-L100
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.brand
public function brand($iBrandID) { $arResultIDList = ProductListStore::instance()->brand->get($iBrandID); return $this->intersect($arResultIDList); }
php
public function brand($iBrandID) { $arResultIDList = ProductListStore::instance()->brand->get($iBrandID); return $this->intersect($arResultIDList); }
[ "public", "function", "brand", "(", "$", "iBrandID", ")", "{", "$", "arResultIDList", "=", "ProductListStore", "::", "instance", "(", ")", "->", "brand", "->", "get", "(", "$", "iBrandID", ")", ";", "return", "$", "this", "->", "intersect", "(", "$", "...
Filter product list by brand ID @param int $iBrandID @return $this
[ "Filter", "product", "list", "by", "brand", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L107-L112
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.promo
public function promo($iPromoBlockID) { $arResultIDList = ProductListStore::instance()->promo_block->get($iPromoBlockID); //Fire event, get additional product ID list $arEventDataList = Event::fire(PromoBlock::EVENT_GET_PRODUCT_LIST, $iPromoBlockID); if (empty($arEventDataList)) { ...
php
public function promo($iPromoBlockID) { $arResultIDList = ProductListStore::instance()->promo_block->get($iPromoBlockID); //Fire event, get additional product ID list $arEventDataList = Event::fire(PromoBlock::EVENT_GET_PRODUCT_LIST, $iPromoBlockID); if (empty($arEventDataList)) { ...
[ "public", "function", "promo", "(", "$", "iPromoBlockID", ")", "{", "$", "arResultIDList", "=", "ProductListStore", "::", "instance", "(", ")", "->", "promo_block", "->", "get", "(", "$", "iPromoBlockID", ")", ";", "//Fire event, get additional product ID list", "...
Filter product list by promo block ID + different extensions @param int $iPromoBlockID @return $this
[ "Filter", "product", "list", "by", "promo", "block", "ID", "+", "different", "extensions" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L119-L141
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.promoBlock
public function promoBlock($iPromoBlockID) { $arResultIDList = ProductListStore::instance()->promo_block->get($iPromoBlockID); return $this->intersect($arResultIDList); }
php
public function promoBlock($iPromoBlockID) { $arResultIDList = ProductListStore::instance()->promo_block->get($iPromoBlockID); return $this->intersect($arResultIDList); }
[ "public", "function", "promoBlock", "(", "$", "iPromoBlockID", ")", "{", "$", "arResultIDList", "=", "ProductListStore", "::", "instance", "(", ")", "->", "promo_block", "->", "get", "(", "$", "iPromoBlockID", ")", ";", "return", "$", "this", "->", "intersec...
Filter product list by promo block ID @param int $iPromoBlockID @return $this
[ "Filter", "product", "list", "by", "promo", "block", "ID" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L148-L153
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.getOfferMinPrice
public function getOfferMinPrice($sPriceTypeCode = null) { $obProductList = clone $this; $sSorting = ProductListStore::SORT_PRICE_ASC; if (!empty($sPriceTypeCode)) { $sSorting .= '|'.$sPriceTypeCode; } $obProductList->sort($sSorting); //Get product with...
php
public function getOfferMinPrice($sPriceTypeCode = null) { $obProductList = clone $this; $sSorting = ProductListStore::SORT_PRICE_ASC; if (!empty($sPriceTypeCode)) { $sSorting .= '|'.$sPriceTypeCode; } $obProductList->sort($sSorting); //Get product with...
[ "public", "function", "getOfferMinPrice", "(", "$", "sPriceTypeCode", "=", "null", ")", "{", "$", "obProductList", "=", "clone", "$", "this", ";", "$", "sSorting", "=", "ProductListStore", "::", "SORT_PRICE_ASC", ";", "if", "(", "!", "empty", "(", "$", "sP...
Get offer with min price @param string $sPriceTypeCode @return OfferItem
[ "Get", "offer", "with", "min", "price" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L160-L194
lovata/oc-shopaholic-plugin
classes/collection/ProductCollection.php
ProductCollection.getIDListChildrenCategory
protected function getIDListChildrenCategory($iCategoryID) : array { //Get category item $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isEmpty() || $obCategoryItem->children->isEmpty()) { return []; } $arResultIDList = []; forea...
php
protected function getIDListChildrenCategory($iCategoryID) : array { //Get category item $obCategoryItem = CategoryItem::make($iCategoryID); if ($obCategoryItem->isEmpty() || $obCategoryItem->children->isEmpty()) { return []; } $arResultIDList = []; forea...
[ "protected", "function", "getIDListChildrenCategory", "(", "$", "iCategoryID", ")", ":", "array", "{", "//Get category item", "$", "obCategoryItem", "=", "CategoryItem", "::", "make", "(", "$", "iCategoryID", ")", ";", "if", "(", "$", "obCategoryItem", "->", "is...
Get product ID list for children categories @param int $iCategoryID @return array
[ "Get", "product", "ID", "list", "for", "children", "categories" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/collection/ProductCollection.php#L242-L257
lovata/oc-shopaholic-plugin
classes/store/promoblock/SortingListStore.php
SortingListStore.getIDListFromDB
protected function getIDListFromDB() : array { switch ($this->sValue) { case PromoBlockListStore::SORT_DATE_BEGIN_ASC: $arElementIDList = $this->getByDateBeginASC(); break; case PromoBlockListStore::SORT_DATE_BEGIN_DESC: $arElementIDLis...
php
protected function getIDListFromDB() : array { switch ($this->sValue) { case PromoBlockListStore::SORT_DATE_BEGIN_ASC: $arElementIDList = $this->getByDateBeginASC(); break; case PromoBlockListStore::SORT_DATE_BEGIN_DESC: $arElementIDLis...
[ "protected", "function", "getIDListFromDB", "(", ")", ":", "array", "{", "switch", "(", "$", "this", "->", "sValue", ")", "{", "case", "PromoBlockListStore", "::", "SORT_DATE_BEGIN_ASC", ":", "$", "arElementIDList", "=", "$", "this", "->", "getByDateBeginASC", ...
Get ID list from database @return array
[ "Get", "ID", "list", "from", "database" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/promoblock/SortingListStore.php#L57-L81
lovata/oc-shopaholic-plugin
classes/store/promoblock/SortingListStore.php
SortingListStore.getCustomSortingList
protected function getCustomSortingList() : array { $arEventResult = Event::fire('shopaholic.promo_block.sorting.get.list', [$this->sValue]); if (empty($arEventResult)) { return []; } $arElementIDList = []; foreach ($arEventResult as $arEventPromoBlockIDList) { ...
php
protected function getCustomSortingList() : array { $arEventResult = Event::fire('shopaholic.promo_block.sorting.get.list', [$this->sValue]); if (empty($arEventResult)) { return []; } $arElementIDList = []; foreach ($arEventResult as $arEventPromoBlockIDList) { ...
[ "protected", "function", "getCustomSortingList", "(", ")", ":", "array", "{", "$", "arEventResult", "=", "Event", "::", "fire", "(", "'shopaholic.promo_block.sorting.get.list'", ",", "[", "$", "this", "->", "sValue", "]", ")", ";", "if", "(", "empty", "(", "...
Get element list with custom sorting @return array
[ "Get", "element", "list", "with", "custom", "sorting" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/classes/store/promoblock/SortingListStore.php#L87-L105
lovata/oc-shopaholic-plugin
models/Product.php
Product.importData
public function importData($arElementList, $sSessionKey = null) { if (empty($arElementList)) { return; } $obImport = new ImportProductModel(); $obImport->setDeactivateFlag(); foreach ($arElementList as $iKey => $arImportData) { $obImport->import($arI...
php
public function importData($arElementList, $sSessionKey = null) { if (empty($arElementList)) { return; } $obImport = new ImportProductModel(); $obImport->setDeactivateFlag(); foreach ($arElementList as $iKey => $arImportData) { $obImport->import($arI...
[ "public", "function", "importData", "(", "$", "arElementList", ",", "$", "sSessionKey", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "arElementList", ")", ")", "{", "return", ";", "}", "$", "obImport", "=", "new", "ImportProductModel", "(", ")", ...
Import item list from CSV file @param array $arElementList @param null $sSessionKey @throws \Throwable
[ "Import", "item", "list", "from", "CSV", "file" ]
train
https://github.com/lovata/oc-shopaholic-plugin/blob/f6124c3aaae626ee01e88cceb911677657e80495/models/Product.php#L228-L249
amphp/http-server
src/DefaultErrorHandler.php
DefaultErrorHandler.handleError
public function handleError(int $statusCode, string $reason = null, Request $request = null): Promise { static $errorHtml; if ($errorHtml === null) { $errorHtml = \file_get_contents(\dirname(__DIR__) . "/resources/error.html"); } if (!isset($this->cache[$statusCode])) {...
php
public function handleError(int $statusCode, string $reason = null, Request $request = null): Promise { static $errorHtml; if ($errorHtml === null) { $errorHtml = \file_get_contents(\dirname(__DIR__) . "/resources/error.html"); } if (!isset($this->cache[$statusCode])) {...
[ "public", "function", "handleError", "(", "int", "$", "statusCode", ",", "string", "$", "reason", "=", "null", ",", "Request", "$", "request", "=", "null", ")", ":", "Promise", "{", "static", "$", "errorHtml", ";", "if", "(", "$", "errorHtml", "===", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/amphp/http-server/blob/e332da0c7f282cbea36c32e32b3dedbc73a339ae/src/DefaultErrorHandler.php#L18-L42