mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
fixed configuration sort order
This commit is contained in:
parent
a81c5d5abc
commit
bef50883ca
@ -9,85 +9,88 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
||||
class OptionConfigurationRepository extends EntryRepository implements OptionConfigurationRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* The entry model.
|
||||
*
|
||||
* @var OptionConfigurationModel
|
||||
*/
|
||||
protected $model;
|
||||
protected $advRepository;
|
||||
protected $productOptionsValueRepository;
|
||||
/**
|
||||
* The entry model.
|
||||
*
|
||||
* @var OptionConfigurationModel
|
||||
*/
|
||||
protected $model;
|
||||
protected $advRepository;
|
||||
protected $productOptionsValueRepository;
|
||||
|
||||
/**
|
||||
* Create a new OptionConfigurationRepository instance.
|
||||
*
|
||||
* @param OptionConfigurationModel $model
|
||||
*/
|
||||
public function __construct(
|
||||
OptionConfigurationModel $model,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||
)
|
||||
{
|
||||
$this->model = $model;
|
||||
$this->advRepository = $advRepository;
|
||||
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||
}
|
||||
/**
|
||||
* Create a new OptionConfigurationRepository instance.
|
||||
*
|
||||
* @param OptionConfigurationModel $model
|
||||
*/
|
||||
public function __construct(
|
||||
OptionConfigurationModel $model,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||
)
|
||||
{
|
||||
$this->model = $model;
|
||||
$this->advRepository = $advRepository;
|
||||
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||
}
|
||||
|
||||
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||
{
|
||||
return $this->create([
|
||||
'parent_adv_id' => $ad_id,
|
||||
'price' => $price,
|
||||
'currency' => $currency,
|
||||
'stock' => $stock,
|
||||
'option_json' => $option_json,
|
||||
]);
|
||||
}
|
||||
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||
{
|
||||
return $this->create([
|
||||
'parent_adv_id' => $ad_id,
|
||||
'price' => $price,
|
||||
'currency' => $currency,
|
||||
'stock' => $stock,
|
||||
'option_json' => $option_json,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getConf($ad_id)
|
||||
{
|
||||
$adv = $this->advRepository->find($ad_id);
|
||||
$configurations = array();
|
||||
public function getConf($ad_id)
|
||||
{
|
||||
$adv = $this->advRepository->find($ad_id);
|
||||
$configurations = array();
|
||||
|
||||
$product_configurations = $this->model->where('stock', '>', '0')->where('parent_adv_id', $ad_id)->get();
|
||||
$product_configurations = $this->model->where('stock', '>', '0')
|
||||
->where('parent_adv_id', $ad_id)
|
||||
->orderBy('created_at', 'ASC')
|
||||
->get();
|
||||
|
||||
foreach ($product_configurations as $product_configuration) {
|
||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||
$option_group_value = "";
|
||||
foreach ($configurations_item as $option_id => $value) {
|
||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||
$option_group_value .= " " . $value_entry->getName();
|
||||
}
|
||||
$configurations[$product_configuration->getId()] = [
|
||||
'name' => $option_group_value,
|
||||
'price' => $product_configuration->price,
|
||||
'currency' => $product_configuration->currency,
|
||||
'stock' => $product_configuration->stock,
|
||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||
];
|
||||
}
|
||||
foreach ($product_configurations as $product_configuration) {
|
||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||
$option_group_value = "";
|
||||
foreach ($configurations_item as $option_id => $value) {
|
||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||
$option_group_value .= " " . $value_entry->getName();
|
||||
}
|
||||
$configurations[$product_configuration->getId()] = [
|
||||
'name' => $option_group_value,
|
||||
'price' => $product_configuration->price,
|
||||
'currency' => $product_configuration->currency,
|
||||
'stock' => $product_configuration->stock,
|
||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||
];
|
||||
}
|
||||
|
||||
return $configurations;
|
||||
}
|
||||
return $configurations;
|
||||
}
|
||||
|
||||
public function getUnusedConfigs()
|
||||
{
|
||||
return $this->newQuery()
|
||||
public function getUnusedConfigs()
|
||||
{
|
||||
return $this->newQuery()
|
||||
->leftJoin('advs_advs as ads', 'advs_option_configuration.parent_adv_id', 'ads.id')
|
||||
->whereNull('ads.id')
|
||||
->orWhereNotNull('deleted_at')
|
||||
->pluck('parent_adv_id')
|
||||
->all();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteUnusedConfigs($adsIDs)
|
||||
{
|
||||
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||
}
|
||||
public function deleteUnusedConfigs($adsIDs)
|
||||
{
|
||||
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||
}
|
||||
|
||||
public function deleteAdsConfigs($adID)
|
||||
{
|
||||
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||
}
|
||||
public function deleteAdsConfigs($adID)
|
||||
{
|
||||
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
272
composer.json
272
composer.json
@ -1,139 +1,143 @@
|
||||
{
|
||||
"name": "openclassify/openclassify",
|
||||
"description": "OpenClassify is the extensible and most advanced open source classified app build with Laravel.",
|
||||
"type": "project",
|
||||
"keywords": [
|
||||
"OpenClassify",
|
||||
"classified",
|
||||
"open Classify"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Visiosoft, Inc.",
|
||||
"email": "support@visiosoft.com.tr"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"wikimedia/composer-merge-plugin": "~1.4.0",
|
||||
"anomaly/streams-composer-plugin": "~1.1.0",
|
||||
"visiosoft/streams-platform": "^1.7",
|
||||
"anomaly/default_authenticator-extension": "~2.1.0",
|
||||
"anomaly/throttle_security_check-extension": "~2.1.0",
|
||||
"anomaly/private_storage_adapter-extension": "~1.0.0",
|
||||
"anomaly/default_page_handler-extension": "~2.1.0",
|
||||
"anomaly/user_security_check-extension": "~2.1.0",
|
||||
"anomaly/xml_feed_widget-extension": "~2.1.0",
|
||||
"anomaly/page_link_type-extension": "~2.1.0",
|
||||
"anomaly/url_link_type-extension": "~2.1.0",
|
||||
"anomaly/relationship-field_type": "~2.2.0",
|
||||
"anomaly/colorpicker-field_type": "~2.3.0",
|
||||
"anomaly/polymorphic-field_type": "~2.1.0",
|
||||
"anomaly/checkboxes-field_type": "~2.4.0",
|
||||
"anomaly/encrypted-field_type": "~2.1.0",
|
||||
"anomaly/datetime-field_type": "~3.0.0",
|
||||
"anomaly/repeater-field_type": "~1.3.0",
|
||||
"anomaly/language-field_type": "~2.2.0",
|
||||
"anomaly/multiple-field_type": "~2.3.0",
|
||||
"anomaly/textarea-field_type": "~2.1.0",
|
||||
"anomaly/markdown-field_type": "~3.1.0",
|
||||
"anomaly/wysiwyg-field_type": "~3.1.0",
|
||||
"anomaly/boolean-field_type": "~2.3.0",
|
||||
"anomaly/country-field_type": "~2.3.0",
|
||||
"anomaly/decimal-field_type": "~2.1.0",
|
||||
"anomaly/integer-field_type": "~2.1.0",
|
||||
"anomaly/editor-field_type": "~3.1.0",
|
||||
"anomaly/select-field_type": "~2.3.0",
|
||||
"anomaly/slider-field_type": "~3.0.0",
|
||||
"anomaly/addon-field_type": "~2.2.0",
|
||||
"anomaly/email-field_type": "~2.1.0",
|
||||
"anomaly/state-field_type": "~2.3.0",
|
||||
"anomaly/files-field_type": "~2.3.0",
|
||||
"anomaly/tags-field_type": "~2.4.0",
|
||||
"anomaly/slug-field_type": "~2.1.0",
|
||||
"anomaly/text-field_type": "~2.2.0",
|
||||
"anomaly/file-field_type": "~2.2.0",
|
||||
"anomaly/url-field_type": "~2.2.0",
|
||||
"anomaly/configuration-module": "~2.1.0",
|
||||
"anomaly/preferences-module": "~2.2.0",
|
||||
"anomaly/navigation-module": "~2.4.0",
|
||||
"anomaly/dashboard-module": "~2.2.0",
|
||||
"anomaly/redirects-module": "~2.3.0",
|
||||
"anomaly/variables-module": "~2.4.0",
|
||||
"anomaly/settings-module": "~2.4.0",
|
||||
"anomaly/blocks-module": "~1.3.0",
|
||||
"anomaly/search-module": "~3.0.0",
|
||||
"anomaly/system-module": "~1.0.0",
|
||||
"anomaly/users-module": "~2.5.0",
|
||||
"anomaly/pages-module": "~2.6.0",
|
||||
"anomaly/posts-module": "~2.6.0",
|
||||
"anomaly/files-module": "~2.6.0",
|
||||
"anomaly/contact-plugin": "~1.2.0",
|
||||
"anomaly/helper-plugin": "~2.1.0",
|
||||
"anomaly/robots-extension": "~2.1.0",
|
||||
"anomaly/sitemap-extension": "~2.2.0",
|
||||
"anomaly/html_block-extension": "~1.0.0",
|
||||
"anomaly/wysiwyg_block-extension": "~1.0.0",
|
||||
"ammadeuss/laravel-html-dom-parser": "^1.1",
|
||||
"visiosoft/decimal-field_type": "~2.1.0",
|
||||
"visiosoft/integer-field_type": "~2.1.0",
|
||||
"visiosoft/list-field_type": "*",
|
||||
"guzzlehttp/guzzle": "~6.3.3",
|
||||
"composer/composer": "^1.6"
|
||||
},
|
||||
"replace": {
|
||||
"anomaly/streams-platform": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "~2.0",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"mockery/mockery": "0.9.*",
|
||||
"symfony/css-selector": "3.1.*",
|
||||
"symfony/dom-crawler": "3.1.*",
|
||||
"anomaly/installer-module": "~2.3.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://packages.pyrocms.com"
|
||||
},
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://community.pyrocms.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"database"
|
||||
"name": "openclassify/openclassify",
|
||||
"description": "OpenClassify is the extensible and most advanced open source classified app build with Laravel.",
|
||||
"type": "project",
|
||||
"keywords": [
|
||||
"OpenClassify",
|
||||
"classified",
|
||||
"open Classify"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/TestCase.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"merge-plugin": {
|
||||
"include": [
|
||||
"addons/*/*/*/composer.json",
|
||||
"core/*/*/composer.json"
|
||||
],
|
||||
"recurse": true,
|
||||
"replace": false
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Visiosoft, Inc.",
|
||||
"email": "support@visiosoft.com.tr"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"wikimedia/composer-merge-plugin": "~1.4.0",
|
||||
"anomaly/streams-composer-plugin": "~1.1.0",
|
||||
"visiosoft/streams-platform": "^1.7",
|
||||
"anomaly/default_authenticator-extension": "~2.1.0",
|
||||
"anomaly/throttle_security_check-extension": "~2.1.0",
|
||||
"anomaly/private_storage_adapter-extension": "~1.0.0",
|
||||
"anomaly/default_page_handler-extension": "~2.1.0",
|
||||
"anomaly/user_security_check-extension": "~2.1.0",
|
||||
"anomaly/xml_feed_widget-extension": "~2.1.0",
|
||||
"anomaly/page_link_type-extension": "~2.1.0",
|
||||
"anomaly/url_link_type-extension": "~2.1.0",
|
||||
"anomaly/relationship-field_type": "~2.2.0",
|
||||
"anomaly/colorpicker-field_type": "~2.3.0",
|
||||
"anomaly/polymorphic-field_type": "~2.1.0",
|
||||
"anomaly/checkboxes-field_type": "~2.4.0",
|
||||
"anomaly/encrypted-field_type": "~2.1.0",
|
||||
"anomaly/datetime-field_type": "~3.0.0",
|
||||
"anomaly/repeater-field_type": "~1.3.0",
|
||||
"anomaly/language-field_type": "~2.2.0",
|
||||
"anomaly/multiple-field_type": "~2.3.0",
|
||||
"anomaly/textarea-field_type": "~2.1.0",
|
||||
"anomaly/markdown-field_type": "~3.1.0",
|
||||
"anomaly/wysiwyg-field_type": "~3.1.0",
|
||||
"anomaly/boolean-field_type": "~2.3.0",
|
||||
"anomaly/country-field_type": "~2.3.0",
|
||||
"anomaly/decimal-field_type": "~2.1.0",
|
||||
"anomaly/integer-field_type": "~2.1.0",
|
||||
"anomaly/editor-field_type": "~3.1.0",
|
||||
"anomaly/select-field_type": "~2.3.0",
|
||||
"anomaly/slider-field_type": "~3.0.0",
|
||||
"anomaly/addon-field_type": "~2.2.0",
|
||||
"anomaly/email-field_type": "~2.1.0",
|
||||
"anomaly/state-field_type": "~2.3.0",
|
||||
"anomaly/files-field_type": "~2.3.0",
|
||||
"anomaly/tags-field_type": "~2.4.0",
|
||||
"anomaly/slug-field_type": "~2.1.0",
|
||||
"anomaly/text-field_type": "~2.2.0",
|
||||
"anomaly/file-field_type": "~2.2.0",
|
||||
"anomaly/url-field_type": "~2.2.0",
|
||||
"anomaly/configuration-module": "~2.1.0",
|
||||
"anomaly/preferences-module": "~2.2.0",
|
||||
"anomaly/navigation-module": "~2.4.0",
|
||||
"anomaly/dashboard-module": "~2.2.0",
|
||||
"anomaly/redirects-module": "~2.3.0",
|
||||
"anomaly/variables-module": "~2.4.0",
|
||||
"anomaly/settings-module": "~2.4.0",
|
||||
"anomaly/blocks-module": "~1.3.0",
|
||||
"anomaly/search-module": "~3.0.0",
|
||||
"anomaly/system-module": "~1.0.0",
|
||||
"anomaly/users-module": "~2.5.0",
|
||||
"anomaly/pages-module": "~2.6.0",
|
||||
"anomaly/posts-module": "~2.6.0",
|
||||
"anomaly/files-module": "~2.6.0",
|
||||
"anomaly/contact-plugin": "~1.2.0",
|
||||
"anomaly/helper-plugin": "~2.1.0",
|
||||
"anomaly/robots-extension": "~2.1.0",
|
||||
"anomaly/sitemap-extension": "~2.2.0",
|
||||
"anomaly/html_block-extension": "~1.0.0",
|
||||
"anomaly/wysiwyg_block-extension": "~1.0.0",
|
||||
"ammadeuss/laravel-html-dom-parser": "^1.1",
|
||||
"visiosoft/decimal-field_type": "~2.1.0",
|
||||
"visiosoft/integer-field_type": "~2.1.0",
|
||||
"visiosoft/list-field_type": "*",
|
||||
"guzzlehttp/guzzle": "~6.3.3",
|
||||
"composer/composer": "^1.6"
|
||||
},
|
||||
"laravel": {
|
||||
"dont-discover": [
|
||||
"*"
|
||||
]
|
||||
"replace": {
|
||||
"anomaly/streams-platform": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "~2.0",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"mockery/mockery": "0.9.*",
|
||||
"symfony/css-selector": "3.1.*",
|
||||
"symfony/dom-crawler": "3.1.*",
|
||||
"anomaly/installer-module": "~2.3.0"
|
||||
},
|
||||
"repositories": {
|
||||
"0": {
|
||||
"type": "composer",
|
||||
"url": "https://packages.pyrocms.com"
|
||||
},
|
||||
"1": {
|
||||
"type": "composer",
|
||||
"url": "https://community.pyrocms.com"
|
||||
},
|
||||
"repo-name": {
|
||||
"type": "composer",
|
||||
"url": "https://repo.openclassify.com"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"database"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/TestCase.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"merge-plugin": {
|
||||
"include": [
|
||||
"addons/*/*/*/composer.json",
|
||||
"core/*/*/composer.json"
|
||||
],
|
||||
"recurse": true,
|
||||
"replace": false
|
||||
},
|
||||
"laravel": {
|
||||
"dont-discover": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user