Pagination for product options in admin
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



