Post by iplocker » Sun Mar 08, 2015 6:56 am

Hello.

I want to move my site build with Joomla + Mijoshop to OC 2.0 but I have a small problem .
I have a plugin at Joomla that it gives me the option to have tabs in the products description.

So I have : {tab TITLE1}.....{tab TITLE2}....{tab TITLE3}....{/tabs}

Is there is any extension at OC supports such a way creates tabs inside product description ?

Thanks

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm


Post by pushap.manik » Thu Mar 12, 2015 1:12 am

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Product Description Tabs</name>
<code>Product-Description-Tabs</code>
<version>2.0</version>
<author>Pushap Manik</author>
<!--Admin Starts-->
<file path="admin/language/*/catalog/product.php" >
<operation error="log">
<search><![CDATA[
$_['help_sku']
]]></search>
<add position="before" trim="true"><![CDATA[
$_['help_productdescription_tabs'] = 'To Add Tabs in product description follow below method for create unlimited tabs. <br/>
{tabs} {tab=tab name 1}, {tab=tab name 2},{tab=tab name n} {/tabs} <br/>
{tab name 1} <br/>
desciption of first tab <br/>
{/tab name 1} <br/>
{tab name 2} <br/>
desciption of second tab <br/>
{/tab name 2} <br/>
{tab name n} <br/>
desciption of nth(Unlimited) tabs <br/>
{/tab name n} <br/>
';
]]></add>
</operation>
</file>
<file path="admin/controller/catalog/product.php" >
<operation error="log">
<search><![CDATA[
$data['help_sku'] =
]]></search>
<add position="before" trim="true"><![CDATA[
$data['help_productdescription_tabs'] = $this->language->get('help_productdescription_tabs');
]]></add>
</operation>
</file>
<file path="admin/view/template/catalog/product_form.tpl">
<operation error="log">
<search><![CDATA[
<?php echo $entry_description; ?></label>
]]></search>
<add position="replace" trim="true"><![CDATA[
<span data-toggle="tooltip" title="<?php echo $help_productdescription_tabs; ?>"><?php echo $entry_description; ?></span></label>
]]></add>
</operation>
</file>
<!--Admin Ends-->
<!--Catalog Starts-->
<file path="catalog/model/catalog/product.php" >
<operation error="log">
<search><![CDATA[
'date_modified' => $query->row['date_modified'],
]]></search>
<add position="after" trim="true"><![CDATA[
'description' => $description,
'description1' => $description1,
]]></add>
</operation>
<operation error="log">
<search><![CDATA[
return array(
]]></search>
<add position="before"><![CDATA[
/**Product Description Tabs Starts*/
//{tabs} {tab=Description}, {tab=Features},{tab=Technical specifications} {/tabs} {Description}

$description = $query->row['description'];
$description1 = $query->row['description'];
if(preg_match("#{tabs}#s", $description)){
// Remove {} from description for shot description

$description = explode('{tabs}',$query->row['description']);
$description = explode('{/tabs}',$description[1]);
$tabs = explode(',',$description[0]);
$replacer=array();
foreach($tabs as $tab){
$replace = str_replace('{tab=','',$tab);
$replace = trim(str_replace('}','',$replace));
$replacer[]='{'.$replace.'}';
$replacer[]='{/'.$replace.'}';
}

$description2 = $description[1];

$description = str_replace($replacer,'',$description[1]);

// make tabs in product description
$replacer_div=array();

$productdescriptiontab = '<ul class="nav nav-tabs">';
$total_tabs=count($tabs);
foreach($tabs as $key => $tab){
$replace = str_replace('{tab=','',$tab);
$replace_name = trim(str_replace('}','',$replace));
$replace = strtolower(strtoupper($replace_name));
$replace = str_replace(array(' ','_','&nbsp;'),'-',$replace);

$div='';
if($key==0){
$productdescriptiontab .= '<li class="active"><a href="#tab-product'.$replace.'" data-toggle="tab">'.$replace_name.'</a></li>';

$div.='<div class="tab-content">';
$div.='<div class="tab-pane active" id="tab-product'.$replace.'">';
}else{
$productdescriptiontab .= '<li><a href="#tab-product'.$replace.'" data-toggle="tab">'.$replace_name.'</a></li>';

$div.='<div class="tab-pane" id="tab-product'.$replace.'">';
}

$replacer_div[]=$div;
if($key==$total_tabs-1){
$replacer_div[]='</div></div>';
}else{
$replacer_div[]='</div>';
}
}
$productdescriptiontab .= '</ul>';

$replacer_div = array_map('htmlentities',$replacer_div);

$description1 = str_replace($replacer,$replacer_div,$description2);

$description1 = htmlentities($productdescriptiontab).$description1;
}
/**Product Description Tabs Ends*/
]]></add>
</operation>
</file>
<file path="catalog/controller/product/product.php" >
<operation error="log">
<search><![CDATA[
html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
]]></search>
<add position="replace" trim="true"><![CDATA[
html_entity_decode($product_info['description1'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>
<!--Catalog Ends-->
</modification>

Newbie

Posts

Joined
Thu Mar 12, 2015 1:04 am

Post by iplocker » Sun Mar 15, 2015 5:05 am

Hello.

Thanks for writing this mod, but I m taking some error logs.
I am attaching the logs.

Thank you very much.

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm

Who is online

Users browsing this forum: No registered users and 41 guests