mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 07:16:06 -06:00
#1879 Ürün seçenekleri ve GET seçenekleri
This commit is contained in:
parent
047a21b2d4
commit
48b6791ed7
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
|||||||
|
|
||||||
interface OptionConfigurationInterface extends EntryInterface
|
interface OptionConfigurationInterface extends EntryInterface
|
||||||
{
|
{
|
||||||
|
public function getName();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,4 @@ interface OptionConfigurationRepositoryInterface extends EntryRepositoryInterfac
|
|||||||
public function createConfigration($ad_id,$price,$currency,$stock,$option_json);
|
public function createConfigration($ad_id,$price,$currency,$stock,$option_json);
|
||||||
|
|
||||||
public function getConf($ad_id);
|
public function getConf($ad_id);
|
||||||
|
|
||||||
public function getName($id);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,27 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
|
||||||
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||||
{
|
{
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
if($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id))
|
||||||
|
{
|
||||||
|
$configurations_item = json_decode($this->option_json, true);
|
||||||
|
$option_group_value = "";
|
||||||
|
|
||||||
|
foreach ($configurations_item as $option_id => $value) {
|
||||||
|
$value_entry = app(ProductoptionsValueRepositoryInterface::class)->find($value);
|
||||||
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,19 +70,4 @@ class OptionConfigurationRepository extends EntryRepository implements OptionCon
|
|||||||
|
|
||||||
return $configurations;
|
return $configurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName($id){
|
|
||||||
$configuration = $this->find($id);
|
|
||||||
$adv = $this->advRepository->getName($configuration->parent_adv_id);
|
|
||||||
|
|
||||||
$configurations_item = json_decode($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();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $adv . ' | ' . trim($option_group_value, ' ');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user