View Full Version : ThreeRandomGrandChildren
I'm trying to use the ThreeRandomGrandChildren feature of the root categories like in the standard client category tree. I'm not using the client software though and really don't understand how it works, especially with all the smarty code mixed in. I've coded my site from scratch using the API reference and can't understand why the ThreeRandomGrandChildren property of any category object I retrieve is always empty. Example code:
$cats = array(97);
$aCategoryParams = array('aCategoryIds'=>$cats);
$oCategories = $oClient->call('getCategory',$aCategoryParams);
$aCategories = $oCategories->getCategoryReturn;
print_r($aCategories);
Can any help me find the grand children? Ta.
Answered my own question here. The ThreeRandomGrandChildren field is only populated when fetched with getCategoryTree. Makes sense really. S'been a long day:o
The problem I have now is that the ThreeRandomGrandchildren I get are not so random. In fact, they never change.
When I run this code:
$oApiCategoryTree= new api_categoryTree();
$aCategoryTreeParams = array('iCategoryId'=>0, 'bIncludeDescendants'=>false, 'bIncludeEmptyCats'=>false);
$aCats= $oApiCategoryTree->getCategoryTree($oCategoryTreeParams);
print_r($aCats);
The results are always exactly the same. Has anyone that's written a category browser from scratch already come across this problem and found a solution?
Can anyone from SW offer any advice??
Still haven't figured this one out. Anyone from AW able to offer any help?
Confuscius
06-11-07, 18:49
Technical support appears not to be available here (except from other users!) - DigiWin message relaying service only - which is highly frustrating at times.
Paul
Thanks Paul.
Sorry to hear about your websites, saw the other thread too. I hope you get it sorted asap.
This is just a minor niggle, certainly not as important as other problems on this forum which is why I don't want to take up anyone's time. But I thought at least maybe a coder working on this stuff would might be able to chip in an answer here or there on their lunch break when there's an obvious solution. I realise the importance of not using up developers' time with technical support questions but a quick response now and again would be really useful.
Hi Steve,
A shame to hear you're still having problems with this. As you know i am not a PHP developer myself, so not much use to you in this instance. I can however see if one of our dev guys can take a peek for you.
Paul, you already have my direct contact details so please feel free to call/email me anytime during office hours. I've also included my direct contact details below too (just for you).
Kind Regards,
Adrian
SW Integration & Technical Support
Direct Tel: 020 8269 4010
Email: adrian.botelho@digitalwindow.com
www.digitalwindow.com
Hi Steve,
Just spoke with our dev team about this. I am told that this function was removed a while ago due to performance reasons. So in fact it is now 'ThreeGrandchildren' (without the random part!) It will however be removed in the next version (v.2).
Adrian
SW Integration & Technical Support
Email: adrian.botelho@digitalwindow.com
www.digitalwindow.com
Thanks Adrian. That would explain it!
What confused me is the fact that it seems to work fine on shopwindow.com.
Confuscius
07-11-07, 12:26
Adrian - If this is to be removed in v2 then are there any plans to replace it with, say, a collapsible menu system so that all main links are visible as you navigate? The current method really does cause search engine indexing inconsistencies.
Steve - the grandchildren are still random on my sites that display the whole structure so I cannot see that anything has changed - puzzled?
Example below:
*********************************
#
Books & Subscriptions
Adult Books
Books
Magazine Subscriptions
#
Clothing & Accessories
Nightwear
Bodies
Men's Swimwear
#
Computers & Software
Monitors
Modems
Laptop Bags
#
DVD & Video
Adult DVDs & Video
DVD Players
DVDs
#
Electronics
Combi TVs
Plasma TV
Projector Accessories
#
Gifts, Gadgets & Toys
Decorations
Action Figures
Baby Toys
#
Health & Beauty
Bodycare Appliances
Cosmetics
Glasses
HIT REFRESH below:
*********************************
#
Books & Subscriptions
Adult Books
Books
Magazine Subscriptions
#
Clothing & Accessories
Women's Underwear
Suspenders & Garters
Men's Sportswear
#
Computers & Software
Motherboards
Mice
Web Hosting
#
DVD & Video
Blu-Ray
DVD Players
DVDs
#
Electronics
CD Players
DJ Equipment
Portable MiniDisc
#
Gifts, Gadgets & Toys
Birthday Gifts
Other Occasions
Toy Models
#
Health & Beauty
Haircare Appliances
Glasses
Medical
So they are changing.
Paul
Very puzzled, but losing interest. I assumed Adrian meant that the function that returned ThreeRandomGrandChildren had been removed and replaced with something that returned three hard coded grandchildren. But since both your's and the shopwindow site display random grandchildren with every refresh I'm not sure at all now.
I think I'll ignore this one until V2. There are other category problems I have that have never been answered, like why 'Women's Swimwear' never appears in my category tree but does appear in parent category product listings. Can't figure that one out either.
Hi Steve,
Likewise i am also very puzzled by this as i was informed it wasn't the case?? Paul, thanks for your input with this. Hopefully i can get you some answers on this soon.
Apologies for the confusion guys.
Adrian
SW Integration & Technical Support
Email: adrian.botelho@digitalwindow.com
www.digitalwindow.com
... 'Women's Swimwear' never appears ...
Funny how you spotted that! :D
Funny how you spotted that! :D
I could try and claim that as my niche, but I'd be lying.
Paul Inman
08-11-07, 10:41
Hi all.
Hope this clears things up.
ThreeRandomGrandChildren aka ThreeGrandChildren:
The API server uses a cached layer for default calls to getCategorytree. If you start to ask for non-default (bIncludeCounts, sReplationship - check the client code for exact details) settings then the system can't use the caching layer because it holds non-affiliate specific data and you've then requested data specific to your affiliate account.
Missing the caching layer means hitting the db and the three random GC's caused a lot of overhead and proved un-scalable. This was noticed early on in it's life (8 months ago I think) so we turned off the randomisation.
Why it's not in v2:
The concept of 3 random GC's isn't something that should sit on the API server, the server should provide the raw data and the client then executes the logic required (The API gives you all GC's, PHP make them random and restricts to three).
All the best!
Paul
Thanks Paul, that definitely clears that up.
I'm probably going to cache the category structure on my own db then and write my own TRGC function before V2.
There are other category problems I have that have never been answered, like why 'Women's Swimwear' never appears in my category tree
Having looked at the category ID PDF document I'm guessing the reason Women's Swimwear doesn't appear in my category tree is because it's strangely categorised as adult, along with Women's Underwear but not Men's Underwear or Adult DVDs & Videos???
I'm blocking Adult Content so that probably explains that.
Confuscius
08-11-07, 11:06
I am really quite puzzled now! IF the randomisation has been turned off then why does Shop Window still produce what APPEARS to be 3 random results?
Paul