Joomla / Virtuemart weight and postage configuration
We recently launched aa Joomla-Virtuemart-based e-commerce website selling fireplaces for one of our clients and we stumbled upon an unusual aspect of Virtuemart that we hadn't anticipated. (Joomla 1.0.14 and Virtuemart 1.0.14). First, a little background...
We needed to set up the delivery so that small items were cheap to deliver (for example, small bits of fireplace trim etc.) and large bits were more expensive (for example, huge granite hearths!). Obviously if someone needed both a big lump of granite and a small piece of trim this would put it in the upper price bracket for delivery. The obvious solution was to configure shipping based on the weight of the order; "light goods" or "heavy goods".
Now, when you configure the shipping based on weight it does not specify which units of measurement it would prefer - it simply asks for a number, so we selected 50... whether this was kilogrammes, pounds or bananas we didn't think it mattered. Conversely, when you configure your products you can enter a weight and a unit of measurement, however the unit of measurement is typed into a text field as opposed to selecting it from a menu. Therefore you could literally choose a unit of bananas if you wanted to (we haven't tried this!). We didn't know the exact weights of all the items so we used arbitrary figures which should dump the product into a particular category.
However, in the fullness of time, what we thought was a small 'bug' of Virtuemart came to our attention. One or two large fireplaces were falling into the "light goods" category and hence not enough delivery was being charged.
Due to the amount of time and number of people administering the website there was an inconsistency in the units used - some products used kg, others pounds, some had no units at all.
We chased down the issue and discovered that the handful of items with incorrect delivery charges were set up at around 100lbs weight and, after after jabing at a calculator for a moment, we discovered that...
Virtuemart automatically converts units of weight!
...so an item at 100lbs actually has a weight of about 45kg... not enough to tip it into the "over 50 somethings" shipping weight category. Setting the weight to 110lbs still didn't tip it but 111lbs did (50kg is about 110.2lbs). Also setting the unit to kg (and leaving the weight at 100) tipped it into the heavy goods category also.
Obviously we ran a quick query on the database and converted all weights to kilogrammes for consistency and that has solved the problem, and hopefully if you find this page this will save you a little time and effort too.
We are not yet sure whether it can convert from bananas to kilgrammes though.




























