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
 All Forums
 Technical
 Advanced Tips and Tricks - NO QUESTIONS PLEASE
 Add content regions by category to details page
Author « Topic »  

John M
Advanced Member

457 Posts

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

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 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);
}
}
}


Next find:

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

Immediately below add the following line:

elseif($layoutoption=='catcontentregion') pddcatcontentregion();

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

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

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

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.03 seconds. Snitz Forums 2000