Add description2 field to AdvancedSearchSeoClass and update related templates

This commit is contained in:
2026-01-26 23:07:28 +01:00
parent 9ffe3d5e16
commit 9adfa3074a
8 changed files with 19 additions and 57 deletions

View File

@@ -139,63 +139,6 @@ $(document).ready(function() {
// }
//});
if (pd_google_analitycs_controller != 'cart') {
prestashop.on('updateCart', function(params) {
if (typeof(params) !== 'undefined' && typeof(prestashop.cart) !== 'undefined') {
let iso_code = prestashop.currency.iso_code,
product_id = params.reason.idProduct,
product_id_product_attribute = params.reason.idProductAttribute;
if (typeof(product_id) !== 'undefined' && typeof(product_id_product_attribute) !== 'undefined') {
$.ajax({
type: "POST",
url: pdgoogleanalytycs4pro_ajax_link,
data: {'action': 'updateCart', 'product_id': product_id, 'product_id_product_attribute' : product_id_product_attribute, 'secure_key': pdgoogleanalytycs4pro_secure_key, ajax : true},
dataType: "json",
success: function(data) {
console.log('Fired up event GA4: add_to_cart');
if (window.location.hostname === "lulandia.pl") {
gtag('event', 'conversion', {
'send_to': 'AW-11243281264/WgG_CN2SsesYEPC2m_Ep',
'value': data.content_value,
'currency': 'PLN'
});
console.log( 'Fired up event GADS add_to_cart conversion lulandia.pl' );
}
gtag('event', 'add_to_cart', {
currency: iso_code,
items: [{
item_id: data.content_ids,
item_name: data.content_name,
coupon: '',
discount: data.content_discount,
index: '1',
item_list_name: pd_google_analitycs_controller,
item_list_id: pd_google_analitycs_controller,
affiliation: data.http_referer,
item_brand: data.content_manufacturer,
item_category: data.content_category,
item_category2: (data.content_category2.length) ? data.content_category2 : '',
item_category3: (data.content_category3.length) ? data.content_category3 : '',
item_category4: (data.content_category4.length) ? data.content_category4 : '',
item_category5: (data.content_category5.length) ? data.content_category5 : '',
item_variant: data.content_variant,
price: data.content_value_old,
currency: iso_code,
quantity: 1
}],
value: data.content_value
});
}
});
}
}
});
}
// qty up > thecheckout module opc
$('body').on("click", "a.cart-line-product-quantity-up", function(e) {

View File

@@ -27,6 +27,7 @@ class AdvancedSearchSeoClass extends ObjectModel
public $title;
public $seo_url;
public $description;
public $description2;
public $criteria;
public $deleted;
public $seo_key;
@@ -54,6 +55,7 @@ class AdvancedSearchSeoClass extends ObjectModel
'meta_keywords' =>'isGenericName',
'title' =>'isGenericName',
'description' =>'isString',
'description2' =>'isString',
'seo_url' =>'isGenericName',
);
public static $definition = array(
@@ -67,6 +69,7 @@ class AdvancedSearchSeoClass extends ObjectModel
'seo_url' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => false),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => false),
'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => false),
'description2' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => false),
)
);
protected $table = 'pm_advancedsearch_seo';
@@ -100,6 +103,7 @@ class AdvancedSearchSeoClass extends ObjectModel
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
$fields[$language['id_lang']][$this->identifier] = (int)$this->id;
$fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']]) and !empty($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : pSQL($this->description[$defaultLanguage], true);
$fields[$language['id_lang']]['description2'] = (isset($this->description2[$language['id_lang']]) and !empty($this->description2[$language['id_lang']])) ? pSQL($this->description2[$language['id_lang']], true) : pSQL($this->description2[$defaultLanguage], true);
foreach ($fieldsArray as $field) {
if (!Validate::isTableOrIdentifier($field)) {
die(Tools::displayError());

View File

@@ -141,6 +141,7 @@ class pm_advancedsearch4seoModuleFrontController extends ModuleFrontController
'path' => $resultSeoUrl[0]['title'],
'as_seo_title' => $resultSeoUrl[0]['title'],
'as_seo_description' => $resultSeoUrl[0]['description'],
'as_seo_description2' => $resultSeoUrl[0]['description2'],
'as_cross_links' => AdvancedSearchSeoClass::getCrossLinksSeo((int)$this->context->language->id, $resultSeoUrl[0]['id_seo']),
));
} else {

View File

@@ -158,6 +158,7 @@ class pm_advancedsearch4seoModuleFrontController extends AdvancedSearchProductLi
'listing' => $variables,
'id_search' => $this->idSearch,
'as_seo_description' => $this->seoPageInstance->description,
'as_seo_description2' => $this->seoPageInstance->description2,
'as_seo_title' => $this->seoPageInstance->title,
'as_see_also_txt' => $this->module->l('See also', 'seo-17'),
));

View File

@@ -0,0 +1,3 @@
-- Dodanie kolumny description2 do tabeli pm_advancedsearch_seo_lang
ALTER TABLE `PREFIX_pm_advancedsearch_seo_lang`
ADD COLUMN `description2` TEXT NOT NULL AFTER `description`;

View File

@@ -172,6 +172,7 @@
{as4_inputTextLang obj=$params.obj key='title' label={l s='Title (H1)' mod='pm_advancedsearch4'} size='350px'}
{as4_inputTextLang obj=$params.obj key='seo_url' label={l s='Friendly URL' mod='pm_advancedsearch4'} size='350px' onkeyup='ASStr2url(this);' onchange='ASStr2url(this);'}
{as4_richTextareaLang obj=$params.obj key='description' label={l s='Description (visible on the top of the page)' mod='pm_advancedsearch4'}}
{as4_richTextareaLang obj=$params.obj key='description2' label={l s='Description 2 (visible below the product listing)' mod='pm_advancedsearch4'}}
{as4_ajaxSelectMultiple selectedoptions=$cross_links_selected key='cross_links' label={l s='Results pages to link to this page (cross-linking)' mod='pm_advancedsearch4'} remoteurl="{$base_config_url|as4_nofilter}&pm_load_function=displaySeoSearchOptions&id_seo_origin={$params.obj->id}"}
<input type="hidden" name="criteria" id="seoSearchCriteriaInput" />

View File

@@ -26,6 +26,11 @@
<div id="PM_ASearchResults" data-id-search="{$id_search|intval}">
<div id="PM_ASearchResultsInner" class="PM_ASearchResultsInner_{$id_search|intval}">
{$smarty.block.parent}
{if $as_seo_description2}
<div class="block-category card card-block">
<div id="category-description2" class="text-muted">{$as_seo_description2 nofilter}</div>
</div>
{/if}
{if isset($as_cross_links) && $as_cross_links && sizeof($as_cross_links)}
<div id="PM_ASearchSeoCrossLinks" class="card-block">
<h4 class="h4">{$as_see_also_txt}</h4>

View File

@@ -33,6 +33,10 @@
</div>
{/if}
{if $as_seo_description2}
<div class="cat_desc cat_desc_bottom">{$as_seo_description2|as4_nofilter}</div>
{/if}
{include file=$as_obj->_getTplPath("pm_advancedsearch_cross_links.tpl")}
</div>
</div>