Computing has never been static and it is clear the numerous options Cloud Computing bring to the table are just starting to be understood. It is also clear there are more decisions than ever before, and we shouldn’t be drunk on the cloud. There are many things the cloud doesn’t do but equally it has rightly changed the way we think about scale.
How do you choose? You need trusted help, and this is a role SRI has filled for many companies. SRI- Service, Reliability, Integrity- this is what you need when you get recommendations on hosting. SRI has been a provider that uses multiple 3rd party cloud systems, and has also been running a blend of VPS and physical servers since 2005, so we can stand behind our recommendations.
UPDATE: 2012/09/17 The development team at VirtueMart just committed our patch for this problem. So the fix below works perfectly, and when you upgrade to VirtueMart 2.0.12 it will be applied for you as part of the upgrade.
As we setup Virtuemart 2 for one of our clients they requested tax only be applied to customers purchasing in Idaho. The configuration in Virtuemart 2 under “Products” > “Tax and Calculation Rules” seemed simple enough but there was a problem. Currently if you are checking out and have not yet chosen a state (or are from a country without States/Provinces) all of the state specific tax rules will be applied to your order.
After digging around a little we found the problem. There is a function, “testRulePartEffecting,” that tests to see if a calculation rule should be applied, the problem with this function is it returns true if you pass it an empty variable. To put into simple terms if you don’t select a state all state specific taxes will be applied. Since we didn’t want to change this function and possible break another part of virtuemart we found a solution to fix the tax issue without breaking anything else.
When Virtuemart makes the comparison we simply need to make sure the state must equal something. In administrator/components/com_virtuemart/helpers/calculationh.php around line 191 change:
if (!empty($this->_cart->ST['virtuemart_country_id'])) {
$this->_deliveryCountry = $this->_cart->ST['virtuemart_country_id'];
} else if (!empty($this->_cart->BT['virtuemart_country_id'])) {
$this->_deliveryCountry = $this->_cart->BT['virtuemart_country_id'];
}
if (!empty($this->_cart->ST['virtuemart_state_id'])) {
$this->_deliveryState = $this->_cart->ST['virtuemart_state_id'];
} else if (!empty($cart->BT['virtuemart_state_id'])) {
$this->_deliveryState = $this->_cart->BT['virtuemart_state_id'];
}
TO:
if (!empty($this->_cart->ST['virtuemart_country_id'])) {
$this->_deliveryCountry = (int)$this->_cart->ST['virtuemart_country_id'];
} else if (!empty($this->_cart->BT['virtuemart_country_id'])) {
$this->_deliveryCountry = (int)$this->_cart->BT['virtuemart_country_id'];
}
if (!empty($this->_cart->ST['virtuemart_state_id'])) {
$this->_deliveryState = (int)$this->_cart->ST['virtuemart_state_id'];
} else if (!empty($cart->BT['virtuemart_state_id'])) {
$this->_deliveryState = (int)$this->_cart->BT['virtuemart_state_id'];
}
As always this code sample comes without any guarantee but we would love to help you implement it if you are not confident. (209) 257-1706 x3
Checkout our other Virtuemart posts here
As we upgraded a Virtuemart 2 site for one of our clients, we realized the state field in the front end user editor is not required. This is especially a problem for US sites where the state field is used to choose which sales tax to apply.
While attempting to save your address without a state will trigger a small popup, users found the address will still save successfully, allowing you to checkout without a state. And then inaccurately applying sales tax rules.
There is good news however. There is already a validation tool in place in Virtuemart the solution was just a few simple lines of javascript apply the required class when state options exist. Score one for Open Source software!
Insert the following code right before the body close tag (anywhere after jquery/virtuemart is included should be acceptable)
/* the following function checks whether the state should be required and either applies or removes the required class */
function requireState() {
if(jQuery("select#virtuemart_state_id optgroup option").length < 2) {
jQuery("select#virtuemart_state_id").removeClass('required invalid') /* if there are no state options also remove the invalid class in case the user has changed the country */
} else {
jQuery("select#virtuemart_state_id").addClass('required')
}
}
jQuery(document).ready(function(){
setTimeout(requireState, 500) /* after the page has loaded wait .5 seconds before applying the fix so virtuemart will finish adding in the states */
jQuery("select#virtuemart_state_id, select#virtuemart_country_id").change(function() { /* if user changes state our country field reconsider if state should be required */
requireState();
});
});
If you would rather include it as a javascript file you can download the fix here.
While upgrading a site from VirtueMart 1.1 to VirtueMart 2, we found a handful of product descriptions cut off at about 1500 characters. Upon looking at the database schema, we realized the column had been changed from a text field to a varchar. In this case the varchar had a limited number of characters, a number large enough for most deployments, however in our case it was not optimal.
After a quick alter, VirtueMart now behaves as we want. Use the following SQL at your own risk.**
alter table f6boa_virtuemart_products_en_gb change column product_desc product_desc TEXT NOT NULL;
If this is not clear, our team would be happy to help you with your project! Please call us at 209 257 1706 x3 or email us using our contact form.
** WARNING: We expect the reason for this change was for performance and/or the size of the database, but we did not look in to this. Feedback on why it was changed is welcome, you can call or use the contact form on our page to let us know.
As we were setting up Virtuemart 2 for one of our clients we ran into a problem. When adding products to the cart there was no popup to alert us we had added items and the cart module wasn’t updated until the page reloaded.
It seemed like a JavaScript issue, so we went straight to the error console. From there depending on which browser we looked at, we saw 2 different error messages.
Uncaught TypeError: Cannot read property ’settings’ of undefined
vmprices.js:62
OR
Error: TypeError: $.facebox is undefined
Source File: components/com_virtuemart/assets//js/vmprices.js
Line: 62
Thankfully the developers over at virtuemart have a solution in this forum post, though it was buried in a post by many other people asking about this and other problems. So we decided to make post that would make the answer very easy to find.
If you getting this error message then most likely you are including jQuery multiple times. This may be in your template or in another module/plugin, viewing the source of your page and searching for jquery will help you find it.
Once Virtuemart has loaded its jQuery and the additional plugins to jQuery (i.e. facebox) if you include jQuery again all the plugins added by Virtuemart are over written.
As always if you have any trouble solving this problem or if you would like help with other aspects of your joomla/virtuemart setup give us a call at (209) 257-1706 x3 or email us.
As we upgrade clients to Virtuemart 2 we ran into a small problem where there is no default country on the checkout page even after the shop is all setup. There is an easy way to fix this problem and a more complex way, I will describe both below.
In the easy fix, the only downside is if you ever change your shop’s country location, you would need to redo the change. We really only did the complex way so we could submit a change back to Virtumart would allow them to make the quick fix not necessary.
To the magic! For a simple one-time fix, to set your default country, run the MySQL query below (replacing YOURCOUNTRY, with the name of your country exactly how it appears in virtuemart and jos with your table prefix):
UPDATE jos_virtuemart_userfields SET `default`=(SELECT virtuemart_country_id FROM jos_virtuemart_countries WHERE country_name='YOURCOUNTRY') WHERE name='virtuemart_country_id';
For a more permanent solution to match the functionality found in Virtuemart 1.x where the default country matches the country the shop is located in you will need to update 2 files. I have attached a zip file which includes those 2 files, please feel free to diff them against the vanilla virtuemart files to see what changes we have made. Before applying this patch make sure you are on virtuemart 2.0.6
These are the 2 files you must replace:
administrator/components/com_virtuemart/models/userfields.php
administrator/components/com_virtuemart/controllers/user.php
Here are the files and as always both the files and query come with out any warranty. We strongly suggest you back up your files and database before making any changes.
If you are in need of additional help in upgrading Virtuemart, we’d love to hear from you! 209 257 1706 x3
Checkout other Virtuemart solutions and reviews here.
As I said in my previous post on how to fix your featured products the migration tools for moving to Virtuemart 2 while saving us much time and work occasionally miss something.
One of the problems a we experienced while upgrading virtuemart for one of our clients was many of their categories became unpublished for no apparent reason. Thankfully these 2 simple SQL queries should fix things. As always we strongly suggest you backup your database before proceeding.
UPDATE jos_virtuemart_categories AS c LEFT JOIN jos_virtuemart_categories_en_gb AS cen ON c.virtuemart_category_id=cen.virtuemart_category_id SET c.published=1 WHERE cen.category_name in (SELECT category_name FROM jos_vm_category WHERE category_publish='Y');
UPDATE jos_virtuemart_categories AS c LEFT JOIN jos_virtuemart_categories_en_gb AS cen ON c.virtuemart_category_id=cen.virtuemart_category_id SET c.published=0 WHERE cen.category_name in (SELECT category_name FROM jos_vm_category WHERE category_publish='N');
The above query may have issues if you have multiple categories with the same name, and use at your own risk, we make now warranty upon it. If your unsure of how to make this work or want additional migration assistance, give us a call or send us an email, we would love to talk to you. (209) 257-1706 x3
Upgrading your virtuemart site from 1.1.x to virtuemart 2 is a big undertaking. Thankfully the developers for virtuemart have provided us with a great migration tool that helps bring most of your content over with very little effort.
If one of the problems you are experiencing is products that used to be “featured” are no longer “featured” the solution is quite simple. You can simple run the SQL command below and all of your products which were “featured” will be “featured” once again. We strongly suggest you back up your database before executing this query.
UPDATE jos_virtuemart_products AS p LEFT JOIN jos_virtuemart_products_en_gb AS pen ON p.virtuemart_product_id=pen.virtuemart_product_id SET p.product_special='1' WHERE pen.product_name IN (SELECT product_name FROM jos_vm_product where product_special='Y');
The above query may have issues if you have multiple products with the same name, and use at your own risk, we make now warranty upon it. If your unsure of how to make this work or want additional migration assistance, give us a call or send us an email, we would love to talk to you. (209) 257-1706 x3.
Coming off my post about technology and the cool-aid of hype, an article about what the cloud doesn’t do resonated with my thinking. It reminded me of being a kid … “do you believe in magic” … we all want to believe, but when it comes to your computing, skilled analysis is still critical to your success. Seth Godin points out when execution gets cheaper, so should planning but counting on the cloud to do magic doesn’t count as planning.
Moreso, in his article, what Alexander says is that the cloud is here to stay. It is not going to altogether replace traditional computing methods, so now users will be faced with even more choices. With so much press on cloud products, often mixing or confusing SaaS, Iaas, PaaS services, confusion or poor choices are bound to result!
With new options being added daily, it is much more important to have trusted and skilled help to manage, evaluate, and deploy technology. Some thoughts come to mind:
SRI is in some ways a traditional hosting company, owning hardware and running many enterprise sites. However in other ways we are a support and services team, using available tools to skillfully built a solution to best meet our customers needs. Several recent CloudFront CDN deployments we have done are a great example of this. We certainly could leased a few servers, put a web cache on them, and call it a CDN. But we know our customers could get better, indeed needed better for world-wide caching, and so we made recommendations based on their needs to use CloudFront. Next time their request may lead to another Amazon service, to a different 3rd party provider, or maybe to our data center space.
If you are looking for planning, implementation, or help evaluating options don’t hesitate to call us!
But for magic, see this:
