leelee23 Posted August 29, 2010 Share Posted August 29, 2010 Hi there,I'm currently trying to customise a link for 'Specials' only to be displayed if there are actually items within the catalog containing a discounted item. Was hoping there'd be some simple coding to do this check - but having scoured the files I haven't really noticed anything!Any help would be greatly appreciated!Cheers Link to comment Share on other sites More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 To display a Specials link only when specials exist, you could put the following in the PHP file: $special = Product::getRandomSpecial(intval($params['cookie']->id_lang)); then the following in the TPL file: {if $special}<a href="{$base_dir}prices-drop.php">{l s='Specials'}{/if} Link to comment Share on other sites More sharing options...
leelee23 Posted August 30, 2010 Author Share Posted August 30, 2010 Hi rocky,Thanks for the reply. I've just tried it out (basically this is within a horizontal navigation bar) but when doing it in the .php and .tpl as suggested the link is removed even when there is items with the specials section. Any further suggestions on this?I also tried moving the first bit of code into the header to see if it was a problem with that specific bit of coding - but to no prevail!Thanks Link to comment Share on other sites More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 Perhaps $param['cookie'] doesn't exist in that module. Try the following instead: $special = Product::getRandomSpecial(intval($cookie->id_lang)); Link to comment Share on other sites More sharing options...
leelee23 Posted August 30, 2010 Author Share Posted August 30, 2010 Hi rocky, thanks again for the help! Sadly, this didn't work either - any further suggestions? lol Link to comment Share on other sites More sharing options...
rocky Posted August 31, 2010 Share Posted August 31, 2010 Make sure that $cookie is defined as a global variable. At the top of the function where you are adding the code, there should be a line like this: global $cookie; Link to comment Share on other sites More sharing options...
leelee23 Posted August 31, 2010 Author Share Posted August 31, 2010 Sorry about this rocky, but again for some reason it's not working (I really do appreciate your help and assistance by the way!!!)You're right, the global $cookie; was missing but even inserting it (and trying all of the combinations of the $special didn't do the trick! It's pretty frustrating as I can see it's obviously working with the blockspecials - as that can be hidden using technique. Therefore I took a look at what blockspecial.php was doing and I was suprised to see there was no mention of the global $cookie; in there either!Any further thoughts/suggestions with this?Thanks again Link to comment Share on other sites More sharing options...
rocky Posted August 31, 2010 Share Posted August 31, 2010 That's because the specials block uses $params['cookie'], which your menu module doesn't provide. It is hard to help without actually having the menu module to play around with. Link to comment Share on other sites More sharing options...
leelee23 Posted September 1, 2010 Author Share Posted September 1, 2010 That's understandable... I've zipped the module up and attached it. If you get a chance to take a look, that'd be amazing!Cheers categoriesbar.zip Link to comment Share on other sites More sharing options...
rocky Posted September 2, 2010 Share Posted September 2, 2010 Here's the updated code. I added the $params['cookie'] code above and it seems to be working fine. categoriesbar.zip Link to comment Share on other sites More sharing options...
leelee23 Posted September 4, 2010 Author Share Posted September 4, 2010 Oh dear, that's embaressing from me - I think I don't think I'd put it in the function... D'OH! Thanks a lot though rocky, really appreciate this and all the other fantastic help you give on this forum. Keep up the good work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now