What means customizing within kh_vmoci
With a template, you can determine which data the OCI sends. With simple PHP functions you can also determine the format of data.

The standard template
The standard template is default.tpl.php.

Where are the templates

Edit a template.
Open the template default.tpl.php or copy it to a new template and open it.

<form id="kh_vmOciSendForm" action=" <?php echo $hook_url ?>" method="post" target="_top">
    standard parameter 
    <input type="hidden" name="~OkCode" value="ADDI" />
    <input type="hidden" name="~target" value="_top" />
    <input type="hidden" name="~Caller" value="CTLG" />
        $counter = 1;
        foreach( $rows as $row ) 
In the foreach construct, you can determine the data for each product of the order. E.g.
    <input type="hidden" name="NEW_ITEM-DESCRIPTION[<?php echo $counter ?>]" 
        value="<?php echo substr($row->order_item_name,0,40) ?>" />
    <input type="hidden" name="NEW_ITEM-QUANTITY[<?php echo $counter ?>]" 
        value="<?php echo number_format($row->product_quantity, 3, '.', '') ?>" />
    <input type="hidden" name=NEW_ITEM-UNIT[<?php echo $counter ?>]" 
        value="<?php echo substr($row->product_unit,0,3) ?>" />
    <input type="hidden" name="NEW_ITEM-PRICE[<?php echo $counter ?>]" 
        value="<?php echo number_format($row->product_item_price, 3, '.', '') ?>" />
    <input type="hidden" name="NEW_ITEM-PRICEUNIT[<?php echo $counter ?>]" 
        value="1" />
    <input type="hidden" name="NEW_ITEM-CURRENCY[<?php echo $counter ?>]" 
        value="<?php echo $row->order_item_currency ?>" />
    More data..
    <?php $counter++; ?>
    <?php } //end for ?> 
    <input type="button" class="button" value="<?php echo $button_text ?>"
    id=kh_submitoci name=kh_submitoci onClick="kh_vmocisendform()">

Which fields in the template are available

/* here are all fields */
            // from order
            //from product

Templates to user

Only necessary if different customers want different transmitted data.
Otherwise simply edit default.tpl.php.

If necessary, you can specify a template for each user.
Is no template specified, kh_vmoci use default.tpl.php.

To assign a template to an user, the following steps have to be executed.

  1. In VirtueMart -> Administration -> Manage Userfields insert a new field with the name vm_kh_oci . !! Attention!! There are some bugs in VM!
    • The new field will inserted with index 0.
      If you delete the field (e.g. wrong name) and insert an new field, then you have two fields with index 0.
      At worst, you have to correct the index in the database table jos_vm_userfield in the column ordering.
    • In most versions of VirtueMart, VirtueMart automatically inserts "vm_" in front of the field name.
      So, if you write kh_oci, the field name will be changed into vm_kh_oci
  2. Insert new users in VirtueMart -> Administration -> Users and write the name of the template without extensions into the field vm_kh_oci (e.g. mytemplate).


Wiki: Home

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks