本文整理汇总了PHP中Configuration::getInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::getInt方法的具体用法?PHP Configuration::getInt怎么用?PHP Configuration::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::getInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerDiscount
public function registerDiscount($id_customer, $register = false, $id_currency = 0)
{
$configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency));
$cartRule = new CartRule();
if ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::PERCENT) {
$cartRule->reduction_percent = (double) $configurations['REFERRAL_PERCENTAGE'];
} elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::AMOUNT and isset($configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency])) {
$cartRule->reduction_amount = (double) $configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency];
}
$cartRule->quantity = 1;
$cartRule->quantity_per_user = 1;
$cartRule->date_from = date('Y-m-d H:i:s', time());
$cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000);
// + 1 year
$cartRule->code = $this->getDiscountPrefix() . Tools::passwdGen(6);
$cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
$cartRule->id_customer = (int) $id_customer;
$cartRule->id_currency = (int) $id_currency;
if ($cartRule->add()) {
if ($register != false) {
if ($register == 'sponsor') {
$this->id_cart_rule_sponsor = (int) $cartRule->id;
} elseif ($register == 'sponsored') {
$this->id_cart_rule = (int) $cartRule->id;
}
return $this->save();
}
return true;
}
return false;
}
示例2: getInt
public static function getInt($key, $id_shop_group = null, $id_shop = null)
{
ConfigurationKPI::setKpiDefinition();
$r = parent::getInt($key, $id_shop_group, $id_shop);
ConfigurationKPI::unsetKpiDefinition();
return $r;
}
示例3: registerDiscount
public function registerDiscount($id_customer, $register = false)
{
$configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_DISCOUNT_VALUE'));
$discount = new Discount();
$discount->id_discount_type = intval($configurations['REFERRAL_DISCOUNT_TYPE']);
$discount->value = floatval($configurations['REFERRAL_DISCOUNT_VALUE']);
$discount->quantity = 1;
$discount->quantity_per_user = 1;
$discount->date_from = date('Y-m-d H:i:s', time());
$discount->date_to = date('Y-m-d H:i:s', time() + 31536000);
// + 1 year
$discount->name = $this->getDiscountPrefix() . Tools::passwdGen(6);
$discount->description = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
$discount->id_customer = intval($id_customer);
if ($discount->add()) {
if ($register != false) {
if ($register == 'sponsor') {
$this->id_discount_sponsor = $discount->id;
} elseif ($register == 'sponsored') {
$this->id_discount = $discount->id;
}
return $this->save();
}
return true;
}
return false;
}
示例4: __construct
public function __construct()
{
$this->name = 'referralprogram';
$this->tab = 'Tools';
$this->version = '1.4';
parent::__construct();
$this->confirmUninstall = $this->l('All sponsor and friends would be deleted. Do you really want to uninstall this module ?');
$this->displayName = $this->l('Customer referral program');
$this->description = $this->l('Integrate a referral program system to your shop.');
$this->_configuration = Configuration::getMultiple(array('REFERRAL_NB_FRIENDS', 'REFERRAL_ORDER_QUANTITY', 'REFERRAL_DISCOUNT_TYPE', 'REFERRAL_DISCOUNT_VALUE'));
$this->_configuration['REFERRAL_DISCOUNT_DESCRIPTION'] = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
$path = dirname(__FILE__);
if (strpos(__FILE__, 'Module.php') !== false) {
$path .= '/../modules/' . $this->name;
}
$this->_xmlFile = $path . '/referralprogram.xml';
include_once $path . '/ReferralProgramModule.php';
}
示例5: __construct
public function __construct()
{
$this->name = 'referralprogram';
$this->tab = 'advertising_marketing';
$this->version = '1.5';
$this->author = 'PrestaShop';
parent::__construct();
$this->confirmUninstall = $this->l('All sponsors and friends will be deleted. Are you sure you want to uninstall this module?');
$this->displayName = $this->l('Customer referral program');
$this->description = $this->l('Integrate a referral program system into your shop.');
if (Configuration::get('REFERRAL_DISCOUNT_TYPE') == 1 and !Configuration::get('REFERRAL_PERCENTAGE')) {
$this->warning = $this->l('Please specify an amount for referral program vouchers.');
}
if ($this->id) {
$this->_configuration = Configuration::getMultiple(array('REFERRAL_NB_FRIENDS', 'REFERRAL_ORDER_QUANTITY', 'REFERRAL_DISCOUNT_TYPE', 'REFERRAL_DISCOUNT_VALUE'));
$this->_configuration['REFERRAL_DISCOUNT_DESCRIPTION'] = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
$this->_xmlFile = dirname(__FILE__) . '/referralprogram.xml';
}
}
示例6: registerDiscount
public function registerDiscount($id_customer, $register = false, $id_currency = 0)
{
$configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency));
$discount = new Discount();
$discount->id_discount_type = (int) $configurations['REFERRAL_DISCOUNT_TYPE'];
/* % */
if ($configurations['REFERRAL_DISCOUNT_TYPE'] == 1) {
$discount->value = (double) $configurations['REFERRAL_PERCENTAGE'];
} elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == 2 and isset($configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency])) {
$discount->value = (double) $configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency];
} else {
$discount->value = 0;
}
$discount->quantity = 1;
$discount->quantity_per_user = 1;
$discount->date_from = date('Y-m-d H:i:s', time());
$discount->date_to = date('Y-m-d H:i:s', time() + 31536000);
// + 1 year
$discount->name = $this->getDiscountPrefix() . Tools::passwdGen(6);
$discount->description = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
$discount->id_customer = (int) $id_customer;
$discount->id_currency = (int) $id_currency;
if ($discount->add()) {
if ($register != false) {
if ($register == 'sponsor') {
$this->id_discount_sponsor = (int) $discount->id;
} elseif ($register == 'sponsored') {
$this->id_discount = (int) $discount->id;
}
return $this->save();
}
return true;
}
return false;
}
示例7: getContent
public function getContent()
{
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$languages = Language::getLanguages(false);
$iso = $this->context->language->iso_code;
$output = '';
if (Tools::isSubmit('submitCustPrivMess')) {
$message_trads = array();
foreach ($_POST as $key => $value) {
if (preg_match('/custpriv_message_/i', $key)) {
$id_lang = preg_split('/custpriv_message_/i', $key);
$message_trads[(int) $id_lang[1]] = $value;
}
}
Configuration::updateValue('CUSTPRIV_MESSAGE', $message_trads, true);
$this->_clearCache('blockcustomerprivacy.tpl');
$output = '<div class="conf confirm">' . $this->l('Configuration updated') . '</div>';
}
$content = '';
if (version_compare(_PS_VERSION_, '1.4.0.0') >= 0) {
$content .= '
<script type="text/javascript">
var iso = \'' . (file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en') . '\' ;
var pathCSS = \'' . _THEME_CSS_DIR_ . '\' ;
var ad = \'' . dirname($_SERVER['PHP_SELF']) . '\' ;
</script>
<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce.inc.js"></script>
<script language="javascript" type="text/javascript">
id_language = Number(' . $id_lang_default . ');
tinySetup();
</script>';
} else {
$content .= '
<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,advimage,advlink,inlinepopups,media,searchreplace,contextmenu,paste,directionality,fullscreen",
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
content_css : "' . __PS_BASE_URI__ . 'themes/' . _THEME_NAME_ . '/css/global.css",
document_base_url : "' . __PS_BASE_URI__ . '",
width: "600",
height: "auto",
font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt",
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
elements : "nourlconvert",
entity_encoding: "raw",
convert_urls : false,
language : "' . (file_exists(_PS_ROOT_DIR_ . '/js/tinymce/jscripts/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en') . '"
});
id_language = Number(' . $id_lang_default . ');
</script>';
}
$values = Configuration::getInt('CUSTPRIV_MESSAGE');
$content .= $output;
$content .= '
<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>
<form action="' . htmlentities($_SERVER['REQUEST_URI']) . '" method="post">
<label>' . $this->l('Customer data privacy message.') . '</label>
<div class="margin-form">';
foreach ($languages as $language) {
$content .= '
<div id="ccont_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang_default ? 'block' : 'none') . ';float: left;">
<textarea class="rte" cols="70" rows="30" id="custpriv_message_' . $language['id_lang'] . '" name="custpriv_message_' . $language['id_lang'] . '">' . (isset($values[$language['id_lang']]) ? $values[$language['id_lang']] : '') . '</textarea>
</div>';
}
$content .= $this->displayFlags($languages, $id_lang_default, 'ccont', 'ccont', true) . '
<div class="clear">
</div>
<p>
' . $this->l('The customer data privacy message will be displayed in the account creation form.') . '<br />
' . $this->l('Tip: If the customer privacy message is too long to be written directly in the form, you can add a link to one of your pages. This can easily be created via the "CMS" page under the "Preferences" menu.') . '
</p>
</div>
<div class="clear"> </div>
<div class="margin-form">
<input type="submit" class="button" name="submitCustPrivMess" value="' . $this->l('Save') . '" />
</div>
</form>
</fieldset>';
return $content;
}
示例8: getContent
public function getContent()
{
$defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
$languages = Language::getLanguages(true);
$this->_html = '';
if (Tools::isSubmit('submitSettings')) {
foreach ($_POST as $key => $value) {
if (preg_match('/LAW_MESSAGE_/i', $key)) {
continue;
}
Configuration::updateValue($key, $value);
}
$message_trads = array();
foreach ($_POST as $key => $value) {
if (preg_match('/LAW_MESSAGE_/i', $key)) {
$id_lang = preg_split('/LAW_MESSAGE_/i', $key);
$message_trads[(int) $id_lang[1]] = $value;
}
}
Configuration::updateValue('LAW_MESSAGE', $message_trads, true);
$this->_html .= $this->displayConfirmation($this->l('Success'));
}
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$this->_html .= '<script type="text/javascript" src="../js/jquery/plugins/jquery.colorpicker.js"></script>';
} else {
$this->_html .= '<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>';
}
$this->_html .= '<h2>' . $this->displayName . '</h2>';
$this->_html .= '<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">';
$this->_html .= '<fieldset>';
$this->_html .= '<legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Settings') . '</legend>';
$values = Configuration::getInt('LAW_MESSAGE');
# text
$this->_html .= '<label>' . $this->l('Text') . '</label><div class="margin-form">';
foreach ($languages as $language) {
$this->_html .= '<div id="lawtext_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;">';
$this->_html .= '<input class="translatable" size="75" type="text" id="LAW_MESSAGE_' . $language['id_lang'] . '" name="LAW_MESSAGE_' . $language['id_lang'] . '" value="' . (isset($values[$language['id_lang']]) ? $values[$language['id_lang']] : '') . '" />';
$this->_html .= '</div>';
}
$this->_html .= $this->displayFlags($languages, $defaultLanguage, 'lawtext', 'lawtext', true);
$this->_html .= '</div><div class="clear"></div><script>id_language = Number(' . $defaultLanguage . ');</script>';
#page
$cms_pages = CMS::listCms();
$this->_html .= '<label>' . $this->l('CMS page for the "more informations" link') . '</label><div class="margin-form">';
$this->_html .= '<select name="COOKIE_LAW_CMS">';
foreach ($cms_pages as $page) {
$selected = Configuration::get('COOKIE_LAW_CMS') == $page['id_cms'] ? 'selected="selected"' : '';
$this->_html .= '<option value="' . $page['id_cms'] . '" ' . $selected . '>' . $page['meta_title'] . '</option>';
}
$this->_html .= '</select></div>';
# background
$this->_html .= '<label>' . $this->l('Background color') . '</label><div class="margin-form">';
$this->_html .= '<input type="color" name="COOKIE_LAW_BAR_BG" data-hex="true" class="color mColorPickerInput" value="' . Configuration::get('COOKIE_LAW_BAR_BG') . '" /></div><div class="clear"></div>';
# text color
$this->_html .= '<label>' . $this->l('Text color') . '</label><div class="margin-form">';
$this->_html .= '<input type="color" name="COOKIE_LAW_TEXT_COLOR" data-hex="true" class="color mColorPickerInput" value="' . Configuration::get('COOKIE_LAW_TEXT_COLOR') . '" /></div><div class="clear"></div>';
# opacity
$this->_html .= '<label>' . $this->l('Bar opacity') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_OPACITY" value="' . Configuration::get('COOKIE_LAW_BAR_OPACITY') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('from 0.1 to 1') . '</p>
</div><div class="clear"></div>';
# width
$this->_html .= '<label>' . $this->l('Bar width') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_WIDTH" value="' . Configuration::get('COOKIE_LAW_BAR_WIDTH') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('in "%" or "px"') . '</p>
</div><div class="clear"></div>';
# position
$this->_html .= '<label>' . $this->l('Bar position') . '</label><div class="margin-form">';
$this->_html .= '<select name="COOKIE_LAW_BAR_POSITION"">
<option value="top" ' . (Configuration::get('COOKIE_LAW_BAR_POSITION') == 'top' ? 'selected' : '') . '>' . $this->l('top of page') . '</option>
<option value="bottom" ' . (Configuration::get('COOKIE_LAW_BAR_POSITION') == 'bottom' ? 'selected' : '') . '>' . $this->l('bottom of page') . '</option>
</select>
</div><div class="clear"></div>';
# padding
$this->_html .= '<label>' . $this->l('Bar padding') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_PADDING" value="' . Configuration::get('COOKIE_LAW_BAR_PADDING') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('spacing within the bar, in "px"') . '</p>
</div><div class="clear"></div>';
# radius
$this->_html .= '<label>' . $this->l('Bar border radius') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_RADIUS" value="' . Configuration::get('COOKIE_LAW_BAR_RADIUS') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('bar rounding, in "px", higher value = more rounded') . '</p>
</div><div class="clear"></div>';
# margins
$this->_html .= '<label>' . $this->l('Bar margins') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_MARGIN" value="' . Configuration::get('COOKIE_LAW_BAR_MARGIN') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('margins, in "px": top right bottom left, for eg. 20px 0 20px 0') . '</p>
</div><div class="clear"></div>';
# text align
$this->_html .= '<label>' . $this->l('Text align') . '</label><div class="margin-form">';
$this->_html .= '<select name="COOKIE_LAW_TEXT_ALIGN"">
<option value="left" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'left' ? 'selected' : '') . '>' . $this->l('left') . '</option>
<option value="center" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'center' ? 'selected' : '') . '>' . $this->l('center') . '</option>
<option value="right" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'right' ? 'selected' : '') . '>' . $this->l('right') . '</option>
</select>
</div><div class="clear"></div>';
# margins
$this->_html .= '<label>' . $this->l('Z-index (advanced users)') . '</label><div class="margin-form">';
$this->_html .= '<input type="text" name="COOKIE_LAW_BAR_ZINDEX" value="' . Configuration::get('COOKIE_LAW_BAR_ZINDEX') . '" />
<p style="clear:both;" class="preference_description">' . $this->l('z-index for imp_cookies layer, be carefull with modify this setting') . '</p>
//.........这里部分代码省略.........