| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Product Tabs Display | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() I have successfully added a "tab" to the product details page tabs for the extra fields. The problem is: the tab is always there, whether it is needed or not, the extra fields will not be used on all products, so I only want to show the tab if the extra fields have values in them.
Example: some products will have dimensions (extra field), on these products, I want the tab labeled "specifications" to appear with the other tabs (send to friend, customer feedback, etc.,). other product will not have dimensions listed, but may have materials (another extra field) listed instead, in this case I still want to show the "specifications" tab. but some products will have neither dimensions or materials, in this case I don't want the tab to appear at all. I added the tab by editing include/product_tabs.php, the code I added is below. I am assuming I need to add something else to the extra Fields sections to tell it to only display the "Specifications" tab if at least one of the extra fields has a value in it, but I don't know what? Any ideas anyone? Code:
__________________
X-Cart Pro 4.4 |
|||||||
#2
|
|||||||
|
|||||||
![]()
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||
|
|||||||
![]() Thanks balinor, but it didn't change anything.
I added the following code to the ui_tabs.tpl file and the tab still shows up even if the extra fields are blank. Code:
__________________
X-Cart Pro 4.4 |
|||||||
#4
|
|||||||
|
|||||||
![]() Ok I understand what you want, here's is how I would tackle this issue.
In the product-tabs.tpl you created the new tab called specification, this will be just pseudo code: 1) First check loop through all extra fields for a value. For each field in extra fields table, check if there is a value (if value ne '') 2) A new boolean variable that will decide to create the tab or not If value ne '' then showtab (variable - boolean) = False 3) Show tab or not If showtab = True, use the code to make the tab Summary: So basically you will loop through all extra fields and if even one field has a value, this will trigger the showtab variable to equal True. When showtab is equal to true then only the Specifications tab will be shown. I would set the showtab variable to False before going through the loop and it should only turn to True if an extra field value is not equal to nothing. I hope this helps, if you need further assistance I can try and code this myself. |
|||||||
#5
|
|||||||
|
|||||||
![]() Thanks for your reply, but I am a newbie at this x-cart stuff and far from an expert with php coding, so with that being said -- can you give me an exact example of how this would be written out with the code below. With the code the way it is, it displays the "Specifications" tab all the time whether there are any extra fields empty or not.
This is the code in include/product_tabs.php Code:
__________________
X-Cart Pro 4.4 |
|||||||
#6
|
|||||||
|
|||||||
![]() It may be simpler(and cheaper if your time is worth something) to just order Dynamic Product Tabs from WebsiteCM as the functionality to only show tabs with content is already programmed into the module as well as a bunch of other features: http://www.websitecm.com/x-cart-mods/dynamic-product-tabs-for-xcart.html
|
|||||||
|
|||
X-Cart forums © 2001-2020
|