Find current subcategories siblings?
Can someone point me in the right direction as to how to determine what the current subcategory's parent category is, so I can then get all the parent's subcategories?
Thanks!~ |
Re: Find current subcategories siblings?
Look at the {$current_category} array. {$current_category.parentid} should contain the parent categoryid.
|
Re: Find current subcategories siblings?
Thank you so much!
I was just coming back to post that I was able to locate the data I needed! |
Re: Find current subcategories siblings?
Ummm.. ok. So I haven't been able to figure out how or if the subcategory siblings data exists already.. somewhere. I want to provide a select menu which contains all the sibling subcategories, but on the subcategory pages.. I am able to locate the data if I am on the parent category page.
Am I going to need to make my own function to get this data? If so, is there a tutorial or thread that explains the hierarchy (not sure this is the right word)? From looking through the php files, I see the functions are in the /include/func files (duh) and I understand the root level php files passes values into Smarty, which is then used in the .tpl files... is it alright to call a function from the root php files or do I need another level in there? |
Re: Find current subcategories siblings?
I have made a little progress on this. But I am still not getting the data I need :(
I am not just familiar with how xCart works and how to store/access data. Any help would be greatly appreciated. And a very special thank you to cherie, for getting me this far. I did not want to keep bothering cherie, which is why I am posting in this thread. To recap, I need to build an array, something like this where parentid: PHP Code:
The I need to retrieve and loop the array data based on $current_category.parentid. What I current have, returns all the category names of all the subcategories but I can't figure out how to build the array correctly. include/common.php PHP Code:
skin/<theme>/customer/main/subcategories.tpl Code:
{foreach from=$subCats key=pid item=i} |
Re: Find current subcategories siblings?
Why reinventing the wheel. If you are using the Flyout Menus module the categories array is already created. Just reuse it. I think it is called $categories_menu and subcategories for each category are under childs
|
Re: Find current subcategories siblings?
And if I am not, can I still tap into those functions?
|
Re: Find current subcategories siblings?
1 Attachment(s)
Quote:
Have you seen this webinar from Tony? http://kb.x-cart.com/pages/viewpage.action?pageId=7504837#Webinar2-10Apr2014-DesignchangesinX-Cart5(Custom...thmyownme nu? It should get you familiar with overriding things. Take a look at the attached file, it is my drop down menu module, rename the zip file to a tar, I just renamed it zip so I could upload. |
Re: Find current subcategories siblings?
I believe this is for XC4 so the XC5 code won't work :)
If you are not using the Flyout Menus module you can still use its functions but you need to make your own calls to them to built the menu array |
Re: Find current subcategories siblings?
(1) Uncheck General Settings > Appearance > "Always show root categories in the category list"
(2) Use... Code:
<select onchange="window.location.href=this.value"> --- (1) May affect your main category menu though... It looks like yours is a custom menu, so you might get away with it. |
All times are GMT -8. The time now is 11:07 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.