Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Additional Tab In Product_Update.tpl Rate Topic   - - - - -

 
  • ffqa
  • Newbie
  • Members
  • Join Date: 10-Jun 21
  • 4 posts

Posted 10 June 2021 - 04:28 PM #1

I am unsure how to display an additional tab on product variation pages, if it is a 'Variations as one product'.

 

I have a design/backend/templates/addons/my_addon/hooks/products/tabs_content.post.tpl

<div class="{if $selected_section !== "my_addon"}hidden{/if}" id="content_my_addon">
{include file="views/products/components/picker/picker.tpl"
    input_name="my_addon_data[]"
    item_ids=$my_addon
    multiple=true
    view_mode="external"
    select_group_class="btn-toolbar"
}
</div>

For variations as separate products it works just fine.

 

 

design\backend\templates\addons\product_variations\hooks\products\tabs_content.override.tpl

has a condition

{if !$product_type->isFieldAvailable("tabs_content")}
    <!-- Overridden by the Product Variations add-on -->
{/if}

So I added app\addons\my_addon\schemas\product_variations\product_types.post.php with

use Tygh\Addons\ProductVariations\Product\Type\Type;

$schema[Type::PRODUCT_TYPE_VARIATION]['tabs'][] = 'my_addon';

return $schema; 

and it actually adds a tab... without content.

 

 

I'm not sure what to make of this. I'm new to CS-Cart and smarty, can anyone shed some light on this for me?



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1425 posts

Posted 12 June 2021 - 12:19 PM #2

Hello,

 

Have you defined the tab on controller level?

In add-on you should create a controller /controllers/backend/products.post.php and add this mode there:

if ($mode == 'update') {
            Registry::set('navigation.tabs.my_addon', array (
                'title' => __('my_addon'),
                'js' => true
            ));
} // end if

Also, make sure that you're cleaning cache regularly - templates are prone to be cached and therefore fields in tab may not be displaying correctly.

 

Best regards,

Robert
 


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • ffqa
  • Newbie
  • Members
  • Join Date: 10-Jun 21
  • 4 posts

Posted 14 June 2021 - 02:34 PM #3

Thanks, I have the controller and cleared cache, but the problem persists.



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1425 posts

Posted 14 June 2021 - 02:50 PM #4

Hello

 

Does the tab show and has no content or is the tab not visible at all?
Have you tried to enter anything else in this <div>?
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


 
  • ffqa
  • Newbie
  • Members
  • Join Date: 10-Jun 21
  • 4 posts

Posted 15 June 2021 - 01:59 PM #5

The tab is visible for all variations, the tab content is visible on pages of 'variations as separate products' and does not exist on pages of 'variations as one product'.



 
  • ffqa
  • Newbie
  • Members
  • Join Date: 10-Jun 21
  • 4 posts

Posted Today, 04:13 AM #6

As a workaround I simply put the content of my div in design\backend\templates\addons\my_addon\hooks\products\update_product_availability.post.tpl  

 

Now it properly loads for all types of product variations.

However, 'variations as one product' is still giving me trouble. For this kind of product my data doesn't get saved/updated.

I have no explanation since it works for all other products that arent 'variations as one product'.