Tuesday, April 30, 2013

Prestashop hook before header

If you are looking for a hook which comes before any controller is dispatched,
use $this->registerHook('actionDispatcher')

function hookActionDispatcher() {
...
}

Sunday, April 28, 2013

mosync exceptions -fexceptions

Mosync cannot use exception.
Enabling -fexceptions seems to throw lots of linking error.
use maPanic instead, but which is not a wise way to handle error...

Wednesday, April 24, 2013

network congested to a specific server? try ssh tunelling

SSH tunnelling basically open up a proxy through your localhost on a specific port,
and redirect the traffic through your ssh server to the destination domain.

#Run this SSH tunnel
ssh -f ssh-username@ssh-server.com -L 2000:yourdomain.com:80 -N
#edit hosts file to point a domain to a localhost
vi /etc/hosts (/private/etc/hosts - on MAC OS)
127.0.0.1 www.yourdomain.com
#open this in browser
http://www.yourdomain.com:2000/


Monday, April 22, 2013

Adding custom tab for product admin via module

be sure to use input names which is not same as database field name,
then you may use hookproductupdate or hookproductadd to set the value manually,
and call update to the $product parameter.


Saturday, April 13, 2013

prestashop 1.5.4.0 delete all orders and cart items

TRUNCATE `ps_orders`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_detail_tax`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_invoice`;
TRUNCATE `ps_order_invoice_payment`;
TRUNCATE `ps_order_invoice_tax`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_payment`;
TRUNCATE `ps_order_return`;
TRUNCATE `ps_order_return_detail`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_slip`;
TRUNCATE `ps_order_slip_detail`;
TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;
TRUNCATE `ps_message`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;

Friday, April 12, 2013

Prestashop complete state list of the world

Need a complete list of states of the world?
use these code below, but Note:
this has changed name size to 200 and iso_code size to 30,
please remember to change class/State.php accordingly,
and change class/Validate.php too.

Or replace both class via override/classes, see code below:
(as of prestashop 1.5.4.0)

makesure to run this after import:
update ps_country set contains_states=1;

to enable all countries:
update ps_country set active=1;

Monday, April 8, 2013

Prestashop adding jQuery plugin

Front end / Back end controller class, call this:
 $this->addJQuery($componentname);
 $this->addJqueryUI("ui.componentname");

 eg. $this->addJqueryUI("ui.datepicker");

Tuesday, April 2, 2013

modx getresources sortby and limit

looking @ the new documentation of getresources, it shows that its possible to add sort direction within the sortby parameter. but as it turn out, if we add sortby and limit together, will also need to add sortdir,...