Stampa cumulativa di ordini

Inviato da sara il Mar, 15/02/2011 - 17:45

E anche oggi ho risolto un bel problema.

Un cliente, da quanti ordini ha, (beato lui) non riesce più a gestirli e mi ha chiesto la seguente modifica:

- dall'elenco degli ordini gli serve un pulsante per stampare in blocco tutti gli ordini che non sono stati evasi finora. Per lui evasi voleva dire non stampati.

Si tratta di andare a modificare in maniera non troppo pesante un joomla 1.5 e un Virtuemart 1.1.3

Sostanzialmente, ho copiato il file order.order_printdetails.php presente nella cartella administrator/components/com_virtuemart/html/ in quanto quel file era la mia buona base di partenza per fare quello che volevo. In fondo mi bastava trasformare la prima query in un ciclo, modificandola opportunamente ed ero più o meno apposto.

Almeno con la visualizzazione degli ordini.

Ah no, la prima cosa che ho fatto è stata quella di aggiungere nella tabella di virtuemart orders un nuovo campo per la gestione di un flag, chiamato flag_stampa e l'ho messo di default a 0, perchè alla creazione dell'ordine doveva restare così.

Poi ho fatto una query per portar tutta la tabella ad un valore di 1 del suddetto campo.

A mano poi ne ho modificati due o tre riportandoli a 0 giusto per provare.

Bene...

 

questo è il file che ho fatto...

<code>

<?php

if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 

/**

*

* @version $Id: order.order_printdetails.php 1408 2008-06-10 04:03:14Z soeren_nb $

* @package VirtueMart

* @subpackage html

* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.

* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php

* VirtueMart is free software. This version may have been modified pursuant

* to the GNU General Public License, and as distributed it includes or

* is derivative of works licensed under the GNU General Public License or

* other free or open source software licenses.

* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.

*

* http://virtuemart.net

*/

mm_showMyFileName( __FILE__ );

global $ps_order_status;

require_once(CLASSPATH.'ps_checkout.php');

require_once(CLASSPATH.'ps_userfield.php');

require_once(CLASSPATH.'ps_product.php');

$ps_product= new ps_product;

 

$registrationfields = ps_userfield::getUserFields('registration', false, '', true, true );

$shippingfields = ps_userfield::getUserFields('shipping', false, '', true, true );

//$order_id = vmRequest::getInt('order_id', 0);

$dbc = new ps_DB;

 

?>

<script>

var xmlhttp

var myform

var testk

//funzione da richiamare se non devo fare niente prima

function Kload(url, miafunzione, send1)

{

xmlhttp=null

// code for Mozilla, etc.

if (window.XMLHttpRequest)

  {

  xmlhttp=new XMLHttpRequest()

  }

// code for IE

else if (window.ActiveXObject)

  {

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")

  }

if (xmlhttp!=null)

  {

  testk=miafunzione

  xmlhttp.onreadystatechange=state_Change

  xmlhttp.open(";POST", url ,true)

  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

  xmlhttp.send(send1);

  }

else

  {

  alert("Your browser does not support XMLHTTP.")

  }

}

function state_Change()

{

// if xmlhttp shows "loaded"

if (xmlhttp.readyState==4)

  {

  // if "OK"

  if (xmlhttp.status==200)

  {

    eval(testk+'(xmlhttp.responseText)');

  }

  else

  {

  alert("Problem retrieving data:" + xmlhttp.statusText)

  }

  }

}

function load_page(url, mydiv2, callback)

{

 

   mydiv=document.getElementById(mydiv2);

   mydiv.innerHTML=mydiv.innerHTML+"<div style=\"background-color:#b3e7b7; height: 22px;\"><span style=\"color: red;\">Sto caricando..</span></div>"

   //var temp=url.split('?');

   //temp=temp[1].split('=');

   //temp=temp[1].split('&');

   //temp=temp[0];

   //temp=document.getElementById('row_'+temp);

   //temp.className='row_3';

   Kload(url, callback, null);

}

function load_page2(testo)

{

     mydiv.innerHTML=testo;

}

function azzera_ordini(array)

{

    load_page('index.php?page=order.order_printdetails_azzera_ordini&no_menu=1&pop=1&tmpl=component&option=com_virtuemart&id_ordini='+array, 'messaggio_di_ritorno', 'load_page2');

}

</script>

<br />&nbsp;&nbsp;

Quando si clicca questo pulsante si resettano gli ordini sottostanti.<br>

Quindi alla prossima stampa o al refresh di pagina dopo il click sull'icona non saranno piu' presenti!<br>

<span class="vmNoPrint">;

<a href="javascript:void(0)&quot; onclick="javascript:window.print(); azzera_ordini(document.getElementById('id_ordini').value);&quot; title="Stampa">

<img src="http://www.pharmasi.it/images/M_images/printButton.png" alt="Stampa" name="Stampa" align="middle" border="0">

</a>

</span>

<div id="messaggio_di_ritorno&quot;></div>

<br />

<?php 

$db = new ps_DB;

$q = "SELECT * FROM #__{vm}_orders WHERE flag_stampa='0'"; 

$db->query($q);

while ($db->next_record()){

$order_id =$db->f("order_id";);

$id_dell_ordine[]=$db->f(&quot;order_id");

?>

<table width="100%"  align="center" border="0" cellspacing="0" cellpadding="0" style='page-break-after:always'>

  <tr>

    <td valign="top">

     <h2><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL') ?></h2>

     <p><?php echo ps_vendor::formatted_store_address(true) ?></p>

    </td>

    <td valign="top" width="10%" align="right"><;?php echo $vendor_image; ?></td>

  </tr>

  <!-- begin customer information --> 

  <tr class="sectiontableheader"> 

    <th align="left" colspan="2"><?php echo $VM_LANG->_('PHPSHOP_ACC_ORDER_INFO') ?></th>

  </tr>

  <tr> 

    <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER')?>:</td>

    <td><?php printf("%08d", $db->f("order_id")); ?></td>

  </tr>

 

  <tr> 

    <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE') ?>:</td>

    <td><?php echo vmFormatDate( $db->f("cdate")); ?></td>

  </tr>

  <tr> 

    <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS') ?>:</td>

    <td><?php echo $ps_order_status->getOrderStatusName( $db->f("order_status&quot;) )   ?></td>

  </tr>

  <?php

  // Print the coupon code when available

  if( $db->f("coupon_code&quot;) ) { ?>

 <tr>

 <td><strong><?php echo $VM_LANG->_('PHPSHOP_COUPON_COUPON_HEADER') ?>:</strong></td&gt;

 <td><?php $db->p("coupon_code&quot;); ?></td>

 </tr>

 <?php 

  }

  ?>

  <!-- End Customer Information --> 

  <!-- Begin 2 column bill-ship to --> 

  <tr class="sectiontableheader"> 

    <th align="left" colspan="2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_INFO_LBL') ?></th>

  </tr>

  <tr valign="top">&nbsp;

    <td width="50%"> <!-- Begin BillTo --><?php

    // Get bill_to information

    $dbbt = new ps_DB;

    $q  = "SELECT * FROM #__{vm}_order_user_info WHERE user_id='" . $db->f("user_id") . "'  AND order_id='$order_id' ORDER BY address_type ASC"; 

    $dbbt->query($q);

    $dbbt->next_record(); 

    $user = $dbbt->record;

  ?> 

      <table width="100%" cellspacing="0" cellpadding="2" border="0">

        <tr> 

          <td colspan="2"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_BILL_TO_LBL') ?></strong></td>;

        </tr>

       <?php 

foreach( $registrationfields as $field ) {

if( $field->name == 'email') $field->name = 'user_email';

if($field->type == 'captcha') continue;

?>

 <tr> 

<td align="right"><;?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title ?>:</td>

<td><?php

switch($field->name) {

          case 'country':

          require_once(CLASSPATH.'ps_country.php');

          $country = new ps_country();

          $dbc = $country->get_country_by_code($dbbt->f($field->name));

          if( $dbc !== false ) echo $dbc->f('country_name');

          break;

          default: 

          echo $dbbt->f($field->name);

          break;

         }

         ?>

</td>

 </tr>

 <?php

}

  ?>

      </table>

      <!-- End BillTo --> </td>

    <td width="50%"> <!-- Begin ShipTo --> <?php

    // Get ship_to information

    $dbbt->next_record(); 

    $dbst =& $dbbt;

  ?> 

 <table width="100%" cellspacing="0" cellpadding="2" border="0">

        <tr> 

          <td colspan="2"><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIP_TO_LBL') ?></strong></td>;

        </tr>

        <?php 

foreach( $shippingfields as $field ) {

if( $field->name == 'email') $field->name = 'user_email';

?>

 <tr> 

<td width="35%" align="right">&amp;nbsp;<?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title ?>:</td>

<td width="65%"><?php

switch($field->name) {

          case 'country':

          require_once(CLASSPATH.'ps_country.php');

          $country = new ps_country();

          $dbc = $country->get_country_by_code($dbst->f($field->name));

          if( $dbc !== false ) echo $dbc->f('country_name');

          break;

          default: 

          echo $dbst->f($field->name);

          break;

         }

         ?>

</td>

 </tr>

 <?php

}

  ?>

      </table>

      <!-- End ShipTo --> 

      <!-- End Customer Information --> 

    </td>

  </tr>

  <tr> 

    <td colspan="2">&nbsp;</td>

  </tr>

  <?php 

  if ($PSHOP_SHIPPING_MODULES[0] != "no_shipping" && $db->f("ship_method_id")) {

   $details = explode( "|", $db->f("ship_method_id"));

   ?> 

  <tr> 

    <td colspan="2"> ;

      <table width="100%" border="0" cellspacing="0" cellpadding="1">

        

        <tr class="sectiontableheader"> 

          <th align="left"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_SHIPPING_LBL') ?></th>

        </tr>

        <tr> 

          <td> 

            <table width="100%" border="0" cellspacing="0" cellpadding="0">

              <tr> 

                <td><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_CARRIER_LBL') ?></strong></td>;

                <td><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_MODE_LBL') ?></strong></td>;

                <td><strong><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PRICE') ?>&nbsp;</strong></td>

              </tr>

              <tr> 

                <td><?php echo $details[1];  ?>&nbsp;</td&gt;

                <td><?php echo $details[2]; ?></td>

                <td><?php echo $CURRENCY_DISPLAY->getFullValue($details[3], '', $db->f('order_currency')); ?></td>

              </tr>

            </table>

          </td>

        </tr>        

      </table>

    </td>

  </tr><?php

     } 

 

  ?> 

  <tr>

    <td colspan="2">&nbsp;</td>

  </tr>

  <!-- Begin Order Items Information --> 

  <tr class="sectiontableheader"> 

    <th align="left" colspan="2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_ITEM') ?></th>

  </tr>

  <tr> 

    <td colspan="2"> ;

      <table width="100%" cellspacing="0" cellpadding="2" border="0">

        <tr align="left">&nbsp;

          <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_QTY') ?></th>

          <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_NAME') ?></th>

          <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SKU') ?></th>

          <th><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PRICE') ?></th>

          <th align="right"><;?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL') ?>&nbsp;&nbsp;&nbsp;</th>

        </tr>

        <?php 

      $dbcart = new ps_DB;

      $q  = "SELECT * FROM #__{vm}_order_item ";

      $q .= "WHERE #__{vm}_order_item.order_id='$order_id' ";

      $dbcart->query($q);&nbsp;

      $subtotal = 0;

      while ($dbcart->next_record()) {

?> 

        <tr align="left">&nbsp;

          <td><?php $dbcart->p("product_quantity"); ?></td>

          <td><?php $dbcart->p("order_item_name"); echo " <font size=\"-2\">"; . $dbcart->f("product_attribute") . "</font>";?>;</td>

          <td><?php $dbcart->p("order_item_sku"); ?></td>

          <td><?php /*

                $price = $ps_product->get_price($dbcart->f("product_id&quot;));

                $item_price = $price["product_price&quot;]; */

                $item_price = $dbcart->f("product_item_price");

               echo $CURRENCY_DISPLAY->getFullValue($item_price, '', $db->f('order_currency'));

               

           ?></td>

          <td align="right"><;?php $total = $dbcart->f("product_quantity") * $item_price; 

                $subtotal += $total;

                echo $CURRENCY_DISPLAY->getFullValue($total, '', $db->f('order_currency'));

           ?>&nbsp;&nbsp;&nbsp;</td>

        </tr><?php

      }

?> 

        <tr> 

          <td colspan="4" align="right">&amp;nbsp;&nbsp;</td>

          <td>&nbsp;</td>

        </tr>

        <tr> 

          <td colspan="4" align="right"><;?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SUBTOTAL') ?> :</td>

          <td align="right"><;?php echo $CURRENCY_DISPLAY->getFullValue($subtotal, '', $db->f('order_currency')) ?>&nbsp;&nbsp;&nbsp;</td>

        </tr>

<?php 

      /* COUPON DISCOUNT */

      $coupon_discount = $db->f("coupon_discount");

      

      if( $coupon_discount > 0 ) {

        $subtotal -= $coupon_discount;

      ?>

        <tr>

          <td colspan="4" align="right"><;?php echo $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT') ?>:

          </td> 

          <td align="right"><;?php

            echo "- ".$CURRENCY_DISPLAY->getFullValue( $coupon_discount, '', $db->f('order_currency') ); ?>&nbsp;&nbsp;&nbsp;

          </td>

        </tr>

      <?php

      }

      if (($db->f("order_discount") != Innocent && (PAYMENT_DISCOUNT_BEFORE == '1')) { ?>

        <tr>

            <td colspan="4" align="right"><;?php 

              if( $db->f("order_discount") > Innocent

                echo $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');

              else

                echo $VM_LANG->_('PHPSHOP_FEE');

                ?>:

            </td> 

            <td align="right"><;?php

          if ($db->f("order_discount") > 0 )

               echo "- ".$CURRENCY_DISPLAY->getFullValue(abs($db->f(&quot;order_discount")), '', $db->f('order_currency'));

          elseif ($db->f("order_discount") < 0 )

               echo "+ ".$CURRENCY_DISPLAY->getFullValue(abs($db->f(&quot;order_discount")), '', $db->f('order_currency')); ?>

            &nbsp;&nbsp;&;nbsp;</td>

        </tr>

        

        <?php 

      }

?>

        

        <tr> 

          <td colspan="4" align="right"><;?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING') ?> :</td>

          <td align="right"><;?php 

            $shipping_total = $db->f("order_shipping");

            echo $CURRENCY_DISPLAY->getFullValue($shipping_total, '', $db->f('order_currency'));

            

            ?>&nbsp;&nbsp;&nbsp;</td>

        </tr>

        <tr> 

          <td colspan="4" align="right"><;?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX') ?> :</td>

          <td align="right"><;?php 

            $tax_total = $db->f("order_tax";)+ $db->f("order_shipping_tax");

            echo $CURRENCY_DISPLAY->getFullValue($tax_total, '', $db->f('order_currency'));

            

            ?>&nbsp;&nbsp;&nbsp;</td>

        </tr>

     

        <tr> 

          <td colspan="4" align="right">

          <?php if (PAYMENT_DISCOUNT_BEFORE == '1') { ?><strong><?php } 

          

          echo $VM_LANG->_('PHPSHOP_CART_TOTAL') .":"; if (PAYMENT_DISCOUNT_BEFORE != '1') { ?></strong><?php } ?></td>

          

          <td align="right"><;?php 

          if (PAYMENT_DISCOUNT_BEFORE == '1') { ?><strong><?php  

            $total = $db->f("order_total&quot;);

            echo $CURRENCY_DISPLAY->getFullValue($total, '', $db->f('order_currency'));

          }

          else {

            //$total = $db->f("order_subtotal") + $db->f("order_tax";) + $db->f("order_shipping") - $db->f("coupon_discount");

$total = $db->f("order_total&quot;);

            echo $CURRENCY_DISPLAY->getFullValue($total, '', $db->f('order_currency'));

          }

          if (PAYMENT_DISCOUNT_BEFORE == '1') { ?></strong><?php } ?>&nbsp;&nbsp;&nbsp;</td>

        </tr>

        <?php 

        if ($db->f("order_discount") != 0.00 && PAYMENT_DISCOUNT_BEFORE != '1') { ?>

        <tr>

        <td colspan="4" align="right"><;?php 

              if( $db->f("order_discount") > Innocent

                echo $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');

              else

                echo $VM_LANG->_('PHPSHOP_FEE');

                ?>:

        </td> 

        <td align="right"><;?php

          if ($db->f("order_discount") > 0 )

               echo "- ".$CURRENCY_DISPLAY->getFullValue(abs($db->f(&quot;order_discount")), '', $db->f('order_currency'));

          elseif ($db->f("order_discount") < 0 )

               echo "+ ".$CURRENCY_DISPLAY->getFullValue(abs($db->f(&quot;order_discount")), '', $db->f('order_currency'));

               ?>&nbsp;&nbsp;&nbsp;

        </td>

        </tr>

        <tr>

            <td colspan="4" align="right"><;strong><?php echo $VM_LANG->_('PHPSHOP_CART_TOTAL') ?>: </strong></td>

        <td align="right"><;strong><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_total"), '', $db->f('order_currency')); ?>

        </strong>&nbsp;&nbsp;&nbsp;

          </td>

        </tr>

        <?php

        } 

        ?>

        <tr>

            <td colspan="4" align="right">&amp;nbsp;</td>

        <td align="right"><;strong><?php echo ps_checkout::show_tax_details( $db->f('order_tax_details'), $db->f('order_currency') ); ?>

        </strong>&nbsp;&nbsp;&nbsp;

          </td>

        </tr>            

      </table>

    </td>

  </tr>

  <!-- End Order Items Information --> 

  <!-- Begin Payment Information --> 

 

      <tr class="sectiontableheader"> 

        <th align="left" colspan="2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYINFO_LBL') ?></th>

      </tr>

          <?php

          /** Retrieve Payment Info **/

          $dbpm = new ps_DB;

          $q  = "SELECT * FROM #__{vm}_payment_method, #__{vm}_order_payment, #__{vm}_orders ";

          $q .= "WHERE #__{vm}_order_payment.order_id='$order_id' ";

          $q .= "AND #__{vm}_payment_method.payment_method_id=#__{vm}_order_payment.payment_method_id ";

          $q .= "AND #__{vm}_orders.user_id='" . $db->f("user_id") . "' ";

          $q .= "AND #__{vm}_orders.order_id='$order_id' ";

          $dbpm->query($q);

          $dbpm->next_record(); ?> 

      <tr> 

        <td width="20%"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYMENT_LBL') ?> :</td>

        <td><?php $dbpm->p("payment_method_name"); ?> </td>

      </tr>

 <?php

          require_once(CLASSPATH.'ps_payment_method.php');

          $ps_payment_method = new ps_payment_method;

          $payment = $dbpm->f("payment_method_id");

          

          if ($ps_payment_method->is_creditcard($payment)) { 

          

            // DECODE Account Number

            $dbaccount = new ps_DB;

            $q = 'SELECT '.VM_DECRYPT_FUNCTION.'(order_payment_number,\''.ENCODE_KEY.'\') as account_number 

  FROM #__{vm}_order_payment WHERE order_id=\''.$order_id.'\'';

            $dbaccount->query($q);

            $dbaccount->next_record(); ?>

      <tr> 

        <td width="10%"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_ACCOUNT_NAME') ?> :</td>

        <td><?php $dbpm->p("order_payment_name"); ?> </td>

      </tr>

      <tr> 

        <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_ACCOUNT_NUMBER') ?> :</td>

        <td><?php echo ps_checkout::asterisk_pad($dbaccount->f("account_number"),4);

    ?> </td>

      </tr>

      <tr> 

        <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_EXPIRE_DATE') ?> :</td>

        <td><?php echo vmFormatDate($dbpm->f(";order_payment_expire"), '%b-%Y'); ?> </td>

      </tr>

          <?php } ?>

      <!-- end payment information --> 

      <tr>

 <td colspan="2"

 

<?php // }

  

  /** Print out the customer note **/

  if ( $db->f("customer_note&quot;) ) {

    ?>

    <table width="100%">

      <tr>

        <td colspan="2">&nbsp;</td>

      </tr>

      <tr class="sectiontableheader">

        <th align="left" colspan="2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUSTOMER_NOTE') ?></th>

      </tr>

      <tr>

        <td colspan="2">

         <?php echo nl2br($db->f("customer_note"))."<br />"; ?>

       </td>

      </tr>

    </table>

    <?php

  }

?>

</td>

</tr>

</table>

<?php

}

// } /* End of security check */

if(is_array($id_dell_ordine)){

  $id_per_funzione=implode("-",$id_dell_ordine);

}

?>

<input type="hidden" id="id_ordini" value="<?php echo $id_per_funzione ?>">

<script type="text/javascript&quot;>

//<!--

window.document.title="&lt;?php echo $VM_LANG->_('PHPSHOP_CHECK_OUT_THANK_YOU_PRINT_VIEW', false ); ?>";

//-->

</code>

l'ho nominato order.order_printdetails_nonevasi.php

In esso ci sono anche delle funzioni ajax dirette, in quanto dovevo fare in modo che al click dell'icona della stampante in automatico... si aprisse la gestione della stampante e gli ordini presenti nella pagina si flaggassero a 1 e quindi fossero stati evasi, o comunque stampati

Con questo stile:

style='page-break-after:always'

 

E questo è il file che richiamo via ajax per gestire l'update dei flag a 1:

<code>

<?php

if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 

/**

*

* @version $Id: order.order_printdetails.php 1408 2008-06-10 04:03:14Z soeren_nb $

* @package VirtueMart

* @subpackage html

* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.

* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php

* VirtueMart is free software. This version may have been modified pursuant

* to the GNU General Public License, and as distributed it includes or

* is derivative of works licensed under the GNU General Public License or

* other free or open source software licenses.

* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.

*

* http://virtuemart.net

*/

mm_showMyFileName( __FILE__ );

global $ps_order_status;

require_once(CLASSPATH.'ps_checkout.php');

require_once(CLASSPATH.'ps_userfield.php');

require_once(CLASSPATH.'ps_product.php');

if(isset($_GET['id_ordini'])) {

$ordini=explode("-",$_GET['id_ordini']);

$text_id=implode("' or order_id = '",$ordini);

$db = new ps_DB;

$q = "update #__{vm}_orders 

SET flag_stampa='1'

WHERE order_id = '".$text_id."'"

$db->query($q);

echo "ordini azzerati!";

}

?>

</code>

' importante nominare questo file come order.order_printdetails_azzera_ordini.php e non solo includere in testa tutte le funzioni di Joomla e Virtuemart in quanto esiste un controllo sui file che vengono richiamati anche via ajax e se si nomina questo fine senza order.order iniziale non viene considerato corretto.

Per finire alla riga 76 del file order.order_list.php ho aggiunto il seguente codice:

 

<code>

<a href="javascript:void window.open('<?php $sess->purl($_SERVER['PHP_SELF']."?page=order.order_printdetails_nonevasi&no_menu=1&pop=1&tmpl=component&option=com_virtuemart")?>', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');">

  <img src="http://www.pharmasi.it/images/M_images/printButton.png" align="ABSMIDDLE" border="0" height="16" width="16">

</code>

che serve per creare un link nella lista degli ordini e poter eseguire il tutto.

 

Bon... ho finito

 

 

Author Information

sara
Offline
Last seen: 11 settimane 18 min fa
Iscritto: 14/01/2010