i hope type right topic. need know ? controller have list of cms page shop. want content don’t know how.
my controller:
class productcontroller extends productcontrollercore { public function initcontent() { parent::initcontent(); $cmslist = cms::listcms(); $this->context->smarty->assign('cmslist', $cmslist); } public function getcmscontent($cmsid){ $cmsid = cms::getcmscontent(); $this->context->smarty->assign('cmscontentproduct', $cmsid); } }
in product.tpl file have:
{$productcategory = $product->category} {foreach from=$cmslist item=varcms} {$cmsid = $varcms.id_cms} {$cmdtitle = $varcms.meta_title} {if $cmdtitle == $productcategory} {* contnet cms*} {/if} {/foreach}
how paste cms id getcmscontent ?
kind regards
class productcontroller extends productcontrollercore { public function initcontent() { parent::initcontent(); $cmslist = cms::listcms(); $this->context->smarty->assign('cmslist', $cmslist); } public function getcmscontent($cmsid){ $cms = new cms($cmsid, intval($cookie->id_lang)); return $cms; } }
and .tpl file:
{$productcategory = $product->category} {foreach from=$cmslist item=varcms} {$cmsid = $varcms.id_cms} {$cmdtitle = $varcms.meta_title} {if $cmdtitle == $productcategory} <section class="page-product-box"> <h3 class="page-product-heading"></h3> <div class="rte"><p>{productcontroller::getcmscontent($cmsid)->content[1]}</p></div> </section> {/if} {/foreach}
this function check product category , compare cms page. if same function display content of cms. it's works on ps 1.6.
kind regards
Comments
Post a Comment