本文整理汇总了PHP中OrderState::save方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderState::save方法的具体用法?PHP OrderState::save怎么用?PHP OrderState::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderState
的用法示例。
在下文中一共展示了OrderState::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createOrderState
private function _createOrderState()
{
if (Configuration::get($this->prefix . 'ORDER_STATE_ID') && Configuration::get($this->prefix . 'ORDER_STATE_PART_ID')) {
return true;
}
// Awaiting payment
$os = new OrderState();
$os->name = array('1' => 'Awaiting ' . $this->displayName . ' payment', '2' => 'En attente du paiement par ' . $this->displayName, '3' => 'En espera de pago por ' . $this->displayName);
$os->invoice = false;
$os->color = 'lightblue';
$os->logable = true;
if ($os->save()) {
Configuration::updateValue($this->prefix . 'ORDER_STATE_ID', $os->id);
copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 'os/' . $os->id . '.gif');
} else {
return false;
}
// Partially paid
$os1 = new OrderState();
$os1->name = array('1' => 'Partially paid by ' . $this->displayName, '2' => 'Payé partiellement via ' . $this->displayName, '3' => 'Pagado parcialmente con ' . $this->displayName);
$os1->invoice = false;
$os1->color = 'lightblue';
$os1->logable = true;
if ($os1->save()) {
Configuration::updateValue($this->prefix . 'ORDER_STATE_PART_ID', $os1->id);
copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 'os/' . $os1->id . '.gif');
return true;
}
return false;
}
示例2: install
/**
* Prestashop install
*/
public function install()
{
$pendingStatus = Configuration::get('MTGOX_PENDING_STATE_ID');
if ($pendingStatus === false) {
$orderState = new OrderState();
$langs = Language::getLanguages();
foreach ($langs as $lang) {
$orderState->name[$lang['id_lang']] = pSQL('MtGox payment pending');
}
$orderState->invoice = false;
$orderState->send_email = false;
$orderState->logable = true;
$orderState->color = '#FFDD99';
$orderState->save();
Configuration::updateValue('MTGOX_PENDING_STATE_ID', $orderState->id);
copy(dirname(__FILE__) . '/logo.gif', dirname(__FILE__) . '/../../img/os/' . (int) $orderState->id . '.gif');
}
if (parent::install() == false or !$this->registerHook('payment') or !Configuration::updateValue('MTGOX_MERCHANT_ID', '0') or !Configuration::updateValue('MTGOX_API_KEY', '0') or !Configuration::updateValue('MTGOX_API_SECRET_KEY', '0') or !Configuration::updateValue('MTGOX_PAYMENT_DESCRIPTION', 'MtGox Payment Gateway') or !Configuration::updateValue('MTGOX_EMAIL_ON_SUCCESS', '1') or !Configuration::updateValue('MTGOX_AUTOSELL', '1') or !Configuration::updateValue('MTGOX_INSTANT_ONLY', '0')) {
return false;
}
return true;
}
示例3: install
public function install()
{
Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'rnp_categories` (
`id_category` int(10) unsigned NOT NULL auto_increment,
`id_rnp` int(10) NOT NULL,
PRIMARY KEY (`id_category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'sac_carriers` (
`id_carrier` int(11) NOT NULL,
`id_sac_carrier` int(11) NOT NULL,
PRIMARY KEY `id_carrier` (`id_carrier`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
if (!Configuration::get('RNP_NBDELIVERYDAYS')) {
Configuration::updateValue('RNP_NBDELIVERYDAYS', 7);
}
if (!Configuration::get('RNP_TYPE_DISPLAY')) {
Configuration::updateValue('RNP_TYPE_DISPLAY', 1);
}
if (!parent::install() or !$this->registerHook('payment') or !$this->registerHook('paymentReturn') or !$this->registerHook('adminOrder') or !$this->registerHook('rightColumn')) {
return false;
}
$orderState = new OrderState();
$langs = Language::getLanguages();
foreach ($langs as $lang) {
$orderState->name[$lang['id_lang']] = 'Waiting FIA-NET validation';
}
$orderState->name[2] = 'Attente FIA-NET validation';
$orderState->invoice = false;
$orderState->send_email = false;
$orderState->logable = false;
$orderState->color = '#3333FF';
$orderState->save();
Configuration::updateValue('RNP_ID_ORDERSTATE', intval($orderState->id));
return true;
}
示例4: install
public function install()
{
if (!parent::install()) {
return false;
}
if (!file_exists(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
return false;
} elseif (!($sql = file_get_contents(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE))) {
return false;
}
$sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
$sql = preg_split("/;\\s*[\r\n]+/", $sql);
foreach ($sql as $query) {
if ($query and sizeof($query) and !Db::getInstance()->Execute(trim($query))) {
return false;
}
}
$langs = Language::getLanguages();
$orderState = new OrderState();
foreach ($langs as $lang) {
$orderState->name[$lang['id_lang']] = 'Waiting FIA-NET checking';
}
$orderState->name[2] = 'Attente validation commande FIA-NET';
$orderState->invoice = false;
$orderState->send_email = false;
$orderState->logable = false;
$orderState->color = '#FF9999';
$orderState->hidden = true;
$orderState->save();
Configuration::updateValue('SAC_ID_WAITING', (int) $orderState->id);
$orderState = new OrderState();
foreach ($langs as $lang) {
$orderState->name[$lang['id_lang']] = 'Fraud Detected By FIA-NET';
}
$orderState->name[2] = 'Fraude détectée par FIA-NET';
$orderState->invoice = false;
$orderState->send_email = false;
$orderState->logable = false;
$orderState->color = '#FF6666';
$orderState->hidden = true;
$orderState->save();
Configuration::updateValue('SAC_ID_FRAUD', (int) $orderState->id);
if (!$this->registerHook('updateCarrier')) {
return false;
}
if (!Configuration::updateValue('SAC_SITEID', '') or !Configuration::updateValue('SAC_LOGIN', '') or !Configuration::updateValue('SAC_PASSWORD', '') or !Configuration::updateValue('SAC_MINIMAL_ORDER', 0)) {
return false;
}
return $this->registerHook('cart') and $this->registerHook('newOrder') and $this->registerHook('adminOrder') and $this->registerHook('updateOrderStatus');
}
示例5: createKwixoPaymentStatus
/**
* Create Kwixo payments status
*
* @param array $array
* @param string $color
* @param string $template
*/
public function createKwixoPaymentStatus($array, $color, $template, $invoice, $send_email, $paid, $logable)
{
foreach ($array as $key => $value) {
$kw_ow_status = Configuration::get($key);
if ($kw_ow_status === false) {
$orderState = new OrderState();
$orderState->id_order_state = (int) $key;
} else {
$orderState = new OrderState((int) $kw_ow_status);
}
$langs = Language::getLanguages();
foreach ($langs as $lang) {
$orderState->name[$lang['id_lang']] = utf8_encode(html_entity_decode($value));
}
$orderState->invoice = $invoice;
$orderState->send_email = $send_email;
if ($template != '') {
$orderState->template = $template;
}
if ($paid != '') {
$orderState->paid = $paid;
}
$orderState->logable = $logable;
$orderState->color = $color;
$orderState->save();
Configuration::updateValue($key, (int) $orderState->id);
copy(dirname(__FILE__) . '/img/' . $key . '.gif', dirname(__FILE__) . '/../../img/os/' . (int) $orderState->id . '.gif');
}
}
示例6: _installOrderState
/**
* Create order states
*
* @version 1.0
* @global object $cookie Informations users
* @return boolean
*/
private function _installOrderState()
{
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$cookie = $this->context->cookie;
} else {
global $cookie;
}
$iso = Language::getIsoById((int) $cookie->id_lang);
// List of order state
$oStates = OrderState::getOrderStates($cookie->id_lang);
$orderStateName = array();
// Just name
foreach ($oStates as $state) {
$orderStateName[$state['id_order_state']] = $state['name'];
}
// HIPAY_PENDING
$translate = $iso == "fr" ? 'HIPAY - EN ATTENTE' : 'HIPAY - PENDING';
if (!in_array($translate, $orderStateName)) {
$OS = new OrderState();
$OS->name = array();
foreach (Language::getLanguages() as $language) {
if (Tools::strtolower($language['iso_code']) == 'fr') {
$OS->name[$language['id_lang']] = 'HIPAY - EN ATTENTE';
} else {
$OS->name[$language['id_lang']] = 'HIPAY - PENDING';
}
}
} else {
// if order state exists
$key = array_search($translate, $orderStateName);
$OS = new OrderState($key);
}
$OS->send_email = false;
$OS->color = "RoyalBlue";
$OS->hidden = false;
$OS->delivery = false;
$OS->logable = true;
$OS->invoice = false;
$OS->paid = false;
$OS->module_name = $this->name;
if (!$OS->save()) {
return false;
}
if (!in_array($translate, $orderStateName)) {
Configuration::updatevalue('HIPAY_PENDING', $OS->id);
} else {
Configuration::updatevalue('HIPAY_PENDING', $key);
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$file = 'os/' . $OS->id . '.gif';
} else {
$file = 'tmp/order_state_mini_' . $OS->id . '.gif';
}
}
@copy(dirname(__FILE__) . "/wait.gif", _PS_IMG_DIR_ . $file);
// HIPAY_CHALLENGED
$translate = $iso == "fr" ? 'HIPAY - CONTESTÉ' : 'HIPAY - CHALLENGED';
if (!in_array($translate, $orderStateName)) {
$OS = new OrderState();
$OS->name = array();
foreach (Language::getLanguages() as $language) {
if (Tools::strtolower($language['iso_code']) == 'fr') {
$OS->name[$language['id_lang']] = 'HIPAY - CONTESTÉ';
} else {
$OS->name[$language['id_lang']] = 'HIPAY - CHALLENGED';
}
}
} else {
// if order state exists
$key = array_search($translate, $orderStateName);
$OS = new OrderState($key);
}
$OS->send_email = false;
$OS->color = "RoyalBlue";
$OS->hidden = false;
$OS->delivery = false;
$OS->logable = true;
$OS->invoice = false;
$OS->paid = false;
$OS->module_name = $this->name;
if (!$OS->save()) {
return false;
}
if (!in_array($translate, $orderStateName)) {
Configuration::updatevalue('HIPAY_CHALLENGED', $OS->id);
} else {
Configuration::updatevalue('HIPAY_CHALLENGED', $key);
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$file = 'os/' . $OS->id . '.gif';
} else {
$file = 'tmp/order_state_mini_' . $OS->id . '.gif';
}
}
@copy(dirname(__FILE__) . "/wait.gif", _PS_IMG_DIR_ . $file);
//.........这里部分代码省略.........
示例7: createCustomOrderStates
public function createCustomOrderStates()
{
/** @noinspection PhpUndefinedClassInspection */
if (!Configuration::get('PAYIN7_OS_PENDING')) {
// PAYIN7_OS_PENDING
/** @noinspection PhpUndefinedClassInspection */
$OrderState = new OrderState();
$OrderState->name = array_fill(0, 10, 'ACEPTACION PAGO PAYIN7 EN ESPERA');
$OrderState->send_email = 0;
$OrderState->module_name = self::MODULE_NAME;
$OrderState->invoice = 0;
$OrderState->logable = 0;
$OrderState->color = '#2A5E8E';
$OrderState->unremovable = true;
/** @noinspection PhpUndefinedMethodInspection */
$OrderState->save();
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedFieldInspection */
Configuration::updateValue('PAYIN7_OS_PENDING', $OrderState->id);
}
/** @noinspection PhpUndefinedClassInspection */
if (!Configuration::get('PAYIN7_OS_ACCEPTED')) {
// PAYIN7_OS_ACCEPTED
/** @noinspection PhpUndefinedClassInspection */
$OrderState = new OrderState();
$OrderState->name = array_fill(0, 10, 'PAGO PAYIN7 ACEPTADO');
$OrderState->send_email = 0;
$OrderState->module_name = self::MODULE_NAME;
//$OrderState->template = 'payment';
$OrderState->invoice = 0;
$OrderState->logable = 0;
$OrderState->color = '#32CD32';
$OrderState->unremovable = true;
/** @noinspection PhpUndefinedMethodInspection */
$OrderState->save();
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedFieldInspection */
Configuration::updateValue('PAYIN7_OS_ACCEPTED', $OrderState->id);
}
/** @noinspection PhpUndefinedClassInspection */
if (!Configuration::get('PAYIN7_OS_CANCELLED')) {
// PAYIN7_OS_CANCELLED
/** @noinspection PhpUndefinedClassInspection */
$OrderState = new OrderState();
$OrderState->name = array_fill(0, 10, 'PAGO PAYIN7 CANCELADO');
$OrderState->send_email = 0;
$OrderState->module_name = self::MODULE_NAME;
//$OrderState->template = 'order_canceled';
$OrderState->invoice = 0;
$OrderState->logable = 0;
$OrderState->color = '#DC143C';
$OrderState->unremovable = true;
/** @noinspection PhpUndefinedMethodInspection */
$OrderState->save();
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedFieldInspection */
Configuration::updateValue('PAYIN7_OS_CANCELLED', $OrderState->id);
}
// previously - PS_OS_CHEQUE
/** @noinspection PhpUndefinedClassInspection */
Configuration::updateValue('PAYIN7_ID_ORDER_STATE_PENDING', Configuration::get('PAYIN7_OS_PENDING'));
// previously - PS_OS_PAYMENT
/** @noinspection PhpUndefinedClassInspection */
Configuration::updateValue('PAYIN7_ID_ORDER_STATE_ACCEPTED', Configuration::get('PAYIN7_OS_ACCEPTED'));
// previously - PS_OS_CANCELED
/** @noinspection PhpUndefinedClassInspection */
Configuration::updateValue('PAYIN7_ID_ORDER_STATE_CANCELLED', Configuration::get('PAYIN7_OS_CANCELLED'));
}
示例8: _create_order_state
private function _create_order_state($label, $template = null, $color = 'DarkOrange')
{
//Create the new status
$os = new OrderState();
$os->name = array('1' => $label, '2' => '', '3' => '');
$os->invoice = true;
$os->unremovable = true;
$os->color = $color;
$os->template = $template;
$os->send_email = false;
$os->save();
return $os->id;
}
示例9: install
/**
* @see PaymentModuleCore::install()
*/
public function install()
{
if (!method_exists('Tools', 'version_compare') || Tools::version_compare(_PS_VERSION_, '1.5')) {
// incompatible version of Prestashop
return false;
}
if (!parent::install() || !$this->registerHook('header') || !$this->registerHook('displayBackOfficeHeader') || !$this->registerHook('payment') || !$this->registerHook('paymentReturn') || !$this->registerHook('displayShoppingCart')) {
return false;
}
foreach ($this->_getAdminParameters() as $param) {
if (in_array($param['key'], $this->_multiLangFields)) {
// multilingual field, use prestashop IDs as keys
$default = array();
foreach (Language::getLanguages(false) as $language) {
$default[$language['id_lang']] = key_exists($language['iso_code'], $param['default']) ? $param['default'][$language['iso_code']] : '';
}
} else {
$default = $param['default'];
}
if (!Configuration::updateValue($param['key'], $default, false, false, false)) {
return false;
}
}
###ONEY_STATE_START###
if (Configuration::get('PAYZEN_ONEY_PENDING')) {
// rename oney status
Configuration::updateValue('PAYZEN_OS_ONEY_PENDING', Configuration::get('PAYZEN_ONEY_PENDING'));
Configuration::deleteByName('PAYZEN_ONEY_PENDING');
}
// Oney payment pending confirmation order status
if (!Configuration::get('PAYZEN_OS_ONEY_PENDING')) {
// create a pending order status
$lang = array('en' => 'Funding request in progress', 'fr' => 'Demande de financement en cours');
$name = array();
foreach (Language::getLanguages(true) as $language) {
$name[$language['id_lang']] = key_exists($language['iso_code'], $lang) ? $lang[$language['iso_code']] : '';
}
$oneyState = new OrderState();
$oneyState->name = $name;
$oneyState->invoice = false;
$oneyState->send_email = false;
$oneyState->module_name = $this->name;
$oneyState->color = '#FF8C00';
$oneyState->unremovable = true;
$oneyState->hidden = false;
$oneyState->logable = false;
$oneyState->delivery = false;
$oneyState->shipped = false;
$oneyState->paid = false;
if (!$oneyState->save() || !Configuration::updateValue('PAYZEN_OS_ONEY_PENDING', $oneyState->id)) {
return false;
}
// add small icon to status
@copy(_PS_MODULE_DIR_ . 'payzen/views/images/os_oney.gif', _PS_IMG_DIR_ . 'os/' . Configuration::get('PAYZEN_OS_ONEY_PENDING') . '.gif');
}
if (!Configuration::get('PAYZEN_OS_PAYMENT_OUTOFSTOCK')) {
// create a pending order status
$lang = array('en' => 'Payment accepted on backorder', 'fr' => 'Paiement accepté en attente de réapprovisionnement');
$name = array();
foreach (Language::getLanguages(true) as $language) {
$name[$language['id_lang']] = key_exists($language['iso_code'], $lang) ? $lang[$language['iso_code']] : '';
}
$oosState = new OrderState();
$oosState->name = $name;
$oosState->invoice = true;
$oosState->send_email = true;
$oosState->module_name = $this->name;
$oosState->color = 'HotPink';
$oosState->unremovable = true;
$oosState->hidden = false;
$oosState->logable = false;
$oosState->delivery = false;
$oosState->shipped = false;
$oosState->paid = true;
$oosState->template = 'outofstock';
if (!$oosState->save() || !Configuration::updateValue('PAYZEN_OS_PAYMENT_OUTOFSTOCK', $oosState->id)) {
return false;
}
// add small icon to status
@copy(_PS_MODULE_DIR_ . 'payzen/views/images/os_oos.gif', _PS_IMG_DIR_ . 'os/' . Configuration::get('PAYZEN_OS_PAYMENT_OUTOFSTOCK') . '.gif');
}
###ONEY_STATE_END###
return true;
}
示例10: _createPendingCashState
private function _createPendingCashState()
{
$state = new OrderState();
$languages = Language::getLanguages();
$names = array();
foreach ($languages as $lang) {
$names[$lang['id_lang']] = 'En espera de pago';
}
$state->name = $names;
$state->color = '#4169E1';
$state->send_email = true;
$state->module_name = 'conektaprestashop';
$templ = array();
foreach ($languages as $lang) {
$templ[$lang['id_lang']] = 'conektaprestashop';
}
$state->template = $templ;
if ($state->save()) {
Configuration::updateValue('waiting_cash_payment', $state->id);
$directory = _PS_MODULE_DIR_ . $this->name . '/mails/';
if ($dhvalue = opendir($directory)) {
while (($file = readdir($dhvalue)) !== false) {
if (is_dir($directory . $file) && $file[0] != '.') {
copy($directory . $file . '/conektaefectivo.html', '../mails/' . $file . '/conektaefectivo.html');
}
}
closedir($dhvalue);
}
} else {
return false;
}
return true;
}