0% found this document useful (0 votes)
77 views13 pages

Open Catalog Interface (Oci) : For Virtuemart

Uploaded by

Muhammad Ilyas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views13 pages

Open Catalog Interface (Oci) : For Virtuemart

Uploaded by

Muhammad Ilyas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Ver. 2.

Open Catalog Interface (OCI)


for VirtueMart
Joomla 2.5 und Virtuemart 2.0.6

Ing. Karl Hirzberger

Table of Contents
Term declaration ........................................................................................................................ 3
OCI for VirtueMart .................................................................................................................... 4
Installation .............................................................................................................................. 4
Autologin .................................................................................................................................... 5
Administrator ......................................................................................................................... 5
Frontend ................................................................................................................................. 6
Calling kh_autologin .......................................................................................................... 6
Test mode ........................................................................................................................... 6
Vmoci ......................................................................................................................................... 7
Administrator ......................................................................................................................... 7
Frontend ................................................................................................................................. 8
Test mode ............................................................................................................................... 8
Customizing ............................................................................................................................... 9
What means customizing within kh_vmoci ........................................................................... 9
The standard template ............................................................................................................ 9
Where are the templates ......................................................................................................... 9
Edit a template. ....................................................................................................................... 9
Which fields in the template are available ....................................................................... 10
Templates to users ................................................................................................................ 11
License ..................................................................................................................................... 13

Page 2 of 13

Term declaration
The Open Catalog Interface (OCI) is the interface between catalogs and SAP Business-toBusiness Procurement. SAPs Open Catalog Interface uses standard Internet protocols. It has
already been implemented between several catalog applications and SAP Business-to-Business
Procurement.

VirtueMart is an Open Source E-Commerce solution to be used together with a Content


Management System (CMS) called Joomla!. Joomla and VirtueMart are written in PHP and can
be used in typical PHP/MySQL environments.

Page 3 of 13

OCI for VirtueMart


It contains two plugins..
Kh_autologin for automatic login.
Kh_vmoci for sending data.
Important:
Vmoci stores date in the session-object.
You have to set the session timeout in Joomla-configuration long enough.

Installation
Install and activate the Plugins kh_autologin and kh_vmoci.

Page 4 of 13

Autologin
Administrator

Parameter
Url redirect

Description
Which page should be invoked
after login?

Password

How to send the login data

Debug

Debug mode

Values
Empty
Any page from Joomla: e.g.
Index.php
unencrypted
encrypted
SAP standard is unencrypted
no
yes
Only for testing

Page 5 of 13

Frontend
Calling kh_autologin
Parameter
URL

Description
Url of the own Page

Username

Username

Password

Password

Hook_Url

Values
http://www.myshop.com/index.php
index.php must be specified
USER
user
USERNAME
username
SAP standard is USERNAME
passw
PASSW
password
PASSWORD
SAP standard is PASSWORD
hook_url
HOOK_URL
SAP standard is HOOK_URL

Url to which the order data will be


sent.
Is passed from the calling system
and stored in the session.
Make sure that the session time is
large enough.
The parameter and parameter names have to be posted to the customer.
Example:
USERNAME
PASSWORD
HOOK_URL

Name of user
Password
Will be created by the system

Test mode
If you call the catalog with HOOK_URL=test, then the OCI-data will be shown.
URL: MyShop/index.php?USERNAME=xxx&PASSWORD=xxx&HOOK_URL=test

Page 6 of 13

Vmoci
Vmoci sends the order data to the Hook_url.
Important:
Vmoci injects Code in the thankyou-Page from VirtueMart. Therefore, the ordering
process has to end with the thankyou-page of VirtueMart.
With basic knowledge of PHP you can determine the fields and the format for transmit.
For each user you can define their own template.
Please read the section Customizing.

Administrator

Parameter
Automatic
transfer

Description
If YES: transfers data without clicking
the send button.

Values
Yes
No

Time

Time in milliseconds before the data


will be transferred automatically.
Debug mode

Milliseconds

Debug

No
Yes
Only for testing

Page 7 of 13

Frontend
The OCI will be shown in the thankyou page of Virtuemart.
If automatic sending is no, the user have to click the send button.

Test mode
When HOOK_URL has the value test, the "reflector for testing forms" shows the order data.

Page 8 of 13

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/template/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>

Page 9 of 13

Which fields in the template are available


/* here are all fields
// from order
$row->order_id;
$row->vendor_id;
$row->product_id;
$row->order_item_sku;
$row->order_item_name;
$row->product_quantity;
$row->product_item_price; //per Unit
$row->product_tax
//per Position
$row->product_basePriceWithTax // per Unit
$row->product_subtotal_discount //per Postion
$row->product_final_price; // per Unit
$row->order_item_currency;
$row->order_status;
$row->order_item_cdate;
$row->order_item_mdate;
$row->product_attribute;
//from product language-file
$row->product_s_desc;
$row->product_desc;
//from product
$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;
*/

Page 10 of 13

Templates to users
!!
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 -> Configuraterion -> Shopper Fields insert a new field with the name
kh_oci .
!! Attention!!
There is a bug in VM!
a. 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.

Page 11 of 13

2.

Insert new users in VirtueMart -> Ordes & Shoppers -> Shoppers -> Additional
Information and write the name of the template without extensions into the field kh_oci
(e.g. mytemplate).

Page 12 of 13

License
GNU General Public License

Page 13 of 13

You might also like