Skip to main content

Posts

Showing posts from February, 2013

YiiFramework - Check If User Is Logged In (couponic)

So, I was doing a bit of customization of a Couponic template where I wanted to add a squeeze box (a future post!), but I first needed to check if a user was logged in or not. I didn't want a logged in user to see the squeeze box so I needed to figure out how the framework checked if a user is logged in. Well, it's pretty simple (I've included a quick and dirty write to the browser console log for quick debugging) <?php $isUser = Yii::app()->user->checkAccess('user'); if(!$isUser){ ?> <script> console.log("NOT A USER!!!!!!!!!!!!"); </script> <?php }else{ ?> <script> console.log("IS A USER!!!!!!!!!!!!"); </script> <?php } ?>

Virtuemart: Different Free Shipping Amount For Different Countries

How to adapt Virtuemart's Minimum Amount For Free Shipping so it can handle different amounts for different countries: Now, before we begin, the usual warning:  Backup the files you are going to be working with.  This is a hack of the global.php file to allow different free shipping amounts for different countries. The file you'll be working with:  /administrator/components/com_virtuemart/global.php First, in the Virtuemart administration page, go to the Store -> Edit Store page and set the base amount you want to use for 'free shipping'.  Usually, this should be the value you set for the most commonly used free amount you want to use (ie. your home country). Now, open up global.php , and search for: $vendor_freeshipping = $db->f("vendor_freeshipping"); The example will show how to detect for a country and hard-code in a new value for free-shipping. Ie. The amount set in the VM Admin page will be the base amount for free shipping in Canada.