View Single Post
  #8  
Old 04-07-2014, 09:34 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Custom Product Tabs

Tony,

Thank you for your guidance on this. Ok, so I got the code working as described - currently I have the three necessary functions in my APage.php - defineTabs, getExtendedSpecAttributes and getWhereUsedAttributes. The latter two functions I call from their respective tab TPL files, and all that works perfectly. It seems to not be the most elegant code, but it does work.

I also modified the defineTabs as follows so it only shows tabs if there is content in them:

PHP Code:
protected function defineTabs()
    {
        
$list parent::defineTabs();

        
$widgets $this->getAttributesWidgets(); 

        foreach (
$widgets as $widget) {

            foreach (
$widget->getAttrList() as $attribute) {

                
$attributesToDisplay = array ('EXTENDED_SPECIFICATIONS'); 
                if (
in_array(strtoupper($attribute['name']), $attributesToDisplay)) { 
                    
$list['Extended Specifications'] = array(
                        
'list' => 'product.details.page.tab.extended_spec',
                        );
                }
                
$attributesToDisplay = array ('WHERE_USED');
                if (
in_array(strtoupper($attribute['name']), $attributesToDisplay)) { 
                    
$list['Where Used'] = array(
                        
'list' => 'product.details.page.tab.where_used',
                        );
                }
            }
        }

        return 
$list;
    } 

Again, probably could have been coded more efficiently but it does function. I still have two questions though:
  • How can I pull the attribute value in the tpl so I can use HTML in the field? I tried using {a.value:htmlspecialchars}, {a.value:h} and [a.value:loadHTML} but none of these work.
  • Right now the extended specs and where used attributes still show up on the standard "Specification" tab, how can I suppress this?

Thanks again Tony!

-Mark
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote