Blog - Joomla Tips, Code, and News

Embed a Gift Certificate in Email with Virtuemart and Joomla

By default, our Gift Certificate software for VM 2 includes an email template with an embedded gift certificate.  However, you may need to change the design, specs, or otherwise modify the image dimensions to your liking.  Follow this tutorial to find out how to properly embed an image background in an email.

Set a default country in Virtuemart 2 user registration / cart

For most Virtuemart shops, you will be primarily operating within a single country, and thus would like users to be able to quickly select your home country while checking out.  Users should not have to pour through a list of hundreds of countries.

Instead, it is better to have your default home country selected at the start, also so that the 'State' field is pre-populated with the correct values.  Insert the code below into administrator/components/com_virtuemart/helpers/shopfunctions.php, around like 262.  Right before return JHTML::_('select.genericlist', $countries, $idA, $attrs, $id, $name, $countryId);.  This function might vary depending upon your version of Virtuemart 2, but it is the last line of the function.  Also, just add the single line ABOVE our comment below, the second line is just there to show you where it will sit. It will look like the below (or close), when you are done. 223 is the country ID for the United States, replace this number with the ID of the country you wish to have pre-populated.

if($countryId == 0){$countryId = 223;}
//OS Ignite - If no country selected, then select US by default
return JHTML::_('select.genericlist', $countries, $idA, $attrs, $id, $name, $countryId);

 

Manual Product Ordering in Virtuemart 2 / VM2

Using manual category and product ordering in Virtuemart 2 allows you to completely control how your products will display, valuable for small stores with not as many products or filters.  The problem is that VM 2 does not have the correct code to enable manual ordering in all cases.

In particular, there is a bug in many versions (anything below VM 2.014) which only allows ordering to happen for products in a single category.  Many times, you will have products assigned to multiple categories, and then the VM 2 ordering does not work.  The hack / fix below will solve this problem for you.

// OS Ignite Hack to make ordering work in ALL associated product categories
$q = 'SELECT `virtuemart_product_id` FROM `#__virtuemart_product_categories` WHERE `id`=' . (int)$key ;
$this->_db->setQuery ($q);
$catproductlist = $this->_db->loadObjectList();
foreach($catproductlist as $catproduct) {
$this->_db->setQuery ('UPDATE `#__virtuemart_product_categories` SET `ordering` = ' . $i . ' WHERE `virtuemart_product_id` = ' . (int)$catproduct->virtuemart_product_id . ' ');
            if (!$this->_db->query ()) {
                vmError ($this->_db->getErrorMsg ());
                return FALSE;
            }
}


You will insert this code in your product model at administrator/components/com_virtuemart/models/product.php around line 1310.

It goes right below the line which is inserting the first ordering record, so paste it directly below this code.

if (!$this->_db->query ()) {
                vmError ($this->_db->getErrorMsg ());
                return FALSE;
            }

Make sure to set the 'Product Ordering' to 'Ordering' in the default Virtuemart 2 configuration, as well, to complete the effect.  Now your products will follow the same manual ordering field no matter which category they are displayed on, as originally intended.

Security & SSL

We take data security very seriously. Thus, your information is encrypted by a bank-grade, 256-bit SSL certificate during all secure transactions performed on our website.

Find Us

OS Ignite, Inc.
3420 Bristol St, Fl 6
Costa Mesa, CA 92626