♥kymation Posted December 8, 2010 Share Posted December 8, 2010 The biggest challenge most people seem to have with using 2.2 Addons in a 2.3 store is the boxes. The new modular boxes look completely different than the old 2.2 boxes. However, all of the critical elements are there in both designs, so it's not all that hard to convert. You just need to learn how to spot the important parts. First, let's look at typical instructions from a 2.2 Addon. The following example is shamelessly copied from Jack's excellent EasyMap addon (which already has the instructions for 2.3 and doesn't need this guide.) -----------------------------------------------------------------------3) In includes/boxes/information.php REPLACE '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>'); with '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' . '<a href="' . tep_href_link(FILENAME_EASYMAP) . '">' . BOX_INFORMATION_EASYMAP . '</a>'); ----------------------------------------------------------------------- Now that talks about replacing code, but if you compare the original part with the replaced code, you'll see that it's really just adding some code. I'll highlight that here, with green for the existing and red for the new code: '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .'<a href="' . tep_href_link(FILENAME_EASYMAP) . '">' . BOX_INFORMATION_EASYMAP . '</a>'); Pay close attention to the part in red, as that's what we need to add to the new Information box. There are two important elements in there: the filename and the text that shows the link in the box. The filename is this part: FILENAME_EASYMAP. Note that the first part is FILENAME and is in all caps. That's how you know that it's a filename. If you look in catalog/includes/filenames.php you'll find a big list of these. Also note that our example Addon, EasyMap, adds a new definition to this file for FILENAME_EASYMAP. The Addon that you want to install should do something similar. The next part that we need to look at is also in all caps: BOX_INFORMATION_EASYMAP. This is the part that defines the text. It will have a separate definition for each language in your shop. For example, look in catalog/includes/languages/english.php. You'll see that our example adds a definition for BOX_INFORMATION_EASYMAP in that file. These also have a similar structure to the filenames: The BOX part says that it's part of a box, and the INFORMATION part says that it's part of the Information box. Now it's time to do something with the information that we've gathered. Let's take a look at the code in the new box at catalog/includes/modules/boxes/bm_information.php. Yes, there's a lot of it, but there is only a small part of that that we need to be concerned with: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_INFORMATION_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' <a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . MODULE_BOXES_INFORMATION_BOX_SHIPPING . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . MODULE_BOXES_INFORMATION_BOX_PRIVACY . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . MODULE_BOXES_INFORMATION_BOX_CONDITIONS . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a>' . ' </div>' . '</div>'; There should be some things in there that are starting to look familiar. Yes, it's a list of filename and text constants. Let's look at one of those. ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a>' . In this line, FILENAME_CONTACT_US is the Contact Us file, and MODULE_BOXES_INFORMATION_BOX_CONTACT is the text. The structure of the text constant is a bit different than what we saw in 2.2 -- it has MODULE at the beginning because the new boxes are modules. This isn't really important, as the old way of writing the constants will still work. The only thing that matters is that the exact same constant appears in your language file. There's one other little difference that you need to pay attention to: Every line except the last has a <br /> near the end. This is what puts the links on separate lines in the box. so, if we are going to add a new line after this one we need to add that to the end of the line, like so: ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a><br />' . Note that it is still inside the single quotes. It's important to keep those quote marks in the same place. Messing those up will get you all sorts of nasty error messages and confusion. Leave them alone and you'll be fine. We still need to add a new link to the bottom of the list. To keep from messing up those pesky single quotes, just copy the existing last line and paste it in again below the original. Remember that the last line doesn't need that <br /> near the end. So now our file looks like this: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_INFORMATION_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' <a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . MODULE_BOXES_INFORMATION_BOX_SHIPPING . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . MODULE_BOXES_INFORMATION_BOX_PRIVACY . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . MODULE_BOXES_INFORMATION_BOX_CONDITIONS . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a>' . ' </div>' . '</div>'; Now the only thing we need to do is make that last line work as our link to our new file. Remember those Filename and text constants that we found in the first part? Just replace the ones in the new last line above with the ones we got from our Addon instructions. Now our code looks like this: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_INFORMATION_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' <a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . MODULE_BOXES_INFORMATION_BOX_SHIPPING . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . MODULE_BOXES_INFORMATION_BOX_PRIVACY . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . MODULE_BOXES_INFORMATION_BOX_CONDITIONS . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . MODULE_BOXES_INFORMATION_BOX_CONTACT . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_EASYMAP) . '">' . BOX_INFORMATION_EASYMAP . '</a>' . ' </div>' . '</div>'; Yes, the lines in the 2.3 box are very similar to the lines in the 2.2 box. I've shown you how they are put together so that you can understand the elements and not just blindly copy lines. You're less likely to make mistakes if you know what you're doing. That's it; you're done. Now the test: Go apply this knowledge to the Addons that you want to use. Please keep any discussion here related to this Tip. I'm perfectly willing to answer questions if you're unclear about something I've said above, but I won't go off-topic. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
axioma Posted December 13, 2010 Share Posted December 13, 2010 GUAUUU NICE! Link to comment Share on other sites More sharing options...
starapple Posted March 5, 2011 Share Posted March 5, 2011 Great info Jim. Worked fine. Now any advice on making an includes/modules/boxes/bm_file.php file? from an includes/boxes/box/file.php? Mark. All the Web's a stage. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.