Quando la lingua di default non è quella inglese WPML
AGGIORNAMENTO VERSIONE 3.3 WPML
Quando la lingua di default non è quella inglese WPML
AGGIORNAMENTO VERSIONE 3.3 WPML
#id_elemento{
margin: 0 auto;
display: table;
}
Come centrare in una riga un elemento mantenendo le proprietà responsive.
Fare rifermento a questo articolo : http://nemops.com/adding-new-fields-to-prestashop-contact-form/#.VY1AaRPtlHw
{theme}/contact-form.tpl
<label for="extrafield">{l s='Extra field'}</label>
{if isset($customerThread.extrafield)}
<input type="text" id="extrafield" name="extrafield" value="{$customerThread.extrafield|escape:'htmlall':'UTF-8'}" readonly="readonly" />
{else}
<input type="text" id="extrafield" name="extrafield" value="" />
{/if}
Creare ovverride: /override/class/CustomerThread.php
class CustomerThread extends CustomerThreadCore
{
public $extrafield;
public static $definition = array(
'table' => 'customer_thread',
'primary' => 'id_customer_thread',
'fields' => array(
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_contact' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_customer' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 254),
'token' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'status' => array('type' => self::TYPE_STRING),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'extrafield' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
),
);
}
Inserire un campo nella tabelle ps_customer_thread
File: /override/controller/front/OrderController
Ovverride della funzione init, questa modifica permette di impostare un minimo prezzo d’acquisto per effettuare la validazione di un’ordine per un gruppo
// Check minimal amount
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
$orderTotal = $this->context->cart->getOrderTotal();
$customer = new Customer((int)($this->context->customer->id));
$Cgroups = $customer->getGroups();
$minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase && $this->step > 0)
{
$this->step = 0;
$this->errors[] = sprintf(
Tools::displayError('A minimum purchase total of %1s (tax excl.) is required to validate your order, current purchase total is %2s (tax excl.).'),
Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency)
);
}
if ($Cgroups[0]==4)
$minimal_purchase = 150;
if ($Cgroups[0]==4 && $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase && $this->step > 0)
{
$this->step = 0;
$this->errors[] = sprintf(
Tools::displayError('A minimum purchase total of %1s (tax excl.) is required to validate your order, current purchase total is %2s (tax excl.).'),
Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency)
);
}
Qui di seguito i moduli che hanno subito dei fix da parte mia:
GROUPCATEGORY
Originale ajax.php
$sql = "Insert Into "._DB_PREFIX_."groupcategory_groups (`position`, `position_name`, `id_shop`, `categoryId`, `style_id`, `manufactureConfig`, `itemConfig`, `types`, `ordering`, `status`, `type_default`, `layout`) Values ('".$position."', '$position_name', '$shopId', '".$categoryId."', '".$style_id."', '".$manufactureConfig."', '".$itemConfig."', '".$types."', '".$maxOrdering."', 1, '".$type_default."', '".$layout."')";
Modificato
$sql = "Insert Into "._DB_PREFIX_."groupcategory_groups (`position`, `position_name`, `id_shop`, `categoryId`, `style_id`, `manufactureConfig`, `itemConfig`, `types`, `ordering`, `status`, `type_default`, `layout`, `icon`, `note`) Values ('".$position."', '$position_name', '$shopId', '".$categoryId."', '".$style_id."', '".$manufactureConfig."', '".$itemConfig."', '".$types."', '".$maxOrdering."', 1, '".$type_default."', '".$layout."', '', '')";
Validazione Codice fiscale
Modificare {root}/js/validate.js la funzione validate_isDniLite
function validate_isDniLite(s)
{
// var reg = /^[0-9a-z-.]{1,16}$/i;
var reg = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/;
return reg.test(s);
}
Percorso: /theme/{nome_tema}/address.tpl
function controllaCF() {
var p = validate_isDniLite($("#dni").val());
// console.log(p);
if (p == false) {
$("#requiredField").append('<div class="module_error alert alert-danger" id="errorField" style="margin-top:15px;"><button type="button" class="close" data-dismiss="alert">×</button>ERRORE: Il codice fiscale inserito non è valido.</div>');
$("#errorField").delay(5000).fadeOut(1500);
setTimeout(function() {
$('#errorField').remove();
}, 7500);
return false;
}
};
$( "#add_address" ).submit(function( event ) {
var checkValidCF = controllaCF();
if (checkValidCF == false){
event.preventDefault();
} else {
$( "#add_address" ).submit();
}
});
Blocco Manufacturer
Posizione CSS: /modules/manufactuterslider/manufactuterslider.css
Posizione JS: /modules/manufactuterslider/manufactuterslider.js
Serve per allineare più o meno in basso le icone più piccole
$(document).ready(function(){
$("#manufacturers_logo_slider li a").hover(
function () {
$(this).stop().animate({opacity:1});
},
function () {
$(this).stop().animate({opacity:1});
}
);
$(".logo_manufacturer").load(function() {
console.log($(this).attr("title") + ' ' +$(this).height());
var height = $(this).height();
if (height < 70){
$(this).css("margin-top","35px");
}
if (height === 65 || height === 64){
$(this).css("margin-top","23px");
}
});
});
Gestione fasce in home page:
Modulo: Supershop – Group Category Module
La gestione del css è demandata al file /js/tools.js che sistema sia la fascia alta del nome nascondendo l’icona, che il colore di sfondo.
File indipendente dal template in termini di aggiornamenti.