March 10th, 2009
How to add pagination to product options in Admin ?
This customisation is for all UK2.net e-commerce package customers and Tradingeye users (5.04+)

Files need to modify:
modules/ecom/templates/admin/optionHome.tpl.htm
modules/ecom/classes/admin/option_interface.php
Edit the option_interface.php class as following steps:
1. Modify the c_optionInterface() function
Before edit:
#CONSTRUCTOR
function c_optionInterface()
{
$this->err=0;
$this->errMsg="";
$this->libFunc=new c_libFunctions();
}
After edit:
#CONSTRUCTOR
function c_optionInterface()
{
$this->err=0;
$this->errMsg="";
$this->libFunc=new c_libFunctions();
#INITIALISING PAGINATION VARIABLES
$this->pageTplPath=MODULES_PATH."default/templates/admin/";
$this->pageTplFile="pager.tpl.htm";
$this->pageSize="50"; #NUMBER OF ITEMS DISPLAYING PER PAGE
}
2. Modify the m_showOptions() function
Replace everything between these 2 parts
Part1(line 47):
$resOption=$this->obDb->fetchQuery();
$varCount=$this->obDb->record_count;
Part2(line 70):
$query= "SELECT * FROM ".CHOICES." order by vName" ;
By this code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| #ADDED PAGINATION FOR PRODUCTS
$extraString ="action=ec_option.home";
$pn =new PrevNext($this->pageTplPath, $this->pageTplFile,$this->obDb);
$pn->formno =1;
$navArr =$pn->create($query, $this->pageSize, $extraString);
$resOption =$navArr['qryRes'];
$recordCount =$navArr['selRecs'];
$totalRecord =$navArr['totalRecs'];
$row1 =$navArr;
#BLANK OUT THE PAGINATION
$this->ObTpl->set_var("TPL_VAR_PAGINATION", "");
if($totalRecord>$this->pageSize){
$this->ObTpl->set_var("TPL_VAR_PAGINATION", $row1['pnContents']);
}
$this->ObTpl->set_var("TPL_TOTAL_RECORDS",$varCount);
if($totalRecord>0)
{
for($i=0;$i< $recordCount;$i++)
{
if($resOption[$i]->iState==1)
{
$this->ObTpl->set_var("TPL_VAR_CHECKED","checked");
}
else
{
$this->ObTpl->set_var("TPL_VAR_CHECKED","");
}
$this->ObTpl->set_var("TPL_OPTION_ID",$resOption[$i]->iOptionid_PK);
$this->ObTpl->set_var("TPL_VAR_TITLE",$resOption[$i]->vName);
$this->ObTpl->set_var("TPL_VAR_DESC",$resOption[$i]->vDescription);
$this->ObTpl->set_var("TPL_VAR_MESSAGE","");
$this->ObTpl->parse("dspstdoption_blk","TPL_STDOPTIONS_BLK",true);
}
} |
Edit the optionHome.tpl.htm template file as below:
1. Add line 16, add this code for the pagination
{TPL_VAR_PAGINATION}
Finally, make sure you replace 2 other files from the download ZIP
1. modules/default/prevNext.php
2. modules/default/templates/main/pager.tpl.htm
That’s it. Please note this modification is for Standard Options only. You can follow the same method to apply the pagination for Custom Option or even product listing under department.
Feel free to ask me any question.
Categories: PHP, Tradingeye & UK2 Ecommerce, Web development |
Tags: pagination-product-options, standard-option-tradingeye, tradingeye-customisation, uk2-ecommerce-bespoke-customisation | No Comments
November 16th, 2008
his modification is for Tradingeye accessible e-commerce system and the latest UK2.net E-commerce package to help you track visitor movement through checkout pages. To get better understanding and the benefit of this feature, please refer to these 2 article as below:

1. Google Ecommerce Tracking Code
2. Analytics Talk
Now, please follow these steps
Step 1: Enabling E-Commerce Reporting in the Profile
The first step of tracking e-commerce transactions is to enable e-commerce reporting for your website’s profile. To enable e-commerce reporting, please follow these steps:
Log in to your account.
Click Edit next to the profile you’d like to enable.
On the Profile Settings page, click edit next to Main Website Profile Information.
Change the E-Commerce Website radio button from No to Yes.
Step 2: Receipt Page Format
Tradingeye and UK2.net payment process is slightly different from others. Once customer completed their transaction, he will be taken to an acknowlegdement (thank-you) page rather than a receipt page. He then has to click on the link “view your receipt” to see his receipt. Thus, we need to modifify these following files:
/modules/ecom/templates/main/orderProcessed.tpl.htm
/modules/ecom/classes/main/receipt.php
Lets get the ball rolling!
2.1: Place this code below at the bottom of the file orderProcessed.tpl.htm
<pre lang=”html”><!– BEGIN TPL_GOOGLE_ECOMMERCE_TRACKING_BLOCK –>
<script type=”text/javascript”><!–
var gaJsHost = ((“https:” == document.location.protocol ) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
// –></script>
<script type=”text/javascript”><!–
var pageTracker = _gat._getTracker(“UA-4440573-2″);
pageTracker._initData();
pageTracker._addTrans(
“{TPL_VAR_ORDER_ID}”, // order ID – required
“{TP_VAR_STORE_NAME}”, // affiliation or store name
“{TPL_VAR_TOTAL}”, // total – required
“{TPL_VAR_TAX_TOTAL}”, // tax
“{TPL_VAR_SHIPPING_COST}”, // shipping
“{TPL_VAR_CITY}”, // city
“{TPL_VAR_COUNTY}”, // state or province
“{TPL_VAR_COUNTRY}” // country
);
// add items might be called for every item in the shopping cart
<! BEGIN TPL_GOOGLE_ADDITEM_BLK –>
pageTracker._addItem(
“{TPL_VAR_ORDER_ID}”, // order ID – required
“{TPL_VAR_SKU_CODE}”, // SKU/code
“{TPL_VAR_PRODUCT_TITLE}”, // product name
“{TPL_VAR_CATEGORY}”, // category or variation
“{TPL_VAR_PRODUCT_PRICE}”, // unit price – required
“{TPL_VAR_QUANTITY}” // quantity – required
);
<!– END TPL_GOOGLE_ADDITEM_BLK –>
pageTracker._trackTrans(); //submits order info in hidden form after page load
// –></script>
<!– END TPL_GOOGLE_ECOMMERCE_TRACKING_BLOCK –></pre>
You need to replace this “UA-xxxxxx-xx” to your own Google Tracking ID
2.2: Modify the receipt.php class.
Under the method (function) m_orderProcessed()
At Line 47, Look for:
<pre lang=”php”>
#DECLARE BLOCKS $this->ObTpl->set_block(“TPL_ORDER_FILE”,”TPL_ORDERSTATUS_BLK”,”orderstatus_blk”);
$this->ObTpl->set_block(“TPL_ORDER_FILE”,”TPL_BACKORDER_BLK”,”backorder_blk”);
<pre>
And add:
<pre lang=”php”>
$this->ObTpl->set_block(“TPL_ORDER_FILE”,”TPL_GOOGLE_ECOMMERCE_TRACKING_BLOCK”,”google_blk”);
$this->ObTpl->set_block(“TPL_GOOGLE_ECOMMERCE_TRACKING_BLOCK”,”TPL_GOOGLE_ADDITEM_BLK”,”item_blk”);
$this->ObTpl->set_var(“google_blk”,”");
$this->ObTpl->set_var(“item_blk”,”");
</pre>
Look for this comment
#FLAG TO INDICATE SEPERATE BACKORDER AND NORMAL ORDER
and replace all the code from there to
<pre lang=”php”>$this->ObTpl->set_var(“TPL_VAR_BACKORDERURL”,$backOrderUrl);</pre>
by the code below:
<pre lang=”php”>#FLAG TO INDICATE SEPERATE BACKORDER AND NORMAL ORDER
$_SESSION['backOrderSeperate']=$this->libFunc->ifSet($_SESSION,’backOrderSeperate’,'0′);
$this->obDb->query = “SELECT count(*) as cnt FROM “.TEMPCART.” WHERE vSessionId=’”.$this->sessionId.”‘”;
$rowCount=$this->obDb->fetchQuery();
if($_SESSION['backOrderSeperate']==1 && $rowCount[0]->cnt>0)
{
$this->ObTpl->parse(“backorder_blk”,”TPL_BACKORDER_BLK”);
}
else
{
#GETTING INVOICE DETAIL AND ADD TO GOOGLE ECOMMERCE API
$this->obDb->query = “SELECT tmOrderDate,vPayMethod,vShipDescription,fShipTotal,”;
$this->obDb->query.= “vFirstName,vLastName,vEmail,vAddress1,vAddress2,vCity,iInvoice,”;
$this->obDb->query.= “vState,vStateName,vCountry,vZip,vCompany,vPhone,vHomepage,”;
$this->obDb->query.= “vAltPhone,fCodCharge,fPromoValue,”;
$this->obDb->query.= “vDiscountCode,fDiscount,iGiftcert_FK,fGiftcertTotal,fMemberPoints,”;
$this->obDb->query.= “fTaxRate,fTaxPrice,tComments,vStatus,iPayStatus,fTotalPrice,iEarnedPoints,iCustomerid_FK”;
$this->obDb->query .= ” FROM “.ORDERS.” WHERE iOrderid_PK=’”.$this->request['mode'].”‘”;
$qryResult = $this->obDb->fetchQuery();
$rCount=$this->obDb->record_count;
if($rCount!=1)
{
$errrorUrl=SITE_URL.”index.php?action=error&mode=order”;
$this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($errrorUrl));
}
#PARSING VALUE TO TEMPLATE VARIABLE
$this->ObTpl->set_var(“TPL_VAR_ORDER_ID”,$this->libFunc->m_displayContent($qryResult[0]->iInvoice));
$this->ObTpl->set_var(“TP_VAR_STORE_NAME”,SITE_NAME);
$this->ObTpl->set_var(“TPL_VAR_TOTAL”,$qryResult[0]->fTotalPrice);
$this->ObTpl->set_var(“TPL_VAR_TAX_TOTAL”,0);
$this->ObTpl->set_var(“TPL_VAR_SHIPPING_COST”,$qryResult[0]->fShipTotal);
$this->ObTpl->set_var(“TPL_VAR_CITY”,$this->libFunc->m_displayContent($qryResult[0]->vCity));
$this->ObTpl->set_var(“TPL_VAR_COUNTY”,$this->libFunc->m_displayContent($qryResult[0]->vZip));
$this->ObTpl->set_var(“TPL_VAR_COUNTRY”,$this->libFunc->m_displayContent($qryResult[0]->vFirstName));
#GETTING PRODUCTS DETAIL AND ADD TO GOOGLE API
$this->obDb->query = “SELECT iOrderProductid_PK,iProductid_FK,iQty,OP.fPrice,”;
$this->obDb->query.= “fDiscount,OP.vTitle,OP.vSku,OP.iKit,OP.tShortDescription,OP.vSeoTitle, “;
$this->obDb->query.=”OP.iTaxable,OP.iFreeship,vPostageNotes,vDownloadablefile “;
$this->obDb->query .= ” FROM “.ORDERPRODUCTS.” OP INNER JOIN “.PRODUCTS.” P ON OP.iProductid_FK=P.iProdId_PK WHERE iOrderid_FK=’”.$this->request['mode'].”‘”;
$rsOrderProduct=$this->obDb->fetchQuery();
$rsOrderProductCount=$this->obDb->record_count;
if ($rsOrderProductCount >0){
for($i=0;$i< $rsOrderProductCount;$i++){
#PARSING VALUE TO TEMPLATE VARIABLE
$this->ObTpl->set_var(“TPL_VAR_PRODUCT_TITLE”,$this->libFunc->m_displayContent($rsOrderProduct[$i]->vTitle));
$this->ObTpl->set_var(“TPL_VAR_SKU_CODE”,$this->libFunc->m_displayContent($rsOrderProduct[$i]->vSku));
$this->ObTpl->set_var(“TPL_VAR_PRODUCT_PRICE”,number_format($rsOrderProduct[$i]->fPrice,2,’.',”));
$this->ObTpl->set_var(“TPL_VAR_QUANTITY”,$rsOrderProduct[$i]->iQty);
$this->ObTpl->set_var(“TPL_VAR_ORDER_ID”,$this->libFunc->m_displayContent($qryResult[0]->iInvoice));
$this->ObTpl->set_var(“TPL_VAR_CATEGORY”,”"); # INITILISE CATEGORY NAME
#GETTING CATEGORY NAME BASED ON PRODUCT ID
/*
PLEASE NOTE: A PRODUCT COULD BE ASSOCIATED TO MANY DEPARTMENTS OR HOMEPAGE THEREFORE WE WILL GET
THE CATEGORY WHICH THAT PRODUCT WAS INITIALLY CREATED FROM.
*/
$this->obDb->query = ” SELECT fusionId, iOwner_FK, iOwner_FK, vtype, iState, vOwnerType “;
$this->obDb->query .= ” FROM ” .FUSIONS . ” WHERE iSubId_FK = ‘”.$rsOrderProduct[$i]->iProductid_FK .”‘”;
$this->obDb->query .= ” AND vOwnerType =’department’ AND iState =’1′ AND iOwner_FK >0 ORDER BY fusionId”;
$rsFusion=$this->obDb->fetchQuery();
if ($this->obDb->record_count > 0){
#ASSIGN THE FIRST RECORD TO CATEGORY ID
$deptId = $rsFusion[0]->iOwner_FK;
$this->obDb->query = ” SELECT iDeptid_PK, vTitle FROM “. DEPARTMENTS . ” WHERE iDeptid_PK = ‘”. $deptId .”‘”;
$rsDept =$this->obDb->fetchQuery();
$this->ObTpl->set_var(“TPL_VAR_CATEGORY”,$this->libFunc->m_displayContent($rsDept[0]->vTitle));
}#if
#PARSE PRODUCTS DETAIL TO GOOGLE E-COMMERCE API
$this->ObTpl->parse(“item_blk”,”TPL_GOOGLE_ADDITEM_BLK”,true);
}#for loop
}#if $rsOrderProductCount
$this->ObTpl->parse(“google_blk”,”TPL_GOOGLE_ECOMMERCE_TRACKING_BLOCK”);
$this->ObTpl->parse(“orderstatus_blk”,”TPL_ORDERSTATUS_BLK”);
}
$backOrderUrl=$this->libFunc->m_safeUrl(SITE_URL.”ecom/index.php?action=checkout.backorder”);
$this->ObTpl->set_var(“TPL_VAR_BACKORDERURL”,$backOrderUrl);
</pre>
Notice
1. If your shop is using Off-site payment gateway such as Paypal or GoogleCheckout, it is required your customer going back to the merchant site otherwise no record is tracked.
2. The modified m_orderProcessed() method is also availablet to download from the link at bottom of the post.
Enjoy!

Categories: E-commerce, Games, PHP, Tradingeye & UK2 Ecommerce, Viva, Web development |
Tags: google analytics, Google Conversion Tracking, google ecommerce tracking code, google-ecommerce-tracking, google-ecommerce-tradingeye-uk2-net, Tradingeye google conversion tracking code, tradingeye-customisation | 17 Comments
August 6th, 2008
It’s actually made me surprise how quick it is to be on #1 google ranking after just 2 days submitting my blog to Processional-On-The-Web site.
All you need to do is filling a simple Signup form and finally add up-to 10 keywords for your site.. That’s just it.
I tried to use 10 keywords as below:
web-development-blog, web-developer-newcastle, php-developer-newcastle, tradingeye-developer, accessible-ecommerce-blog, dave-sniper-blog, dave-bui-blog, seo-marketing-newcastle-uk, tradingeye-customisation, web-accessibility-blog
Surprisingly, I tried to look for “Web development Blog Newcastle” in Google Search Engine and my blog link was promoted to be number 1 google ranking
Questions:
1. Did Google treat my keyword as a phrase? I used the hyphens to concatenate all main words and to make a quality keyword (like a phrase)
2. Why Professionalontheweb.com site has to list all of my tags there ?
3. What would happen if you have perfect keywords, description in your Meta tags but the page content does not actually have anything relate to it?
All answers are welcome.
Categories: SEO & Marketing, Web development |
Tags: accessible-ecommerce-blog, dave-bui-blog, dave-sniper-blog, Google SEO, php-developer-newcastle, seo-marketing-newcastle-uk, tradingeye-customisation, tradingeye-developer, web-accessibility-blog, web-developer-newcastle, web-development-blog, web-development-newcastle | No Comments