Dodanie tymczasowych plików testowych oraz poprawa szablonów i klas w module empikmarketplace

This commit is contained in:
2025-03-25 14:12:17 +01:00
parent 9074c2fb27
commit dda8aa3d7e
38 changed files with 23333 additions and 75 deletions

View File

@@ -96,26 +96,26 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
return;
}
$action = Tools::getValue('action');
// $type = Tools::getValue('type');
if ($action == 'processPosition') {
$this->processPosition();
}
if ($action == 'selectPosition') {
$this->selectPosition();
}
if (Tools::isSubmit('submitImportData')) {
$this->importData(Language::getLanguages(false), (int)$this->context->language->id);
}
if ($action == 'export') {
$this->exportData();
}
//DONGND:: submit save
if (Tools::isSubmit('submitSaveAndStay')) {
if (Tools::getValue('data_profile') && Tools::getValue('data_profile') != '') {
@@ -179,7 +179,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
$obj_model->add();
}
$path = _PS_ROOT_DIR_.'/cache/smarty/cache/'.$this->module_name;
$this->deleteDirectory($path);
};
@@ -203,10 +203,10 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
$this->error[] = $this->trans('Not exist data_profile', array(), 'Admin.Notifications.Success');
}
parent::postProcess();
}
public function ajaxProcessShowImportForm()
{
$id_profile = Tools::getValue('idProfile');
@@ -276,7 +276,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
$array = array('hasError' => false, 'result' => $helper->generateForm(array($fields_form)));
die(Tools::jsonEncode($array));
}
/**
* Show panel : widgets and modules
* .group-add
@@ -326,13 +326,13 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
$array = array('hasError' => false, 'result' => $tpl->fetch());
die(Tools::jsonEncode($array));
}
public function ajaxProcessSaveData()
{
$type = Tools::getValue('type');
$this->saveData('save', $type);
}
public function saveData($action, $type)
{
$data_form = Tools::getValue('dataForm');
@@ -563,7 +563,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
//load javascript for menu tree, Product Carousel widget
$tree = new HelperTreeCategories('123', null);
$tree->render();
$model = new ApPageBuilderModel();
$id_profile = Tools::getValue('id_appagebuilder_profiles');
if (!$id_profile) {
@@ -611,7 +611,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
$positions[$key] = $temp;
}
// Get list position for dropdowns
$list_positions = array();
$list_positions['header'] = $model->getListPositisionByType('header', $this->context->shop->id);
@@ -662,10 +662,10 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
$shortcode_form[] = $this->tpl_path.'/ap_page_builder_shortcodes/'.$s_from;
}
// ROOT//modules/appagebuilder/views/templates/admin/ap_page_builder_home/home.tpl
$tpl = $this->createTemplate('home.tpl');
$languages = array();
foreach (Language::getLanguages(false) as $lang) {
$languages[$lang['iso_code']] = $lang['id_lang'];
@@ -676,20 +676,20 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
} else {
$check_save_multithreading = 0;
};
//DONGND: check enable save submit
if (Configuration::get('APPAGEBUILDER_SAVE_SUBMIT')) {
$check_save_submit = 1;
} else {
$check_save_submit = 0;
};
//DONGND: error when submit
$errorSubmit = '';
if (Tools::isSubmit('errorSubmit')) {
$errorSubmit = $this->l('There was an error during save. Please try again and check the value of server config: max_input_vars, make sure it is greater than 30000');
}
$tpl->assign(array(
'positions' => $positions,
'listPositions' => $list_positions,
@@ -719,7 +719,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
'checkSaveSubmit' => $check_save_submit,
'errorSubmit' => $errorSubmit,
'listAnimation' => ApPageSetting::getAnimationsColumnGroup(),
));
$path_guide = $this->getTemplatePath().'guide.tpl';
$guide_box = ApPageSetting::buildGuide($this->context, $path_guide, 3);
@@ -728,12 +728,12 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
$this->errors[] = $this->l('Your Profile ID is not exist!');
}
}
private function exportData()
{
$action = Tools::getValue('action');
$type = Tools::getValue('type');
$data = $this->saveData($action, $type);
if ($data) {
if ($type == 'all') {
@@ -791,7 +791,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
die(Tools::jsonEncode($array));
}
}
private function importData($language, $lang_id)
{
$upload_file = new Uploader('importFile');
@@ -1021,7 +1021,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
return array('id' => '0', 'name' => '');
}
private function getParamByHook($groups, $params, $hook, $action = 'save')
{
$groups['params']['specific_type'] = (isset($groups['params']['specific_type']) && $groups['params']['specific_type']) ? $groups['params']['specific_type'] : '';
@@ -1073,13 +1073,13 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
$params .= '[/ApRow]';
return $params;
}
public function clearModuleCache()
{
$module = APPageBuilder::getInstance();
$module->clearHookCache();
}
private function deleteDirectory($dir)
{
if (!file_exists($dir)) {
@@ -1101,18 +1101,18 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
return rmdir($dir);
}
private function deleteModuleFromHook($hook_name, $module_name)
{
$res = true;
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
WHERE `id_hook` IN(
WHERE `id_hook` IN(
SELECT `id_hook` FROM `'._DB_PREFIX_.'hook`
WHERE name ="'.pSQL($hook_name).'") AND `id_module` IN( SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE name ="'.pSQL($module_name).'")';
$res &= Db::getInstance()->execute($sql);
return $res;
}
private function saveExceptionConfig($hook, $type, $page, $ids)
{
if (!$type) {
@@ -1142,7 +1142,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}
}
}
public function createXmlFile($title)
{
$file_content = '<?xml version="1.0" encoding="UTF-8"?>';
@@ -1163,7 +1163,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
return _THEMES_DIR_._THEME_NAME_.'/'.'export/'.$title.'.xml';
}
/**
* PERMISSION ACCOUNT demo@demo.com
* OVERRIDE CORE
@@ -1172,7 +1172,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
public function getTabSlug()
{
if (empty($this->tabSlug)) {
// GET RULE FOLLOW AdminApPageBuilderProfiles
$result = Db::getInstance()->getRow('
SELECT `id_tab`
@@ -1185,7 +1185,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
return $this->tabSlug;
}
/**
* PERMISSION ACCOUNT demo@demo.com
* OVERRIDE CORE
@@ -1194,7 +1194,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
{
parent::initProcess();
if (count($this->errors) <= 0) {
if (!$this->access('edit')){
if (Tools::isSubmit('submitSaveAndStay')) {
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
@@ -1203,9 +1203,9 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
}elseif( Tools::getIsset('action') && Tools::getValue('action') == 'export'){
$this->errors[] = $this->trans('You do not have permission to export this.', array(), 'Admin.Notifications.Error');
}
}
if (!$this->access('edit') && $this->ajax){
if(Tools::getValue('action') == 'showImportForm')
{

View File

@@ -98,10 +98,10 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
$this->_where = ' AND sa.id_shop='.(int)$this->context->shop->id;
$this->theme_name = _THEME_NAME_;
$this->profile_css_folder = _PS_THEME_DIR_.apPageHelper::getCssDir().'profiles/';
$this->profile_js_folder = _PS_THEME_DIR_.apPageHelper::getJsDir().'profiles/';
if (!is_dir($this->profile_css_folder)) {
mkdir($this->profile_css_folder, 0755, true);
}
@@ -109,11 +109,11 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
mkdir($this->profile_js_folder, 0755, true);
}
}
public function initPageHeaderToolbar()
{
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
$this->page_header_toolbar_btn['SaveAndStay'] = array(
'href' => 'javascript:void(0);',
'desc' => $this->l('Save and stay'),
@@ -128,7 +128,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
);
parent::initPageHeaderToolbar();
}
public function setMedia($isNewTheme = false)
{
parent::setMedia($isNewTheme);
@@ -138,7 +138,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
public function processDelete()
{
$object = $this->loadObject();
if ($object && !$object->active) {
$object = parent::processDelete();
if ($object->profile_key) {
@@ -186,7 +186,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
$this->redirect_after .= '&id_appagebuilder_profiles='.$object->id;
$this->redirect();
}
public function displayViewLink($token = null, $id, $name = null)
{
// validate module
@@ -273,7 +273,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
// $id_shop = $context->shop->id;
$id = Tools::getValue('id_appagebuilder_profiles');
$model = new ApPageBuilderProfilesModel($id);
if($model){
$old_key = $model->profile_key;
$model->profile_key = $profile_key = 'profile'.ApPageSetting::getRandomNumber();
@@ -282,7 +282,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
$model->active = '';
$model->friendly_url = array();
$duplicate_object = $model->save();
if($duplicate_object){
//duplicate shortCode
$id_new = $model->id;
@@ -673,7 +673,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
unset($key);
}
$params->fullwidth_other_hook = $post_other_hooks;
# get post disable hook
$cache_hooks = ApPageSetting::getCacheHook();
$post_disable_hooks = array();
@@ -684,18 +684,18 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
unset($key);
}
$params->disable_cache_hook = $post_disable_hooks;
# Save to params
$this->object->params = Tools::jsonEncode($params);
# Save group_box
if (Tools::getValue('groupBox')) {
$this->object->group_box = implode(',', Tools::getValue('groupBox'));
} else {
$this->object->group_box = '';
}
$this->object->save();
}
@@ -710,7 +710,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
if (Tools::getValue('js') != '') {
ApPageSetting::writeFile($this->profile_js_folder, $key.'.js', Tools::getValue('js'));
}
if (Tools::getValue('css') != '') {
# FIX CUSTOMER CAN NOT TYPE "\"
$temp = Tools::getAllValues();
@@ -775,7 +775,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
$params = Tools::jsonDecode($this->object->params);
return isset($params->disable_cache_hook) ? $params->disable_cache_hook : ApPageSetting::getCacheHook(3);
}
/**
* PERMISSION ACCOUNT demo@demo.com
* OVERRIDE CORE
@@ -783,7 +783,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
public function initProcess()
{
parent::initProcess();
if (count($this->errors) <= 0) {
if( Tools::isSubmit('duplicate'.$this->table) ) {
if ($this->id_object) {

View File

@@ -1,4 +1,4 @@
{*
{*
* @Module Name: AP Page Builder
* @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com>
@@ -25,7 +25,7 @@
<a href="javascript:;" id="btn-preview" class="label-tooltip" title="{l s='Preview this profile' mod='appagebuilder'}" data-placement="left"><i class="icon-zoom-in"></i></a>
<a href="javascript:;" id="btn-design-layout" class="label-tooltip" title="{l s='Mode design layout' mod='appagebuilder'}" data-placement="left"><i class="icon-desktop"></i></a>
</div>
<iframe id="live-edit-iframe" src="{$url_live_edit|escape:'html':'UTF-8'}{if $id_default}{$id_default|escape:'html':'UTF-8'}{/if}"
<iframe id="live-edit-iframe" src="{$url_live_edit|escape:'html':'UTF-8'}{if $id_default}{$id_default|escape:'html':'UTF-8'}{/if}"
idProfile="{if $id_default}{$id_default|escape:'html':'UTF-8'}{/if}">
</iframe>
</div>
@@ -44,11 +44,11 @@
{addJsDef idProfile=$id_default}
function resize() {
//$("#live-edit-iframe").width($(window).width() - 80);
$("#live-edit-iframe").height($("body").height() -
$("#header_infos").height() - $(".page-head").height() -
$("#form-appagebuilder_profiles").height() - $(".ap-live-tool").height() -
$("#live-edit-iframe").height($("body").height() -
$("#header_infos").height() - $(".page-head").height() -
$("#form-appagebuilder_profiles").height() - $(".ap-live-tool").height() -
$("#footer").height() - 80 - ($(".bootstrap .alert").length > 0 ? ($(".bootstrap .alert").height() + 20) : 0));
}
function changeProfilePreview(obj) {
$("#ap_loading").show();
@@ -59,7 +59,7 @@
var td = $(obj).closest("tr").find("td:nth-child(1)");
var tdName = $(obj).closest("tr").find("td:nth-child(2)");
}
var d = new Date();
idProfile = $.trim($(td).text());
$("#name-profile b").text($.trim($(tdName).text()));
@@ -76,15 +76,15 @@
var idProfile = $.trim($(this).find("td:nth-child(1)").text());
else
var idProfile = $.trim($(this).find("td:nth-child(2)").text());
var url = urlProfileDetail + "&submitBulkinsertLangappagebuilder_profiles&id=" + idProfile;
$(this).find(".pull-right ul").prepend("<li><a title='{l s='Copy data from default language to other' mod='appagebuilder'}' href='" + url + "'><i class='icon-copy'></i> {l s='Copy to Other Language' mod='appagebuilder'}</a></li>");
url = urlEditProfile + "&id_appagebuilder_profiles=" + idProfile;
$(this).find(".pull-right ul").prepend("<li><a title='{l s='Edit in mode design layout' mod='appagebuilder'}' target='_blank' href='" + url + "'><i class='icon-desktop'></i> {l s='Edit Design Layout' mod='appagebuilder'}</a></li>");
url = urlPreview + "?id_appagebuilder_profiles=" + idProfile;
$(this).find(".pull-right ul").prepend("<li><a title='{l s='Preview' mod='appagebuilder'}' target='_blank' href='" + url + "'><i class='icon-search-plus'></i> {l s='Preview' mod='appagebuilder'}</a></li>");
});
@@ -95,20 +95,20 @@
});
var d = new Date();
if($('.table-responsive-row .row-selector').length){
var listTd = ".appagebuilder_profiles tr td:nth-child(2)," +
var listTd = ".appagebuilder_profiles tr td:nth-child(2)," +
".appagebuilder_profiles tr td:nth-child(3), .appagebuilder_profiles tr td:nth-child(4)";
}else{
var listTd = ".appagebuilder_profiles tr td:nth-child(1)," +
var listTd = ".appagebuilder_profiles tr td:nth-child(1)," +
".appagebuilder_profiles tr td:nth-child(2), .appagebuilder_profiles tr td:nth-child(3)";
}
$("#live-edit-iframe").attr("src", urlLiveEdit + "&ap_edit_token=" + urlEditProfileToken + "&id_appagebuilder_profiles=" + idProfile + "&t=" + d.getTime());
$(listTd).each(function() {
$(this).attr("onclick", "return changeProfilePreview(this);");
});
$("#btn-reload-live").click(function() {
$("#ap_loading").show();
var d = new Date();
var d = new Date();
$("#live-edit-iframe").attr("src", urlLiveEdit + "&ap_edit_token=" + urlEditProfileToken + "&id_appagebuilder_profiles=" + idProfile + "&t=" + d.getTime());
});
$("#btn-preview").click(function() {

View File

@@ -1,4 +1,4 @@
{*
{*
* @Module Name: AP Page Builder
* @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com>

BIN
modules/empikmarketplace/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,46 @@
<?php
namespace Empik\Marketplace\Repository;
use Db;
use DbQuery;
use Empik\Marketplace\Utils\Utils;
class AttributeRepository
{
/** @var Db */
protected $db;
/** @var int */
protected $langId;
public function __construct()
{
$this->db = Db::getInstance();
$this->langId = Utils::getLangId();
}
public function getAttributes($productId, $productAttributeId)
{
$sql = new DbQuery();
$sql->select('al.name AS value, agl.public_name AS name');
$sql->from('attribute_group', 'ag');
$sql->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = ag.id_attribute_group AND agl.id_lang = ' . (int)$this->langId);
$sql->leftJoin('product_attribute', 'pa', 'pa.id_product = ' . (int)$productId . ' AND pa.id_product_attribute = ' . (int)$productAttributeId);
$sql->leftJoin('product_attribute_combination', 'pac', 'pac.id_product_attribute = pa.id_product_attribute');
$sql->leftJoin('attribute', 'a', 'a.id_attribute = pac.id_attribute AND ag.id_attribute_group = a.id_attribute_group');
$sql->leftJoin('attribute_lang', 'al', 'al.id_attribute = a.id_attribute AND al.id_lang = ' . (int)$this->langId);
$sql->orderBy('ag.id_attribute_group');
$result = $this->db->executeS($sql);
$resultGrouped = [];
foreach ($result as $item) {
if (!isset($resultGrouped[$item['name']]) || $item['value']) {
$resultGrouped[$item['name']] = $item;
}
}
return (array)$resultGrouped;
}
}

View File

@@ -0,0 +1 @@
c:\visual studio code\projekty\drmaterac.pl\modules\empikmarketplace\vendor\composer\installers\src\Composer\Installers\~syncthing~CakePHPInstaller.php.tmp

View File

@@ -0,0 +1 @@
c:\visual studio code\projekty\drmaterac.pl\modules\empikmarketplace\vendor\symfony\config\Tests\Definition\~syncthing~MergeTest.php.tmp

View File

@@ -0,0 +1 @@
c:\visual studio code\projekty\drmaterac.pl\modules\empikmarketplace\vendor\symfony\dependency-injection\Tests\Compiler\~syncthing~CheckDefinitionValidityPassTest.php.tmp

View File

@@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1;
class Service4
{
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\BarService;
return function (ContainerConfigurator $c) {
$c->services()
->set('bar', 'Class1')
->set(BarService::class)
->abstract(true)
->lazy()
->set('foo')
->parent(BarService::class)
->decorate('bar', 'b', 1)
->args([ref('b')])
->class('Class2')
->file('file.php')
->parent('bar')
->parent(BarService::class)
;
};

View File

@@ -0,0 +1 @@
c:\visual studio code\projekty\drmaterac.pl\modules\empikmarketplace\vendor\symfony\dependency-injection\Tests\Fixtures\xml\~syncthing~services_deprecated.xml.tmp

BIN
modules/empikmarketplace/views/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.