Free Android CakePHP GMaps Articles by Bali Web Design

March 6, 2012

How to set confirmation email order prestashop

Filed under: prestashop — admin @ 3:36 am

By default prestashop will not send confirmation email order to sales or admin email. So we need to set first before we can get confirmation email order using prestashop. We know prestashop is quit complex CMS for ecommerce, that make setting much harder than others CMS.

I use this procedure to get confirmation email order send to sales or admin email :

  1. Install Maill Alerts by Prestashop Module, and then configure. Place target confirmation email address on Send to these e-mail addresses
  2. Go to Employess > Contacts, set email for Customer Service
  3. Go to Preferences > E-mail, set email to Customer Service

By using that procedure my prestashop now can send confirmation email order to sales or admin email.

February 13, 2012

How to enable and disable PHPSESSID

Filed under: php-tips-basic — admin @ 10:13 pm

For some case where the visitor cannot save cookie, we need to put it on the url. This is happen on some browser also that cannot save cookie, like i-mode in japan. It will be a big task to add PHPSESSID to all pages URL, so we can enable PHPSESSID using php script setting.


ini_set('session.use_cookies', 0);
ini_set('session.use_only_cookies', 0);
ini_set('session.use_trans_sid', 1);
ini_set('session.name', 'PHPSESSID');
ini_set('url_rewriter.tags', 'a=href,area=href,frame=src,input=src,form=,fieldset=');

(more…)

May 25, 2011

Saving Mysql Function Now on Cakephp

Filed under: cakephp,php — admin @ 3:45 am

I think many cakephp programmer will get confuse when they want to save column/field on table with mysql function such as NOW(), CURDATE(), etc, We cannot use simple way of the saveField method or save method on model object.

This code will not save the data field into current date time on mysql.

$this->ModelName->saveField('date_field', 'NOW()');

or

$data['ModelName']['id'] = 1;
$data['ModelName']['date_field'] = 'NOW()';
$this->ModelName->save($data);

It will not work as you want. Because cakephp will ada quote on the value.

(more…)

January 19, 2011

strange id added on form create url cakephp

Filed under: cakephp,php — admin @ 9:18 pm

I found something strange on cakephp when i create form using FormHelper, a strange id appear on the action url. So i have this code on my view

<?php echo $form->create('Evoucher', array('url' => array('controller' => 'gift_vouchers', 'action' => 'buy', $giftVoucher['GiftVoucher']['amount'])));?>

It is generated a form tag with strange id added on action url. Something like this

<form id="EvoucherBuyForm" method="post" action="/gift_vouchers/buy/2/20" accept-charset="utf-8">

After exploration, i found the problem was on the controller action for buy. I have set id for the data variable

$this->data['Evoucher']['id'] = 2;

So after taking out this line, i change it into

$this->Evoucher->id = 2;

And cakephp can generate correct action url for the form tag

<form id="EvoucherBuyForm" method="post" action="/gift_vouchers/buy/20" accept-charset="utf-8">

I hope this tutorial help you. Thanks for visiting our blog

November 8, 2010

How to install cakephp on hostgator shared hosting

Filed under: cakephp,php — admin @ 8:03 pm

I just buy new shared hosting account for my new domain on hostgator. I want to install cakephp web application into this hosting. However the local setting or common setting that i used on other hosting is not work on hostgator. After figure out the problem, i found that the hostgator hosting does not allow for changing DOCUMENT ROOT setting.

So after research on cakephp tutorial, which come to setting cakephp on shared hosting and i think this solution also good for production phase. I will mention how i set my cakephp on hostgator (more…)

October 28, 2010

How to remove generator meta tag wordpress

Filed under: php,wordpress — admin @ 10:13 pm

Starting from wordpress 2.5 and above, you cannot remove generated meta tag wordpress version through your template. On prior version, it is simple by comment the line for showing wordpress version on your template.

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

WordPress 2.5 and above, the version is moved into the core of the wordpress. So it will automatically generate metatag generate, such as

<meta name="generator" content="WordPress 3.0" />

If you want to remove this generated line, there are some ways :

  1. Login to administration wordpress page, and then go to Appearance > Themes, And then Editor. Open functions.php, Add this line before the closing ?> tag
    remove_action('wp_head', 'wp_generator');
  2. Or use this plugin. Install on plugins area.

Redirect with exit using cakephp

Filed under: cakephp,php — admin @ 8:38 am

If you run redirect function on cakephp 1.1, don’t forget to add exit() function after redirect sintax. This thing can make security hole that confusing you. The purpose of adding exit() function after redirect sintax is to avoid php running others code after redirect function.

$this->redirect('controller/action');
exit();

However cakephp 1.2 give you default exit after redirect. The complete sintax for redirect on cakephp 1.2 is

$this->redirect('controller/action', null, true);

which the third parameter define exit = true, means terminate the script. second parameter is for setting exit status, for example 404, etc. Defaultly you only need to write

$this->redirect('controller/action');

get referer url using cakephp

Filed under: cakephp,php — admin @ 8:08 am

Sometime we need to get the referer url that access a page or url on our website. It is easy to find referer url using cakephp framework. Inside your controller or cakephp class, you can get the referer url using this sintak

Controller::referer()

Referer url is the last page or url that accessed by the user before open current page or url.

How to log your website using cakephp

Filed under: cakephp,php — admin @ 7:50 am

Cakephp is a good framework, it is a rapid web development framework for building any type of website. As a framework, cakephp has many built in feature. One of cakephp feature is build in logging system. Developer can easily log their application using cakephp.

Log function that can be accessed through your controller easily. You can save or add new log into error log or debug log, or you can make new log file. All file will be placed inside CAKEPHP_FOLDER/app/tmp/logs folder

default sintax that added to CAKEPHP_FOLDER/app/tmp/logs/error.log

$this->log("error message log");

(more…)

October 13, 2010

Captcha component for cakephp using captcha.net

Filed under: cakephp,php — admin @ 8:32 pm

Captcha is a type of challenge-response to ensure that the user is really a person that the response is not generated by computer. We usually find captcha on any form input on a website such us contact us, feedback, registration and etc. The captcha is used to protect our site from spammer.

The popular captcha is recaptcha from captcha.net website. It is free for use. Their interface or design also really nice to put on your website. You can check their sample in http://www.captcha.net/. They support both image captcha and audio chaptca.

Since i work with cakephp framework, i need to integrate this captcha into my application. I would like to share my captcha component for you. It is a simple code and easy to integrate. Here are the step (more…)

« Older PostsNewer Posts »