本文整理汇总了PHP中mage::getStoreConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP mage::getStoreConfig方法的具体用法?PHP mage::getStoreConfig怎么用?PHP mage::getStoreConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mage
的用法示例。
在下文中一共展示了mage::getStoreConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPassword
/**
* check password
*
*/
private function checkPassword()
{
$password = $this->getRequest()->getParam('password');
if ($password != mage::getStoreConfig('clientcomputer/general/password')) {
die('Access denied');
}
}
示例2: calculateOrderWeight
/**
* Method to calculate order weight depending of configuration
*
* @param unknown_type $order
*/
public function calculateOrderWeight($products)
{
$retour = 0;
//If calculation is enabled
if (mage::getStoreConfig('orderpreparation/order_weight_calculation/enable')) {
//compute bulk product weight
for ($i = 0; $i < count($products); $i++) {
$productId = $products[$i]['product_id'];
$product = mage::getModel('catalog/product')->load($productId);
if ($product->getId()) {
$qty = $products[$i]['qty'];
$retour += $product->getWeight() * $qty;
}
}
//Add additional weight
$methodValue = mage::getStoreConfig('orderpreparation/order_weight_calculation/additional_weight_value');
switch (mage::getStoreConfig('orderpreparation/order_weight_calculation/additional_weight_method')) {
case MDN_Orderpreparation_Model_OrderWeightCalculation::METHOD_ADD_FIX_WEIGHT:
$retour += $methodValue;
break;
case MDN_Orderpreparation_Model_OrderWeightCalculation::METHOD_ADD_FIX_WEIGHT_PER_PRODUCT:
for ($i = 0; $i < count($products); $i++) {
$qty = $products[$i]['qty'];
$retour += $qty * $methodValue;
}
break;
case MDN_Orderpreparation_Model_OrderWeightCalculation::METHOD_ADD_PERCENT:
$retour += $retour / 100 * $methodValue;
break;
}
}
return $retour;
}
示例3: canSave
/**
* Can Save Enabled
* @return string
*/
public function canSave()
{
$cansave = mage::getStoreConfig('payment/pinpayments/can_save');
$isLoggedIn = mage::getSingleton('customer/session')->isLoggedIn();
if ($cansave && $isLoggedIn) {
return true;
}
return false;
}
示例4: getPurchaseTaxRate
/**
* Retourne le taux de taxe achat pour le produit
*
*/
public function getPurchaseTaxRate()
{
//Définit le tax id
$TaxId = $this->getpurchase_tax_rate();
if ($TaxId == 0 || $TaxId == '') {
$TaxId = mage::getStoreConfig('purchase/purchase_order/products_default_tax_rate');
}
//recupere et retourne la valeur
return mage::getModel('Purchase/TaxRates')->load($TaxId)->getptr_value();
}
示例5: _checkIpAllowed
/**
* If the 'limit by IP' options is set in the backend, check if the user's IP ids allowed
* NOTE: this is only the general limit by ip option. Individual module's limit by IP options are not checked here
*
* @return bool
*/
private static function _checkIpAllowed()
{
$ipAllowed = false;
if (Mage::getStoreConfig('dev/restrict/allow_ips') && Mage::getStoreConfig('buckaroo/buckaroo3extended_advanced/limit_by_ip')) {
$allowedIp = explode(',', mage::getStoreConfig('dev/restrict/allow_ips'));
if (in_array(Mage::helper('core/http')->getRemoteAddr(), $allowedIp)) {
$ipAllowed = true;
}
} else {
$ipAllowed = true;
}
return $ipAllowed;
}
示例6: deleteTasks
/**
* Delete tasks depending of config
*
*/
public function deleteTasks()
{
$dbh = $this->_getWriteAdapter();
$ExpireTimeStamp = time() - mage::getStoreConfig('backgroundtask/general/history_duration') * 3600;
$ExpireDate = date('Y-m-d H:i', $ExpireTimeStamp);
$deleteErrorTask = mage::getStoreConfig('backgroundtask/general/delete_error_tasks');
$condition = ' bt_executed_at is not null ';
if (!$deleteErrorTask) {
$condition .= " and bt_result <> 'error'";
}
$condition .= " and bt_executed_at < '" . $ExpireDate . "'";
try {
$dbh->delete($this->getTable('BackgroundTask/Task'), $condition);
} catch (Exception $ex) {
throw new Exception("Error while deleting tasks : " . $ex->getMessage());
}
}
示例7: talkToGateway
/**
* Talk to pin gateway
*
* @param array $data
* @param string $endPoint
* @return object
*/
protected function talkToGateway($data, $endPoint, $proto = Zend_Http_Client::POST)
{
$url = mage::helper('pinpayments')->getGatewayUrl() . '1/' . $endPoint;
$secretKey = mage::getStoreConfig('payment/pinpayments/secret_api_key');
if ($proto == Zend_Http_Client::PUT) {
$result = exec("curl {$url} -u {$secretKey}: -X PUT -d email={$data['email']} -d card_token={$data['card_token']}", $output, $return_var);
} else {
$curl = new ProxiBlue_PinPayments_Varien_Http_Adapter_Curl();
$curl->setConfig(array('timeout' => 15));
$curl->setConfig(array('userpwd' => mage::getStoreConfig('payment/pinpayments/secret_api_key') . ":"));
$curl->write($proto, $url, '1.1', null, $data);
$curlData = $curl->read();
$result = Zend_Http_Response::extractBody($curlData);
$curl->close();
$result = json_decode($result);
}
return $result;
}
示例8: execute
/**
* Execute tasks (limited by max execution time)
*
*/
public function execute()
{
$startTime = time();
$hasTask = true;
$maxExecutionTime = mage::getStoreConfig('backgroundtask/general/max_execution_time');
while (time() - $startTime < $maxExecutionTime && $hasTask) {
//collect next task to execute
$task = $this->getNextTaskToExecute();
//execute task
if ($task) {
$task->execute();
$this->setbtg_executed_tasks($this->getbtg_executed_tasks() + 1)->save();
} else {
//no task to execute, quit loop
$hasTask = false;
}
}
}
示例9: sendEmailReview
public function sendEmailReview()
{
$new_no_spam_review_yn = mage::getStoreConfig("no_more_spam/no_spam/new_no_spam_review");
$enabled_review_yn = mage::getStoreConfig("no_more_spam/no_spam/enabled_review");
if ($enabled_review_yn == 0) {
return;
}
if ($new_no_spam_review_yn == 0) {
return;
}
if ($this->checkCronTime() == false) {
return;
}
$review_collection = $this->getReviewsToday();
$ids = array();
$reviews_collection = array();
foreach ($review_collection as $review) {
$review_id = $review->getData('review_id');
$ids[] = $review_id;
$reviews_collection[] = $review;
}
Mage::helper("nomorespam")->sendEmailNotify($ids, $reviews_collection);
}
示例10: SaveAction
/**
* Sav le produit
*
*/
public function SaveAction()
{
//recupere les infos
$ProductId = $this->getRequest()->getPost('product_id');
$StockMini = $this->getRequest()->getPost('notity_stock_qty');
$UseConfigStockMini = $this->getRequest()->getPost('use_config_notify_stock_qty');
if ($UseConfigStockMini == '') {
$UseConfigStockMini = 0;
}
$exclude_from_supply_needs = $this->getRequest()->getPost('exclude_from_supply_needs');
if ($exclude_from_supply_needs == '') {
$exclude_from_supply_needs = 0;
}
$DefaultSupplyDelay = $this->getRequest()->getPost('default_supply_delay');
//define price to store
if (mage::getStoreConfig('tax/calculation/price_includes_tax')) {
$productPrice = $this->getRequest()->getPost('price_ttc');
} else {
$productPrice = $this->getRequest()->getPost('price');
}
//met a jour
$product = mage::getModel('catalog/product')->load($ProductId);
$product->setdefault_supply_delay($DefaultSupplyDelay);
$product->setexclude_from_supply_needs($exclude_from_supply_needs);
$product->setprice($productPrice);
$product->setmanual_supply_need_qty($this->getRequest()->getPost('manual_supply_need_qty'));
$product->setmanual_supply_need_comments($this->getRequest()->getPost('manual_supply_need_comments'));
$product->setmanual_supply_need_date($this->getRequest()->getPost('manual_supply_need_date'));
$product->setpurchase_tax_rate($this->getRequest()->getPost('purchase_tax_rate'));
$product->save();
$product->getStockItem()->setnotify_stock_qty($StockMini)->setuse_config_notify_stock_qty($UseConfigStockMini)->save();
//confirme
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Product successfully Saved'));
//Redirige vers la fiche créée
$this->_redirect('Purchase/Products/Edit/product_id/' . $ProductId);
}
示例11: newAction
/**
* New subscription action
*/
public function newAction()
{
$data = $this->getRequest()->getPost();
$isKeyHash = false;
$field_1 = Mage::helper("nomorespam")->getNmsField1();
$empty_text = Mage::helper("nomorespam")->getNmsField2();
if (isset($data[$field_1]) && isset($data[$empty_text])) {
$isKeyHash = $this->checkHashKey($data[$field_1], $data[$empty_text]);
}
//else $isKeyHash = true; //
$enabled_newsletter = mage::getStoreConfig("no_more_spam/no_spam/enabled_newsletter");
$session = Mage::getSingleton('core/session');
if (!$enabled_newsletter) {
$isKeyHash = true;
}
// if this section is off in nomorespam config then don't check our fields
if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email') && $isKeyHash) {
$customerSession = Mage::getSingleton('customer/session');
$email = (string) $this->getRequest()->getPost('email');
try {
if (!Zend_Validate::is($email, 'EmailAddress')) {
Mage::throwException($this->__('Please enter a valid email address.'));
}
if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 && !$customerSession->isLoggedIn()) {
Mage::throwException($this->__('Sorry, but administrator denied subscription for guests. Please <a href="%s">register</a>.', Mage::helper('customer')->getRegisterUrl()));
}
$ownerId = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email)->getId();
if ($ownerId !== null && $ownerId != $customerSession->getId()) {
Mage::throwException($this->__('This email address is already assigned to another user.'));
}
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
$session->addSuccess($this->__('Confirmation request has been sent.'));
} else {
$session->addSuccess($this->__('Thank you for your subscription.'));
}
} catch (Mage_Core_Exception $e) {
$session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
} catch (Exception $e) {
$session->addException($e, $this->__('There was a problem with the subscription.'));
}
$this->_redirectReferer();
} else {
$session->addError($this->__('Unable subscription. Try again later.'));
$this->_redirectReferer();
}
}
示例12: getCommitJsAction
/**
* Return js code to execute on commit button
*
*/
public function getCommitJsAction()
{
$retour = 'commit(';
//save data
$retour .= 'true,';
if (mage::getStoreConfig('orderpreparation/commit_button_actions/create_shipments_invoices') == 1) {
$retour .= 'true,';
} else {
$retour .= 'false,';
}
if (mage::getStoreConfig('orderpreparation/commit_button_actions/print_documents') == 1) {
$retour .= 'true,';
} else {
$retour .= 'false,';
}
if (mage::getStoreConfig('orderpreparation/commit_button_actions/download_documents') == 1) {
$retour .= 'true,';
} else {
$retour .= 'false,';
}
if (mage::getStoreConfig('orderpreparation/commit_button_actions/print_shipping_label') == 1) {
$retour .= 'true,';
} else {
$retour .= 'false,';
}
if (mage::getStoreConfig('orderpreparation/commit_button_actions/select_next_order') == 1) {
$retour .= 'true';
} else {
$retour .= 'false';
}
$retour .= ');';
return $retour;
}
示例13: postAction
public function postAction()
{
$post = $this->getRequest()->getPost();
$isKeyHash = false;
$enable_email = mage::getStoreConfig("no_more_spam/no_spam/enabled_email");
if ($enable_email == 1) {
$field_1 = Mage::helper("nomorespam")->getNmsField1();
$empty_text = Mage::helper("nomorespam")->getNmsField2();
if (isset($post[$field_1]) && isset($post[$empty_text])) {
$isKeyHash = $this->_checkHashKey($post[$field_1], $post[$empty_text]);
}
}
if (!$enable_email) {
$isKeyHash = true;
}
// if this section is off in nomorespam config then don't check our fields
if ($post && $isKeyHash) {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
try {
$postObject = new Varien_Object();
$postObject->setData($post);
$error = false;
if (!Zend_Validate::is(trim($post['name']), 'NotEmpty')) {
$error = true;
}
if (!Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
$error = true;
}
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
$error = true;
}
if (isset($post['hideit']) && Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
$error = true;
}
if ($this->_checkManualSpam()) {
$error = true;
}
if ($error) {
throw new Exception();
}
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate->setDesignConfig(array('area' => 'frontend'))->setReplyTo($post['email'])->sendTransactional(Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER), Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT), null, array('data' => $postObject));
if (!$mailTemplate->getSentSuccess()) {
throw new Exception();
}
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to send message. Please, try again later'));
$this->_redirect('*/*/');
return;
}
} else {
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(true);
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
$this->_redirect('*/*/');
}
}
示例14: notifyDevelopper
/**
* Notify developper by email
*
*/
public function notifyDevelopper($msg)
{
$email = mage::getStoreConfig('backgroundtask/general/debug');
if ($email != '') {
mail($email, 'Magento Background Task notification', $msg);
}
}
示例15: isAvailable
public function isAvailable($quote = null)
{
$storeId = Mage::app()->getStore()->getId();
// Check if quote is null, and try to look it up based on adminhtml session
if (!$quote && Mage::helper('buckaroo3extended')->isAdmin()) {
$quote = Mage::getSingleton('adminhtml/session_quote');
}
// If quote is not null, set storeId to quote storeId
if ($quote) {
$storeId = $quote->getStoreId();
}
// Check if the module is set to enabled
if (!Mage::getStoreConfig('buckaroo/' . $this->_code . '/active', $storeId)) {
return false;
}
// Check if the country specified in the billing address is allowed to use this payment method
if ($quote && Mage::getStoreConfigFlag('buckaroo/' . $this->_code . '/allowspecific', $storeId) && $quote->getBillingAddress()->getCountry()) {
$allowedCountries = explode(',', Mage::getStoreConfig('buckaroo/' . $this->_code . '/specificcountry', $storeId));
$country = $quote->getBillingAddress()->getCountry();
if (!in_array($country, $allowedCountries)) {
return false;
}
}
$areaAllowed = null;
if ($this->canUseInternal()) {
$areaAllowed = Mage::getStoreConfig('buckaroo/' . $this->_code . '/area', $storeId);
}
// Check if the paymentmethod is available in the current shop area (frontend or backend)
if ($areaAllowed == 'backend' && !Mage::helper('buckaroo3extended')->isAdmin()) {
return false;
} elseif ($areaAllowed == 'frontend' && Mage::helper('buckaroo3extended')->isAdmin()) {
return false;
}
// Check if max amount for the issued PaymentMethod is set and if the quote basegrandtotal exceeds that
$maxAmount = Mage::getStoreConfig('buckaroo/' . $this->_code . '/max_amount', $storeId);
if ($quote && !empty($maxAmount) && $quote->getBaseGrandTotal() > $maxAmount) {
return false;
}
// check if min amount for the issued PaymentMethod is set and if the quote basegrandtotal is less than that
$minAmount = Mage::getStoreConfig('buckaroo/' . $this->_code . '/min_amount', $storeId);
if ($quote && !empty($minAmount) && $quote->getBaseGrandTotal() < $minAmount) {
return false;
}
// Check limit by ip
if (mage::getStoreConfig('dev/restrict/allow_ips') && Mage::getStoreConfig('buckaroo/' . $this->_code . '/limit_by_ip')) {
$allowedIp = explode(',', mage::getStoreConfig('dev/restrict/allow_ips'));
if (!in_array(Mage::helper('core/http')->getRemoteAddr(), $allowedIp)) {
return false;
}
}
// get current currency code
$currency = Mage::app()->getStore()->getBaseCurrencyCode();
// currency is not available for this module
if (!in_array($currency, $this->allowedCurrencies)) {
return false;
}
if (!TIG_Buckaroo3Extended_Model_Request_Availability::canUseBuckaroo($quote)) {
return false;
}
return parent::isAvailable($quote);
}