Tuesday, July 22, 2014

Custom Variables

For multiple stores...
  • create a custom variable
  • then click on the variable to edit.
  • select a store from the drop down (Choose Store View)
  • set (Use Default Variable Values) to NO
  • change your variables
  • access them like below...
Use it like this (note the setStoreId() to get the value for the correct store view):
$value = Mage::getModel('core/variable')
Or to get the html value:
$value = Mage::getModel('core/variable')
If no html value is defined, getValue() returns the text value if you request the html value.
thanks to stackoverflow and

Thursday, July 10, 2014

Highlight textarea where you need input via jQuery...

        !function($) {
            $.fn.setCursorPosition = function(pos,end) {
                    if(typeof end == 'undefined'){
                        end = pos;
                    if (this.setSelectionRange) {
                        this.setSelectionRange(pos, end);
                    } else if (this.createTextRange) {
                        var range = this.createTextRange();
                        if(pos < 0) {
                            pos = $(this).val().length + pos;
                        if(end < 0) {
                            end = $(this).val().length + end;
                        range.moveEnd('character', end);
                        range.moveStart('character', pos);
        } (jQuery);

            var textStr = $("#body").val();
            var exists = textStr.indexOf('??????');
            if(exists > -1){
                $("#body").setCursorPosition(exists, (exists+6) );
                $(document).trigger("event.sharedErrorContent",['Please enter a thing here.',false]);
                return false;

Schema - To be or not to be



I could not agree MORE with this article. All data structures have a schema of some type whether it is a strict enforceable schema, or a weak non-maintainable structure. At least with a RDBMS you can see your schema without documentation that is typically missing anyway.