Virtuemart, why do you hate us? Does it ever serve a purpose to show customers meaningless product ID numbers; no it doesn't. Here's how to remove them.


In this example we are working with Virtuemart Image Search plugin from CrazyTemplate.com: http://crazytemplate.com/extensions/view_document/5-virtuemart-2-0-x-image-search-plugin.html on Joomla! 3.7.3 Stable.

You'll want to open up the virtuemartimagesearch.php file located in the /plugins/search folder after installation and jump down to approximately line 275 and look for something like:

$query = "SELECT DISTINCT CONCAT( a.product_name,' (',p.product_sku,')' ) AS title

We'll need to remove the ,' (',p.product_sku,')' ) from the CONCAT query so it reads:

SELECT DISTINCT CONCAT( a.product_name AS title, ...

Other search plugins follow a similar pattern though the default may be _id rather than _sku dependent upon publisher version and Joomla version.

Upon updating from Joomla 3.6.x we discovered that the sku's were appearing again in our live ajax results so we dug into the file located at /plugins/search/virtuemart/virtuemart.php. It follows a very similar pattern to the aforementioned and modified virtuemartimagesearch.php file. Line #182 included the p.product_sku concat and all it took was to remove it in the same pattern as above. The php should like this:

CONCAT( a.product_name ) AS title,

Grip Fast Information Services & Technology exists to share knowledge and give back to the IT community and enthusiastic laypersons. We are always looking for new projects and solving unique challenges for our prospective customers. Please contact us to begin your next big thing...


About the Writer
Chris Lessley
Author: Chris Lessley
A server admin, dev ops warrior and website designer since 2002, Chris is a lover of all things Linux and open-source! Each blog topic has been tested by fire in the real world and shared with the hope to help others. Need more help? Hire me! Chris' other interests include fine art and the humanities in the classical tradition and can be found writing for our friends over at gripfastart.works. If you like this content, kindly consider donating to keep this website free to all, without ads.

Comments powered by CComment

Member of The Internet Defense LeagueOpen Source Initiative