Practical Web Applications for Daily Living…
User Interface
Ecommerce Consultants based in Singapore
Sep 6th
I am trying this keyword if I will be index if somebody search for Ecommerce Consultant base in Singapore, well.. actually yes, we are one of the best ecommerce consultants in Singapore, we design, develop and deploy your ecommerce system in ourr secure web servers. Need ERP? you’ve landed on the right page. Please drop me an email or visit Entrust Network Services Pte Ltd for more information.
Code Igniter Ajax Form
Sep 5th
$j(document).ready(function(){
$j("form").submit(function(e) {
e.preventDefault();
$j.post("/index.php/home/submitmessage", { firstname: $j("#firstname").val(), lastname: $j("#lastname").val(), address: $j("#address").val(), email: $j("#email").val(), confirmemail: $j("#confirmemail").val() , telephone: $j("#telephone").val(), mobile: $j("#mobile").val(),message: $j("#message").val() }, function (data) {
alert(data);
});
});
});
in application/config/constant
define(‘IS_AJAX’, isset($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’);
in the controller
{
//load form validation
$this->load->library(‘form_validation’);
//set form rules
$this->form_validation->set_rules(‘firstname’, ‘Firstname’, ‘required’);
$this->form_validation->set_rules(‘lastname’, ‘Lastname’, ‘required’);
$this->form_validation->set_rules(‘email’, ‘Email’, ‘required|valid_email|matches[confirmemail]‘);
$this->form_validation->set_rules(‘confirmemail’, ‘Confirm Email’, ‘required|valid_email’);
$this->form_validation->set_rules(‘address’, ‘Address’, ‘required’);
$this->form_validation->set_rules(‘message’, ‘Message’, ‘required’);
//run form validation
$success = $this->form_validation->run();
//set username variable
$firstname = $this->input->post(‘firstname’);
$lastname = $this->input->post(‘lastname’);
$email = $this->input->post(‘email’);
$address = $this->input->post(‘address’);
$message = $firstname." ".$lastname."\n";
$message .= "Tel:".$this->input->post(‘telephone’)." | Mobile:".$this->input->post(‘mobile’)."\n";
$message .= $address."\n";
$message .= $this->input->post(‘message’);
$msg = $message;
//if the validation was a success
if ((IS_AJAX && $success) || (!IS_AJAX && $success)) {
$this->load->library(‘email’);
$this->email->from($email, $firstname." ".$lastname);
$this->email->to(‘juliusbacosa@gmail.com’);
$this->email->subject(‘Message from Weekee’);
$this->email->message($msg);
$this->email->send();
echo "Congradulations {$firstname}, your form was accepted!";
}
//if validation failed
else { echo strip_tags(validation_errors()); }
}
Copy and Paste Now!!!!
JQUERY JSON Codeigniter
Sep 3rd
Jquery snippet to call a method with a json p=output
jQuery.getJSON("index.php/welcome/jjson/", function(json){
jQuery(‘#json’).html("<a href=’http://www.google.com’ target=’_blank’>" + json.glossary.title + "</a>:"+ json.glossary.GlossDiv.title + ":" + json.glossary.GlossDiv.GlossList.GlossEntry.ID);
});
});
where
json.glossary.GlossDiv.title
is the from json = the variable containing the data
glossary = is an array item from the json data
Glossdiv… etc…
here is the controller that writes this data.
{
$results[‘jsonx’] = ‘{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}’;
$this->load->view(‘Json_record’,$results);
}
then the view to render the data.
Jquery Developers Singapore or simply Jquery Singapore
Sep 2nd
Having a stable ecommerce system like magento in my arsenal which we are selling like hot cakes to SME companies here in singapore, I am now equipping and wants to go deeper to user interface design not only in Ecommerce website but for all types of applications residing in browsers. I am so sleepy right now so maybe I have to sleep, zend framework and code igniter? … well these looks will only be called if there is a need for very customize web app, magento and wordpress is feeding me right now and also joomla, I never knew joomla could generate so much food… well for asp.net mvc… I still love its potentials… but right now I am going towards opensource technologies so all the experience and disciplines I have in the .net world are still very useful especially the MVC pattern… For server side frameworks.. spring mvc, zend framework and code igniter… for front end? if I code the project from scrath then I will definitely choose jquery, but for out of the box web apps… I can take prototype and primitive javascript… scriptalicious? mmm I haven’t digested it yet… so got to sleep…. hoping for a jquery developer singapore show down….
Javascript Cute Exam
Sep 2nd
Somebody called me today asking how good I am in Javascript, well… javascript is a side dish for server side programmers and especially for mash up developers like myself, so that question make me think.. yeahh.. how good am I in JavaScript, so I tried to find some online exam to test myself how good really am I in javascripting even though its not my primary weapon in web development industry… , fortunately… I did the exam well… so now I am looking for more advanced exam…
Jquery Ajax Codeigniter
Sep 1st
In your View
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
jQuery(‘#x’).click(function(){
jQuery("#content").empty().html(‘<img src="http://juliusbacosachronicles.com/wp-content/themes/mystique/images/workstation.jpg" />’);
var num = 8;
jQuery(‘#content’).load("index.php/welcome/jajax/"+num,function(str){});
});
});
// Code that uses other library’s $ can follow here.
</script>
then the div to hold the content
In your Controller
{
parent::Controller();
$this->load->helper(‘url’);
}
function index()
{
$this->load->view(‘welcome_message’);
}
function jajax($num)
{
$results[‘xxx’] = $num*111;
$this->load->view(‘Ajax_record’,$results);
//get the record from the database
}
then for the view Ajax_record
Retrieving data from Model and accessing the database is still the same.
Byeee….
Setting Up Contact Form within Static Block in Magento
Aug 31st
Just put this within your static block
<ul>
<li>
<div class="input-box">
<div><label for="name">Name <span class="required">*</span></label> <input id="name" class="required-entry input-text" title="Name" name="name" type="text" /></div>
<div class="input-box"><label for="email">Email <span class="required">*</span></label></div>
<div><input id="email" class="required-entry input-text validate-email" title="Email" name="email" type="text" /></div>
<div class="input-box"><label for="telephone">Telephone</label><br /> <input id="telephone" class="input-text" title="Telephone" name="telephone" type="text" /></div>
<div class="input-box"><label for="comment">Comment</label><br /> <textarea id="comment" class="input-text" style="height: 150px; width: 525px;" title="Comment" cols="50" rows="5" name="comment"></textarea></div>
</div>
</li>
</ul>
</fieldset>
<div class="button-set">
<p class="required">* Required</p>
<input id="hideit" style="display:none !important;" name="hideit" type="text" /> <button class="form-button"><span>Submit</span></button></div>
</form>
<script type="text/javascript">// <![CDATA[
var contactForm = new VarienForm(‘contactForm’, true);
// ]]></script>
And adding fields just put normal fields like how to do it in normal html forms,
then add the variables in the Email Template that you will be using
which can be found at system>email transaction>
next thing is to go to system>Generals>Contacts> setup where the email should be sent.
Changing Style of Parent Element of an HTML form input with Javascript
Aug 29th
The html input is a checkbox, I want to let the li be in highlight mode if the checkbox is checked.
<input type="checkbox" name="dishs[]" value="<?php echo $listdish[‘dish_name’]; ?>" onclick="checktolimit(this);"> <?php echo $listdish[‘dish_name’]; ?>
</li>
The javascript for this is.
if(obj.checked){
obj.parentNode.className=’selectactive’;
}else{
obj.parentNode.className=’selectnotactive’;
}
}
where selectnotactive and selectactive are class names in your style.css or whatever you call it.
Sleeping in 3,2,1…
Best IT Solution for SME Singapore
Aug 27th
We are current on top of the next phase of IT solution for Singapore SME Companies, The solution we are building will eventually cut company expenses by 25% if not by half. And everything is going to be in the cloud so they can access all there business transactions everywhere in the world with speed and 99.99% no downtime. Business Chores like emails, company collaboration and all IT tasks will be done with ease.
They can also avail our cloud softwares to do computing of there Business Needs.
Configurable Product Magento, switch view more images solved
Aug 22nd
Once again, I’ve managed to solve one fuzzy client request and stayed the weekend to kick this functionality into action.
My confidence in building website functionalities in the web is bursting that there is no impossible for me already, it just depends in time and of course your budget
well…. as usual I am sharing some code snippet that could help some fellow developers out there.
This is to replace the contents within the .more-views class in media.phtml of the product details.
where numx is the color attribute of the configurable product. this numx also is what I named the class populated hidden within the product detail page.
And is being rendered by this code
$product = Mage::getModel(‘catalog/product’);
$parent = $product->load($_product->getId());
$children = Mage::getModel(‘catalog/product_type_configurable’)->getUsedProductCollection($parent);
$xxx = $parent->getResource()->getAttribute(‘Color’)->getFrontend()->getValue($parent);
foreach($children as $child){
$child = $product->load($child->getId()); ?>
<div style="display:none;">
<a href="<?php echo $this->helper(‘catalog/image’)->init($child, ‘image’); ?>" id="<?php echo "link".$child->getResource()->getAttribute(‘Color’)->getFrontend()->getValue($child); ?>">
<img src="<?php echo $this->helper(‘catalog/image’)->init($child, ‘image’); ?>" id="<?php echo "img".$child->getResource()->getAttribute(‘Color’)->getFrontend()->getValue($child); ?>" />
</a>
</div>
<div style="display:none;">
<div class=’<?php echo $child->getResource()->getAttribute(‘Color’)->getFrontend()->getValue($child); ?>‘>
<h2><?php echo $this->__(‘mouse over image to zoom’) ?></h2>
<ul>
<li>
<?php
$assoc_product = Mage::getModel(‘catalog/product’)->load($child->getId());
foreach($assoc_product->getMediaGalleryImages() as $assoc_product_img){ ?>
<a href="<?php echo $this->helper(‘catalog/image’)->init($assoc_product, ‘image’, $assoc_product_img->getFile()); ?>" title="<?php echo $assoc_product->getName();?>" onclick="$(’image’).src = this.href; $(’imagex’).src = this.href; return false;">
<img src="<?php echo $this->helper(‘catalog/image’)->init($assoc_product, ‘thumbnail’, $assoc_product_img->getFile())->resize(70, 70); ?>" alt="<?php echo $this->htmlEscape($assoc_product_img->getLabel()) ?>" title="<?php echo $this->htmlEscape($assoc_product_img->getLabel()) ?>"/>
</a>
</li>
<?php } ?>
</div>
</div>
<?php } ?>
Ofcourse only demi Gods can understand this without proper explaination. Just PM me if you need something like this.
As I have search the web, I can’t find any solution in magento with this functionality.
This whole project is way beyond the clients budget. Lucky Him

