Velocity Meta Data Issue Fixed
This commit is contained in:
parent
8961e1ccfa
commit
701d99e51c
|
|
@ -176,7 +176,7 @@ class Helper extends Review
|
||||||
/**
|
/**
|
||||||
* Returns the count rating of the product.
|
* Returns the count rating of the product.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return \Webkul\Velocity\Repositories\VelocityMetadataRepository
|
||||||
*/
|
*/
|
||||||
public function getVelocityMetaData($locale = null, $channel = null, $default = true)
|
public function getVelocityMetaData($locale = null, $channel = null, $default = true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace Webkul\Velocity\Http\Controllers\Admin;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Webkul\Core\Traits\Sanitizer;
|
use Webkul\Core\Traits\Sanitizer;
|
||||||
|
use Webkul\Velocity\Helpers\Helper;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Webkul\Velocity\Repositories\VelocityMetadataRepository;
|
use Webkul\Velocity\Repositories\VelocityMetadataRepository;
|
||||||
|
|
||||||
|
|
@ -12,17 +13,14 @@ class ConfigurationController extends Controller
|
||||||
use Sanitizer;
|
use Sanitizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locale
|
* Velocity helper instance.
|
||||||
|
*
|
||||||
|
* @var \Webkul\Velocity\Helpers\Helper
|
||||||
*/
|
*/
|
||||||
protected $locale;
|
protected $velocityHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channel
|
* Velocity meta data repository intance.
|
||||||
*/
|
|
||||||
protected $channel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VelocityMetadataRepository $velocityMetaDataRepository
|
|
||||||
*
|
*
|
||||||
* @var \Webkul\Velocity\Repositories\VelocityMetadataRepository
|
* @var \Webkul\Velocity\Repositories\VelocityMetadataRepository
|
||||||
*/
|
*/
|
||||||
|
|
@ -34,15 +32,16 @@ class ConfigurationController extends Controller
|
||||||
* @param \Webkul\Velocity\Repositories\MetadataRepository $velocityMetaDataRepository
|
* @param \Webkul\Velocity\Repositories\MetadataRepository $velocityMetaDataRepository
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct (VelocityMetadataRepository $velocityMetadataRepository)
|
public function __construct (
|
||||||
|
Helper $velocityHelper,
|
||||||
|
VelocityMetadataRepository $velocityMetadataRepository
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->_config = request('_config');
|
$this->_config = request('_config');
|
||||||
|
|
||||||
$this->velocityHelper = app('Webkul\Velocity\Helpers\Helper');
|
$this->velocityHelper = $velocityHelper;
|
||||||
$this->velocityMetaDataRepository = $velocityMetadataRepository;
|
|
||||||
|
|
||||||
$this->locale = core()->checkRequestedLocaleInChannel();
|
$this->velocityMetaDataRepository = $velocityMetadataRepository;
|
||||||
$this->channel = core()->getRequestedChannelCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,12 +51,16 @@ class ConfigurationController extends Controller
|
||||||
*/
|
*/
|
||||||
public function renderMetaData()
|
public function renderMetaData()
|
||||||
{
|
{
|
||||||
$velocityMetaData = $this->velocityHelper->getVelocityMetaData($this->locale, $this->channel, false);
|
$locale = core()->checkRequestedLocaleInChannel();
|
||||||
|
|
||||||
|
$channel = core()->getRequestedChannelCode();
|
||||||
|
|
||||||
|
$velocityMetaData = $this->velocityHelper->getVelocityMetaData($locale, $channel, false);
|
||||||
|
|
||||||
if (! $velocityMetaData) {
|
if (! $velocityMetaData) {
|
||||||
$this->createMetaData($this->locale, $this->channel);
|
$this->createMetaData($locale, $channel);
|
||||||
|
|
||||||
$velocityMetaData = $this->velocityHelper->getVelocityMetaData($this->locale, $this->channel);
|
$velocityMetaData = $this->velocityHelper->getVelocityMetaData($locale, $channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
$velocityMetaData->advertisement = $this->manageAddImages(json_decode($velocityMetaData->advertisement, true) ?: []);
|
$velocityMetaData->advertisement = $this->manageAddImages(json_decode($velocityMetaData->advertisement, true) ?: []);
|
||||||
|
|
@ -75,7 +78,9 @@ class ConfigurationController extends Controller
|
||||||
*/
|
*/
|
||||||
public function storeMetaData($id)
|
public function storeMetaData($id)
|
||||||
{
|
{
|
||||||
// check if radio button value
|
$locale = core()->checkRequestedLocaleInChannel();
|
||||||
|
|
||||||
|
/* check if radio button value */
|
||||||
if (request()->get('slides') == "on") {
|
if (request()->get('slides') == "on") {
|
||||||
$params = request()->all() + [
|
$params = request()->all() + [
|
||||||
'slider' => 1,
|
'slider' => 1,
|
||||||
|
|
@ -116,14 +121,14 @@ class ConfigurationController extends Controller
|
||||||
unset($params['images']);
|
unset($params['images']);
|
||||||
unset($params['slides']);
|
unset($params['slides']);
|
||||||
|
|
||||||
$params['locale'] = $this->locale;
|
$params['locale'] = $locale;
|
||||||
|
|
||||||
// update row
|
/* update row */
|
||||||
$product = $this->velocityMetaDataRepository->update($params, $id);
|
$this->velocityMetaDataRepository->update($params, $id);
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => trans('velocity::app.admin.meta-data.title')]));
|
session()->flash('success', trans('admin::app.response.update-success', ['name' => trans('velocity::app.admin.meta-data.title')]));
|
||||||
|
|
||||||
return redirect()->route($this->_config['redirect'], ['locale' => $this->locale]);
|
return redirect()->route($this->_config['redirect'], ['locale' => $locale]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -201,7 +206,6 @@ class ConfigurationController extends Controller
|
||||||
* Manage add images.
|
* Manage add images.
|
||||||
*
|
*
|
||||||
* @param array $addImages
|
* @param array $addImages
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function manageAddImages($addImages)
|
public function manageAddImages($addImages)
|
||||||
|
|
@ -231,7 +235,6 @@ class ConfigurationController extends Controller
|
||||||
*
|
*
|
||||||
* @param string $locale
|
* @param string $locale
|
||||||
* @param string $channel
|
* @param string $channel
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function createMetaData($locale, $channel)
|
private function createMetaData($locale, $channel)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue