Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 Advanced Tips and Tricks - NO QUESTIONS PLEASE
 Add content regions by category to details page
Author « Topic »  

John M
Advanced Member

459 Posts

Pre-sales questions only
(More Details...)

Posted - 01/14/2018 :  02:03:07  
Very simple way to add fixed content, using the content regions feature, by category, to every product detail page, simply by naming the Region Name the same as the Category Name

[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 pddcatcontentregion(){
global $catid,$contentName,$catname;
$sSQL='SELECT sectionID,topSection,'.getlangid('sectionName',256).',rootSection,'.getlangid('sectionurl',2048)." AS sectionurl FROM sections WHERE sectionID='" . escape_string($catid) . "'";
$result2=ect_query($sSQL) or ect_error();
if(ect_num_rows($result2) > 0){
$rs2=ect_fetch_assoc($result2);
$catname = $rs2[getlangid('sectionName',256)];
ect_free_result($result2);
}
$sSQL = "SELECT contentID,contentName,".getlangid('contentData',32768)." FROM contentregions WHERE contentName='".escape_string($catname)."'";
$result=ect_query($sSQL) or ect_error();
if(ect_num_rows($result) > 0){
$rs=ect_fetch_assoc($result);
$contentName = $rs['contentName'];
$contentdata=$rs[getlangid("contentData",32768)];
if($contentName==$catname) {
print '<div class="detaildescription contentregion" >' ;
print '<div class="contentregion' . $catid . '" >';
print $contentdata;
print '</div>';
print '</div>';
ect_free_result($result);
}
}
}[/red]

[blue]Next find:[/blue]

elseif($layoutoption=='description') pdddescription();

[blue]Immediately below add the following line:[/blue]

[red]elseif($layoutoption=='catcontentregion') pddcatcontentregion();[/red]

[blue]Next add catcontentregion to your $detailpagelayout e.g. if you want the content regions just after the description:[/blue]

$detailpagelayout="navigation,productname,productimage,previousnext,productid,reviewstars,sku,description,[red]catcontentregion[/red],instock,options,price,currency,quantity,checkoutbutton,emailfriend,searchwords,socialmedia,reviews”;

[blue]Next add content regions for each category, that you want to add data to, where the [red]Region Name[/red] exactly equals the [red]Category Name[/red][/blue]

The content region will then show up on every product detail page only for that specific category.

John
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000