Merge branch 'main' of http://91.189.216.43:3000/jacek.pyziak/drmaterac.pl
This commit is contained in:
@@ -37,46 +37,46 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
'fields' => array(
|
||||
'shortcode_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
// 'id_appagebuilder' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
|
||||
|
||||
'shortcode_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true, 'required' => true),
|
||||
|
||||
|
||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
|
||||
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_shortcode_shop` (`id_shop`, `id_appagebuilder_shortcode`, `active`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.', '.(int)$this->active.')');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public function update($nullValues = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::update($nullValues);
|
||||
|
||||
|
||||
$res &= Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps set ps.active = '.(int)$this->active.' WHERE ps.id_shop='.(int)$id_shop.' AND ps.id_appagebuilder_shortcode = '.(int)$this->id);
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
@@ -90,25 +90,25 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')');
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: delete appagebuilder related shortcode
|
||||
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode((int)$this->id);
|
||||
|
||||
|
||||
if ($id_appagebuilder) {
|
||||
$obj = new ApPageBuilderModel($id_appagebuilder);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function getShortCodeContent($id_appagebuilder = 0, $is_font = 0, $id_lang = 0)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder='.(int)$id_appagebuilder;
|
||||
|
||||
|
||||
if ($id_lang) {
|
||||
$where .= ' AND pl.id_lang = '.(int)$id_lang;
|
||||
} else {
|
||||
@@ -119,10 +119,10 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shop` ps ON (ps.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_lang` pl ON (pl.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shortcode` pp ON (p.id_appagebuilder_shortcode = pp.id_appagebuilder_shortcode)
|
||||
|
||||
|
||||
'.pSql($where).' ORDER BY p.id_appagebuilder';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($result);die();
|
||||
$id_langs = Language::getLanguages(true, false, true);
|
||||
@@ -132,7 +132,7 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data_lang = array();
|
||||
if ($is_font) {
|
||||
foreach ($result as $row) {
|
||||
@@ -177,10 +177,10 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
}
|
||||
$data_hook[$row['hook_name']] = $row;
|
||||
}
|
||||
|
||||
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end
|
||||
* @param type $id_profiles
|
||||
@@ -248,24 +248,24 @@ class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
|
||||
public static function getShortCode($shortcode_key)
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
|
||||
$sql = 'SELECT p.*, pp.`id_appagebuilder` FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder` pp on(p.`id_appagebuilder_shortcode` = pp.`id_appagebuilder_shortcode`) WHERE
|
||||
p.`shortcode_key` = "'.pSQL($shortcode_key).'" AND ps.`active`= 1 AND ps.`id_shop` = '.(int)$id_shop;
|
||||
|
||||
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
|
||||
public static function getListShortCode()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
|
||||
$sql = 'SELECT p.*, ps.*, pl.* FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_lang` pl on(p.`id_appagebuilder_shortcode` = pl.`id_appagebuilder_shortcode`) WHERE
|
||||
|
||||
@@ -112,12 +112,6 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
$this->context->controller->addJs(__PS_BASE_URI__.'js/jquery/jquery-3.5.1.min.js');
|
||||
// $this->context->controller->addJquery();
|
||||
$this->context->controller->addJqueryUI('ui.sortable'); // FILE FORM.js required this
|
||||
$this->context->controller->addJqueryUI('ui.draggable'); // FILE FORM.js required this
|
||||
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
|
||||
$this->page_header_toolbar_btn['SaveAndStay'] = array(
|
||||
'href' => 'javascript:void(0);',
|
||||
|
||||
@@ -19,8 +19,6 @@ function updateListIdFullSlider() {
|
||||
$("#total_slider").val(listId);
|
||||
}
|
||||
$(document).ready(function() {
|
||||
console.log("ready!");
|
||||
|
||||
$("#modal_form").draggable({
|
||||
handle: ".modal-header"
|
||||
});
|
||||
|
||||
@@ -19,8 +19,6 @@ function updateListIdFullSlider() {
|
||||
$("#total_slider").val(listId);
|
||||
}
|
||||
$(document).ready(function() {
|
||||
console.log("ready");
|
||||
|
||||
$("#modal_form").draggable({
|
||||
handle: ".modal-header"
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @description: ApPageBuilder is module help you can build content for your shop
|
||||
*}
|
||||
<!-- @file modules\appagebuilder\views\templates\hook\header -->
|
||||
|
||||
<script>
|
||||
/**
|
||||
* List functions will run when document.ready()
|
||||
|
||||
@@ -1358,6 +1358,7 @@ class Gm_OmniPrice extends Module
|
||||
}
|
||||
$lowestCachedPrice = $this->getLowestCachedPrice($params);
|
||||
}
|
||||
|
||||
$realDiscount = '';
|
||||
if ($showRealDiscount && $lowestCachedPrice && isset($hookParams['product']['price_amount']))
|
||||
{
|
||||
@@ -1365,6 +1366,7 @@ class Gm_OmniPrice extends Module
|
||||
$previousPrice = $lowestCachedPrice['raw'];
|
||||
$realDiscount = $this->calculateRealDisount($currentPrice, $previousPrice);
|
||||
}
|
||||
|
||||
if (!$lowestCachedPrice)
|
||||
{
|
||||
//may have a promotion for an individual combination
|
||||
@@ -1376,7 +1378,10 @@ class Gm_OmniPrice extends Module
|
||||
];
|
||||
}
|
||||
}
|
||||
if ($lowestCachedPrice)
|
||||
|
||||
$checkIfProductIsDiscounted = self::checkIfProductIsDiscounted( $this->getDiscountedProductIds( $params['id_shop'], $params['id_currency'], $params['id_country'], $params['id_group'] ), $productId, $params['id_product_attribute'] );
|
||||
|
||||
if ( $lowestCachedPrice and $checkIfProductIsDiscounted )
|
||||
{
|
||||
$this->context->smarty->assign(
|
||||
[
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-size: 0px; padding: 10px 25px; word-break: break-word;">
|
||||
<div style="font-family:Open sans, arial, sans-serif;font-size:14px;font-weight:600;line-height:25px;text-align:left;color:#363A41;" align="left">
|
||||
<div style="font-family:Open sans, arial, sans-serif;font-size:14px;font-weight:500;line-height:25px;text-align:left;color:#363A41;" align="left">
|
||||
Dziękujemy za zapisanie się do newslettera <b>Dr Materac!</b> Teraz będziesz na bieżąco z najlepszymi ofertami, nowościami i poradami dotyczącymi zdrowego snu.<br><br>
|
||||
🎁 Oto Twój kod rabatowy na pierwsze zakupy: <b>{discount}</b><br><br>
|
||||
Wykorzystaj go na <b>drmaterac.pl</b> i ciesz się komfortowym snem!
|
||||
|
||||
Reference in New Issue
Block a user