Nik Grey Posted January 8, 2014 Share Posted January 8, 2014 Using the Mican skin. I want to add a link in the navigation menu on the left hand side which points to this tool Here. but either I am using the wrong search terms or there is very little to give me any clues. I have tried adding new categories/products etc but still no way of pointing a menu item to the page which contains my tool I suppose we are going to be editing files ? how would I go about this hopefully simple task ? Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 8, 2014 Share Posted January 8, 2014 Would you like to use a snippet (a small piece of PHP that modifies the results of CubeCart core code and survives upgrades), or a hard edit on the skin? If a hard edit on the skin, in the skin template file box.navigation.php, find: <li><a href="{$STORE_URL}/index.php" title="{$LANG.navigation.homepage}">{$LANG.navigation.homepage}</a></li> {$NAVIGATION_TREE} {if $CTRL_CERTIFICATES && !$CATALOGUE_MODE} Between the second and third line shown, add: <li><a href="{$STORE_URL}/index.php?_a=letter" title="Lettering Tool">Lettering Tool</a></li> Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 8, 2014 Author Share Posted January 8, 2014 Anything that survives upgrades please.. I couldn't imagine going through all of this every time we get an upgrade Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 8, 2014 Share Posted January 8, 2014 On the other hand, you can make a copy of the Mican skin, call it Mican_Nik (with two edits in the config.xml file), and this new skin won't be overwrote on an upgrade. But then you will need to make any upgrades to this new skin manually. So, we will do a snippet. In admin, Manage Hooks, Code Snippets tab: Enabled: green tick Unique ID: Lettering_Tool_on_Nav@Nik_Grey Execution Order: 99 Description: Adds a link to my Lettering Tool page on the Shop by Category Navigation List. Trigger: class.gui.display_navigation.pre_cache Version: 1.0 Author: forums.cubecart.com/topic/48070-linking-to-a-tool-in-nav-menu/ PHP Code: {php} $lettering_tool_branch = array('url' => $GLOBALS['storeURL']."/index.php?_a=letter", 'name' => "Lettering Tool"); $GLOBALS['smarty']->assign('BRANCH', $lettering_tool_branch); $navigation_tree .= $GLOBALS['smarty']->fetch('templates/element.navigation_tree.php'); $GLOBALS['smarty']->assign('NAVIGATION_TREE', $navigation_tree); {/php} In CubeCart admin, Maintenance, Rebuild tab, clear your cache because this navigation list is cached, and the current cached list does not have the link that this snippet adds. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 8, 2014 Author Share Posted January 8, 2014 Excellent, it's working and I was even able to rename it http://www.greyprint.co.uk/ The only problem now is from that 'Tool' page there is no 'Homepage' link and I am sure people will get stuck - also is there a way I can get rid of the boxes on the right, so the tool can fill that area completely ? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 8, 2014 Share Posted January 8, 2014 The tiny Breadcrumb Home is available there - so maybe you could use HOME, instead, so it's more prominent? But shouldn't the Tool itself show up in the Breadcrumb? Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 8, 2014 Share Posted January 8, 2014 "There is no 'Homepage' link. Is there a way I can get rid of the boxes on the right?" Apparently, some javascript is causing the sidebar_left column to disappear. The same could be done for the sidebar_right column. In the file, /modules/external/lettering/js/front.js, after: $("#sidebar_left").remove(); add: $("#sidebar_right").remove(); The "Home" breadcrumb is still there. Also, (but then, if it works for you...) the Tool page HTML is calling jQuery 1.8.2, and the core CubeCart calls jQuery 1.7. I mention again, I have no knowledge as to the consequences of calling two versions of the jQuery code. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 8, 2014 Share Posted January 8, 2014 Adding the statement above to the javascript file will still require some CSS adjustments. In the file /modules/external/lettering/css/letter.css, line 157, #designform is width:1068px; and line 160, #text is width:1068px; Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 8, 2014 Share Posted January 8, 2014 Just a PS - have you considered what you will do about the Mobile skin? The tool page is not responsive, as is, as near as I can tell. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 8, 2014 Author Share Posted January 8, 2014 Just got home, I present/represent Hospital Radio here in Norwich and had to go and accept a cheque from our local Amateur Radio club - it was a big occasion and took longer than expected.. as we are a charity I do a few things in the fundraising department. I will try the code above Brian so thanks for that. DB The Mobile Skin may have to be disabled as I think its going to be more trouble than its worth at the moment as there's no way the tools will work with it - the Upload Tool cropping wont work on touch screens and I hadnt even checked the Lettering tool. I would be happy with Breadcrumbs but I cant even see them ! I can see them, was looking in the wrong place (I am used to Joomla) I am using Firefox on OSX 10.9.1 ok, that worked - it removed the sidebar on the right but its just a blank space now as may as well have the sidebar back unless there is a way of making that tool bigger without too much messing about (I doubt it though). Also I just noticed Brians 2nd comment.. will try now. You see - if you follow instruction things do work Outstanding: http://greyprint.co.uk/index.php?_a=letter Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 9, 2014 Author Share Posted January 9, 2014 Is there any way I can add some explanation text under this tool now ? I will need to explain how to use it and maybe link to some other pages - a 'Vinyl Application Guide' for example. Really what I am saying is I would like to edit the page ! Oh no, its broken again, nothing is being added to the cart Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 9, 2014 Author Share Posted January 9, 2014 ok - sussed it I must have a 'Lettering' category enabled for this to work - if I disable it then nothing is sent to the cart. So... how can I hide this 'Lettering' category from the menu but still keep it active ? Your a Legend Brian. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2014 Share Posted January 9, 2014 How can I hide this 'Lettering' category from the menu but still keep it active? I won't try to guess why having a 'Lettering' category is a requirement. But I see what appears to be tool submissions as products in the category. So the tool must first be creating a new inventory item, then assigning it to the 'Lettering' category. Then it adds the newly created inventory item to the shopping basket. (It would be kind of neat to have a set of "products" in the 'Lettering' category already in inventory: famous quotes, taglines, etc.) (Umm.. You are making vinyl signs/posters. So why would anyone want such a thing with a quote/tagline?) Have you tried making the 'Lettering' category invisible (it will still be enabled -- status=1)? Admin, Categories, click to make the red x in the Visible column. If that affects how the Lettering Tool functions, then we will need to find another solution. Really what I am saying is I would like to edit the page! You can issue a "change order" to the developers and require the project to include a method in admin to put custom content in the newly opened up area on the right third of the lettering tool screen. You will say it's for more fuller explanatory text (maybe in several languages) that CSS tricks allow when hovering over the tool's selectors (instead of 'tooltips'). For example, you might create the text block that shows the color chart here instead of a separate page. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 9, 2014 Author Share Posted January 9, 2014 Thanks Brian, I have paid the developer for this now, I am just glad its over with them. it would probably take months to get the revisions I want and I am due for a less stressful time. I tried the 'Status' option - turning it from the tick to the cross but then nothing is added to my cart from the tool, it took me a while to figure that out - I have been trying different stages of the instructions you gave above to see which bit was causing it to fail.. then in a last attempt tried enabling that category again. If you go to the category I want to hide, there is sort of an explanation at the top "Separate Category to Maintain Products Created for Lettering Purpose from Front End." but of course there is no need to show what others have purchased - some may not like to see that made public at all as you can imagine. I think I am going to have to find a way to put a page in between the link on the homepage and the tool so I can explain how it works - that's the only way I can see at the moment. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2014 Share Posted January 9, 2014 "I tried the 'Status' option" No, not the Status property. The Status property is shown when adding/editing an individual category. When you see the entire list of categories, there is (or should be) a Visible column. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 9, 2014 Author Share Posted January 9, 2014 I didnt even see that until I was preparing a screenshot.. ok, thats now been turned off and it's not visible now. BUT... guess what ? items are not being added to the basket Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2014 Share Posted January 9, 2014 I have no answer for that. I am not recalling anything in the CubeCart code that would disallow adding a product to the cart based on the Visibility (or Status, for that matter) of any category. Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted January 9, 2014 Share Posted January 9, 2014 When calling the add method in cart, it called catalogue -> getProductData, which does return false if the category is disabled, so yeah, as it currently stands, you can't order products if the category is turned off. You could turn that off by editting classes/catalogue.class.php Finding: if (!$category_status) { return false; } And just changing to if (!$category_status) { # return false; } Not sure if that's makeable as a snippet, still require the standard hooks don't they? Don't see any suitable on those locations that would get round it Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 9, 2014 Share Posted January 9, 2014 Disabling a category and hiding the category aren't the same thing, as I understand it. Are you sure, Nik, that you only HID it, not disabled it? - Maybe clear caches, including browser, and try again? Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2014 Share Posted January 9, 2014 I have recently discovered that the Visible column in the admin list of categories is actually the Status. I find no code in CC525 that reads from or writes to the 'hide' column of the CC_category table. So, there is no hiding a category. I will add to the existing snippet that will look for the string of code that has the 'Lettering' category and remove it. I'll get to this shortly. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 9, 2014 Share Posted January 9, 2014 Well, I was thinking I had done this successfully with categories, so I checked. I AM able to hide a category - as a test I was able to hide the Clearance category on plushcatalog. But, unlike a hidden document, I could NOT use the actual url for the clearance category to access it. So there is a difference between a hidden category, which is in effect disabled, and a hidden document, which is still accessible. Documents have an extra field in the table called doc_url_openin that controls the hidden feature. It would seem logical that this is a bug in CC, as why otherwise hide a category when you have done the same thing as disable it? Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 9, 2014 Share Posted January 9, 2014 In the snippet, change the PHP code to this: {php} $lettering_tool_branch = array('url' => $GLOBALS['storeURL']."/index.php?_a=letter", 'name' => "Lettering Tool"); $GLOBALS['smarty']->assign('BRANCH', $lettering_tool_branch); $navigation_tree .= $GLOBALS['smarty']->fetch('templates/element.navigation_tree.php'); $navigation_tree = preg_replace('#<li>.*title="Lettering".*</li>#s','',$navigation_tree); $GLOBALS['smarty']->assign('NAVIGATION_TREE', $navigation_tree); {/php} The new line is a preg_replace that looks for a <li> tag, followed by anything but eventually must contain the title="Lettering" sequence, followed by anything, ending with a </li> tag. If found, the function will replace the match with nothing. This only affects the Navigation List (Shop by Category). That is, a site map will still be listed, for example. We also need to deal with these "products" showing up in the Featured Product and Popular Products boxes. "Cart->add() calls Catalogue->getProductData(), which does return false if the category is disabled." I stand corrected. Quote Link to comment Share on other sites More sharing options...
convict Posted January 10, 2014 Share Posted January 10, 2014 Well, I was thinking I had done this successfully with categories, so I checked. I AM able to hide a category - as a test I was able to hide the Clearance category on plushcatalog. But, unlike a hidden document, I could NOT use the actual url for the clearance category to access it. So there is a difference between a hidden category, which is in effect disabled, and a hidden document, which is still accessible. Documents have an extra field in the table called doc_url_openin that controls the hidden feature. It would seem logical that this is a bug in CC, as why otherwise hide a category when you have done the same thing as disable it? Hidden category status is set to 0 - disabled. No other way to hide a category. When category is disabled it can't be accessed nor any product from such a category purchased. Documents have the hide link feature category does not at this time. When a document is disabled it can't be even viewed this acts as the same as disabled category. However document link can be hidden using "Show link to document in storefront?" setting but document must be enabled to access its content via direct URL. Custom doc URL even doc_url_openin as you already mentioned has nothing common to hide doc link. Well there is a category table column using name 'hide' but used almost nowhere apart from searchCatalogue() method of catalogue class but seems as an early v5 development result only. May be a new feature as the same as document has to hide link to a category from Shop By Category box. This however also removes such a category subcategories from list. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted January 10, 2014 Author Share Posted January 10, 2014 Sorry for the delay in my response, and trying the suggested edits. Thursdays is my Hospital Radio Show day so am not usually around much on that day as there is a lot of preparation to do (patients to visit). Many thanks for your continued support - I only wish I had the money to throw at this in order to get it as I expected it to be I tried both Brian's edit and then Jonathan's but unfortunately Brians removed my other products aswell. adding the hash to the file mentioned didnt seem to do anything. WI was clearing my Cache each time (got used to doing that when making any change). Quote Link to comment Share on other sites More sharing options...
Toucan Web Design Posted January 10, 2014 Share Posted January 10, 2014 Hmm, that's weird.. my change should let it add a product despite the category being disabled, can't see any other error it would cause getting the product data. It's not something else, like it missing a required option and throwing an error due to that perhaps? That's one of the few other checks it makes while trying to add something to the basket. There's some code which checks if it's out of stock or such, but that should still add it, though it'll cause a redirect to the basket which will usually then remove it and give you a warning message (or allow it, if you've got your settings to allow out of stock purchases) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.