Customizing

hirzi

Home

Customizing

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
MyJoomlaInstallation/plugins/system/kh_vmoci/xxxxx.tpl.php

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" />
    <?php 
        $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()">
    </form>

Which fields in the template are available

/* here are all fields */
            // from order
            $row->order_id;
            $row->user_info_id;
            $row->vendor_id;
            $row->product_id;
            $row->order_item_sku;
            $row->order_item_name;
            $row->product_quantity;
            $row->product_item_price;
            $row->product_final_price;
            $row->order_item_currency;
            $row->order_status;
            $row->order_item_cdate;
            $row->order_item_mdate;
            $row->product_attribute;
            //from product
            $row->product_s_desc;
            $row->product_desc;
            $row->product_weight;
            $row->product_weight_uom;
            $row->product_length;
            $row->product_width;
            $row->product_height;
            $row->product_lwh_uom;
            $row->product_url;
            $row->product_available_date;
            $row->product_tax_id;
            $row->product_unit;
            $row->product_packaging;    

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).

Related

Wiki: Home

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

Sign up for the SourceForge newsletter:





No, thanks