Posted - 12/15/2017 : 11:14:01
Quick way to add your choice of static content to every product detail page using the content regions feature.
This example adds Region ID's 1,2,3 & 4 just below the description but it can be positioned anywhere on the detail page using $detailpagelayout feature.
First add content regions 1, 2, 3, 4 with what ever content you want or use any other Region ID of your choice.
In the incproddetail.php file find:
function pdddescription(){ global $usecsslayout,$usedetailbodyformat,$rs,$longdesc; if(! @$usecsslayout) print '<br />'; if(@$usedetailbodyformat==3){ }elseif($longdesc!='') print '<div class="detaildescription"' . displaytabs($longdesc) . '</div>'; elseif(trim($rs[getlangid('pDescription',2)])!='') print '<div class="detaildescription" itemprop="description">' . $rs[getlangid('pDescription',2)] . '</div>'; }
Immediately below add the following function:
function pddcontentregion(){ global $detailcontentregion; print '<div class="detaildescription contentregion" >' ; foreach ($detailcontentregion as $theid) { $sSQL = "SELECT ".getlangid('contentData',32768)." FROM contentregions WHERE contentID='".escape_string($theid)."'"; $result=ect_query($sSQL) or ect_error(); if($rs=ect_fetch_assoc($result)) $contentdata=$rs[getlangid("contentData",32768)]; print '<div class="contentregion' . $theid . '" >' ; print $contentdata; print '</div>'; } print '</div>'; }
Next find:
elseif($layoutoption=='description') pdddescription();
Immediately below add the following line:
elseif($layoutoption=='contentregion') pddcontentregion();
In the includes file add the following depending on the content region numbers you want to display. e.g. Region ID's 1,2,3 & 4
$detailcontentregion=array("1", "2", "3", "4");
Next add contentregion to you $detailpagelayout e.g. if you want the content regions just after the description:
$detailpagelayout="navigation,productname,productimage,previousnext,productid,reviewstars,sku,description,contentregion,instock,options,price,currency,quantity,checkoutbutton,emailfriend,searchwords,socialmedia,reviews";
This will default to using the detaildescription css class however you can style how you want them to look using the following css classes: contentregion, contentregion1, contentregion2, contentregion3, contentregion4
Simples.
John
Edited by - John M on 12/15/2017 11:40:52
|