Thursday, July 3, 2008

Can Platypus Be Pets?

Zen Cart: applicare uno sconto % a seconda del tipo di pagamento scelto

Okay, it starts to write something ...

Specifically, Zen Cart and again to see today how to achieve a reduction in percentage of the total order which is activated when the user selects a particular payment system.

In the case of my example will use the module as a transfer payment system on which to apply the discount.

discounts, price increases (both in percentage is calculated otherwise) going to change the order total is accomplished by creating a new form of 'serious' order_total

In this case, since it will also add a small note as to seen in Phase 2 of the checkout (ie the choice of payment system) at the payment system affected by this discount, we will also make a small change to the payment form and the corresponding language file. This note is optional, useful for the buyer to understand that if you choose this payment system will get a discount (the percentage is taken by dynamically configuring the module that will create total order and the note disappears if you disable the discount).

since the creation of form order_total:

position: includes / modules / order_total /
name: ot_sconto_bonifico.php

contents of the file:

/ ** *
sconto_bonifico order-total module

* * @ package OrderTotal
* @copyright Copyright 2008 Paolo De Dionigi aka spike00 http://www.atfriends.net
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @copyright Portions Copyright (c) 2002 Thomas Plänkers http://www.oscommerce.at
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: ot_sconto_bonifico.php 2008-07-03 spike00 $
*/
/**
* sconto_bonifico Order Totals Module
*
*/

class ot_sconto_bonifico {
var $title, $output;

function ot_sconto_bonifico() {
$this->code = 'ot_sconto_bonifico';
$this->title = MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TITLE;
$this->description = MODULE_ORDER_TOTAL_SCONTO_BONIFICO_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_SCONTO_BONIFICO_SORT_ORDER;

$this->output = array();
}

function process() {
global $order, $currencies, $sconto_valore, $sconto_bonifico_country, $shipping, $db;

if (MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS == 'true') {
if ($_SESSION['payment'] == 'bonifico') {

$sconto_valore = MODULE_ORDER_TOTAL_SCONTO_BONIFICO_VALORE;
$importo_sconto = ($order->info['total'] * $sconto_valore / 100);
$sconto_bonifico_tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TAX_CLASS, $sconto_bonifico_tax_address['country_id'], $sconto_bonifico_tax_address['zone_id']);
$order->info['total'] -= $importo_sconto;
if ($tax > 0) {
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TAX_CLASS, $sconto_bonifico_tax_address['country_id'], $sconto_bonifico_tax_address['zone_id']);
$order->info['tax'] -= zen_calculate_tax($importo_sconto, $tax);
$order->info['tax_groups'][$tax_description] -= zen_calculate_tax($importo_sconto, $tax);
$order->info['total'] -= zen_calculate_tax($importo_sconto, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$importo_sconto -= zen_calculate_tax($importo_sconto, $tax);
}
}

$this->output[] = array('title' => $this->title . ':',
'text' => '- ' . $currencies->format($importo_sconto, true, $order->info['currency'], $order->info['currency_value']),
'value' => $importo_sconto);
}
}
}

function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS'");
$this->_check = $check_query->RecordCount();
}

return $this->_check;
}
//lagt tilk servicepakke her!!!!
function keys() {
return array('MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_SORT_ORDER', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_VALORE', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TAX_CLASS');
}

function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values \u200b\u200b('Supplement View', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS', 'true', 'Activate the form?', '6 ', '1', 'zen_cfg_select_option (array (\\' true \\ ', \\' false \\ '), ', now ())");
$ db-> Execute ("insert into". TABLE_CONFIGURATION. "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values \u200b\u200b(' Display Order ',' MODULE_ORDER_TOTAL_SCONTO_BONIFICO_SORT_ORDER ' , '991 ',' display order. ', '6', '2 ', now ())");
$ db-> Execute ("insert into". TABLE_CONFIGURATION. "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values \u200b\u200b('Value discount bank', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_VALORE', '2 .00 ',' Set the value of the discount to be applied for payment by bank transfer. If you want eg 3 % 3:00 write ', '6', '3 ', now ())");
$ db-> Execute ("insert into". TABLE_CONFIGURATION. "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function , set_function, date_added) values \u200b\u200b('Class IVA', 'MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TAX_CLASS', '0 ',' Use this rate VAT reduction for payment. ', '6', '25 ',' Zen_get_tax_class_title ',' zen_cfg_pull_down_tax_classes (', now ())");



} function remove () {global $ db
;
$ keys = '';
keys_array $ = $ this-> keys ();
$ keys_size = sizeof ($ keys_array)
for ($ i = 0; <$keys_size; $i++) {
$ i $ keys .= "'". keys_array $ [$ i] . "',";

} $ keys = substr ($ keys, 0, -1);

$ db-> Execute ("delete from". TABLE_CONFIGURATION. "where configuration_key in (". $ keys. ") ");}


} ?>


Note the line that says this form of 'entering function' if the user has selected the bank as payment system:

if ($ _SESSION ['payment'] == 'transfer ')

as it is in quotation marks'' or the word bank, must be exactly what is contained in quotes the line: $ this-> code = 'bank';
which is located near the top of file on the payment form (in this case: includes / modules / payment / bonifico.php), ie the 'code' to attribute the payment form. Other

file to create is the language file:

position: includes / languages \u200b\u200b/ italian / modules / order_total /
nome: ot_sconto_bonifico.php

contenuto del file:

/**
* @package languageDefines
* @copyright Copyright 2008 Paolo De Dionigi aka spike00 http://www.atfriends.net
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: ot_sconto_bonifico.php 2008-07-03 spike00 $
*/
define('MODULE_ORDER_TOTAL_SCONTO_BONIFICO_TITLE', 'Sconto per pagamento con bonifico');
define('MODULE_ORDER_TOTAL_SCONTO_BONIFICO_DESCRIPTION', 'Sconto per pagamenti tramite bonifico');
?>

Infine apportiamo le modifiche al file del modulo di pagamento per inserire la nota di cui sopra:

Subito dopo la riga

$this->title = MODULE_PAYMENT_BONIFICO_TEXT_TITLE;

inseriamo queste righe:

if (MODULE_ORDER_TOTAL_SCONTO_BONIFICO_STATUS == 'true') {
$this->title = MODULE_PAYMENT_BONIFICO_TEXT_TITLE . '
Nota: previsto sconto pari al ' . MODULE_ORDER_TOTAL_SCONTO_BONIFICO_VALORE .'%
';
}

Qui ho scritto direttamente il testo in italiano, ovviamente se si ha un sito multilingua questa operazione comporterà che anche nelle lingue diverse dall'italiano, il messaggio si veda in italiano, quindi invece di fare così, si deve creare una o più nuove defines di lingua e usarle al posto del testo scritto direttamente nel modulo.



Ok, ora rimano soltanto da attivare il modulo e configurarlo.

Si va nell'amministrazione, in moduli, totale ordine. Qui comparirà il nostro nuovo modulo 'Sconto per pagamento con bonifico', lo installiamo come qualsiasi altro modulo. Di default ho inserito come posizionamento il valore 991, che dovrebbe essere subito dopo il calcolo dell'iva e subito prima del totale, così il tutto risulta coerente in visualizzazione da parte del cliente, comunque ovviamente è possibile modificare the display order.

Other key parameter is obviously the value of the discount. If you want to set such a discount of 3%, write 3:00 in the appropriate field.

last thing: the module is switched off course and / or uninstalled. If you disable or uninstall course will no longer apply the discount will disappear and the note at the system of payment on page 2 of checkout.

End;)

Special discounts to all;)

Monday, May 12, 2008

Where Can I Buy Wella

Rotondella, cold analysis of the vote

Il risultato delle ultime elezioni politiche fornisce indicazioni di rilievo sul piano locale

ROTONDELLA - A Rotondella il voto delle politiche si è rivelato in linea con il trend nazionale, ma non ha mancato di fornire qualche indicazione di rilievo sul piano locale. Forse anche in vista delle prossime elezioni comunali, in programma per la primavera del 2009. Il primo dato interessante è la sconfitta, difficilmente prevedibile, del Pd. In pochi, infatti, avrebbero scommesso sul sorpasso del Pdl, né tanto meno su uno scarto così rilevante: 737 voti alla Camera contro i 550 del partito di Veltroni! Infatti il Pdl, se escludiamo i Circoli della Libertà di Rudy Marranchelli e la ex sezione An, certainly no different for a strong local roots. It is a different speech for the Democratic Party, a political reality that is far more important, able to grasp the territory and to involve young people. Hardly, therefore, explains the outcome of the polls, if not with a strong sense of distrust for the proposed Veltroni and who, in the territory, if they have done bearer.
That this result can not be the stimulus for the creation of a more stable and center-rooted reality in the area? Even with a possible implication of candidacy for the forthcoming municipal? Who knows .... A Rotondella, as is known, the center does not have a list for years so-called "political" being represented by more or less transverse civic coalitions. Too high, the gap with the electoral center. At the last session, for example, the group managed to beat Vito Agresti Olive thanks to a substantial amount of the circle Pio Latorre, now "transformed" in the Communist Refoundation. And here the case is no different from that of Pd. The section of Rc is alive and present on the territory, but the disastrous outcome of the polls (only 57 votes in the House of L'Arcobaleno) leaves room for some reflection. Worthy of note are the 81 votes for the UDC (5%), which refer to an ideal rather than territorial representation and the consensus around the list Di Pietro (73 votes), which ha potuto giovarsi del sostegno di alcuni esponenti politici del territorio, non ultimo l'assessore comunale Antonio Dimatteo. Interessanti anche i 42 voti per La Destra di Storace, su cui ha pesato la presenza di un candidato locale, seppur di bandiera.
FONTE: Il Quotidiano della Basilicata

Installing Floor On A Aluminum Boat

The Democratic Party looks at young people and open space on the web

ROTONDELLA - L'esperienza politica più attiva, quella più riconoscibile sul piano della presenza sociale, è senz'altro rappresentata dalla sezione del Pd. Una realtà nuova, ricca di idee, che fa della partecipazione giovanile la sua arma principale. Alla nuova generazione appartiene anche la nuova segretaria cittadina, Donatella Negro, eletta nei mesi scorsi con voto unanime, to witness the historic "climate of peace," the Democratic Party of Rotondella. "We'll have a great deal of attention to young people - said the Negro - as we have already demonstrated the enormous generational change of the new committee."
same climate of consensus was celebrated, during elections, the inauguration of the new section of the PD (the premises of the former section Ds) named after the late Charles Stigliano, so that it costs for the establishment of a united center locally and regional levels. The latest addition to execution of a web site open to public participation. The address is http://www.rotondellapd.netsons.org
SOURCE: The Daily Basilicata