From fa51406c7f5271c7fd23c63d21fb0d403b07bb99 Mon Sep 17 00:00:00 2001 From: Sachintechjoomla Date: Fri, 8 Nov 2024 17:57:03 +0530 Subject: [PATCH] Issue#228680 Fix: Menu items not load > "Register as a vendor" and "Profile" --- .../site/views/vendor/tmpl/edit.php | 16 ++ .../site/views/vendor/tmpl/edit_bs3.php | 177 +++++++++++++++++ .../site/views/vendor/tmpl/edit_bs5.php | 181 ++++++++++++++++++ .../site/views/vendor/view.html.php | 4 +- 4 files changed, 376 insertions(+), 2 deletions(-) create mode 100644 src/com_tjvendors/site/views/vendor/tmpl/edit.php create mode 100644 src/com_tjvendors/site/views/vendor/tmpl/edit_bs3.php create mode 100644 src/com_tjvendors/site/views/vendor/tmpl/edit_bs5.php diff --git a/src/com_tjvendors/site/views/vendor/tmpl/edit.php b/src/com_tjvendors/site/views/vendor/tmpl/edit.php new file mode 100644 index 0000000..e98fb70 --- /dev/null +++ b/src/com_tjvendors/site/views/vendor/tmpl/edit.php @@ -0,0 +1,16 @@ + + * @copyright Copyright (C) 2024 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +// Do not allow direct access +defined('_JEXEC') or die('Restricted access'); + +$bsVersion = (JVERSION >= '4.0.0') ? 'bs5' : 'bs3'; + +echo $this->loadTemplate($bsVersion); diff --git a/src/com_tjvendors/site/views/vendor/tmpl/edit_bs3.php b/src/com_tjvendors/site/views/vendor/tmpl/edit_bs3.php new file mode 100644 index 0000000..b4263a6 --- /dev/null +++ b/src/com_tjvendors/site/views/vendor/tmpl/edit_bs3.php @@ -0,0 +1,177 @@ + + * @copyright Copyright (C) 2024 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +// No direct access +defined('_JEXEC') or die; + +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; + +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('formbehavior.chosen', 'select'); +HTMLHelper::_('behavior.keepalive'); +HTMLHelper::script(Uri::root(true) . '/libraries/techjoomla/assets/js/tjvalidator.js'); + +$script = array(); +$script[] = 'var layout = "edit"'; +$script[] = 'let CommonObj = new tjvendor.UI.CommonUI();'; +$script[] = 'var _URL = window.URL || window.webkitURL;'; +$script[] = 'var allowedMediaSizeErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_SIZE_VALIDATE") . $this->params->get("image_size") . "KB" . '"'; +$script[] = 'var allowedImageDimensionErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_DIMENSIONS_VALIDATE") . '"'; +$script[] = 'var allowedImageTypeErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_IMAGE_TYPE_VALIDATION") . '"'; +$script[] = 'const vendorAllowedMediaSize = "' . $max_images_size = $this->params->get("image_size") * 1024 . '"'; +$script[] = 'var country = "' . $this->vendor->country . '"'; +$script[] = 'var region = "' . $this->vendor->region . '"'; +$script[] = 'var city = "' . $this->vendor->city . '"'; +$script[] = 'tjVSite.vendor.initVendorJs();'; + +Factory::getDocument()->addScriptDeclaration(implode("\n", $script)); +?> +
+id) +{ + ?> +

+ vendor_id) + { + echo Text::_('COM_TJVENDOR_UPDATE_VENDOR'); + echo ': ' . htmlspecialchars($this->vendor->vendor_title, ENT_COMPAT, 'UTF-8'); + } + else + { + echo Text::_('COM_TJVENDOR_CREATE_VENDOR'); + } + ?> +

+
+
+
+ + +
+ +
+
+ + + + + + + + + + input; + + if (!empty($this->vendor->vendor_logo)) + { + $this->vendorLogoProfileImg = $this->vendor->vendor_logo; + $this->vendorLogoProfileImgPath = Uri::root() . $this->vendorLogoProfileImg; + } + ?> + +
+
+ form->renderField('vendor_title'); + echo $this->form->renderField('alias'); + echo $this->form->renderField('vendor_description'); + ?> + +
+
+
+ +
+
+
+ form->renderField('vendor_logo'); ?> +
+
+
+ params->get('image_size', '', 'STRING'));?> +
+
+
+ form->renderField('phone_number'); + echo $this->form->renderField('address'); + ?> +
+
+ +
+
+ dropdown = HTMLHelper::_('select.genericlist', $this->options, 'jform[country]', + 'aria-invalid="false" size="1" onchange="CommonObj.generateStates(id,\'' . + 0 . '\',\'' . $this->vendor->region . '\',\'' . $this->vendor->city . '\')"', 'value', 'text', $this->default, 'jform_country'); + ?> +
+
+ form->renderField('region'); + echo $this->form->renderField('city'); + echo $this->form->renderField('other_city'); + echo $this->form->renderField('zip'); + echo $this->form->renderField('website_address'); + echo $this->form->renderField('vat_number'); + ?> +
+
+
+
+ + +
+
+ form->getInput('payment_gateway');?> +
+
+ +
+ +
+
+ +
+ + +
+ + +
+ redirect($link); +} +?> +
diff --git a/src/com_tjvendors/site/views/vendor/tmpl/edit_bs5.php b/src/com_tjvendors/site/views/vendor/tmpl/edit_bs5.php new file mode 100644 index 0000000..2d2cf1a --- /dev/null +++ b/src/com_tjvendors/site/views/vendor/tmpl/edit_bs5.php @@ -0,0 +1,181 @@ + + * @copyright Copyright (C) 2024 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +// No direct access +defined('_JEXEC') or die; + +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; + +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('behavior.keepalive'); +HTMLHelper::script(Uri::root(true) . '/libraries/techjoomla/assets/js/tjvalidator.js'); + +$script = array(); +$script[] = 'var layout = "edit"'; +$script[] = 'let CommonObj = new tjvendor.UI.CommonUI();'; +$script[] = 'var _URL = window.URL || window.webkitURL;'; +$script[] = 'var allowedMediaSizeErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_SIZE_VALIDATE") . $this->params->get("image_size") . "KB" . '"'; +$script[] = 'var allowedImageDimensionErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_DIMENSIONS_VALIDATE") . '"'; +$script[] = 'var allowedImageTypeErrorMessage = "' . Text::_("COM_TJVENDORS_VENDOR_LOGO_IMAGE_TYPE_VALIDATION") . '"'; +$script[] = 'const vendorAllowedMediaSize = "' . $max_images_size = $this->params->get("image_size") * 1024 . '"'; +$script[] = 'var country = "' . $this->vendor->country . '"'; +$script[] = 'var region = "' . $this->vendor->region . '"'; +$script[] = 'var city = "' . $this->vendor->city . '"'; +$script[] = 'tjVSite.vendor.initVendorJs();'; + +Factory::getDocument()->addScriptDeclaration(implode("\n", $script)); +?> +
+id) +{ + ?> +

+ vendor_id) + { + echo Text::_('COM_TJVENDOR_UPDATE_VENDOR'); + echo ': ' . htmlspecialchars($this->vendor->vendor_title, ENT_COMPAT, 'UTF-8'); + } + else + { + echo Text::_('COM_TJVENDOR_CREATE_VENDOR'); + } + ?> +

+
+
+
+
+ + +
+ +
+
+ + + + + + + + + + input; + + if (!empty($this->vendor->vendor_logo)) + { + $this->vendorLogoProfileImg = $this->vendor->vendor_logo; + $this->vendorLogoProfileImgPath = Uri::root() . $this->vendorLogoProfileImg; + } + ?> + +
+
+ form->renderField('vendor_title'); + echo $this->form->renderField('alias'); + echo $this->form->renderField('vendor_description'); + ?> + +
+
+
+ +
+
+
+ form->renderField('vendor_logo'); ?> +
+
+
+ params->get('image_size', '', 'STRING'));?> +
+
+
+ form->renderField('phone_number'); + echo $this->form->renderField('address'); + ?> +
+
+ +
+
+ dropdown = HTMLHelper::_('select.genericlist', $this->options, 'jform[country]', + 'class="form-select" aria-invalid="false" size="1" onchange="CommonObj.generateStates(id,\'' . + 0 . '\',\'' . $this->vendor->region . '\',\'' . $this->vendor->city . '\')"', 'value', 'text', $this->default, 'jform_country'); + ?> +
+
+ form->renderField('region'); + echo $this->form->renderField('city'); + echo $this->form->renderField('other_city'); + echo $this->form->renderField('zip'); + echo $this->form->renderField('website_address'); + echo $this->form->renderField('vat_number'); + ?> +
+
+
+
+ + +
+
+ form->setFieldAttribute('payment_gateway', 'layout', ''); + echo $this->form->getInput('payment_gateway'); + ?> +
+
+ +
+ +
+
+
+
+ + +
+ + +
+
+ redirect($link); +} +?> +
diff --git a/src/com_tjvendors/site/views/vendor/view.html.php b/src/com_tjvendors/site/views/vendor/view.html.php index 4834407..5541ac9 100644 --- a/src/com_tjvendors/site/views/vendor/view.html.php +++ b/src/com_tjvendors/site/views/vendor/view.html.php @@ -180,12 +180,12 @@ public function display($tpl = null) } } - if ($this->layout != "edit") + if ($this->layout != "editinfo") { if (Factory::getUser()->id && !$this->vendor_id) { $client = $app->input->get('client', '', 'STRING'); - $link = Route::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client); + $link = Route::_('index.php?option=com_tjvendors&view=vendor&layout=editinfo&client=' . $client . '&Itemid=' . $this->vendorFormItemId); $app->enqueueMessage(Text::_('COM_TJVENDOR_REGISTRATION_VENDOR_ERROR'), 'notice'); $app->redirect($link); }