Blog Category: Teaching Technology

Two Geeks Teaching – Brand Mapping

View the Brand Map Herezies.

What the heck is a Brand Map?

The version of the brand map we are working with shown to us from Bertz Rosa. It is a hybrid version of the lean module start-up geared towards designers and creatives. It is a template to learn more about client product’s and expectations for your campaign or website build.
[Read more…]

Tri.be The Event Calendar Custom Shortcodes

Tri.be The Event Calendar Custom Shortcodes

If you are using Tri.be’s WordPress Event Calendar, sometimes you might want to display event information in a page using a shortcode. Unfortunately the plugin doesn’t have this out of the box, but luckily it is easy enough to add.

First go to your themes function.php file and back-it up.

Second paste in the following code:

add_shortcode('event_code', 'events_shortcode');
function events_shortcode() {

	$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
	$upcoming = new WP_Query();
	$upcoming->query( array(
		'post_type'=> 'tribe_events',
		// 'eventDisplay' => 'past',
		'posts_per_page' => 3,
		'paged' => $paged)
	);
	$return_string = '';
	if ($upcoming->have_posts()) :
		while ($upcoming->have_posts()) :
			$upcoming->the_post();
			$return_string .= '<strong><a href="'.get_permalink().'">'.get_the_title().'</a></strong> <br/>';
			$return_string .= tribe_events_event_schedule_details();
			$return_string .= '<br/><br/>';
		endwhile;
		if ( function_exists('wp_pagenavi') ) wp_pagenavi( array( 'query' => $upcoming ) ); // tell it which query we are paginating
	endif;
	wp_reset_query(); // important to reset the query
	$return_string .= '<a href="'.tribe_get_events_link().'">View All Upcoming Events</a>';
	return $return_string;
}

Next go to the page you would like to add the shortcode. On this page add the following.

[event_code]

Save the page, and now you should see some event information. If you would like to view more or less events on the page edit value in the above code. For example, if you want to change from showing 3 events to 2, go to:

'posts_per_page' => 3,

And change the 3 to 2.

'posts_per_page' => 2,

That is it!

If you have any questions please feel free to contact me through the comments section below. Also be sure to checkout my Visalia Web Design services.

OSCommerce Blank Admin Login

I was given the task to upgrade some old oscommerce stores, when I did I noticed an error when trying to reach the admin panel. Here are items I did to fix all the different errors so I could finally sign into the account.


PHP Fatal error: require() [function.require]: Failed opening required '/catalog/includes/classes/action_recorder.php' (include_path='.:') in /catalog/admin/includes/classes/action_recorder.php on line 13

The first error I ran into was a PHP Fatal error because of action_recorder.php, to fix this error make sure your configure.php files are correct. If they are then simply download /catalog/admin/includes/classes/action_recorder.php and /catalog/includes/classes/action_recorder.php from the package, then re-upload them, this got the error to go away for me.

The next error I was receiving was that there wasn’t an administrators table. So I login to phpmyadmin and execute the following…


-- phpMyAdmin SQL Dump
-- version 2.11.9.6
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Apr 10, 2014 at 02:20 PM
-- Server version: 5.0.77
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `coslair_db1`
--

-- --------------------------------------------------------

--
-- Table structure for table `administrators`
--

CREATE TABLE IF NOT EXISTS `administrators` (
`id` int(11) NOT NULL auto_increment,
`user_name` varchar(255) character set utf8 collate utf8_bin NOT NULL,
`user_password` varchar(60) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

--
-- Dumping data for table `administrators`
--

INSERT INTO `administrators` (`id`, `user_name`, `user_password`) VALUES
(1, 'admin', '121212121212');

Once this is done, go to the administrators table in phpmyadmin. Now empty the table. This will make it so that you can add a new username and password, now go to the admin page and create your user and password.

Finally I was getting a too many attempts to login error, to fix this error go to /catalog/admin/includes/login.php

Change this

if ($actionRecorder->canPerform())

To this:

if ($actionRecorder->canPerform() || !tep_not_null($actionRecorder->_module))

This should fix your issues 🙂

Parse Event Time From String Javascript

I am working on some code to parse event times from messy input use strings. The idea is to find the time and output the start and end time.

I have developed some code, that needs more tweaks, but I am trying to develop it so it can look for various types of user inputs for example:

7-8am
7:00 till 8:00 p.m.
Even starts at 8:00 a.m. and ends at 7:00 p.m.

Please feel free to use the code or give suggestions on how to tweak my javascript to make faster. I am sure I over-engineered it in more than one way.


var re = /(a.m.|p.m.|pm|am)/g, // Filter By
str = "String blab la bla $22.99 event starts at 12:41 a.m. ends at 10:00 p.m. asdfasdfas"; // String To Test

var timeArray = new Array();
var timeStamp = new Array();

while ((matcher = re.exec(str)) != null) {
timeArray.push(matcher.index);
timeStamp.push(matcher[0]);
}

// Get Start And End Time
startTime = str.substring(timeArray[0] - 6, timeArray[0]);
finishTime = str.substring(timeArray[1] - 13, timeArray[1]);

if (startTime.length == 2) {
finishTime = startTime.substr(1,2);
startTime = startTime.slice(0,1);
} else {
// console.log(finishTime);
// console.log(startTime);

var matches = /(-|to|till)/g;

if (finishTime.match(matches) != null) {

var splitTime = startTime.split( matches );
var slpitTimeFinish = finishTime.split( matches );

if (timeStamp.length > 1) {
finishTime = slpitTimeFinish[2].replace(/[A-Za-z$.]/g, "");
startTime = splitTime[0].replace(/[A-Za-z$.]/g, "");
startTime = startTime.replace(/[0-9]{1,3}\s/g, "");

} else {

finishTime = slpitTimeFinish[2].replace(/[A-Za-z$.]/g, "");
startTime = slpitTimeFinish[0].replace(/[A-Za-z$.]/g, "");

var breakTime = startTime.split(':')
hours = breakTime[0].replace(/[0-9]{1,4}\s/g, "");
minutes = breakTime[1];

if (minutes == null) {
startTime = hours + ":00";
} else {
startTime = hours + ":" + minutes;
}

}

startTime = startTime.replace(/\s+/g, ''); // Remove Spaces
finishTime = finishTime.replace(/\s+/g, ''); // Remove Spaces

} else {
finishTime = finishTime.replace(/[A-Za-z$.]/g, "");
// console.log(finishTime);

var breakTime = finishTime.split(':')
hours = breakTime[0].replace(/[0-9]{1,4}\s/g, "");
minutes = breakTime[1];

if (minutes == null) {
finishTime = hours + ":00";
} else {
finishTime = hours + ":" + minutes;
}

finishTime = finishTime.replace(/\s+/g, ''); // Remove Spaces
// console.log(finishTime);

startTime = startTime.replace(/[A-Za-z$.]/g, "");

var breakTime = startTime.split(':')
hours = breakTime[0].replace(/[0-9]{1,4}\s/g, "");
minutes = breakTime[1];

if (minutes == null) {
startTime = hours + ":00";
} else {
startTime = hours + ":" + minutes;
}

startTime = startTime.replace(/\s+/g, ''); // Remove Spaces

}
}

// Get Time Stamp

if (timeStamp.length > 1) {
eventStartStamp = timeStamp[0];
eventEndStamp = timeStamp[1];
} else {
eventStartStamp = timeStamp[0];
eventEndStamp = timeStamp[0];
}

console.log ("Event Starts At "+ startTime + " " + eventStartStamp +" Ends At "+ finishTime + " " + eventEndStamp );

Magento MP Survey Change Default Page Layout

I purchased and downloaded MagePage’s MP Survey. I had a client that need more than the default Magento page and survey system. I stumbled upon MagePage.com, which developed MP Survey. This Survey is awesome and did the trick. I might do a review about it at a later date.

Anyway, I ran into an issue where the default page layout was not what I wanted. By default it was 2 column, I just wanted one. After about 30 mins of messing around I was able to make this to my 1-column layout.

Here is what you do. Go to /app/design/frontend/puroast/default/layout

There back up the file survey.xml.

Now open up and edit this file and look for the following:

Add the following right after this tag.







That should fix the issue. You can also apply this after survey_category_view and survey_index_index if you would like.

That sohuld fix it.

Bxslide Links and Side Navigation

Here is a way to create a dynamic sidebar. The system will count the list items and associate it with the proper slider.

Here is the javascript code.

$.each($('.side-nav li'), function(index, value) {
console.log(index + ':' + value);
$(".story-nav li a").eq(index).addClass('slide-'+index);
});

$('.side-nav li a').click(function(){
var num_id = $(this).attr('class').match(/\d+/); //
event.preventDefault();
slider.goToSlide(num_id);
});

You can then add this html code on your page:

By adding these items, you can create a side navigation that will scroll to the proper slide. You can name the link what ever you want.

Photoshop To CSS | CSS Hat Review

CSS Hat Interface

Costs: $34.99

I am a professional web site developer, mainly a front-end user interface engineer. Most of my day is spent bouncing around photoshop files and sublime text editor, trying to match pixels and recreate mock-up photoshop web sites into working html and css. As most front end developers know, is that this task, without a proper work flow and set of tools, can be daunting, frustrating, and slow. Going from photoshop to css can be a major pain.
[Read more…]

Pages: 1 2

Magento JQuery Product Fade in On Scroll

Want to add a fade in effect through jQuery when users are scrolling to the bottom of the page.

Add the following code to the header of your pages.




Create a code in the js file called script.js. Add the following code.

var $j = jQuery.noConflict();
$j(document).ready(function() {
$j(function() { // when the DOM is ready...
// Fade In function
// Hide Stuff
$j('.products-grid, #products-list li').hide();
tiles = $j(".products-grid, #products-list li").fadeTo(0, 0);
$j('.first').fadeTo(0, 1);

$j(window).scroll(function(d,h) {
tiles.each(function(i) {
a = $j(this).offset().top ;
b = $j(window).scrollTop() + $j(window).height() -100;
if (a < b) $j(this).fadeTo(700,1); }); });}); });

This will make it so that when the bottom of your browser hits the next product it will "fade in" the content. This works best for the products-grid layout.

Catalog Url Rewrites Index Process Unknown Error Solved!

Having problems with Magento and the Category Reindexer?

Are you getting a “Cannot initialize the indexer process” error when trying to run the Reindex from Index Management in Magento?

If you are getting an error like this then I have the solution for you! You will have the “Cannot initialize the indexer process” or “Catalog Url Rewrites index process unknown error” fixed in four steps!

Catalog Url Rewrites index process unknown error:
exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

Step 1 to fix the Catalog Url Rewrites Error: Turn of your Magento Cache

Login to your Magento backend and go to System > Cache Management. On this page turn off your cache.

Step 2 to solve the Catalog Url Rewrites Error: Make core_url_rewrite Translucent

Login to your phpmyadmin, or your MySQL database using your method of choice. Here find the following table “core_url_rewrite” make it translucent.

Step 3 to correct the Catalog Url Rewrites Error: Rebuild your Data

Login to your Magento backend and go to System > Index Management. On this page check all the boxes and re-index all your data. You should now not get an error.

*Note: You can also login to ssh and go to the “shell” directory. In here you can type:

php indexer.php -reindexall

Step 4 to resolve the Catalog Url Rewrites Error: Clear your Magento Cache

Login to your Magento backend and go to System > Cache Management. On this page flush your Magento cache. Or login via ftp\ssh and delete files in your yourmagentoinstall/var/cache directory.

Magento – Fix Authorize.net Payment Authorization Error or Payment Capturing Error

Sometimes when you are creating a new magento store you will run into one of the following errors when trying to connect the cart to Authorize.net:

Payment authorization error or Payment capturing error

You will see these pages on the magento checkout page right after you place in your credit card information and attempt to confirm the order. This error can be frustrating but with these few steps you should be able to troubleshoot the problem.

Fix Authorize.net “Payment Authorization error” or “Payment capturing error” in Magento. Step One: Verify your Authorize.net API ID and Transaction Key

Step one, make sure your API Login and Transaction Key are correct.
To do this go to https://account.authorize.net/ and login to the authorize.net account.
[Read more…]