Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

rootcategory.id category.id / subcategory.id ?

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 01-27-2016, 01:04 PM
 
info@shadowgraphicsinc.co info@shadowgraphicsinc.co is offline
 

Senior Member
  
Join Date: Jan 2011
Posts: 123
 

Default rootcategory.id category.id / subcategory.id ?

Hello, I am trying to offer a bit of a varied menu per sub category and I'm stumped...

I've added a small code that has:

<?php
$a=func_htmlspecialchars($this->getComplex('category.id'));
$b="996";
$c="1017";
$d="1237";
if ($a == $b || $a == $c || $a == $d )
{echo "TRUE";}
else
{echo "FALSE";}
?>

and that one does work as if it is any of those 3 categories, it is functional - if not... it's false.

However I have a lot of categories and instead of revising the script (and bogging it down with too many #'s to sort through, I was trying to find an easier way to this.

So with that I was looking for the parent category id syntax (the correct wording in place of the "category.id" label) so that way I could use that in it's place.

subcategory.id did not work and I'm having problems trying to find anything going backwards instead of forwards.

but here is a category reference:
Root = 1
Main Category = 2
Sub Category = 3
Main Category = 4
Sub Category = 5
Sub Category = 6
Sub Category = 7
Main Category = 8
etc

I am looking for the syntax to add categories 2, 4 + 8 so that way it would include everything under 3, 5, 6 + 7 as well

thanks for checking it out!
Reply With Quote
  #2  
Old 01-27-2016, 04:22 PM
 
info@shadowgraphicsinc.co info@shadowgraphicsinc.co is offline
 

Senior Member
  
Join Date: Jan 2011
Posts: 123
 

Default Re: rootcategory.id category.id / subcategory.id ?

I ended up indexing all of the categories so that way coding currently looks like this

Code:
<?php // Movies $a=func_htmlspecialchars($this->getComplex('category.id')); $b=func_htmlspecialchars($this->getComplex('page.id')); if ($b > 8 && $b < 8) if ($a == 208 || $a == 1013 || $a == 209 || $a == 1014 || $a == 194 || $a == 210 || $a == 1015 || $a == 406 || $a == 1016 || $a == 211 || $a == 1017 || $a == 407 || $a == 1018 || $a == 212 || $a == 1019 || $a == 213 || $a == 1020 || $a == 214 || $a == 1021 || $a == 215 || $a == 1022 || $a == 216 || $a == 1023 || $a == 218 || $a == 1025 || $a == 219 || $a == 1026 || $a == 220 || $a == 1027 || $a == 221 || $a == 1028 || $a == 222 || $a == 1029 || $a == 223 || $a == 1030 || $a == 224 || $a == 1031 || $a == 226 || $a == 1033 || $a == 1275 || $a == 227 || $a == 1034 || $a == 229 || $a == 1036 || $a == 230 || $a == 1037 || $a == 232 || $a == 1039 || $a == 233 || $a == 1040 || $a == 1276 || $a == 234 || $a == 1041 || $a == 235 || $a == 1042 || $a == 236 || $a == 1043 || $a == 237 || $a == 1044 || $a == 238 || $a == 1045 || $a == 239 || $a == 1046 || $a == 240 || $a == 1047 || $a == 242 || $a == 1049 || $a == 243 || $a == 1050 || $a == 244 || $a == 1051 || $a == 245 || $a == 1052 || $a == 246 || $a == 1053 || $a == 247 || $a == 1054 || $a == 248 || $a == 1055 || $a == 249 || $a == 1056 || $a == 250 || $a == 1057 || $a == 251 || $a == 1058 || $a == 252 || $a == 1059 || $a == 253 || $a == 1060 || $a == 254 || $a == 1061 || $a == 255 || $a == 1062 || $a == 256 || $a == 1063 || $a == 257 || $a == 1064 || $a == 258 ||
.... etc

so it does work, but again we have a lot of sub categories, so if we are able to pick which main category we can highlight instead of all of that, it would definitely be less load time and bloat within the code...

thanks!!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:29 PM.

   

 
X-Cart forums © 2001-2020