Add an imageref to oxReview

We will add a column to the oxreview:

1.) add a DB column to the oxreviews DB table:


2.)  we need to overload core/oxreview.php, to do so

create a file inside modules/htr_oxreviews.php


class htr_oxreview extends htr_oxreview_parent {

   public function save()
       if ($sReviewImageRef = trim( ( string ) oxConfig::getParameter( 'rvw_imgref', true ) ) ){
           $this->oxreviews__oximageref     = new oxField( $sReviewImageRef, oxField::T_RAW );
           $this->_aFieldNames['oximageref'] = 0;



class htr_oxreview extends htr_oxreview_parent

references the admin Modules settings, in which we will add:

oxreview => modules/htr_oxreview

so OXID does know that htr_oxreview_parent is oxreview, which we want to overload.

in there we overload the save() method to save also the new oximageref.

for that we lookup a POST variable ‘rvw_imgref’ and assign it to $dReviewImageRef

for our new DB column we set the according class var $this->oxreviews_oximageref and

add this new field to $this->_aFieldNames

finally we call the parents save method to save all, also make sure future update to the review system will not harm us.

To have the POST Var we will need to add a field to the review.tpl inside the tpl folder e.g. out/basic/tpl/review.tpl

in there we look for the textarea  (<textarea cols=”102″ rows=”15″ name=”rvw_txt” class=”fullsize”></textarea><br>)

and add the line

<input type=”input” name=”rvw_imgref”>

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *