MyShortlist is a highly adaptable Joomla extension.

MyShortlist has been one of our top-selling extensions for years. What makes it so popular? Its high adaptability.

Being compatible with over 90 Joomla components, MyShortlist allows you to create wishlists, carts or favorites out of virtually anything in your Joomla website.

Using Custom Blocks, you may even define custom parts of your website as your own custom items to add into your lists!

Here are some useful tips that can make your site reach new heights by incorporating MyShortlist.

This article describes MyShortlist 3.0 and later, with its four modules (List, Button, Lists Dropdown and Heart Dropdown). If you still use the old, deprecated MyShortlist module, see the note at the end of the template overrides section.

 

Creating Template overrides

MyShortlist uses Joomla's standard template overrides. For an introduction in Template Overrides and how to create them, please read here.

The parts of MyShortlist that all modules share (the list, the buttons, the send form, the PDF and the items) are Joomla layouts, which live in components/com_myshortlist/layouts/, and you override them in templates/your-template/html/layouts/com_myshortlist/. Each module also has its own small view, which you override in templates/your-template/html/<module>/default.php, for example html/mod_myshortlist_list/default.php.

To customize MyShortlist items, you need to know which two-letter code your desired component is using. For an exhaustive list of two-letter codes, please read here.

When an item is shown, MyShortlist automatically picks the best layout for it, depending on the extension this item comes from. It looks for such layouts in the following locations:

templates/your-template/html/layouts/com_myshortlist/items/<two-letter-code>.php

components/com_myshortlist/layouts/items/<two-letter-code>.php

If neither is found, MyShortlist uses the items/default.php layout.

 

Example 1: When a custom layout already exists

A very common example is to customize Virtuemart items. A Virtuemart item saved in MyShortlist has the #vm# two-letter prefix. So, to customize it, you need to copy the already existing vm.php file from components/com_myshortlist/layouts/items/vm.php to templates/your-template/html/layouts/com_myshortlist/items/vm.php.

 

Example 2: When a custom layout doesn't exist

Let's say that you want to customize the layout of an item that doesn't have its own <two-letter-code>.php file in components/com_myshortlist/layouts/items/. If that's the case, you can simply copy components/com_myshortlist/layouts/items/default.php to templates/your-template/html/layouts/com_myshortlist/items/<two-letter-code>.php. Note that the target file name is not the same!

For example, if you want to create a template override for Joomla Contacts, you can simply copy default.php and rename it to jc.php according to its respective two-letter code. For more two-letter codes, see here.

 

Retrieving additional information about the item

That's the most tricky part. It all depends on the component you are trying to customize. Inside each item layout, you can use a variable called $item. This variable contains all the information you need to get started. Here's a var dump of this variable for a Virtuemart item.

Var Dump information about a saved Virtuemart item in MyShortlist

As you can see, the item object contains a property called aid (Article ID) of Myshortlist, which is the unique identifier for this specific item, as well as its own component's id, and the query with which it was loaded, to help you retrieve more information. Most usually, however, you should use the $item->object properties. Here's an example on how to do that, for Virtuemart:

$db = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
$vm_object = $db->setQuery('SELECT * FROM `#__virtuemart_products` a LEFT JOIN `#__virtuemart_products_en_gb` b ON a.`virtuemart_product_id` = b.`virtuemart_product_id` WHERE a.`virtuemart_product_id` = '.(int) $item->object->id)->loadObject();
var_dump($vm_object);

This would yield the following results:

Var Dump information of what can be loaded from the database using the Virtuemart item ID

From this point on, it's a matter of presenting the data you load from the database, using HTML and CSS.

If you need more advanced customizations, like adding an "Add to Cart" button for Virtuemart, we would happily implement that for you, so feel free to drop us a word.

Important: if you override any of the buttons (button.php, delbutton.php, actionbuttons.php) and their forms post without MyShortlist's script, keep Joomla's form token inside each form: <?php echo \Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>

Note: The old, deprecated MyShortlist module still uses its own paths, templates/your-template/html/mod_myshortlist/<two-letter-code>_item.php. These overrides are not picked up by the new modules. When you convert your modules, Components > MyShortlist > Toolkit lists your old overrides and shows where each one moves.

If you don't want to make large changes to the existing layouts, you can always use a few lines of custom CSS, to achieve your desired result.

 

Using the Custom CSS option

Each MyShortlist module includes a Custom CSS option, in which you can write your own CSS. To be able to style the module's elements, you can use CSS selectors.

 

CSS Selectors

CSS or Cascading Style Sheets allows us to style HTML according to our needs, based on so called selectors, which are parts of your HTML page, accompanied by certain symbols.

Here are some useful CSS selectors for MyShortlist:

CSS Selectors per Module
.msl-wrapper Class of the container around the full module
.myshortlist.add_button Selector of the Add to Favorites button
.myshortlist.clearbutton button Selector of the Clear List button
.myshortlist.pagebutton a Selector of the View List link
.myshortlist.sendbutton input Selector of the Send List button
.myshortlist.pdfbutton_wrapper button Selector of the Download PDF button
   
CSS Selectors per Saved Item
.myshortlist_item Class of each saved item
.myshortlist_item_image Class of the image container
.myshortlist_item_image img Selector of the actual image
.myshortlist_item_left Class of the text container of each item
.myshortlist_item_title Class of the title container
.myshortlist_item_title a Selector of the actual title link
.myshortlist.article_category Selector of the item's category
.myshortlist.delete_button Selector of the Delete button of each item
.msl_variable_inputs Class of the Item Variable inputs' container of each item


Below are some examples of what you can achieve with MyShortlist and just a few lines of custom CSS.

Variations of MyShortlist using CSS

 

Full Image example

In the image above, you can see that we have a full image example. To achieve that result, you can just add the following line of CSS in your module's Custom CSS option.

.myshortlist_item_image { float: none; width: auto; margin: 5px 0; }

Easy, right?

 

Only Image, Floating Delete button example

This one's a little trickier. Here's what you need to write in your Custom CSS to achieve that.

.myshortlist_item_image { float: none; width: auto; margin: 5px 0; }
.myshortlist_item { position: relative; }
.myshortlist_item_left { display: none; }
.myshortlist_item_right { position: absolute; top: -8px; right: -8px; }
.myshortlist.delete_button { padding: 3px 5px; }

That's it!

 

There are many things you could do to customize MyShortlist exactly as you want it. Here are some other examples:

.myshortlist.delete_button { font-size: 10px; padding: 0 5px }
Smaller delete button
.myshortlist_item_title a { font-weight: bold; font-size: 15px; }
Larger bold titles
.myshortlist.article_category { display: none; }
No category text
.myshortlist_item { position: relative; }
.myshortlist_item_image {
position: absolute; float: none; width: auto; display: none;
top: 1.2em; padding: 1em; border: 1px solid #999; background: #f9f9f9; z-index: 1000;
}
.myshortlist_item:hover .myshortlist_item_image { display: block; }
Image as popup on hover

 

Multiple Modules per Page

What happens if you have multiple MyShortlist modules in one page and want to style them all separately?

Each MyShortlist container has its own ID, based on the module ID, like this: myshortlist_div_<module-id>.

So, if you want to customize only one instance of the module, you can simply include the container ID, like so:

#myshortlist_div_121 .myshortlist.delete_button { /* This CSS only affects the Delete button of Module with ID 121 */ }

 

Further reading

One of MyShortlist's most amazing features, is the ability to define custom blocks out of virtually anything in your page.
Find out how to do that, by reading our help article titled Explaining the Custom Blocks functionality of MyShortlist.

Ask me!