mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
product options add cart
This commit is contained in:
parent
34a403203c
commit
e04870fcd2
@ -38,4 +38,5 @@ return [
|
|||||||
'new_options_configuration' => 'New Options configuration',
|
'new_options_configuration' => 'New Options configuration',
|
||||||
'new_option_configuration' => 'New Option configuration',
|
'new_option_configuration' => 'New Option configuration',
|
||||||
'new_option_configuration' => 'New Option configuration',
|
'new_option_configuration' => 'New Option configuration',
|
||||||
|
'create_configurations' => 'Create Configurations',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
||||||
class="btn btn-warning shadow-sm mr-4 text-white">
|
class="btn btn-warning shadow-sm mr-4 text-white">
|
||||||
Konfigürasyon Oluştur
|
{{trans('visiosoft.module.advs::button.create_configurations')}}
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}"
|
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}"
|
||||||
class="btn preview-edit shadow-sm border">
|
class="btn preview-edit shadow-sm border">
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<div class="preview-actions text-center">
|
<div class="preview-actions text-center">
|
||||||
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
||||||
class="btn btn-warning shadow-sm mr-4 text-white">
|
class="btn btn-warning shadow-sm mr-4 text-white">
|
||||||
Konfigürasyon Oluştur
|
{{trans('visiosoft.module.advs::button.create_configurations')}}
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}" class="btn preview-edit shadow-sm border">
|
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}" class="btn preview-edit shadow-sm border">
|
||||||
{{ trans('visiosoft.module.advs::field.edit') }}
|
{{ trans('visiosoft.module.advs::field.edit') }}
|
||||||
|
|||||||
@ -109,7 +109,7 @@ class AdvsController extends AdminController
|
|||||||
'text' => 'Replicate',
|
'text' => 'Replicate',
|
||||||
],
|
],
|
||||||
'create_configration' => [
|
'create_configration' => [
|
||||||
'text' => 'Create Configrations',
|
'text' => trans('visiosoft.module.advs::button.create_configurations'),
|
||||||
'href' => route('visiosoft.module.advs::configrations.create')."?ad={entry.id}"
|
'href' => route('visiosoft.module.advs::configrations.create')."?ad={entry.id}"
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -7,4 +7,6 @@ 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,5 @@ use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
|||||||
|
|
||||||
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getName($id)
|
|
||||||
{
|
|
||||||
$configuration = $this->find($id);
|
|
||||||
$adv = $this->adv_model->find($configuration->parent_adv_id);
|
|
||||||
dd($adv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,47 +45,27 @@ class OptionConfigurationRepository extends EntryRepository implements OptionCon
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConf($ad_id, $conf_id = null)
|
public function getConf($ad_id)
|
||||||
{
|
{
|
||||||
$adv = $this->advRepository->find($ad_id);
|
$adv = $this->advRepository->find($ad_id);
|
||||||
$configurations = array();
|
$configurations = array();
|
||||||
|
|
||||||
if ($conf_id == null) {
|
$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)->get();
|
|
||||||
|
|
||||||
foreach ($product_configurations as $product_configuration) {
|
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, ' ') . ')',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$product_configuration = $this->model->find($conf_id);
|
|
||||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||||
$option_group_value = "";
|
$option_group_value = "";
|
||||||
|
|
||||||
foreach ($configurations_item as $option_id => $value) {
|
foreach ($configurations_item as $option_id => $value) {
|
||||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||||
$option_group_value .= " " . $value_entry->getName();
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
}
|
}
|
||||||
|
$configurations[$product_configuration->getId()] = [
|
||||||
$configurations = [
|
'name' => $option_group_value,
|
||||||
'name' => trim($option_group_value),
|
|
||||||
'price' => $product_configuration->price,
|
'price' => $product_configuration->price,
|
||||||
'currency' => $product_configuration->currency,
|
'currency' => $product_configuration->currency,
|
||||||
'stock' => $product_configuration->stock,
|
'stock' => $product_configuration->stock,
|
||||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $configurations;
|
return $configurations;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user