| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Adding Tabs to Home and Subcategory Pages | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() I am setting up a new 4.4.3 Gold store. I want to add tabs to my home and subcategory pages (like the tabs for the product pages). I want Featured products and Bestsellers to appear in tabs rather than in the traditional dialog menus. I have figured out the appearance part and it works, but I'm having trouble with the correct conditional to test for whether there are any Featured products.
I have made a new file in the include folder called welcome_tabs.php. It's modeled after the product_tabs.php. For the featured products tab, I have the following code: Code:
However, it does not allow Featured products to display even when I definitely have Featured products selected. If I get rid of the conditional part, I get the desired effect: 2 tabs - one for Featured products and one for Bestsellers. However, if I have no Featured products selected, a tab still appears for Featured products, but has no content. I don't want to be forced to select Featured products for the home page and every single subcategory, and I want my code to cover all possibilities. It seems as if $f_products is not the correct variable to test, but I can't figure out what might be the correct one. I have looked at featured_products.php and $f_products is all I can come up with. I have a feeling, though, that $f_products is only for template use so it is not recognized as a legitimate variable in a PHP file. Does anyone have any ideas as to how I can get this to work properly? I did clear my X-Cart cache and temp files in case the problem was related to cached data, but it didn't solve the problem. Thanks, Jill
__________________
X-Cart Gold 4.1.8 (Live) BCSE Shipping Estimator for FLC Mod BCSE Shipping Methods per Product Mod BCSE Customer Review Management Mod BCSE Catalog Order Form Mod X-Cart Gold 4.5.2 (Building/Testing) USA |
|||||||
#2
|
|||||||||
|
|||||||||
![]() The $f_products array is most likely empty all the time. This array is populated only when featured_products.php is called and $f_products is actually the array name assigned to smarty. The code as you have it in the php will never work as expected unless you call before that another script or function to populate that array
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() I replied to my own post last night (well, very early this morning really), but I must have accidently hit Preview instead of Submit or something because I don't see my reply now. The issue was as I suspected that $f_products is a Smarty variable so it can't be called as is from a PHP file.
I have now replaced $f-products with $smarty->_tpl_vars['f_products'] in my welcome_tabs.php file and everything is working fine. The tab appears with my Featured products when I have Featured products selected, and no tab appears when I deactivate or delete the Featured products. I call my welcome_tabs.php file - include $xcart_dir . '/include/welcome_tabs.php'; - from home.php after the include './featured_products.php'; line. Then I replaced the following code in welcome.tpl Code:
with Code:
I also plan to modify the featured.tpl and bestsellers.tpl templates for appearance. I haven't looked at it closely yet, but I plan to modify subcategories.tpl as I did welcome.tpl so I can have the tabbed appearance on subcategory pages, too.
__________________
X-Cart Gold 4.1.8 (Live) BCSE Shipping Estimator for FLC Mod BCSE Shipping Methods per Product Mod BCSE Customer Review Management Mod BCSE Catalog Order Form Mod X-Cart Gold 4.5.2 (Building/Testing) USA |
|||||||
|
|||
X-Cart forums © 2001-2020
|