Showing posts with label Prestashop. Show all posts
Showing posts with label Prestashop. Show all posts

Friday, April 5, 2013

How to add hook in PrestaShop 1.5

How to add hook in PrestaShop 1.5

Sometimes we need to add custom hook in prestashop
The process of Hook adding in FrontController.php in PrestaShop 1.5 is different from the other previous version of prestashop like PreataShop 1.4 but for database and installing module parts are still the same way as it before.

1. Open “FrontController.php” from /override/classes/controller/
Default file is looks like this

<?php
 
class FrontController extends FrontControllerCore
{
 
}
 
2. Then, add this following code from main FrontController.php
 
<?php
 
class FrontController extends FrontControllerCore
{
    public function initContent()
    {
        $this->process();
        if (!isset($this->context->cart))
                $this->context->cart = new Cart();
        if ($this->context->getMobileDevice() == false) {
            // These hooks aren't used for the mobile theme.
            // Needed hooks are called in the tpl files.
            if (!isset($this->context->cart))
                $this->context->cart = new Cart();
            $this->context->smarty->assign(array(
                /* === START: DO NOT TOUCH IT */
                'HOOK_HEADER' => Hook::exec('displayHeader'),
                'HOOK_TOP' => Hook::exec('displayTop'),
                'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),
                'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),
                /* === END: DO NOT TOUCH IT */
                 
                /* === START: ADD HOOK | EXAMPLE */
                'HOOK_MY_USER' => Module::hookExec('myUser'),
                'HOOK_MY_CATEGORIES' => Module::hookExec('myCategories'),
                'HOOK_SEARCH' => Module::hookExec('mySearch')
                /* === END: ADD HOOK | EXAMPLE */
            ));
        } else {
            $this->context->smarty->assign(array(
                'HOOK_MOBILE_HEADER' => Hook::exec('displayMobileHeader'),
            ));
        }
    }
}
 
Now save he file and its done.. 



 

How to change mail color in PrestaShop 1.5

How to change mail color in PrestaShop 1.5


Just follow the simple steps
Go to
1. Preferences -> Themes






Thenge change in the manner of the following way

Now
2. Save and Done!


Monday, March 25, 2013

How To Add HTML Links To Standard Prestashop E-Mail Messages

How To Add HTML Links To Standard Prestashop E-Mail Messages


Standard Prestashop order messages section settings do not allow us creating messages which would contain HTML links with clickable anchor texts. But if you want that feature there is still a workaround which you can use to add HTML links to your e-mail messages.

To do this it is necessary to override the method AdminOrderController.php PostProcess as follows:
$customer_message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');


Change to
$customer_message->message = Tools::getValue('message');

How To Put Prestashop Category List In Alphabetical Order

How To Put Prestashop Category List In Alphabetical Order

In prestashop when new categories are added to the multi-level navigation blocks, they are placed at the end position of the list which makes it look quite messy. So to sort all the categories in alphabetical order we need to do the following:

In the file modules/blocklayered/blocklayered.php change this line:
GROUP BY c.id_category ORDER BY c.nleft, c.position';

To this one:
GROUP BY c.id_category ORDER BY cl.name ASC, c.nleft, c.position';


I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off