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.
[red]First add content regions 1, 2, 3, 4 with what ever content you want or use any other Region ID of your choice.[/red]
[blue]In the incproddetail.php file find:[/blue]
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>'; }
[blue]Immediately below add the following function:[/blue]
[red]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>'; }[/red]
[blue]Next find:[/blue]
elseif($layoutoption=='description') pdddescription();
[blue]Immediately below add the following line:[/blue]
[red]elseif($layoutoption=='contentregion') pddcontentregion();[/red]
[blue]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[/blue]
[red]$detailcontentregion=array("1", "2", "3", "4");[/red]
[blue]Next add contentregion to you $detailpagelayout e.g. if you want the content regions just after the description:[/blue]
$detailpagelayout="navigation,productname,productimage,previousnext,productid,reviewstars,sku,description,[red]contentregion[/red],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
|